From 595181da70978ed44983a6c0ca4cb6d982ba0e8b Mon Sep 17 00:00:00 2001 From: Yobmod Date: Sun, 16 May 2021 21:21:44 +0100 Subject: flake8 and mypy fixes --- git/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 220901a4..581bf877 100644 --- a/git/util.py +++ b/git/util.py @@ -24,6 +24,7 @@ from urllib.parse import urlsplit, urlunsplit from typing import (Any, AnyStr, BinaryIO, Callable, Dict, Generator, IO, Iterator, List, Optional, Pattern, Sequence, Tuple, Union, cast, TYPE_CHECKING, overload) +import pathlib if TYPE_CHECKING: from git.remote import Remote @@ -379,7 +380,9 @@ def expand_path(p: PathLike, expand_vars: bool = ...) -> str: ... -def expand_path(p: Union[None, PathLike], expand_vars: bool = True) -> Optional[str]: +def expand_path(p: Union[None, PathLike], expand_vars: bool = True) -> Optional[PathLike]: + if isinstance(p, pathlib.Path): + return p.resolve() try: p = osp.expanduser(p) # type: ignore if expand_vars: -- cgit v1.2.1 From 025fe17da390c410e5bae4d6db0832afbfa26442 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 17 May 2021 13:11:57 +0100 Subject: add types to index.fun.py --- git/util.py | 1 + 1 file changed, 1 insertion(+) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 581bf877..76aaee49 100644 --- a/git/util.py +++ b/git/util.py @@ -377,6 +377,7 @@ def expand_path(p: None, expand_vars: bool = ...) -> None: @overload def expand_path(p: PathLike, expand_vars: bool = ...) -> str: + # improve these overloads when 3.5 dropped ... -- cgit v1.2.1