Skip to content

Commit 2fa9fb1

Browse files
committed
update types in types.py
1 parent acbd6ba commit 2fa9fb1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

‎git/index/base.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def write_tree(self) -> Tree:
572572
# note: additional deserialization could be saved if write_tree_from_cache
573573
# would return sorted tree entries
574574
root_tree = Tree(self.repo, binsha, path='')
575-
root_tree._cache = tree_items # type: ignore # should this be encoded to [bytes, int, str]?
575+
root_tree._cache = tree_items
576576
return root_tree
577577

578578
def _process_diff_args(self, # type: ignore[override]
@@ -586,8 +586,9 @@ def _process_diff_args(self, # type: ignore[override]
586586
return args
587587

588588
def _to_relative_path(self, path: PathLike) -> PathLike:
589-
""":return: Version of path relative to our git directory or raise ValueError
590-
if it is not within our git direcotory"""
589+
"""
590+
:return: Version of path relative to our git directory or raise ValueError
591+
if it is not within our git direcotory"""
591592
if not osp.isabs(path):
592593
return path
593594
if self.repo.bare:

‎git/types.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
from typing import (Callable, Dict, NoReturn, Sequence, Tuple, Union, Any, Iterator, # noqa: F401
88
NamedTuple, TYPE_CHECKING, TypeVar) # noqa: F401
99

10-
if TYPE_CHECKING:
11-
from git.repo import Repo
12-
1310
if sys.version_info[:2] >= (3, 8):
1411
from typing import Final, Literal, SupportsIndex, TypedDict, Protocol, runtime_checkable # noqa: F401
1512
else:
@@ -28,6 +25,7 @@
2825
PathLike = Union[str, 'os.PathLike[str]'] # forward ref as pylance complains unless editing with py3.9+
2926

3027
if TYPE_CHECKING:
28+
from git.repo import Repo
3129
from git.objects import Commit, Tree, TagObject, Blob
3230
# from git.refs import SymbolicReference
3331

@@ -36,6 +34,7 @@
3634

3735
Tree_ish = Union['Commit', 'Tree']
3836
Commit_ish = Union['Commit', 'TagObject', 'Blob', 'Tree']
37+
Lit_commit_ish = Literal['commit', 'tag', 'blob', 'tree']
3938

4039
# Config_levels ---------------------------------------------------------
4140

0 commit comments

Comments
 (0)