Skip to content

Commit 018dbcd

Browse files
committedMar 31, 2021
clean up _stdin_get_value_py3
1 parent 4d57a20 commit 018dbcd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed
 

‎src/flake8/utils.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ def normalize_path(path, parent=os.curdir):
197197
return path.rstrip(separator + alternate_separator)
198198

199199

200-
def _stdin_get_value_py3(): # type: () -> str
200+
@functools.lru_cache(maxsize=1)
201+
def stdin_get_value(): # type: () -> str
202+
"""Get and cache it so plugins can use it."""
201203
stdin_value = sys.stdin.buffer.read()
202204
fd = io.BytesIO(stdin_value)
203205
try:
@@ -208,12 +210,6 @@ def _stdin_get_value_py3(): # type: () -> str
208210
return stdin_value.decode("utf-8")
209211

210212

211-
@functools.lru_cache(maxsize=1)
212-
def stdin_get_value(): # type: () -> str
213-
"""Get and cache it so plugins can use it."""
214-
return _stdin_get_value_py3()
215-
216-
217213
def stdin_get_lines(): # type: () -> List[str]
218214
"""Return lines of stdin split according to file splitting."""
219215
return list(io.StringIO(stdin_get_value()))

0 commit comments

Comments
 (0)