Skip to content

Commit 90fefb0

Browse files
committed
add overloads to to_progress_instance()
1 parent f97d378 commit 90fefb0

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

git/remote.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# typing-------------------------------------------------------
3838

39-
from typing import Any, Callable, Optional, TYPE_CHECKING, Union
39+
from typing import Any, Callable, Optional, TYPE_CHECKING, Union, overload
4040

4141
from git.types import PathLike, Literal
4242

@@ -71,7 +71,23 @@ def add_progress(kwargs: Any, git: Git, progress: Optional[Callable[..., Any]])
7171
#} END utilities
7272

7373

74-
def to_progress_instance(progress: Callable[..., Any]) -> Union[RemoteProgress, CallableRemoteProgress]:
74+
@overload
75+
def to_progress_instance(progress: None) -> RemoteProgress:
76+
...
77+
78+
79+
@overload
80+
def to_progress_instance(progress: Callable[..., Any]) -> CallableRemoteProgress:
81+
...
82+
83+
84+
@overload
85+
def to_progress_instance(progress: RemoteProgress) -> RemoteProgress:
86+
...
87+
88+
89+
def to_progress_instance(progress: Union[Callable[..., Any], RemoteProgress, None]
90+
) -> Union[RemoteProgress, CallableRemoteProgress]:
7591
"""Given the 'progress' return a suitable object derived from
7692
RemoteProgress().
7793
"""

0 commit comments

Comments
 (0)