Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: full typing for "progress" parameter in Repo class#1634

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 1 commit intogitpython-developers:mainfrommadebylydia:main
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes fromall 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
5 changes: 3 additions & 2 deletionsgit/repo/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,6 +60,7 @@
PathLike,
Lit_config_levels,
Commit_ish,
CallableProgress,
Tree_ish,
assert_never,
)
Expand DownExpand Up@@ -1258,7 +1259,7 @@ def _clone(
def clone(
self,
path: PathLike,
progress: Optional[Callable] = None,
progress: Optional[CallableProgress] = None,
multi_options: Optional[List[str]] = None,
allow_unsafe_protocols: bool = False,
allow_unsafe_options: bool = False,
Expand DownExpand Up@@ -1297,7 +1298,7 @@ def clone_from(
cls,
url: PathLike,
to_path: PathLike,
progress:Optional[Callable] = None,
progress:CallableProgress = None,
env: Optional[Mapping[str, str]] = None,
multi_options: Optional[List[str]] = None,
allow_unsafe_protocols: bool = False,
Expand Down
22 changes: 11 additions & 11 deletionsgit/types.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,42 +8,39 @@
from typing import (
Dict,
NoReturn,
Sequence,
Sequence as Sequence,
Tuple,
Union,
Any,
Optional,
Callable,
TYPE_CHECKING,
TypeVar,
) # noqa: F401

if sys.version_info[:2] >= (3, 8):
if sys.version_info >= (3, 8):
from typing import (
Literal,
SupportsIndex,
TypedDict,
Protocol,
SupportsIndex as SupportsIndex,
runtime_checkable,
) # noqa: F401
else:
from typing_extensions import (
Literal,
SupportsIndex, # noqa: F401
SupportsIndex as SupportsIndex,
TypedDict,
Protocol,
runtime_checkable,
) # noqa: F401

# if sys.version_info[:2] >= (3, 10):
# if sys.version_info >= (3, 10):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is this a comment that is relevant to the typing system? If not, I think it can be deleted.

# from typing import TypeGuard # noqa: F401
# else:
# from typing_extensions import TypeGuard # noqa: F401


if sys.version_info[:2] < (3, 9):
PathLike = Union[str, os.PathLike]
else:
# os.PathLike only becomes subscriptable from Python 3.9 onwards
PathLike = Union[str, os.PathLike[str]]
PathLike = Union[str, "os.PathLike[str]"]

if TYPE_CHECKING:
from git.repo import Repo
Expand All@@ -62,6 +59,9 @@

Lit_config_levels = Literal["system", "global", "user", "repository"]

# Progress parameter type alias -----------------------------------------

CallableProgress = Optional[Callable[[int, Union[str, float], Union[str, float, None], str], None]]

# def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]:
# # return inp in get_args(Lit_config_level) # only py >= 3.8
Expand Down
2 changes: 1 addition & 1 deletionrequirements-dev.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,4 +10,4 @@ pytest-icdiff
# pytest-profiling


tox
tox

[8]ページ先頭

©2009-2025 Movatter.jp