def replace(self, local_task: Task, remote_task: Task) -> Task: assert isinstance(remote_task, Task) assert isinstance(local_task, Task) remote_task.index = local_task.index remote_task.unique_id = local_task.unique_id remote_task.due_date = local_task.due_date self.replace_object(local_task.index, remote_task) self.logger.debug( f"Replaced local_task: {dict(local_task)} with remote_task: {dict(remote_task)}" ) return remote_task
def add(self, text, label, project, date_expression) -> List[Task]: assert type(text) and type(label) and type(project)\ and type(date_expression) is str task_list = list() if self.__date_generator.validate_input(date_expression): for due_date in self.__date_generator.get_due_dates( date_expression): task = Task(text) task.label = label task.project = project task.date_expression = date_expression task.due_date = due_date self.append(task) task_list.append(task) else: raise AttributeError( f"Provided date expression {date_expression} is invalid") return task_list