Changing comments and signature to improve the documentation

This commit is contained in:
Guille Gutierrez 2022-03-31 06:44:33 -04:00
parent 688541b20c
commit 60f5d9aca1
2 changed files with 11 additions and 18 deletions

View File

@ -6,27 +6,27 @@ Copyright © 2022 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
class Catalog: class Catalog:
""" """
Catalog name Catalogs base class not implemented instance of the Catalog base class, catalogs will inherit from this class.
""" """
@property @property
def names(self): def names(self, category=None):
""" """
Base property to return the catalog entries names Base property to return the catalog entries names
:return: not implemented error :return: Catalog names filter by category if provided
""" """
raise NotImplementedError raise NotImplementedError
def entries(self, category=None): def entries(self, category=None):
""" """
Base property to return the catalog entries Base property to return the catalog entries
:return: not implemented error :return: Catalog content filter by category if provided
""" """
raise NotImplementedError raise NotImplementedError
def get_entry(self, name): def get_entry(self, name):
""" """
Base property to return the catalog entry matching the given 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 raise NotImplementedError

View File

@ -5,8 +5,9 @@ Copyright © 2022 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
""" """
from pathlib import Path from pathlib import Path
from typing import TypeVar
from catalogs.greenery.greenery_catalog import GreeneryCatalog from catalogs.greenery.greenery_catalog import GreeneryCatalog
Catalog = TypeVar('Catalog')
class GreeneryCatalogFactory: class GreeneryCatalogFactory:
""" """
@ -19,25 +20,17 @@ class GreeneryCatalogFactory:
self._path = base_path self._path = base_path
@property @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
""" """
return GreeneryCatalog((self._path / 'ecore_greenery_catalog.xml').resolve()) return GreeneryCatalog((self._path / 'ecore_greenery_catalog.xml').resolve())
@property @property
def catalog(self) -> GreeneryCatalog: def catalog(self) -> Catalog:
""" """
Enrich the city given to the class using the class given handler Enrich the city given to the class using the class given handler
:return: City :return: Catalog
""" """
return getattr(self, self._file_type, lambda: None) 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())