mirror of
https://github.com/romanz/amodem.git
synced 2026-03-17 15:16:00 +08:00
cli: simplify stdin/stdout logic
This commit is contained in:
10
amodem-cli
10
amodem-cli
@@ -7,12 +7,10 @@ import zlib
|
||||
import logging
|
||||
import argparse
|
||||
|
||||
if sys.version_info.major == 2:
|
||||
_stdin = sys.stdin
|
||||
_stdout = sys.stdout
|
||||
else:
|
||||
_stdin = sys.stdin.buffer
|
||||
_stdout = sys.stdout.buffer
|
||||
# Python 3 has `buffer` attribute for byte-based I/O
|
||||
_stdin = getattr(sys.stdin, 'buffer', sys.stdin)
|
||||
_stdout = getattr(sys.stdout, 'buffer', sys.stdout)
|
||||
|
||||
|
||||
try:
|
||||
import argcomplete
|
||||
|
||||
Reference in New Issue
Block a user