diff options
| author | Scott Gasch <[email protected]> | 2022-02-08 20:21:02 -0800 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-02-08 20:21:02 -0800 |
| commit | 2f5b47c8b30d1b7d86443391332be2f3805cdafd (patch) | |
| tree | 181f08770989ed65f859d8c6772d1d71336c77c7 /string_utils.py | |
| parent | 4b04fd1d5a14c5c4c7e0985e5376b4e2f879ef06 (diff) | |
Cleanup more contextlib.AbstractContextManagers and Literal[False]s.
Diffstat (limited to 'string_utils.py')
| -rw-r--r-- | string_utils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/string_utils.py b/string_utils.py index d75c6ba..adfb149 100644 --- a/string_utils.py +++ b/string_utils.py @@ -40,7 +40,7 @@ import string import unicodedata import warnings from itertools import zip_longest -from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple +from typing import Any, Callable, Dict, Iterable, List, Literal, Optional, Sequence, Tuple from uuid import uuid4 import list_utils @@ -1208,7 +1208,7 @@ def sprintf(*args, **kwargs) -> str: return ret -class SprintfStdout(object): +class SprintfStdout(contextlib.AbstractContextManager): """ A context manager that captures outputs to stdout. @@ -1228,10 +1228,10 @@ class SprintfStdout(object): self.recorder.__enter__() return lambda: self.destination.getvalue() - def __exit__(self, *args) -> None: + def __exit__(self, *args) -> Literal[False]: self.recorder.__exit__(*args) self.destination.seek(0) - return None # don't suppress exceptions + return False def capitalize_first_letter(txt: str) -> str: |
