mirror of https://github.com/pypa/pip
Merge pull request #9376 from jdufresne/fake-file
Remove unnecessary class FakeFile
This commit is contained in:
commit
97b2b0cdee
|
@ -13,7 +13,6 @@ from pip._internal.locations import bin_py, bin_user
|
||||||
from pip._internal.utils.compat import WINDOWS
|
from pip._internal.utils.compat import WINDOWS
|
||||||
from pip._internal.utils.logging import indent_log
|
from pip._internal.utils.logging import indent_log
|
||||||
from pip._internal.utils.misc import (
|
from pip._internal.utils.misc import (
|
||||||
FakeFile,
|
|
||||||
ask,
|
ask,
|
||||||
dist_in_usersite,
|
dist_in_usersite,
|
||||||
dist_is_local,
|
dist_is_local,
|
||||||
|
@ -90,7 +89,7 @@ def uninstallation_paths(dist):
|
||||||
|
|
||||||
UninstallPathSet.add() takes care of the __pycache__ .py[co].
|
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:
|
for row in r:
|
||||||
path = os.path.join(dist.location, row[0])
|
path = os.path.join(dist.location, row[0])
|
||||||
yield path
|
yield path
|
||||||
|
|
|
@ -572,22 +572,6 @@ def write_output(msg, *args):
|
||||||
logger.info(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):
|
class StreamWrapper(StringIO):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in New Issue