system_assignation/imports/schedules/helpers/schedules_helper.py

36 lines
1.0 KiB
Python
Raw Normal View History

"""
Schedules helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
class SchedulesHelper:
usage_to_comnet = {
'residential': 'C-12 Residential',
'industry': 'C-10 Warehouse',
'office and administration': 'C-5 Office',
'hotel': 'C-3 Hotel',
'health care': 'C-2 Health',
'retail': 'C-8 Retail',
'hall': 'C-8 Retail',
'restaurant': 'C-7 Restaurant',
'education': 'C-9 School'
}
comnet_default_value = 'C-12 Residential'
@staticmethod
def comnet_from_usage(usage):
"""
Get Comnet usages from the given internal usages key
:param usage: str
:return: str
"""
try:
return SchedulesHelper.usage_to_comnet[usage]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default Comnet schedules "residential"\n')
return SchedulesHelper.comnet_default_value