diff options
author | Yobmod <yobmod@gmail.com> | 2021-05-16 21:21:44 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-05-16 21:21:44 +0100 |
commit | 595181da70978ed44983a6c0ca4cb6d982ba0e8b (patch) | |
tree | de94a35c9bb218ff09324050500d7a0f81b230b2 /git/util.py | |
parent | f58702b0c3a0bb58d49b995a7e5479a7b24933e4 (diff) | |
download | gitpython-595181da70978ed44983a6c0ca4cb6d982ba0e8b.tar.gz |
flake8 and mypy fixes
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 5 |
1 files changed, 4 insertions, 1 deletions
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: |