summaryrefslogtreecommitdiff
path: root/unidecode/util.py
diff options
context:
space:
mode:
authorTomaz Solc <tomaz.solc@tablix.org>2015-05-13 18:17:54 +0200
committerTomaz Solc <tomaz.solc@tablix.org>2015-05-13 18:17:54 +0200
commit8090157dab6284471634a2ca5535b7d0ede03ead (patch)
tree1c8353e1a9604ef4a20e2b4b92b3eb4982346e6e /unidecode/util.py
parenteb3f746b2a9d48119316b5cd2f9ba261e28d3c0a (diff)
downloadunidecode-8090157dab6284471634a2ca5535b7d0ede03ead.tar.gz
Remove unnecessary check for isatty()
Diffstat (limited to 'unidecode/util.py')
-rw-r--r--unidecode/util.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/unidecode/util.py b/unidecode/util.py
index 77d8c74..b47869a 100644
--- a/unidecode/util.py
+++ b/unidecode/util.py
@@ -1,3 +1,4 @@
+# vim:ts=4 sw=4 expandtab softtabstop=4
from __future__ import print_function
import argparse
import locale
@@ -10,19 +11,16 @@ from unidecode import unidecode
PY3 = sys.version_info[0] >= 3
def main():
- isatty = sys.stdin.isatty()
parser = argparse.ArgumentParser('unidecode')
parser.add_argument('-e',
'--encoding',
nargs=1,
metavar='ENCODING',
help='Specify an encoding, overriding system default')
-
- if isatty:
- parser.add_argument('file',
- nargs=1,
- metavar='FILE',
- help='File to transliterate')
+ parser.add_argument('file',
+ nargs='?',
+ metavar='FILE',
+ help='File to transliterate')
args = parser.parse_args()
if args.encoding:
@@ -30,8 +28,8 @@ def main():
else:
encoding = locale.getpreferredencoding()
- if isatty:
- with open(args.file[0], 'rb') as f:
+ if args.file:
+ with open(args.file, 'rb') as f:
stream = f.read()
else:
# In Python 3, stdin.read() is read in the system's locale and returns type str