◐ Shell
clean mode source ↗

Improve static typing and docstrings related to git object types by EliahKagan · Pull Request #1859 · gitpython-developers/GitPython

Expand Up @@ -5,38 +5,6 @@
# @PydevCodeAnalysisIgnore
__version__ = "git"
from typing import List, Optional, Sequence, Tuple, Union, TYPE_CHECKING
from gitdb.util import to_hex_sha from git.exc import * # noqa: F403 # @NoMove @IgnorePep8 from git.types import PathLike
try: from git.compat import safe_decode # @NoMove @IgnorePep8 from git.config import GitConfigParser # @NoMove @IgnorePep8 from git.objects import * # noqa: F403 # @NoMove @IgnorePep8 from git.refs import * # noqa: F403 # @NoMove @IgnorePep8 from git.diff import * # noqa: F403 # @NoMove @IgnorePep8 from git.db import * # noqa: F403 # @NoMove @IgnorePep8 from git.cmd import Git # @NoMove @IgnorePep8 from git.repo import Repo # @NoMove @IgnorePep8 from git.remote import * # noqa: F403 # @NoMove @IgnorePep8 from git.index import * # noqa: F403 # @NoMove @IgnorePep8 from git.util import ( # @NoMove @IgnorePep8 LockFile, BlockingLockFile, Stats, Actor, remove_password_if_present, rmtree, ) except GitError as _exc: # noqa: F405 raise ImportError("%s: %s" % (_exc.__class__.__name__, _exc)) from _exc
# __all__ must be statically defined by py.typed support # __all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))] __all__ = [ # noqa: F405 "Actor", "AmbiguousObjectName", Expand All @@ -52,6 +20,7 @@ "CommandError", "Commit", "Diff", "DiffConstants", "DiffIndex", "Diffable", "FetchInfo", Expand All @@ -65,18 +34,19 @@ "HEAD", "Head", "HookExecutionError", "INDEX", "IndexEntry", "IndexFile", "IndexObject", "InvalidDBRoot", "InvalidGitRepositoryError", "List", "List", # Deprecated - import this from `typing` instead. "LockFile", "NULL_TREE", "NoSuchPathError", "ODBError", "Object", "Optional", "Optional", # Deprecated - import this from `typing` instead. "ParseError", "PathLike", "PushInfo", Expand All @@ -90,31 +60,62 @@ "RepositoryDirtyError", "RootModule", "RootUpdateProgress", "Sequence", "Sequence", # Deprecated - import from `typing`, or `collections.abc` in 3.9+. "StageType", "Stats", "Submodule", "SymbolicReference", "TYPE_CHECKING", "TYPE_CHECKING", # Deprecated - import this from `typing` instead. "Tag", "TagObject", "TagReference", "Tree", "TreeModifier", "Tuple", "Union", "Tuple", # Deprecated - import this from `typing` instead. "Union", # Deprecated - import this from `typing` instead. "UnmergedEntriesError", "UnsafeOptionError", "UnsafeProtocolError", "UnsupportedOperation", "UpdateProgress", "WorkTreeRepositoryUnsupported", "refresh", "remove_password_if_present", "rmtree", "safe_decode", "to_hex_sha", ]
__version__ = "git"
from typing import List, Optional, Sequence, Tuple, Union, TYPE_CHECKING
from gitdb.util import to_hex_sha from git.exc import * # noqa: F403 # @NoMove @IgnorePep8 from git.types import PathLike
try: from git.compat import safe_decode # @NoMove @IgnorePep8 from git.config import GitConfigParser # @NoMove @IgnorePep8 from git.objects import * # noqa: F403 # @NoMove @IgnorePep8 from git.refs import * # noqa: F403 # @NoMove @IgnorePep8 from git.diff import * # noqa: F403 # @NoMove @IgnorePep8 from git.db import * # noqa: F403 # @NoMove @IgnorePep8 from git.cmd import Git # @NoMove @IgnorePep8 from git.repo import Repo # @NoMove @IgnorePep8 from git.remote import * # noqa: F403 # @NoMove @IgnorePep8 from git.index import * # noqa: F403 # @NoMove @IgnorePep8 from git.util import ( # @NoMove @IgnorePep8 LockFile, BlockingLockFile, Stats, Actor, remove_password_if_present, rmtree, ) except GitError as _exc: # noqa: F405 raise ImportError("%s: %s" % (_exc.__class__.__name__, _exc)) from _exc
# { Initialize git executable path GIT_OK = None
Expand Down Expand Up @@ -146,7 +147,7 @@ def refresh(path: Optional[PathLike] = None) -> None: if not Git.refresh(path=path): return if not FetchInfo.refresh(): # noqa: F405 return # type: ignore [unreachable] return # type: ignore[unreachable]
GIT_OK = True
Expand Down