mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-14 08:24:46 +00:00
Update stdin_get_value monkey-patching
Let's use an enclosed function to replace the stdin_get_value function on pep8. Closes #107
This commit is contained in:
parent
d5e3987a9c
commit
5021da880c
2 changed files with 22 additions and 9 deletions
|
|
@ -1,13 +1,19 @@
|
||||||
CHANGES
|
CHANGES
|
||||||
=======
|
=======
|
||||||
|
|
||||||
2.x.y - 2015-aa-bb
|
2.5.1 - 2015-12-15
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
- **Bug** Properly look for ``.flake8`` in current working directory
|
- **Bug** Properly look for ``.flake8`` in current working directory
|
||||||
(`GitLab#103`_)
|
(`GitLab#103`_)
|
||||||
|
|
||||||
|
- **Bug** Monkey-patch ``pep8.stdin_get_value`` to cache the actual value in
|
||||||
|
stdin. This helps plugins relying on the function when run with
|
||||||
|
multiprocessing. (`GitLab#105`_, `GitLab#107`_)
|
||||||
|
|
||||||
.. _GitLab#103: https://gitlab.com/pycqa/flake8/issues/103
|
.. _GitLab#103: https://gitlab.com/pycqa/flake8/issues/103
|
||||||
|
.. _GitLab#105: https://gitlab.com/pycqa/flake8/issues/105
|
||||||
|
.. _GitLab#107: https://gitlab.com/pycqa/flake8/issues/107
|
||||||
|
|
||||||
2.5.0 - 2015-10-26
|
2.5.0 - 2015-10-26
|
||||||
------------------
|
------------------
|
||||||
|
|
|
||||||
|
|
@ -297,13 +297,20 @@ def get_python_version():
|
||||||
return '%s%s on %s' % (impl, platform.python_version(), platform.system())
|
return '%s%s on %s' % (impl, platform.python_version(), platform.system())
|
||||||
|
|
||||||
|
|
||||||
def make_stdin_get_value():
|
def make_stdin_get_value(original):
|
||||||
value = pep8.stdin_get_value()
|
def stdin_get_value():
|
||||||
if sys.version_info < (3, 0):
|
if not hasattr(stdin_get_value, 'cached_stdin'):
|
||||||
stdin = io.BytesIO(value)
|
value = original()
|
||||||
else:
|
if sys.version_info < (3, 0):
|
||||||
stdin = io.StringIO(value)
|
stdin = io.BytesIO(value)
|
||||||
return stdin.getvalue
|
else:
|
||||||
|
stdin = io.StringIO(value)
|
||||||
|
stdin_get_value.cached_stdin = stdin
|
||||||
|
else:
|
||||||
|
stdin = stdin_get_value.cached_stdin
|
||||||
|
return stdin.getvalue()
|
||||||
|
|
||||||
|
return stdin_get_value
|
||||||
|
|
||||||
|
|
||||||
pep8.stdin_get_value = make_stdin_get_value()
|
pep8.stdin_get_value = make_stdin_get_value(pep8.stdin_get_value)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue