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

Commit94344b4

Browse files
committed
Clarify CallableProgress vs. CallableRemoteProgress
This corrects an overstatement in the git.types.CallableProgressdocstring, which was introduced recently in9e47083, and in whichI had erroneously claimed that it was the most general type ofobject passed as a progress reporter for cloning.There are some non-None non-callable types that can also bepassed and that are not encompassed by git.types.CallableProgress,somewhat confusingly including CallableRemoteProgress (which likeRemoteProgress is not callable; rather, it wraps a callable andforwards progress information to it).In addition, None can be passed, and whilegit.types.CallableProgress does encompass it, it is not callable.(This is minor by comparison and I just added a brief note for it.)This also further expands the git.types.CallableProgress docstring,as well as the git.util.CallableRemoteProgress docstring, toclarify the distinction between them, as well as what "Callable"really signifies for CallableRemoteProgress (that it wraps andforwards to a callable, rather than itself being callable).
1 parente4fd2e3 commit94344b4

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

‎git/types.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,25 @@
115115
# Progress parameter type alias -----------------------------------------
116116

117117
CallableProgress=Optional[Callable[[int,Union[str,float],Union[str,float,None],str],None]]
118-
"""General type of a progress reporter for cloning.
118+
"""General type of afunction or other callable used as aprogress reporter for cloning.
119119
120120
This is the type of a function or other callable that reports the progress of a clone,
121121
when passed as a ``progress`` argument to :meth:`Repo.clone <git.repo.base.Repo.clone>`
122122
or :meth:`Repo.clone_from <git.repo.base.Repo.clone_from>`.
123+
124+
:note:
125+
Those :meth:`~git.repo.base.Repo.clone` and :meth:`~git.repo.base.Repo.clone_from`
126+
methods also accept :meth:`~git.util.RemoteProgress` instances, including instances
127+
of its :meth:`~git.util.CallableRemoteProgress` subclass.
128+
129+
:note:
130+
Unlike objects that match this type, :meth:`~git.util.RemoteProgress` instances are
131+
not directly callable, not even when they are instances of
132+
:meth:`~git.util.CallableRemoteProgress`, which wraps a callable and forwards
133+
information to it but is not itself callable.
134+
135+
:note:
136+
This type also allows ``None``, for cloning without reporting progress.
123137
"""
124138

125139
# -----------------------------------------------------------------------------------

‎git/util.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,14 @@ def update(
749749

750750

751751
classCallableRemoteProgress(RemoteProgress):
752-
"""An implementation forwarding updates to any callable."""
752+
"""A :class:`RemoteProgress` implementation forwarding updates to any callable.
753+
754+
:note:
755+
Like direct instances of :class:`RemoteProgress`, instances of this
756+
:class:`CallableRemoteProgress` class are not themselves directly callable.
757+
Rather, instances of this class wrap a callable and forward to it. This should
758+
therefore not be confused with :class:`git.types.CallableProgress`.
759+
"""
753760

754761
__slots__= ("_callable",)
755762

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp