Skip to content

Commit 5549ffe

Browse files
committed
Remove and replace compat.UnicodeMixin
1 parent 9615ada commit 5549ffe

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

git/compat.py

-14
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,3 @@ def __new__(cls, name, nbases, d):
7676
d['__metaclass__'] = meta
7777
return meta(name, bases, d)
7878
return metaclass(meta.__name__ + 'Helper', None, {})
79-
80-
81-
## From https://docs.python.org/3.3/howto/pyporting.html
82-
class UnicodeMixin(object):
83-
84-
"""Mixin class to handle defining the proper __str__/__unicode__
85-
methods in Python 2 or 3."""
86-
87-
if PY3:
88-
def __str__(self):
89-
return self.__unicode__()
90-
else: # Python 2
91-
def __str__(self):
92-
return self.__unicode__().encode(defenc)

git/exc.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
""" Module containing all exceptions thrown throughout the git package, """
77

88
from gitdb.exc import * # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
9-
from git.compat import UnicodeMixin, safe_decode, string_types
9+
from git.compat import safe_decode, string_types
1010

1111

1212
class GitError(Exception):
@@ -25,7 +25,7 @@ class NoSuchPathError(GitError, OSError):
2525
""" Thrown if a path could not be access by the system. """
2626

2727

28-
class CommandError(UnicodeMixin, GitError):
28+
class CommandError(GitError):
2929
"""Base class for exceptions thrown at every stage of `Popen()` execution.
3030
3131
:param command:
@@ -58,7 +58,7 @@ def __init__(self, command, status=None, stderr=None, stdout=None):
5858
self.stdout = stdout and u"\n stdout: '%s'" % safe_decode(stdout) or ''
5959
self.stderr = stderr and u"\n stderr: '%s'" % safe_decode(stderr) or ''
6060

61-
def __unicode__(self):
61+
def __str__(self):
6262
return (self._msg + "\n cmdline: %s%s%s") % (
6363
self._cmd, self._cause, self._cmdline, self.stdout, self.stderr)
6464

0 commit comments

Comments
 (0)