Path 1: 3 calls (0.5)

4 (3)

1def stop_task(self, task_id: TaskID) -> None:
2        """Stop a task.
3
4        This will freeze the elapsed time on the task.
5
6        Args:
7            task_id (TaskID): ID of task.
8        """
9        with self._lock:
10            task = self._tasks[task_id]
11            current_time = self.get_time()
12            if task.start_time is None:
13                task.start_time = current_time
14            task.stop_time = current_time
            

Path 2: 3 calls (0.5)

4 (3)

1def stop_task(self, task_id: TaskID) -> None:
2        """Stop a task.
3
4        This will freeze the elapsed time on the task.
5
6        Args:
7            task_id (TaskID): ID of task.
8        """
9        with self._lock:
10            task = self._tasks[task_id]
11            current_time = self.get_time()
12            if task.start_time is None:
13                task.start_time = current_time
14            task.stop_time = current_time