FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove unnecessary check for isatty() · jangoking/unidecode@8090157 · GitHub

Repository navigation

Commit 8090157

Browse files
committed
Remove unnecessary check for isatty()
1 parent eb3f746 commit 8090157

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

‎unidecode/util.py‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# vim:ts=4 sw=4 expandtab softtabstop=4
12
from __future__ import print_function
23
import argparse
34
import locale
@@ -10,28 +11,25 @@
1011
PY3 = sys.version_info[0] >= 3
1112

1213
def main():
13-
isatty = sys.stdin.isatty()
1414
parser = argparse.ArgumentParser('unidecode')
1515
parser.add_argument('-e',
1616
'--encoding',
1717
nargs=1,
1818
metavar='ENCODING',
1919
help='Specify an encoding, overriding system default')
20-
21-
if isatty:
22-
parser.add_argument('file',
23-
nargs=1,
24-
metavar='FILE',
25-
help='File to transliterate')
20+
parser.add_argument('file',
21+
nargs='?',
22+
metavar='FILE',
23+
help='File to transliterate')
2624

2725
args = parser.parse_args()
2826
if args.encoding:
2927
encoding = args.encoding[0]
3028
else:
3129
encoding = locale.getpreferredencoding()
3230

33-
if isatty:
34-
with open(args.file[0], 'rb') as f:
31+
if args.file:
32+
with open(args.file, 'rb') as f:
3533
stream = f.read()
3634
else:
3735
# In Python 3, stdin.read() is read in the system's locale and returns type str

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL