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

Appearance settings

Commit 9e47083

Browse filesBrowse files
committed
Start adding docstrings to types in git.types
1 parent 85889cd commit 9e47083
Copy full SHA for 9e47083

1 file changed

+16-3Lines changed: 16 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎git/types.py‎

Copy file name to clipboardExpand all lines: git/types.py
+16-3Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# from typing_extensions import TypeGuard # noqa: F401
4040

4141
PathLike = Union[str, "os.PathLike[str]"]
42+
"""A :class:`str` (Unicode) based file or directory path."""
4243

4344
if TYPE_CHECKING:
4445
from git.repo import Repo
@@ -47,6 +48,8 @@
4748
# from git.refs import SymbolicReference
4849

4950
TBD = Any
51+
"""Alias of :class:`~typing.Any`, when a type hint is meant to become more specific."""
52+
5053
_T = TypeVar("_T")
5154

5255
Tree_ish = Union["Commit", "Tree"]
@@ -56,17 +59,27 @@
5659
# Config_levels ---------------------------------------------------------
5760

5861
Lit_config_levels = Literal["system", "global", "user", "repository"]
62+
"""Type of literal strings naming git configuration levels.
5963
60-
# Progress parameter type alias -----------------------------------------
64+
Such a string identifies what level, or scope, a git configuration variables is in.
65+
"""
6166

62-
CallableProgress = Optional[Callable[[int, Union[str, float], Union[str, float, None], str], None]]
67+
ConfigLevels_Tup = Tuple[Literal["system"], Literal["user"], Literal["global"], Literal["repository"]]
68+
"""Static type of a tuple of the four strings representing configuration levels."""
6369

6470
# def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]:
6571
# # return inp in get_args(Lit_config_level) # only py >= 3.8
6672
# return inp in ("system", "user", "global", "repository")
6773

74+
# Progress parameter type alias -----------------------------------------
6875

69-
ConfigLevels_Tup = Tuple[Literal["system"], Literal["user"], Literal["global"], Literal["repository"]]
76+
CallableProgress = Optional[Callable[[int, Union[str, float], Union[str, float, None], str], None]]
77+
"""General type of a progress reporter for cloning.
78+
79+
This is the type of a function or other callable that reports the progress of a clone,
80+
when passed as a ``progress`` argument to :meth:`Repo.clone <git.repo.base.Repo.clone>`
81+
or :meth:`Repo.clone_from <git.repo.base.Repo.clone_from>`.
82+
"""
7083

7184
# -----------------------------------------------------------------------------------
7285

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.