Merge pull request #9376 from jdufresne/fake-file

Remove unnecessary class FakeFile
This commit is contained in:
Pradyun Gedam 2020-12-27 18:31:26 +00:00 committed by GitHub
commit 97b2b0cdee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 18 deletions

View File

@ -13,7 +13,6 @@ from pip._internal.locations import bin_py, bin_user
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
FakeFile,
ask,
dist_in_usersite,
dist_is_local,
@ -90,7 +89,7 @@ def uninstallation_paths(dist):
UninstallPathSet.add() takes care of the __pycache__ .py[co].
"""
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
r = csv.reader(dist.get_metadata_lines('RECORD'))
for row in r:
path = os.path.join(dist.location, row[0])
yield path

View File

@ -572,22 +572,6 @@ def write_output(msg, *args):
logger.info(msg, *args)
class FakeFile:
"""Wrap a list of lines in an object with readline() to make
ConfigParser happy."""
def __init__(self, lines):
self._gen = iter(lines)
def readline(self):
try:
return next(self._gen)
except StopIteration:
return ''
def __iter__(self):
return self._gen
class StreamWrapper(StringIO):
@classmethod