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

Commitbcea9a8

Browse files
authored
Merge pull request#1859 from EliahKagan/doc-types
Improve static typing and docstrings related to git object types
2 parents883b03a +5778b7a commitbcea9a8

38 files changed

+916
-549
lines changed

‎.github/workflows/pythonpackage.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ jobs:
8888

8989
-name:Check types with mypy
9090
run:|
91-
mypy -p git
92-
# With new versions of mypy new issues might arise. This is a problem if there is nobody able to fix them,
93-
# so we have to ignore errors until that changes.
91+
mypy --python-version=${{ matrix.python-version }} -p git
92+
env:
93+
MYPY_FORCE_COLOR:"1"
94+
TERM:"xterm-256color"# For color: https://github.com/python/mypy/issues/13817
95+
# With new versions of mypy new issues might arise. This is a problem if there is
96+
# nobody able to fix them, so we have to ignore errors until that changes.
9497
continue-on-error:true
9598

9699
-name:Test with pytest

‎git/__init__.py

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,6 @@
55

66
# @PydevCodeAnalysisIgnore
77

8-
__version__="git"
9-
10-
fromtypingimportList,Optional,Sequence,Tuple,Union,TYPE_CHECKING
11-
12-
fromgitdb.utilimportto_hex_sha
13-
fromgit.excimport*# noqa: F403 # @NoMove @IgnorePep8
14-
fromgit.typesimportPathLike
15-
16-
try:
17-
fromgit.compatimportsafe_decode# @NoMove @IgnorePep8
18-
fromgit.configimportGitConfigParser# @NoMove @IgnorePep8
19-
fromgit.objectsimport*# noqa: F403 # @NoMove @IgnorePep8
20-
fromgit.refsimport*# noqa: F403 # @NoMove @IgnorePep8
21-
fromgit.diffimport*# noqa: F403 # @NoMove @IgnorePep8
22-
fromgit.dbimport*# noqa: F403 # @NoMove @IgnorePep8
23-
fromgit.cmdimportGit# @NoMove @IgnorePep8
24-
fromgit.repoimportRepo# @NoMove @IgnorePep8
25-
fromgit.remoteimport*# noqa: F403 # @NoMove @IgnorePep8
26-
fromgit.indeximport*# noqa: F403 # @NoMove @IgnorePep8
27-
fromgit.utilimport (# @NoMove @IgnorePep8
28-
LockFile,
29-
BlockingLockFile,
30-
Stats,
31-
Actor,
32-
remove_password_if_present,
33-
rmtree,
34-
)
35-
exceptGitErroras_exc:# noqa: F405
36-
raiseImportError("%s: %s"% (_exc.__class__.__name__,_exc))from_exc
37-
38-
# __all__ must be statically defined by py.typed support
39-
# __all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))]
408
__all__= [# noqa: F405
419
"Actor",
4210
"AmbiguousObjectName",
@@ -52,6 +20,7 @@
5220
"CommandError",
5321
"Commit",
5422
"Diff",
23+
"DiffConstants",
5524
"DiffIndex",
5625
"Diffable",
5726
"FetchInfo",
@@ -65,18 +34,19 @@
6534
"HEAD",
6635
"Head",
6736
"HookExecutionError",
37+
"INDEX",
6838
"IndexEntry",
6939
"IndexFile",
7040
"IndexObject",
7141
"InvalidDBRoot",
7242
"InvalidGitRepositoryError",
73-
"List",
43+
"List",# Deprecated - import this from `typing` instead.
7444
"LockFile",
7545
"NULL_TREE",
7646
"NoSuchPathError",
7747
"ODBError",
7848
"Object",
79-
"Optional",
49+
"Optional",# Deprecated - import this from `typing` instead.
8050
"ParseError",
8151
"PathLike",
8252
"PushInfo",
@@ -90,31 +60,62 @@
9060
"RepositoryDirtyError",
9161
"RootModule",
9262
"RootUpdateProgress",
93-
"Sequence",
63+
"Sequence",# Deprecated - import from `typing`, or `collections.abc` in 3.9+.
9464
"StageType",
9565
"Stats",
9666
"Submodule",
9767
"SymbolicReference",
98-
"TYPE_CHECKING",
68+
"TYPE_CHECKING",# Deprecated - import this from `typing` instead.
9969
"Tag",
10070
"TagObject",
10171
"TagReference",
10272
"Tree",
10373
"TreeModifier",
104-
"Tuple",
105-
"Union",
74+
"Tuple",# Deprecated - import this from `typing` instead.
75+
"Union",# Deprecated - import this from `typing` instead.
10676
"UnmergedEntriesError",
10777
"UnsafeOptionError",
10878
"UnsafeProtocolError",
10979
"UnsupportedOperation",
11080
"UpdateProgress",
11181
"WorkTreeRepositoryUnsupported",
82+
"refresh",
11283
"remove_password_if_present",
11384
"rmtree",
11485
"safe_decode",
11586
"to_hex_sha",
11687
]
11788

89+
__version__="git"
90+
91+
fromtypingimportList,Optional,Sequence,Tuple,Union,TYPE_CHECKING
92+
93+
fromgitdb.utilimportto_hex_sha
94+
fromgit.excimport*# noqa: F403 # @NoMove @IgnorePep8
95+
fromgit.typesimportPathLike
96+
97+
try:
98+
fromgit.compatimportsafe_decode# @NoMove @IgnorePep8
99+
fromgit.configimportGitConfigParser# @NoMove @IgnorePep8
100+
fromgit.objectsimport*# noqa: F403 # @NoMove @IgnorePep8
101+
fromgit.refsimport*# noqa: F403 # @NoMove @IgnorePep8
102+
fromgit.diffimport*# noqa: F403 # @NoMove @IgnorePep8
103+
fromgit.dbimport*# noqa: F403 # @NoMove @IgnorePep8
104+
fromgit.cmdimportGit# @NoMove @IgnorePep8
105+
fromgit.repoimportRepo# @NoMove @IgnorePep8
106+
fromgit.remoteimport*# noqa: F403 # @NoMove @IgnorePep8
107+
fromgit.indeximport*# noqa: F403 # @NoMove @IgnorePep8
108+
fromgit.utilimport (# @NoMove @IgnorePep8
109+
LockFile,
110+
BlockingLockFile,
111+
Stats,
112+
Actor,
113+
remove_password_if_present,
114+
rmtree,
115+
)
116+
exceptGitErroras_exc:# noqa: F405
117+
raiseImportError("%s: %s"% (_exc.__class__.__name__,_exc))from_exc
118+
118119
# { Initialize git executable path
119120
GIT_OK=None
120121

@@ -146,7 +147,7 @@ def refresh(path: Optional[PathLike] = None) -> None:
146147
ifnotGit.refresh(path=path):
147148
return
148149
ifnotFetchInfo.refresh():# noqa: F405
149-
return# type: ignore[unreachable]
150+
return# type: ignore[unreachable]
150151

151152
GIT_OK=True
152153

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp