system_assignation/factories/occupancy_factory.py

30 lines
850 B
Python
Raw Normal View History

2020-10-22 11:02:41 -04:00
"""
2020-12-15 14:57:46 -05:00
SchedulesFactory retrieve the specific schedules module for the given standard
2020-10-22 11:02:41 -04:00
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from pathlib import Path
2020-12-15 14:57:46 -05:00
from factories.occupancy_feeders.usage_schedules import ComnetSchedules
2020-10-22 11:02:41 -04:00
2020-12-15 14:57:46 -05:00
class SchedulesFactory:
2020-10-22 11:02:41 -04:00
"""
2020-12-15 14:57:46 -05:00
SchedulesFactor class
2020-10-22 11:02:41 -04:00
"""
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/occupancy')):
2020-10-22 11:02:41 -04:00
self._handler = '_' + handler.lower().replace(' ', '_')
self._city = city
self._base_path = base_path
self.factory()
2020-12-15 14:57:46 -05:00
def _comnet(self):
ComnetSchedules(self._city, self._base_path)
2020-10-22 11:02:41 -04:00
def factory(self):
"""
2020-12-15 14:57:46 -05:00
Enrich the city with the schedules information
2020-10-22 11:02:41 -04:00
:return: None
"""
getattr(self, self._handler, lambda: None)()