From 6db6f731d6905a4ba077b77a5a8ecab5af19d659 Mon Sep 17 00:00:00 2001 From: guille Date: Thu, 12 May 2022 17:12:18 -0400 Subject: [PATCH] Partial implementation of usage catalog --- .../data_models/usages/content.py | 10 +++++++ catalog_factories/usage/comnet_catalog.py | 23 ++++++++++++++++ catalog_factories/usage_catalog_factory.py | 26 ++++++++++++++++--- 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 catalog_factories/data_models/usages/content.py create mode 100644 catalog_factories/usage/comnet_catalog.py diff --git a/catalog_factories/data_models/usages/content.py b/catalog_factories/data_models/usages/content.py new file mode 100644 index 00000000..231a8bc1 --- /dev/null +++ b/catalog_factories/data_models/usages/content.py @@ -0,0 +1,10 @@ +""" +Usage catalog content +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2022 Concordia CERC group +Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" + +class Content: + def __init__(self): + pass diff --git a/catalog_factories/usage/comnet_catalog.py b/catalog_factories/usage/comnet_catalog.py new file mode 100644 index 00000000..e1ae8b35 --- /dev/null +++ b/catalog_factories/usage/comnet_catalog.py @@ -0,0 +1,23 @@ +""" +Comnet usage catalog +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2022 Concordia CERC group +Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" +from catalog_factories.catalog import Catalog +from catalog_factories.data_models.usages.content import Content + + +class ComnetCatalog(Catalog): + def __init__(self, path): + pass + + def names(self, category=None): + pass + + def entries(self, category=None): + pass + + def get_entry(self, name): + pass + diff --git a/catalog_factories/usage_catalog_factory.py b/catalog_factories/usage_catalog_factory.py index 5a236d44..cd142057 100644 --- a/catalog_factories/usage_catalog_factory.py +++ b/catalog_factories/usage_catalog_factory.py @@ -7,10 +7,28 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca from pathlib import Path from typing import TypeVar -from catalog_factories.construction.nrel_catalog import NrelCatalog +from catalog_factories.usage.comnet_catalog import ComnetCatalog Catalog = TypeVar('Catalog') -class ConstructionCatalogFactory: - def __init__(self): - pass +class UsageCatalogFactory: + def __init__(self, file_type, base_path=None): + if base_path is None: + base_path = Path(Path(__file__).parent.parent / 'data/usage') + self._catalog_type = '_' + file_type.lower() + self._path = base_path + + @property + def _comnet(self): + """ + Retrieve Comnet catalog + """ + return ComnetCatalog(self._path) + + @property + def catalog(self) -> Catalog: + """ + Enrich the city given to the class using the class given handler + :return: Catalog + """ + return getattr(self, self._catalog_type, lambda: None) \ No newline at end of file