Skip to content

Partial clean up wrt mypy and black #1617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
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
Apply straight-forward typing fixes
  • Loading branch information
bodograumann committed Jul 20, 2023
commit f01ee4f8d0b83f06fc7ba5458ac896ac3b81184a
2 changes: 1 addition & 1 deletion git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def dashify(string: str) -> str:
return string.replace("_", "-")


def slots_to_dict(self: object, exclude: Sequence[str] = ()) -> Dict[str, Any]:
def slots_to_dict(self: "Git", exclude: Sequence[str] = ()) -> Dict[str, Any]:
return {s: getattr(self, s) for s in self.__slots__ if s not in exclude}


Expand Down
2 changes: 1 addition & 1 deletion git/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def _store_path(self, filepath: PathLike, fprogress: Callable) -> BaseIndexEntry
def _entries_for_paths(
self,
paths: List[str],
path_rewriter: Callable,
path_rewriter: Union[Callable, None],
fprogress: Callable,
entries: List[BaseIndexEntry],
) -> List[BaseIndexEntry]:
Expand Down
8 changes: 4 additions & 4 deletions git/index/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def run_commit_hook(name: str, index: "IndexFile", *args: str) -> None:
relative_hp = Path(hp).relative_to(index.repo.working_dir).as_posix()
cmd = ["bash.exe", relative_hp]

cmd = subprocess.Popen(
process = subprocess.Popen(
cmd + list(args),
env=env,
stdout=subprocess.PIPE,
Expand All @@ -116,13 +116,13 @@ def run_commit_hook(name: str, index: "IndexFile", *args: str) -> None:
else:
stdout_list: List[str] = []
stderr_list: List[str] = []
handle_process_output(cmd, stdout_list.append, stderr_list.append, finalize_process)
handle_process_output(process, stdout_list.append, stderr_list.append, finalize_process)
stdout = "".join(stdout_list)
stderr = "".join(stderr_list)
if cmd.returncode != 0:
if process.returncode != 0:
stdout = force_text(stdout, defenc)
stderr = force_text(stderr, defenc)
raise HookExecutionError(hp, cmd.returncode, stderr, stdout)
raise HookExecutionError(hp, process.returncode, stderr, stdout)
# end handle return code


Expand Down
2 changes: 1 addition & 1 deletion git/objects/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def utctz_to_altz(utctz: str) -> int:
return seconds if int_utctz < 0 else -seconds


def altz_to_utctz_str(altz: int) -> str:
def altz_to_utctz_str(altz: float) -> str:
"""Convert a timezone offset west of UTC in seconds into a git timezone offset string

:param altz: timezone offset in seconds west of UTC
Expand Down
2 changes: 1 addition & 1 deletion git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ class IterableList(List[T_IterableObj]):

__slots__ = ("_id_attr", "_prefix")

def __new__(cls, id_attr: str, prefix: str = "") -> "IterableList[IterableObj]":
def __new__(cls, id_attr: str, prefix: str = "") -> "IterableList[T_IterableObj]":
return super(IterableList, cls).__new__(cls)

def __init__(self, id_attr: str, prefix: str = "") -> None:
Expand Down