Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitebcfced

Browse files
committed
Fix and deprecate Lit_commit_ish
It would be a breaking change to keep Lit_commit_ish undefined, sothis brings it back, but with a narrowed definition for consistencywith the corrected Commit_ish, and deprecated, with instructions onwhat to use instead.(This also improves import sorting in the same module.)
1 parent93d19dc commitebcfced

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

‎git/types.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,38 @@
44
importos
55
importsys
66
fromtypingimport (# noqa: F401
7+
Any,
8+
Callable,
79
Dict,
810
NoReturn,
11+
Optional,
912
SequenceasSequence,
1013
Tuple,
11-
Union,
12-
Any,
13-
Optional,
14-
Callable,
1514
TYPE_CHECKING,
1615
TypeVar,
16+
Union,
1717
)
1818

1919
ifsys.version_info>= (3,8):
2020
fromtypingimport (# noqa: F401
2121
Literal,
22-
TypedDict,
2322
Protocol,
2423
SupportsIndexasSupportsIndex,
24+
TypedDict,
2525
runtime_checkable,
2626
)
2727
else:
2828
fromtyping_extensionsimport (# noqa: F401
2929
Literal,
30+
Protocol,
3031
SupportsIndexasSupportsIndex,
3132
TypedDict,
32-
Protocol,
3333
runtime_checkable,
3434
)
3535

3636
ifTYPE_CHECKING:
37-
fromgit.repoimportRepo
3837
fromgit.objectsimportCommit,Tree,TagObject,Blob
38+
fromgit.repoimportRepo
3939

4040
PathLike=Union[str,"os.PathLike[str]"]
4141
"""A :class:`str` (Unicode) based file or directory path."""
@@ -126,22 +126,19 @@
126126
gitglossary(7) on "object type": https://git-scm.com/docs/gitglossary#def_object_type
127127
"""
128128

129+
Lit_commit_ish=Literal["commit","tag"]
130+
"""Deprecated. Type of literal strings identifying sometimes-commitish git object types.
129131
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:
137134
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.
141138
142-
:note:
143-
As noted in:class:`Old_commit_ish`, this isnot limitedtotypes 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 isequivalenttothe old definition of this type
141+
prior to the bugfix.
145142
"""
146143

147144
# Config_levels ---------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp