From 9562ae2e2436e052d31c40d5f9d3d0318f6c4575 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Tue, 16 Mar 2021 19:16:19 +0000 Subject: rebase on master --- git/cmd.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'git/cmd.py') diff --git a/git/cmd.py b/git/cmd.py index 050efaed..ec630d93 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 +import warnings from git.compat import ( defenc, @@ -902,8 +903,14 @@ class Git(LazyMixin): def transform_kwargs(self, split_single_char_options=True, **kwargs): """Transforms Python style kwargs into git command line options.""" + # Python 3.6 preserves the order of kwargs and thus has a stable + # order. For older versions sort the kwargs by the key to get a stable + # order. + if sys.version_info[:2] < (3, 6): + kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0])) + warnings.warn("Python 3.5 support is deprecated and will be removed 2021-09-05.\n" + + "It does not preserve the order for key-word arguments and enforce lexical sorting instead.") args = [] - kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0])) for k, v in kwargs.items(): if isinstance(v, (list, tuple)): for value in v: -- cgit v1.2.1 From 5232c89de10872a6df6227c5dcea169bd1aa6550 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Tue, 16 Mar 2021 22:08:20 +0000 Subject: add types to git.__init__, compat, db, diff, exc, util --- git/cmd.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git/cmd.py') diff --git a/git/cmd.py b/git/cmd.py index ec630d93..0395a708 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -210,7 +210,7 @@ class Git(LazyMixin): # - a GitCommandNotFound error is spawned by ourselves # - a PermissionError is spawned if the git executable provided # cannot be executed for whatever reason - + has_git = False try: cls().version() @@ -498,7 +498,7 @@ class Git(LazyMixin): # skipcq: PYL-E0301 def __iter__(self): return self - + def __next__(self): return self.next() @@ -639,7 +639,7 @@ class Git(LazyMixin): :param env: A dictionary of environment variables to be passed to `subprocess.Popen`. - + :param max_chunk_size: Maximum number of bytes in one chunk of data passed to the output_stream in one invocation of write() method. If the given number is not positive then -- cgit v1.2.1