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

Commitc8ad3a3

Browse files
committed
Deprecate public access to typing imports in git
This adds comments to entries in git.__all__ for each of theentries that come from the standard library typing module, notingthem as deprecated.These imports were included in __all__ inadvertently due to theway __all__ was dynamically constructed, and placed in __all__explicitly when __all__ became static in#1659. They are there forbackward compatibility, in case some code relies on them beingthere. But a module is unlikely to rely intentionally on the gitmodule providing them, since they are not conceptually related toGitPython.`from git import *` should not typically be used, since wildcardimports are not generally recommended, as discussed in PEP-8. Butif someone does choose to use it, they would probably benefit lessfrom DeprecationWarning being issued for each of those names thanthey would usually benefit from DeprecationWarning. This could leadto developers deciding not to enable DeprecationWarning when it mayotherwise be useful. For this reason, no attempt is currently madeto issue DeprecationWarning when those names are accessed asattributes of the git module.
1 parente49327d commitc8ad3a3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎git/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
"IndexObject",
3939
"InvalidDBRoot",
4040
"InvalidGitRepositoryError",
41-
"List",
41+
"List",# Deprecated - import this from `typing` instead.
4242
"LockFile",
4343
"NULL_TREE",
4444
"NoSuchPathError",
4545
"ODBError",
4646
"Object",
47-
"Optional",
47+
"Optional",# Deprecated - import this from `typing` instead.
4848
"ParseError",
4949
"PathLike",
5050
"PushInfo",
@@ -58,19 +58,19 @@
5858
"RepositoryDirtyError",
5959
"RootModule",
6060
"RootUpdateProgress",
61-
"Sequence",
61+
"Sequence",# Deprecated - import this from `typing` instead.
6262
"StageType",
6363
"Stats",
6464
"Submodule",
6565
"SymbolicReference",
66-
"TYPE_CHECKING",
66+
"TYPE_CHECKING",# Deprecated - import this from `typing` instead.
6767
"Tag",
6868
"TagObject",
6969
"TagReference",
7070
"Tree",
7171
"TreeModifier",
72-
"Tuple",
73-
"Union",
72+
"Tuple",# Deprecated - import this from `typing` instead.
73+
"Union",# Deprecated - import this from `typing` instead.
7474
"UnmergedEntriesError",
7575
"UnsafeOptionError",
7676
"UnsafeProtocolError",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp