Partial implementation of usage catalog

This commit is contained in:
Guille Gutierrez 2022-05-12 17:12:18 -04:00
parent 1fbb99a5d6
commit 6db6f731d6
3 changed files with 55 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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)