diff options
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | doc/source/changes.rst | 11 | ||||
-rw-r--r-- | git/compat.py | 11 | ||||
-rw-r--r-- | git/util.py | 3 |
4 files changed, 21 insertions, 6 deletions
@@ -1 +1 @@ -3.1.15 +3.1.16 diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 1b916f30..0c34e385 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,9 +2,18 @@ Changelog ========= -3.1.15 +3.1.16 ====== +* Fix issues from 3.1.15 (see https://github.com/gitpython-developers/GitPython/issues/1223) +* Add more static typing information + +See the following for details: +https://github.com/gitpython-developers/gitpython/milestone/48?closed=1 + +3.1.15 (YANKED) +================ + * add deprectation warning for python 3.5 See the following for details: diff --git a/git/compat.py b/git/compat.py index cbb39fa6..187618a2 100644 --- a/git/compat.py +++ b/git/compat.py @@ -43,9 +43,11 @@ defenc = sys.getfilesystemencoding() @overload def safe_decode(s: None) -> None: ... + @overload def safe_decode(s: AnyStr) -> str: ... + def safe_decode(s: Union[AnyStr, None]) -> Optional[str]: """Safely decodes a binary string to unicode""" if isinstance(s, str): @@ -61,9 +63,11 @@ def safe_decode(s: Union[AnyStr, None]) -> Optional[str]: @overload def safe_encode(s: None) -> None: ... + @overload def safe_encode(s: AnyStr) -> bytes: ... + def safe_encode(s: Optional[AnyStr]) -> Optional[bytes]: """Safely encodes a binary string to unicode""" if isinstance(s, str): @@ -79,9 +83,11 @@ def safe_encode(s: Optional[AnyStr]) -> Optional[bytes]: @overload def win_encode(s: None) -> None: ... + @overload def win_encode(s: AnyStr) -> bytes: ... + def win_encode(s: Optional[AnyStr]) -> Optional[bytes]: """Encode unicodes for process arguments on Windows.""" if isinstance(s, str): @@ -93,7 +99,8 @@ def win_encode(s: Optional[AnyStr]) -> Optional[bytes]: return None -def with_metaclass(meta: Type[Any], *bases: Any) -> TBD: # type: ignore ## mypy cannot understand dynamic class creation +# type: ignore ## mypy cannot understand dynamic class creation +def with_metaclass(meta: Type[Any], *bases: Any) -> TBD: """copied from https://github.com/Byron/bcore/blob/master/src/python/butility/future.py#L15""" class metaclass(meta): # type: ignore @@ -105,4 +112,4 @@ def with_metaclass(meta: Type[Any], *bases: Any) -> TBD: # type: ignore ## mypy return type.__new__(cls, name, (), d) return meta(name, bases, d) - return metaclass(meta.__name__ + 'Helper', None, {}) # type: ignore + return metaclass(meta.__name__ + 'Helper', None, {}) # type: ignore diff --git a/git/util.py b/git/util.py index ef8ea8d6..220901a4 100644 --- a/git/util.py +++ b/git/util.py @@ -332,9 +332,8 @@ def is_cygwin_git(git_executable: Union[None, PathLike]) -> bool: return False if git_executable is None: - return False # or raise error? + return False - #from subprocess import check_output git_executable = str(git_executable) is_cygwin = _is_cygwin_cache.get(git_executable) # type: Optional[bool] if is_cygwin is None: |