diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-04-04 18:42:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-04-04 18:42:11 +0000 |
commit | 361ff4da262b4891323287049e9e6c5fbe1d01dc (patch) | |
tree | 969b376a2c170841758d39ef9516dac65c8b94cd /pre_commit/output.py | |
parent | Adding upstream version 2.17.0. (diff) | |
download | pre-commit-361ff4da262b4891323287049e9e6c5fbe1d01dc.tar.xz pre-commit-361ff4da262b4891323287049e9e6c5fbe1d01dc.zip |
Adding upstream version 2.18.1.upstream/2.18.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/output.py')
-rw-r--r-- | pre_commit/output.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pre_commit/output.py b/pre_commit/output.py index 24f9d84..4bcf27f 100644 --- a/pre_commit/output.py +++ b/pre_commit/output.py @@ -1,8 +1,9 @@ +from __future__ import annotations + import contextlib import sys from typing import Any from typing import IO -from typing import Optional def write(s: str, stream: IO[bytes] = sys.stdout.buffer) -> None: @@ -11,9 +12,9 @@ def write(s: str, stream: IO[bytes] = sys.stdout.buffer) -> None: def write_line_b( - s: Optional[bytes] = None, + s: bytes | None = None, stream: IO[bytes] = sys.stdout.buffer, - logfile_name: Optional[str] = None, + logfile_name: str | None = None, ) -> None: with contextlib.ExitStack() as exit_stack: output_streams = [stream] @@ -28,5 +29,5 @@ def write_line_b( output_stream.flush() -def write_line(s: Optional[str] = None, **kwargs: Any) -> None: +def write_line(s: str | None = None, **kwargs: Any) -> None: write_line_b(s.encode() if s is not None else s, **kwargs) |