diff options
-rw-r--r-- | git/index/base.py | 7 | ||||
-rw-r--r-- | git/types.py | 5 |
2 files changed, 6 insertions, 6 deletions
diff --git a/git/index/base.py b/git/index/base.py index 3aa06e38..220bdc85 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -572,7 +572,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): # note: additional deserialization could be saved if write_tree_from_cache # would return sorted tree entries root_tree = Tree(self.repo, binsha, path='') - root_tree._cache = tree_items # type: ignore # should this be encoded to [bytes, int, str]? + root_tree._cache = tree_items return root_tree def _process_diff_args(self, # type: ignore[override] @@ -586,8 +586,9 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): return args def _to_relative_path(self, path: PathLike) -> PathLike: - """:return: Version of path relative to our git directory or raise ValueError - if it is not within our git direcotory""" + """ + :return: Version of path relative to our git directory or raise ValueError + if it is not within our git direcotory""" if not osp.isabs(path): return path if self.repo.bare: diff --git a/git/types.py b/git/types.py index 9181e040..53f0f1e4 100644 --- a/git/types.py +++ b/git/types.py @@ -7,9 +7,6 @@ import sys from typing import (Callable, Dict, NoReturn, Sequence, Tuple, Union, Any, Iterator, # noqa: F401 NamedTuple, TYPE_CHECKING, TypeVar) # noqa: F401 -if TYPE_CHECKING: - from git.repo import Repo - if sys.version_info[:2] >= (3, 8): from typing import Final, Literal, SupportsIndex, TypedDict, Protocol, runtime_checkable # noqa: F401 else: @@ -28,6 +25,7 @@ elif sys.version_info[:2] >= (3, 9): PathLike = Union[str, 'os.PathLike[str]'] # forward ref as pylance complains unless editing with py3.9+ if TYPE_CHECKING: + from git.repo import Repo from git.objects import Commit, Tree, TagObject, Blob # from git.refs import SymbolicReference @@ -36,6 +34,7 @@ _T = TypeVar('_T') Tree_ish = Union['Commit', 'Tree'] Commit_ish = Union['Commit', 'TagObject', 'Blob', 'Tree'] +Lit_commit_ish = Literal['commit', 'tag', 'blob', 'tree'] # Config_levels --------------------------------------------------------- |