|
39 | 39 | # from typing_extensions import TypeGuard # noqa: F401
|
40 | 40 |
|
41 | 41 | PathLike = Union[str, "os.PathLike[str]"]
|
| 42 | +"""A :class:`str` (Unicode) based file or directory path.""" |
42 | 43 |
|
43 | 44 | if TYPE_CHECKING:
|
44 | 45 | from git.repo import Repo
|
|
47 | 48 | # from git.refs import SymbolicReference
|
48 | 49 |
|
49 | 50 | TBD = Any
|
| 51 | +"""Alias of :class:`~typing.Any`, when a type hint is meant to become more specific.""" |
| 52 | + |
50 | 53 | _T = TypeVar("_T")
|
51 | 54 |
|
52 | 55 | Tree_ish = Union["Commit", "Tree"]
|
|
56 | 59 | # Config_levels ---------------------------------------------------------
|
57 | 60 |
|
58 | 61 | Lit_config_levels = Literal["system", "global", "user", "repository"]
|
| 62 | +"""Type of literal strings naming git configuration levels. |
59 | 63 |
|
60 |
| -# Progress parameter type alias ----------------------------------------- |
| 64 | +Such a string identifies what level, or scope, a git configuration variables is in. |
| 65 | +""" |
61 | 66 |
|
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.""" |
63 | 69 |
|
64 | 70 | # def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]:
|
65 | 71 | # # return inp in get_args(Lit_config_level) # only py >= 3.8
|
66 | 72 | # return inp in ("system", "user", "global", "repository")
|
67 | 73 |
|
| 74 | +# Progress parameter type alias ----------------------------------------- |
68 | 75 |
|
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 | +""" |
70 | 83 |
|
71 | 84 | # -----------------------------------------------------------------------------------
|
72 | 85 |
|
|
0 commit comments