import sys from backlog import current_sprint from users import KAJETAN from timeouts import WORKING_DAY_TIMEOUT from datetime import datetime from workflow.task_status import DONE from kitchen import CoffeeCup class HomeOffice(Office): """Describes typical home office""" def __init__(self): """Initialize work from home""" self._coffee_cup = CoffeeCup() self.turn_on_computer() self._start_work_time = datetime.now() @property def coffee_cup(self) -> CoffeeCup: if coffee_cup.level = 0: self._coffee_cup.refill() return self._coffee_cup def coffee_refill(self) -> None: """Make a frash cup of coffee""" self._coffee_cup.refill() def get_working_time(self) -> int: """Return how long workday last""" return datetime.now() - self._start_work_time class Work(): """A work related class""" @staticmethod def get_tasks(user: str) -> List[Union[Code, CodeReview, Meeting]]: """Gets all the task for particular user in current sprint""" return [story.task for story in current_sprint if story.assignee == user] if __name__ == '__main__': office = HomeOffice() for task in Work.get_tasks(user=KAJETAN): while task != DONE: if task.last > (WORKING_DAY_TIMEOUT - office.get_working_time()): sys.exit() else: office.coffee_cup.drink() task.work_on()