|
14 | 14 | import shutil
|
15 | 15 | import string
|
16 | 16 | import tempfile
|
17 |
| -from collections.abc import Iterable, Mapping |
| 17 | +from collections.abc import Iterable, Iterator, Mapping |
18 | 18 | from datetime import datetime, timedelta
|
19 | 19 | from distutils import dir_util
|
20 | 20 | from pathlib import Path
|
21 | 21 | from tempfile import NamedTemporaryFile
|
22 | 22 | from types import SimpleNamespace
|
23 |
| -from typing import Iterator, Optional, Union |
| 23 | +from typing import Optional, Union |
24 | 24 |
|
25 | 25 | from .html_utilities import (
|
26 | 26 | append_html,
|
@@ -248,7 +248,7 @@ def update_done_time(self) -> None:
|
248 | 248 | """
|
249 | 249 | self.done_time = datetime.now()
|
250 | 250 |
|
251 |
| - def __update_duration(self) -> None: |
| 251 | + def update_duration(self) -> None: |
252 | 252 | """
|
253 | 253 | Update the :attr:`duration` attribute.
|
254 | 254 |
|
@@ -385,7 +385,7 @@ def print(self, msg: str, end: str = "\n") -> None:
|
385 | 385 | msg: The message to print and save to the log.
|
386 | 386 | end: The string appended after the message:
|
387 | 387 | """
|
388 |
| - print(msg, end=end) |
| 388 | + print(msg, end=end) # noqa: T201 |
389 | 389 | log = {"msg": msg, "timestamp": str(datetime.now()), "cmd": None}
|
390 | 390 | self.log_book.append(log)
|
391 | 391 |
|
@@ -427,7 +427,7 @@ def to_html(self) -> Union[Iterator[str], list[Iterator[str]]]:
|
427 | 427 | if isinstance(log, ShellLogger):
|
428 | 428 | # Update the duration of this ShellLogger's commands.
|
429 | 429 | if log.duration is None:
|
430 |
| - log.__update_duration() |
| 430 | + log.update_duration() |
431 | 431 | html.append(child_logger_card(log))
|
432 | 432 |
|
433 | 433 | # Otherwise, if this is a message being logged...
|
@@ -559,7 +559,7 @@ def log( # noqa: PLR0913
|
559 | 559 | # Print the command to be executed.
|
560 | 560 | with stdout_path.open("a"), stderr_path.open("a"):
|
561 | 561 | if verbose:
|
562 |
| - print(cmd) |
| 562 | + print(cmd) # noqa: T201 |
563 | 563 |
|
564 | 564 | # Initialize the log information.
|
565 | 565 | log = {
|
@@ -737,7 +737,7 @@ def default(self, obj: object) -> object: # noqa: PLR0911
|
737 | 737 | """
|
738 | 738 | if isinstance(obj, ShellLogger):
|
739 | 739 | return {
|
740 |
| - **{"__type__": "ShellLogger"}, |
| 740 | + "__type__": "ShellLogger", |
741 | 741 | **{k: self.default(v) for k, v in obj.__dict__.items()},
|
742 | 742 | }
|
743 | 743 | if isinstance(obj, (int, float, str, bytes)):
|
|
0 commit comments