mirror of
https://github.com/romanz/amodem.git
synced 2026-05-10 05:17:38 +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 logging
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
if sys.version_info.major == 2:
|
# Python 3 has `buffer` attribute for byte-based I/O
|
||||||
_stdin = sys.stdin
|
_stdin = getattr(sys.stdin, 'buffer', sys.stdin)
|
||||||
_stdout = sys.stdout
|
_stdout = getattr(sys.stdout, 'buffer', sys.stdout)
|
||||||
else:
|
|
||||||
_stdin = sys.stdin.buffer
|
|
||||||
_stdout = sys.stdout.buffer
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import argcomplete
|
import argcomplete
|
||||||
|
|||||||
Reference in New Issue
Block a user