Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a cast to git.cmd _version_info
  • Loading branch information
Yobmod committed Jul 19, 2021
commit 017b0d4b19127868ccb8ee616f64734b48f6e620
20 changes: 10 additions & 10 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,35 +603,35 @@ def _set_cache_(self, attr: str) -> None:
process_version = self._call_process('version') # should be as default *args and **kwargs used
version_numbers = process_version.split(' ')[2]

self._version_info: Tuple[int, int, int, int] = tuple(
int(n) for n in version_numbers.split('.')[:4] if n.isdigit()
) # type: ignore # use typeguard here
self._version_info = cast(Tuple[int, int, int, int],
tuple(int(n) for n in version_numbers.split('.')[:4] if n.isdigit())
)
else:
super(Git, self)._set_cache_(attr)
# END handle version info

@property
@ property
def working_dir(self) -> Union[None, PathLike]:
""":return: Git directory we are working on"""
return self._working_dir

@property
@ property
def version_info(self) -> Tuple[int, int, int, int]:
"""
:return: tuple(int, int, int, int) tuple with integers representing the major, minor
and additional version numbers as parsed from git version.
This value is generated on demand and is cached"""
return self._version_info

@overload
@ overload
def execute(self,
command: Union[str, Sequence[Any]],
*,
as_process: Literal[True]
) -> 'AutoInterrupt':
...

@overload
@ overload
def execute(self,
command: Union[str, Sequence[Any]],
*,
Expand All @@ -640,7 +640,7 @@ def execute(self,
) -> Union[str, Tuple[int, str, str]]:
...

@overload
@ overload
def execute(self,
command: Union[str, Sequence[Any]],
*,
Expand All @@ -649,7 +649,7 @@ def execute(self,
) -> Union[bytes, Tuple[int, bytes, str]]:
...

@overload
@ overload
def execute(self,
command: Union[str, Sequence[Any]],
*,
Expand All @@ -659,7 +659,7 @@ def execute(self,
) -> str:
...

@overload
@ overload
def execute(self,
command: Union[str, Sequence[Any]],
*,
Expand Down