Skip to content

Commit

Permalink
Merge pull request #9425 from jdufresne/old-style-super
Browse files Browse the repository at this point in the history
Use super() for Python 2 old-style classes
  • Loading branch information
pradyunsg authored Feb 24, 2021
2 parents baaf66f + 6874e88 commit 743d8fd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Empty file.
4 changes: 2 additions & 2 deletions src/pip/_internal/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def should_color(self):

def format(self, record):
# type: (logging.LogRecord) -> str
msg = logging.StreamHandler.format(self, record)
msg = super().format(record)

if self.should_color():
for level, color in self.COLORS:
Expand Down Expand Up @@ -238,7 +238,7 @@ class BetterRotatingFileHandler(logging.handlers.RotatingFileHandler):
def _open(self):
# type: () -> IO[Any]
ensure_dir(os.path.dirname(self.baseFilename))
return logging.handlers.RotatingFileHandler._open(self)
return super()._open()


class MaxLevelFilter(Filter):
Expand Down
7 changes: 2 additions & 5 deletions tests/lib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Path(str):

def __new__(cls, *paths):
if len(paths):
return str.__new__(cls, os.path.join(*paths))
return str.__new__(cls)
return super().__new__(cls, os.path.join(*paths))
return super().__new__(cls)

def __div__(self, path):
"""
Expand Down Expand Up @@ -73,9 +73,6 @@ def __radd__(self, path):
def __repr__(self):
return "Path({inner})".format(inner=str.__repr__(self))

def __hash__(self):
return str.__hash__(self)

@property
def name(self):
"""
Expand Down

0 comments on commit 743d8fd

Please sign in to comment.