Skip to content

Fix Git.{AutoInterrupt,CatFileContentStream} static typing #2039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
overload,
)

if sys.version_info >= (3, 10):
from typing import TypeAlias
else:
from typing_extensions import TypeAlias

from git.types import Literal, PathLike, TBD

if TYPE_CHECKING:
Expand Down Expand Up @@ -952,9 +957,9 @@ def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) ->
f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
)

AutoInterrupt = _AutoInterrupt
AutoInterrupt: TypeAlias = _AutoInterrupt

CatFileContentStream = _CatFileContentStream
CatFileContentStream: TypeAlias = _CatFileContentStream

def __init__(self, working_dir: Union[None, PathLike] = None) -> None:
"""Initialize this instance with:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
gitdb>=4.0.1,<5
typing-extensions>=3.7.4.3;python_version<"3.8"
typing-extensions>=3.10.0.2;python_version<"3.10"
Loading