forked from s_ranjbar/city_retrofit
39 lines
994 B
Python
39 lines
994 B
Python
"""
|
|
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
|
|
import helpers.constants as cte
|
|
|
|
|
|
class UsageHelper:
|
|
"""
|
|
Usage helper class
|
|
"""
|
|
usage_to_hft = {
|
|
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'
|
|
}
|
|
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
|