Skip to content

Commit de10791

Browse files
committed
Add refresh to top-level __all__
This makes the git.refresh function unambiguously public. git.refresh was already public in the sense that it was explicitly documented as appropriate to call from code outside GitPython. However, it had not been included in git.__all__. Because __all__ existed but omitted "refresh", git.refresh had appeared non-public to automated tools. This also does some cleanup: - It removes a comment that showed how git.__all__ had been defined dynamically before gitpython-developers#1659, since with the addition of "refresh", git.__all__ no longer contains exactly the same elements as that technique produced (as it examined the module's contents prior to running the def statement that bound the name "refresh"). - With that comment removed, it is no longer necessary to define __all__ below the imports to show what the dynamic techinque had operated on. So this moves it up above them in accordance with PEP-8.
1 parent b2c3d8b commit de10791

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

Diff for: git/__init__.py

+31-32
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,6 @@
55

66
# @PydevCodeAnalysisIgnore
77

8-
__version__ = "git"
9-
10-
from typing import List, Optional, Sequence, Tuple, Union, TYPE_CHECKING
11-
12-
from gitdb.util import to_hex_sha
13-
from git.exc import * # noqa: F403 # @NoMove @IgnorePep8
14-
from git.types import PathLike
15-
16-
try:
17-
from git.compat import safe_decode # @NoMove @IgnorePep8
18-
from git.config import GitConfigParser # @NoMove @IgnorePep8
19-
from git.objects import * # noqa: F403 # @NoMove @IgnorePep8
20-
from git.refs import * # noqa: F403 # @NoMove @IgnorePep8
21-
from git.diff import * # noqa: F403 # @NoMove @IgnorePep8
22-
from git.db import * # noqa: F403 # @NoMove @IgnorePep8
23-
from git.cmd import Git # @NoMove @IgnorePep8
24-
from git.repo import Repo # @NoMove @IgnorePep8
25-
from git.remote import * # noqa: F403 # @NoMove @IgnorePep8
26-
from git.index import * # noqa: F403 # @NoMove @IgnorePep8
27-
from git.util import ( # @NoMove @IgnorePep8
28-
LockFile,
29-
BlockingLockFile,
30-
Stats,
31-
Actor,
32-
remove_password_if_present,
33-
rmtree,
34-
)
35-
except GitError as _exc: # noqa: F405
36-
raise ImportError("%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",
@@ -109,12 +77,43 @@
10977
"UnsupportedOperation",
11078
"UpdateProgress",
11179
"WorkTreeRepositoryUnsupported",
80+
"refresh",
11281
"remove_password_if_present",
11382
"rmtree",
11483
"safe_decode",
11584
"to_hex_sha",
11685
]
11786

87+
__version__ = "git"
88+
89+
from typing import List, Optional, Sequence, Tuple, Union, TYPE_CHECKING
90+
91+
from gitdb.util import to_hex_sha
92+
from git.exc import * # noqa: F403 # @NoMove @IgnorePep8
93+
from git.types import PathLike
94+
95+
try:
96+
from git.compat import safe_decode # @NoMove @IgnorePep8
97+
from git.config import GitConfigParser # @NoMove @IgnorePep8
98+
from git.objects import * # noqa: F403 # @NoMove @IgnorePep8
99+
from git.refs import * # noqa: F403 # @NoMove @IgnorePep8
100+
from git.diff import * # noqa: F403 # @NoMove @IgnorePep8
101+
from git.db import * # noqa: F403 # @NoMove @IgnorePep8
102+
from git.cmd import Git # @NoMove @IgnorePep8
103+
from git.repo import Repo # @NoMove @IgnorePep8
104+
from git.remote import * # noqa: F403 # @NoMove @IgnorePep8
105+
from git.index import * # noqa: F403 # @NoMove @IgnorePep8
106+
from git.util import ( # @NoMove @IgnorePep8
107+
LockFile,
108+
BlockingLockFile,
109+
Stats,
110+
Actor,
111+
remove_password_if_present,
112+
rmtree,
113+
)
114+
except GitError as _exc: # noqa: F405
115+
raise ImportError("%s: %s" % (_exc.__class__.__name__, _exc)) from _exc
116+
118117
# { Initialize git executable path
119118
GIT_OK = None
120119

0 commit comments

Comments
 (0)