diff options
author | Yobmod <yobmod@gmail.com> | 2021-05-15 23:12:30 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-05-15 23:12:30 +0100 |
commit | c3f91bd1c0e8aef1b416ae6b1f55e7bd93a4f281 (patch) | |
tree | d5948d3de6f89d17ce2cfd038d65e589b866af2a /git/index/fun.py | |
parent | 4dff2004308a7a1e5b9afc7a5b3b9cb515e12514 (diff) | |
download | gitpython-c3f91bd1c0e8aef1b416ae6b1f55e7bd93a4f281.tar.gz |
Add initial types to IndexFile .init() to _to_relative_path()
Diffstat (limited to 'git/index/fun.py')
-rw-r--r-- | git/index/fun.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/git/index/fun.py b/git/index/fun.py index 85b85ed5..466d323c 100644 --- a/git/index/fun.py +++ b/git/index/fun.py @@ -13,7 +13,7 @@ from stat import ( S_IFREG, ) import subprocess -from typing import List, Tuple, Union, cast +from typing import List, Tuple, cast from git.cmd import PROC_CREATIONFLAGS, handle_process_output from git.compat import ( @@ -168,13 +168,15 @@ def read_header(stream): return version, num_entries -def entry_key(*entry: Union[Tuple[BaseIndexEntry], Tuple[PathLike, int]]): +def entry_key(*entry) -> Tuple[PathLike, int]: """:return: Key suitable to be used for the index.entries dictionary :param entry: One instance of type BaseIndexEntry or the path and the stage""" - if len(*entry) == 1: + if len(entry) == 1: entry_first = cast(BaseIndexEntry, entry[0]) # type: BaseIndexEntry return (entry_first.path, entry_first.stage) - return tuple(*entry) + else: + entry = cast(Tuple[PathLike, int], tuple(entry)) + return entry # END handle entry |