From 60f5d9aca150515161da5a98408574ec279687e9 Mon Sep 17 00:00:00 2001 From: guille Date: Thu, 31 Mar 2022 06:44:33 -0400 Subject: [PATCH] Changing comments and signature to improve the documentation --- catalogs/catalog.py | 10 +++++----- catalogs/greenery_catalog_factory.py | 19 ++++++------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/catalogs/catalog.py b/catalogs/catalog.py index 1aff80af..67de9fda 100644 --- a/catalogs/catalog.py +++ b/catalogs/catalog.py @@ -6,27 +6,27 @@ Copyright © 2022 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc class Catalog: """ - Catalog name + Catalogs base class not implemented instance of the Catalog base class, catalogs will inherit from this class. """ @property - def names(self): + def names(self, category=None): """ Base property to return the catalog entries names - :return: not implemented error + :return: Catalog names filter by category if provided """ raise NotImplementedError def entries(self, category=None): """ Base property to return the catalog entries - :return: not implemented error + :return: Catalog content filter by category if provided """ raise NotImplementedError def get_entry(self, name): """ Base property to return the catalog entry matching the given name - :return: not implemented error + :return: Catalog entry with the matching name """ raise NotImplementedError diff --git a/catalogs/greenery_catalog_factory.py b/catalogs/greenery_catalog_factory.py index 3b70687a..905f1602 100644 --- a/catalogs/greenery_catalog_factory.py +++ b/catalogs/greenery_catalog_factory.py @@ -5,8 +5,9 @@ Copyright © 2022 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc """ from pathlib import Path +from typing import TypeVar from catalogs.greenery.greenery_catalog import GreeneryCatalog - +Catalog = TypeVar('Catalog') class GreeneryCatalogFactory: """ @@ -19,25 +20,17 @@ class GreeneryCatalogFactory: self._path = base_path @property - def _nrel(self) -> GreeneryCatalog: + def _nrel(self): """ - Return a greenery catalog using ecore as datasource + Return a greenery catalog based in NREL using ecore as datasource :return: GreeneryCatalog """ return GreeneryCatalog((self._path / 'ecore_greenery_catalog.xml').resolve()) @property - def catalog(self) -> GreeneryCatalog: + def catalog(self) -> Catalog: """ Enrich the city given to the class using the class given handler - :return: City + :return: Catalog """ return getattr(self, self._file_type, lambda: None) - - @property - def catalog_debug(self) -> GreeneryCatalog: - """ - Enrich the city given to the class using the class given handler - :return: City - """ - return GreeneryCatalog((self._path / 'ecore_greenery_catalog.xml').resolve())