hub/imports/schedules_factory.py

29 lines
828 B
Python
Raw Normal View History

2020-06-09 14:07:47 -04:00
"""
2020-12-15 15:15:40 -05:00
SchedulesFactory retrieve the specific schedules module for the given standard
2020-06-09 14:07:47 -04:00
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
2020-12-15 15:15:40 -05:00
from pathlib import Path
from imports.occupancy_feeders.usage_schedules import ComnetSchedules
2020-12-15 15:15:40 -05:00
class SchedulesFactory:
2020-06-15 11:38:18 -04:00
"""
2020-12-15 15:15:40 -05:00
SchedulesFactor class
2020-06-15 11:38:18 -04:00
"""
2020-12-15 15:15:40 -05:00
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/occupancy')):
self._handler = '_' + handler.lower().replace(' ', '_')
self._city = city
self._base_path = base_path
2020-06-30 16:14:39 -04:00
2020-12-15 15:15:40 -05:00
def _comnet(self):
ComnetSchedules(self._city, self._base_path)
2020-06-30 16:14:39 -04:00
def enrich(self):
2020-06-30 16:14:39 -04:00
"""
2020-12-15 15:15:40 -05:00
Enrich the city with the schedules information
:return: None
2020-06-30 16:14:39 -04:00
"""
2020-12-15 15:15:40 -05:00
getattr(self, self._handler, lambda: None)()