MCPcopy
hub / github.com/ArchiveBox/ArchiveBox / accept_stdin

Function accept_stdin

archivebox/logging_util.py:120–134  ·  view source on GitHub ↗

accept any standard input and return it as a string or None

(stdin: Optional[IO]=sys.stdin)

Source from the content-addressed store, hash-verified

118
119
120def accept_stdin(stdin: Optional[IO]=sys.stdin) -> Optional[str]:
121 """accept any standard input and return it as a string or None"""
122
123 if not stdin:
124 return None
125
126 if not stdin.isatty():
127 # stderr('READING STDIN TO ACCEPT...')
128 stdin_str = stdin.read()
129
130 if stdin_str:
131 # stderr('GOT STDIN...', len(stdin_str))
132 return stdin_str
133
134 return None
135
136
137class TimedProgress:

Callers 5

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected