MCPcopy
hub / github.com/Textualize/rich / Task

Class Task

rich/progress.py:936–1058  ·  view source on GitHub ↗

Information regarding a progress task. This object should be considered read-only outside of the :class:`~Progress` class.

Source from the content-addressed store, hash-verified

934
935@dataclass
936class Task:
937 """Information regarding a progress task.
938
939 This object should be considered read-only outside of the :class:`~Progress` class.
940
941 """
942
943 id: TaskID
944 """Task ID associated with this task (used in Progress methods)."""
945
946 description: str
947 """str: Description of the task."""
948
949 total: Optional[float]
950 """Optional[float]: Total number of steps in this task."""
951
952 completed: float
953 """float: Number of steps completed"""
954
955 _get_time: GetTimeCallable
956 """Callable to get the current time."""
957
958 finished_time: Optional[float] = None
959 """float: Time task was finished."""
960
961 visible: bool = True
962 """bool: Indicates if this task is visible in the progress display."""
963
964 fields: Dict[str, Any] = field(default_factory=dict)
965 """dict: Arbitrary fields passed in via Progress.update."""
966
967 start_time: Optional[float] = field(default=None, init=False, repr=False)
968 """Optional[float]: Time this task was started, or None if not started."""
969
970 stop_time: Optional[float] = field(default=None, init=False, repr=False)
971 """Optional[float]: Time this task was stopped, or None if not stopped."""
972
973 finished_speed: Optional[float] = None
974 """Optional[float]: The last speed for a finished task."""
975
976 _progress: Deque[ProgressSample] = field(
977 default_factory=lambda: deque(maxlen=1000), init=False, repr=False
978 )
979
980 _lock: RLock = field(repr=False, default_factory=RLock)
981 """Thread lock."""
982
983 def get_time(self) -> float:
984 """float: Get the current time, in seconds."""
985 return self._get_time()
986
987 @property
988 def started(self) -> bool:
989 """bool: Check if the task as started."""
990 return self.start_time is not None
991
992 @property
993 def remaining(self) -> Optional[float]:

Callers 12

test_bar_columnsFunction · 0.90
test_text_columnFunction · 0.90
test_time_elapsed_columnFunction · 0.90
test_renderable_columnFunction · 0.90
test_spinner_columnFunction · 0.90
test_task_createFunction · 0.90
test_task_startFunction · 0.90
test_task_zero_totalFunction · 0.90
add_taskMethod · 0.85

Calls

no outgoing calls

Tested by 11

test_bar_columnsFunction · 0.72
test_text_columnFunction · 0.72
test_time_elapsed_columnFunction · 0.72
test_renderable_columnFunction · 0.72
test_spinner_columnFunction · 0.72
test_task_createFunction · 0.72
test_task_startFunction · 0.72
test_task_zero_totalFunction · 0.72