2021-05-26 18:17:23 -04:00
|
|
|
"""
|
|
|
|
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
|
2021-06-10 10:48:30 -04:00
|
|
|
import helpers.constants as cte
|
2021-05-26 18:17:23 -04:00
|
|
|
|
|
|
|
|
|
|
|
class UsageHelper:
|
2021-08-27 12:51:30 -04:00
|
|
|
"""
|
|
|
|
Usage helpre class
|
|
|
|
"""
|
2021-05-26 18:17:23 -04:00
|
|
|
usage_to_hft = {
|
2021-06-10 10:48:30 -04:00
|
|
|
cte.RESIDENTIAL: 'residential',
|
|
|
|
cte.INDUSTRY: 'industry',
|
|
|
|
cte.OFFICE_ADMINISTRATION: 'office and administration',
|
|
|
|
cte.HOTEL: 'hotel',
|
|
|
|
cte.HEALTH_CARE: 'health care',
|
|
|
|
cte.RETAIL: 'retail',
|
|
|
|
cte.HALL: 'hall',
|
|
|
|
cte.RESTAURANT: 'restaurant',
|
|
|
|
cte.EDUCATION: 'education'
|
2021-05-26 18:17:23 -04:00
|
|
|
}
|
|
|
|
hft_default_value = 'residential'
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def hft_from_usage(usage):
|
|
|
|
"""
|
2021-06-03 15:56:59 -04:00
|
|
|
Get HfT usage from the given internal usage key
|
2021-05-26 18:17:23 -04:00
|
|
|
:param usage: str
|
|
|
|
:return: str
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
return UsageHelper.usage_to_hft[usage]
|
|
|
|
except KeyError:
|
2021-06-03 15:56:59 -04:00
|
|
|
sys.stderr.write('Error: keyword not found. Returned default HfT usage "residential"\n')
|
2021-05-26 18:17:23 -04:00
|
|
|
return UsageHelper.hft_default_value
|