From 1f2f3e848e10d145fe28d6a8e07b0c579dd0c276 Mon Sep 17 00:00:00 2001 From: yobmod Date: Sun, 28 Feb 2021 17:52:45 +0000 Subject: drop py3.4 support --- git/cmd.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'git') diff --git a/git/cmd.py b/git/cmd.py index 050efaed..91cc602c 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -19,6 +19,7 @@ import sys import threading from collections import OrderedDict from textwrap import dedent +from typing import Any, Callable, Optional, Type from git.compat import ( defenc, @@ -57,7 +58,7 @@ __all__ = ('Git',) ## @{ def handle_process_output(process, stdout_handler, stderr_handler, - finalizer=None, decode_streams=True): + finalizer=None, decode_streams: bool=True) -> Optional[Any]: """Registers for notifications to learn that process output is ready to read, and dispatches lines to the respective line handlers. This function returns once the finalizer returns @@ -113,9 +114,11 @@ def handle_process_output(process, stdout_handler, stderr_handler, if finalizer: return finalizer(process) + else: + return None -def dashify(string): +def dashify(string: str) -> str: return string.replace('_', '-') @@ -304,11 +307,11 @@ class Git(LazyMixin): return has_git @classmethod - def is_cygwin(cls): + def is_cygwin(cls) -> bool: return is_cygwin_git(cls.GIT_PYTHON_GIT_EXECUTABLE) @classmethod - def polish_url(cls, url, is_cygwin=None): + def polish_url(cls, url, is_cygwin: Optional[bool]=None): if is_cygwin is None: is_cygwin = cls.is_cygwin() -- cgit v1.2.1 From 2d92fee01b05e5e217e6dad5cc621801c31debae Mon Sep 17 00:00:00 2001 From: yobmod Date: Sun, 28 Feb 2021 18:04:24 +0000 Subject: add py.typed, mypy.ini and git/types.py --- git/py.typed | 0 git/types.py | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 git/py.typed create mode 100644 git/types.py (limited to 'git') diff --git a/git/py.typed b/git/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/git/types.py b/git/types.py new file mode 100644 index 00000000..19d20c24 --- /dev/null +++ b/git/types.py @@ -0,0 +1,6 @@ +import os +from typing import Optional, Union, Any + + +TBD = Any +PathLike = Union[str, os.PathLike[str]] \ No newline at end of file -- cgit v1.2.1 From b4fe276637fe1ce3b2ebb504b69268d5b79de1ac Mon Sep 17 00:00:00 2001 From: yobmod Date: Sun, 28 Feb 2021 18:16:24 +0000 Subject: move cmd.py types to another branch, mark typing import as unused --- git/cmd.py | 11 ++++------- git/types.py | 6 +++--- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'git') diff --git a/git/cmd.py b/git/cmd.py index 91cc602c..050efaed 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -19,7 +19,6 @@ import sys import threading from collections import OrderedDict from textwrap import dedent -from typing import Any, Callable, Optional, Type from git.compat import ( defenc, @@ -58,7 +57,7 @@ __all__ = ('Git',) ## @{ def handle_process_output(process, stdout_handler, stderr_handler, - finalizer=None, decode_streams: bool=True) -> Optional[Any]: + finalizer=None, decode_streams=True): """Registers for notifications to learn that process output is ready to read, and dispatches lines to the respective line handlers. This function returns once the finalizer returns @@ -114,11 +113,9 @@ def handle_process_output(process, stdout_handler, stderr_handler, if finalizer: return finalizer(process) - else: - return None -def dashify(string: str) -> str: +def dashify(string): return string.replace('_', '-') @@ -307,11 +304,11 @@ class Git(LazyMixin): return has_git @classmethod - def is_cygwin(cls) -> bool: + def is_cygwin(cls): return is_cygwin_git(cls.GIT_PYTHON_GIT_EXECUTABLE) @classmethod - def polish_url(cls, url, is_cygwin: Optional[bool]=None): + def polish_url(cls, url, is_cygwin=None): if is_cygwin is None: is_cygwin = cls.is_cygwin() diff --git a/git/types.py b/git/types.py index 19d20c24..dc44c123 100644 --- a/git/types.py +++ b/git/types.py @@ -1,6 +1,6 @@ -import os -from typing import Optional, Union, Any +import os # @UnusedImport ## not really unused, is in type string +from typing import Union, Any TBD = Any -PathLike = Union[str, os.PathLike[str]] \ No newline at end of file +PathLike = Union[str, 'os.PathLike[str]'] -- cgit v1.2.1