hub/imports/usage/helpers/usage_helper.py

35 lines
915 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 usage from the given internal usage 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 usage "residential"\n')
return UsageHelper.hft_default_value