hub/imports/usages/helpers/usage_helper.py

35 lines
918 B
Python
Raw Normal View History

"""
Usage helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
class UsageHelper:
usage_to_hft = {
'residential': 'residential',
'industry': 'industry',
'office and administration': 'office and administration',
'hotel': 'hotel',
'health care': 'health care',
'retail': 'retail',
'hall': 'hall',
'restaurant': 'restaurant',
'education': 'education'
}
hft_default_value = 'residential'
@staticmethod
def hft_from_usage(usage):
"""
Get HfT usages from the given internal usages key
:param usage: str
:return: str
"""
try:
return UsageHelper.usage_to_hft[usage]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default HfT usages "residential"\n')
return UsageHelper.hft_default_value