MCPcopy
hub / github.com/Textualize/toolong / get_timestamp

Method get_timestamp

src/toolong/log_lines.py:543–555  ·  view source on GitHub ↗

Get a timestamp for the given line, or `None` if no timestamp detected. Args: line_index: Index of line. Returns: A datetime or `None`.

(self, line_index: int)

Source from the content-addressed store, hash-verified

541 return line, text.copy(), timestamp
542
543 def get_timestamp(self, line_index: int) -> datetime | None:
544 """Get a timestamp for the given line, or `None` if no timestamp detected.
545
546 Args:
547 line_index: Index of line.
548
549 Returns:
550 A datetime or `None`.
551 """
552 log_file, start, end = self.index_to_span(line_index)
553 line = log_file.get_line(start, end)
554 timestamp = log_file.timestamp_scanner.scan(line)
555 return timestamp
556
557 def on_unmount(self) -> None:
558 self._line_reader.stop()

Callers 2

action_navigateMethod · 0.95
pointer_movedMethod · 0.80

Calls 3

index_to_spanMethod · 0.95
scanMethod · 0.80
get_lineMethod · 0.45

Tested by

no test coverage detected