summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flake8/utils.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/flake8/utils.py b/src/flake8/utils.py
index 6bf0b49..5db1d22 100644
--- a/src/flake8/utils.py
+++ b/src/flake8/utils.py
@@ -197,7 +197,9 @@ def normalize_path(path, parent=os.curdir):
return path.rstrip(separator + alternate_separator)
-def _stdin_get_value_py3(): # type: () -> str
+@functools.lru_cache(maxsize=1)
+def stdin_get_value(): # type: () -> str
+ """Get and cache it so plugins can use it."""
stdin_value = sys.stdin.buffer.read()
fd = io.BytesIO(stdin_value)
try:
@@ -208,12 +210,6 @@ def _stdin_get_value_py3(): # type: () -> str
return stdin_value.decode("utf-8")
-@functools.lru_cache(maxsize=1)
-def stdin_get_value(): # type: () -> str
- """Get and cache it so plugins can use it."""
- return _stdin_get_value_py3()
-
-
def stdin_get_lines(): # type: () -> List[str]
"""Return lines of stdin split according to file splitting."""
return list(io.StringIO(stdin_get_value()))