clean up _stdin_get_value_py3

This commit is contained in:
Anthony Sottile 2021-03-29 18:16:31 -07:00
parent 4d57a20ffd
commit 018dbcd69a

View file

@ -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()))