|
4 | 4 | import os |
5 | 5 | import sys |
6 | 6 | from typing import ( # noqa: F401 |
| 7 | + Any, |
| 8 | + Callable, |
7 | 9 | Dict, |
8 | 10 | NoReturn, |
| 11 | + Optional, |
9 | 12 | Sequence as Sequence, |
10 | 13 | Tuple, |
11 | | - Union, |
12 | | - Any, |
13 | | - Optional, |
14 | | - Callable, |
15 | 14 | TYPE_CHECKING, |
16 | 15 | TypeVar, |
| 16 | + Union, |
17 | 17 | ) |
18 | 18 |
|
19 | 19 | if sys.version_info >= (3, 8): |
20 | 20 | from typing import ( # noqa: F401 |
21 | 21 | Literal, |
22 | | - TypedDict, |
23 | 22 | Protocol, |
24 | 23 | SupportsIndex as SupportsIndex, |
| 24 | + TypedDict, |
25 | 25 | runtime_checkable, |
26 | 26 | ) |
27 | 27 | else: |
28 | 28 | from typing_extensions import ( # noqa: F401 |
29 | 29 | Literal, |
| 30 | + Protocol, |
30 | 31 | SupportsIndex as SupportsIndex, |
31 | 32 | TypedDict, |
32 | | - Protocol, |
33 | 33 | runtime_checkable, |
34 | 34 | ) |
35 | 35 |
|
36 | 36 | if TYPE_CHECKING: |
37 | | - from git.repo import Repo |
38 | 37 | from git.objects import Commit, Tree, TagObject, Blob |
| 38 | + from git.repo import Repo |
39 | 39 |
|
40 | 40 | PathLike = Union[str, "os.PathLike[str]"] |
41 | 41 | """A :class:`str` (Unicode) based file or directory path.""" |
|
126 | 126 | gitglossary(7) on "object type": https://git-scm.com/docs/gitglossary#def_object_type |
127 | 127 | """ |
128 | 128 |
|
| 129 | +Lit_commit_ish = Literal["commit", "tag"] |
| 130 | +"""Deprecated. Type of literal strings identifying sometimes-commitish git object types. |
129 | 131 |
|
130 | | -# FIXME: After replacing the one use with GitObjectTypeString, define Lit_commit_ish |
131 | | -# somehow (it is a breaking change to remove it entirely). Maybe deprecate it. |
132 | | -Lit_old_commit_ish = Literal["commit", "tag", "blob", "tree"] |
133 | | -"""Literal strings identifying concrete :class:`~git.objects.base.Object` subtypes |
134 | | -representing git object types. |
135 | | -
|
136 | | -See the :class:`Object.type <git.objects.base.Object.type>` attribute. |
| 132 | +Prior to a bugfix, this type had been defined more broadly. Any usage is in practice |
| 133 | +ambiguous and likely to be incorrect. Instead of this type: |
137 | 134 |
|
138 | | -:note: |
139 | | - See also :class:`Old_commit_ish`, a union of the the :class:`~git.objects.base.Object` |
140 | | - subtypes associated with these literal strings. |
| 135 | +* For the type of the string literals associated with :class:`Commit_ish`, use |
| 136 | + ``Literal["commit", "tag"]`` or create a new type alias for it. That is equivalent to |
| 137 | + this type as currently defined. |
141 | 138 |
|
142 | | -:note: |
143 | | - As noted in :class:`Old_commit_ish`, this is not limited to types of git objects that |
144 | | - are actually commit-ish. |
| 139 | +* For the type of all four string literals associated with :class:`AnyGitObject`, use |
| 140 | + :class:`GitObjectTypeString`. That is equivalent to the old definition of this type |
| 141 | + prior to the bugfix. |
145 | 142 | """ |
146 | 143 |
|
147 | 144 | # Config_levels --------------------------------------------------------- |
|
0 commit comments