summaryrefslogtreecommitdiff
path: root/git/remote.py
diff options
context:
space:
mode:
authoryobmod <yobmod@gmail.com>2021-05-03 17:49:36 +0100
committeryobmod <yobmod@gmail.com>2021-05-03 17:49:36 +0100
commit90fefb0a8cc5dc793d40608e2d6a2398acecef12 (patch)
treeea51c3d71b1477201e57e48ca27d24d9a293b550 /git/remote.py
parentf97d37881d50da8f9702681bc1928a8d44119e88 (diff)
downloadgitpython-90fefb0a8cc5dc793d40608e2d6a2398acecef12.tar.gz
add overloads to to_progress_instance()
Diffstat (limited to 'git/remote.py')
-rw-r--r--git/remote.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/git/remote.py b/git/remote.py
index d73da7d4..0071b923 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -36,7 +36,7 @@ from .refs import (
# typing-------------------------------------------------------
-from typing import Any, Callable, Optional, TYPE_CHECKING, Union
+from typing import Any, Callable, Optional, TYPE_CHECKING, Union, overload
from git.types import PathLike, Literal
@@ -71,7 +71,23 @@ def add_progress(kwargs: Any, git: Git, progress: Optional[Callable[..., Any]])
#} END utilities
-def to_progress_instance(progress: Callable[..., Any]) -> Union[RemoteProgress, CallableRemoteProgress]:
+@overload
+def to_progress_instance(progress: None) -> RemoteProgress:
+ ...
+
+
+@overload
+def to_progress_instance(progress: Callable[..., Any]) -> CallableRemoteProgress:
+ ...
+
+
+@overload
+def to_progress_instance(progress: RemoteProgress) -> RemoteProgress:
+ ...
+
+
+def to_progress_instance(progress: Union[Callable[..., Any], RemoteProgress, None]
+ ) -> Union[RemoteProgress, CallableRemoteProgress]:
"""Given the 'progress' return a suitable object derived from
RemoteProgress().
"""