Skip to content

Commit c6d16d0

Browse files
committed
Start on fixing AutoInterrupt/CatFileContentStream aliases
This uses `TypeAlias` from the `typing` module, to make it so the assignment statments introduced in #2037 (to set `Git.AutoInterrupt` and `Git.CatFileContentStream` to nonpublic module-level implementations `_AutoInterrupt` and `_CatFileContentStream`) are treated by `mypy` as type aliases rather than as class variables. For details on the problem this partially fixes, see #2038 and: https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases The fix won't work in this form, however, because it attempts to import `TypeAlias` unconditionally from the standard-library `typing` module, which only gained it in Python 3.10.
1 parent 1e463d4 commit c6d16d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

git/cmd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
TYPE_CHECKING,
5656
TextIO,
5757
Tuple,
58+
TypeAlias,
5859
Union,
5960
cast,
6061
overload,
@@ -952,9 +953,9 @@ def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) ->
952953
f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
953954
)
954955

955-
AutoInterrupt = _AutoInterrupt
956+
AutoInterrupt: TypeAlias = _AutoInterrupt
956957

957-
CatFileContentStream = _CatFileContentStream
958+
CatFileContentStream: TypeAlias = _CatFileContentStream
958959

959960
def __init__(self, working_dir: Union[None, PathLike] = None) -> None:
960961
"""Initialize this instance with:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy