summaryrefslogtreecommitdiff
path: root/src/flake8/utils.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2021-03-29 18:16:31 -0700
committerAnthony Sottile <asottile@umich.edu>2021-03-30 17:37:13 -0700
commit018dbcd69a45b8686cbe63f5e8ce1ba13198f9d7 (patch)
treeed7d85471295dbd81b204f4864333146db82fae7 /src/flake8/utils.py
parent4d57a20ffd3afed446743c40410a78c6fe7a1a9d (diff)
downloadflake8-018dbcd69a45b8686cbe63f5e8ce1ba13198f9d7.tar.gz
clean up _stdin_get_value_py3
Diffstat (limited to 'src/flake8/utils.py')
-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()))