diff options
author | Harmon <Harmon758@gmail.com> | 2020-02-07 05:44:58 -0600 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-02-08 10:55:50 +0800 |
commit | e633cc009fe3dc8d29503b0d14532dc5e8c44cce (patch) | |
tree | 6c85ddf4aa58164f408ceffad0bad942cbe82800 | |
parent | 05cf33acc6f451026e22dbbb4db8b10c5eb7c65a (diff) | |
download | gitpython-e633cc009fe3dc8d29503b0d14532dc5e8c44cce.tar.gz |
Remove and replace compat.UnicodeMixin
-rw-r--r-- | git/compat.py | 14 | ||||
-rw-r--r-- | git/exc.py | 6 |
2 files changed, 3 insertions, 17 deletions
diff --git a/git/compat.py b/git/compat.py index 920537ec..d214b230 100644 --- a/git/compat.py +++ b/git/compat.py @@ -76,17 +76,3 @@ def with_metaclass(meta, *bases): d['__metaclass__'] = meta return meta(name, bases, d) return metaclass(meta.__name__ + 'Helper', None, {}) - - -## From https://docs.python.org/3.3/howto/pyporting.html -class UnicodeMixin(object): - - """Mixin class to handle defining the proper __str__/__unicode__ - methods in Python 2 or 3.""" - - if PY3: - def __str__(self): - return self.__unicode__() - else: # Python 2 - def __str__(self): - return self.__unicode__().encode(defenc) @@ -6,7 +6,7 @@ """ Module containing all exceptions thrown throughout the git package, """ from gitdb.exc import * # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614 -from git.compat import UnicodeMixin, safe_decode, string_types +from git.compat import safe_decode, string_types class GitError(Exception): @@ -25,7 +25,7 @@ class NoSuchPathError(GitError, OSError): """ Thrown if a path could not be access by the system. """ -class CommandError(UnicodeMixin, GitError): +class CommandError(GitError): """Base class for exceptions thrown at every stage of `Popen()` execution. :param command: @@ -58,7 +58,7 @@ class CommandError(UnicodeMixin, GitError): self.stdout = stdout and u"\n stdout: '%s'" % safe_decode(stdout) or '' self.stderr = stderr and u"\n stderr: '%s'" % safe_decode(stderr) or '' - def __unicode__(self): + def __str__(self): return (self._msg + "\n cmdline: %s%s%s") % ( self._cmd, self._cause, self._cmdline, self.stdout, self.stderr) |