From 1b90974b7711f122f7fa8a70a515f2bb47b62462 Mon Sep 17 00:00:00 2001 From: Pilar Date: Fri, 17 Mar 2023 10:10:30 -0400 Subject: [PATCH] some refactoring to keep our naming agreement --- .../cost/montreal_custom_catalog.py | 8 ++++---- .../data_models/cost/chapter.py | 8 ++++---- .../data_models/cost/cost_helper.py | 12 +++--------- .../data_models/cost/income.py | 8 ++++---- .../data_models/cost/item_description.py | 18 +++++++++--------- hub/helpers/constants.py | 12 +++--------- 6 files changed, 27 insertions(+), 39 deletions(-) diff --git a/hub/catalog_factories/cost/montreal_custom_catalog.py b/hub/catalog_factories/cost/montreal_custom_catalog.py index 4624e13b..a0679b89 100644 --- a/hub/catalog_factories/cost/montreal_custom_catalog.py +++ b/hub/catalog_factories/cost/montreal_custom_catalog.py @@ -36,9 +36,9 @@ class MontrealCustomCatalog(Catalog): _lifetime = float(entry[item_type]['lifetime_equipment']['#text']) _item_description = ItemDescription(item_type, initial_investment=_investment, - initial_investment_units=_investment_unit, + initial_investment_unit=_investment_unit, reposition=_reposition, - reposition_units=_reposition_unit, + reposition_unit=_reposition_unit, lifetime=_lifetime) return _item_description @@ -48,7 +48,7 @@ class MontrealCustomCatalog(Catalog): _refurbishment_unit = entry[item_type]['refurbishment_cost']['@cost_unit'] _item_description = ItemDescription(item_type, refurbishment=_refurbishment, - refurbishment_units=_refurbishment_unit) + refurbishment_unit=_refurbishment_unit) return _item_description def _get_capital_costs(self, entry): @@ -140,7 +140,7 @@ class MontrealCustomCatalog(Catalog): hvac_subsidy=hvac, photovoltaic_subsidy=photovoltaic_system, electricity_export=electricity_exports, - reductions_taxes=reduction_tax) + reductions_tax=reduction_tax) _catalog_archetypes.append(Archetype(lod, function, municipality, diff --git a/hub/catalog_factories/data_models/cost/chapter.py b/hub/catalog_factories/data_models/cost/chapter.py index d1be68ac..bf393cbb 100644 --- a/hub/catalog_factories/data_models/cost/chapter.py +++ b/hub/catalog_factories/data_models/cost/chapter.py @@ -10,10 +10,10 @@ from hub.catalog_factories.data_models.cost.item_description import ItemDescript class Chapter: - def __init__(self, chapter_type, items_list): + def __init__(self, chapter_type, items): self._chapter_type = chapter_type - self._items_list = items_list + self._items = items @property def chapter_type(self): @@ -24,9 +24,9 @@ class Chapter: return self._chapter_type @property - def items_list(self) -> List[ItemDescription]: + def items(self) -> List[ItemDescription]: """ Get list of items contained in the chapter :return: [str] """ - return self._items_list + return self._items diff --git a/hub/catalog_factories/data_models/cost/cost_helper.py b/hub/catalog_factories/data_models/cost/cost_helper.py index c51ab02b..fb0d551e 100644 --- a/hub/catalog_factories/data_models/cost/cost_helper.py +++ b/hub/catalog_factories/data_models/cost/cost_helper.py @@ -26,15 +26,9 @@ class CostHelper: } _chapters_in_lod1 = { - 'B10_superstructure': cte.SUPERSTRUCTURE, - 'B20_envelope': cte.ENVELOPE, - 'B30_roofing': cte.ROOFING, - 'D3010_energy_supply': cte.ENERGY_SUPPLY, - 'D3020_heat_generating_systems': cte.HEAT_GENERATION, - 'D3030_cooling_generation_systems': cte.COOL_GENERATION, - 'D3040_distribution_systems': cte.DISTRIBUTION, - 'D3080_other_hvac_ahu': cte.OTHER_SYSTEMS, - 'D5020lighting_and_branch_wiring': cte.LIGHTING_AND_WIRING + 'B_shell': cte.SUPERSTRUCTURE, + 'D_services': cte.ENVELOPE, + 'Z_allowances_overhead_profit': cte.ALLOWANCES_OVERHEAD_PROFIT } @property diff --git a/hub/catalog_factories/data_models/cost/income.py b/hub/catalog_factories/data_models/cost/income.py index baa880ec..0a8c0442 100644 --- a/hub/catalog_factories/data_models/cost/income.py +++ b/hub/catalog_factories/data_models/cost/income.py @@ -13,13 +13,13 @@ class Income: hvac_subsidy=None, photovoltaic_subsidy=None, electricity_export=None, - reductions_taxes=None): + reductions_tax=None): self._construction_subsidy = construction_subsidy self._hvac_subsidy = hvac_subsidy self._photovoltaic_subsidy = photovoltaic_subsidy self._electricity_export = electricity_export - self._reductions_taxes = reductions_taxes + self._reductions_tax = reductions_tax @property def construction_subsidy(self) -> Union[None, float]: @@ -54,9 +54,9 @@ class Income: return self._construction_subsidy @property - def reductions_taxes(self) -> Union[None, float]: + def reductions_tax(self) -> Union[None, float]: """ Get reduction in taxes in percentage (-) :return: None or float """ - return self._reductions_taxes + return self._reductions_tax diff --git a/hub/catalog_factories/data_models/cost/item_description.py b/hub/catalog_factories/data_models/cost/item_description.py index 345e04b7..42ce94b4 100644 --- a/hub/catalog_factories/data_models/cost/item_description.py +++ b/hub/catalog_factories/data_models/cost/item_description.py @@ -11,20 +11,20 @@ from typing import Union class ItemDescription: def __init__(self, item_type, initial_investment=None, - initial_investment_units=None, + initial_investment_unit=None, refurbishment=None, - refurbishment_units=None, + refurbishment_unit=None, reposition=None, - reposition_units=None, + reposition_unit=None, lifetime=None): self._item_type = item_type self._initial_investment = initial_investment - self._initial_investment_units = initial_investment_units + self._initial_investment_unit = initial_investment_unit self._refurbishment = refurbishment - self._refurbishment_units = refurbishment_units + self._refurbishment_unit = refurbishment_unit self._reposition = reposition - self._reposition_units = reposition_units + self._reposition_unit = reposition_unit self._lifetime = lifetime @property @@ -41,7 +41,7 @@ class ItemDescription: Get initial investment of the specific item in given units :return: None, None or float, str """ - return self._initial_investment, self._initial_investment_units + return self._initial_investment, self._initial_investment_unit @property def refurbishment(self) -> Union[(None, None), (float, str)]: @@ -49,7 +49,7 @@ class ItemDescription: Get refurbishment costs of the specific item in given units :return: None, None or float, str """ - return self._refurbishment, self._refurbishment_units + return self._refurbishment, self._refurbishment_unit @property def reposition(self) -> Union[(None, None), (float, str)]: @@ -57,7 +57,7 @@ class ItemDescription: Get reposition costs of the specific item in given units :return: None, None or float, str """ - return self._reposition, self._reposition_units + return self._reposition, self._reposition_unit @property def lifetime(self) -> Union[None, float]: diff --git a/hub/helpers/constants.py b/hub/helpers/constants.py index b67bd61a..2caaee0d 100644 --- a/hub/helpers/constants.py +++ b/hub/helpers/constants.py @@ -171,12 +171,6 @@ CURRENCY_PER_CBM_PER_HOUR = 'currency/(m3/h)' PERCENTAGE = '%' # Costs chapters -SUPERSTRUCTURE = 'B10_superstructure' -ENVELOPE = 'B20_envelope' -ROOFING = 'B30_roofing' -ENERGY_SUPPLY = 'D3010_energy_supply' -HEAT_GENERATION = 'D3020_heat_generating_systems' -COOL_GENERATION = 'D3030_cooling_generation_systems' -DISTRIBUTION = 'D3040_distribution_systems' -OTHER_SYSTEMS = 'D3080_other_hvac_ahu' -LIGHTING_AND_WIRING = 'D5020lighting_and_branch_wiring' +SUPERSTRUCTURE = 'B_shell' +ENVELOPE = 'D_services' +ALLOWANCES_OVERHEAD_PROFIT = 'Z_allowances_overhead_profit'