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

More Python 2 compatibility code clean up. · sysfce2/python-unidecode@4ee4df1 · GitHub

Repository navigation

Commit 4ee4df1

Browse files
committed
More Python 2 compatibility code clean up.
1 parent 96266a1 commit 4ee4df1

3 files changed

Lines changed: 2 additions & 16 deletions

File tree

‎tests/test_utility.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010

1111
here = os.path.dirname(__file__)
1212

13-
# Python 2.7 does not have assertRegex
14-
if not hasattr(unittest.TestCase, 'assertRegex'):
15-
unittest.TestCase.assertRegex = lambda self, text, exp: self.assertTrue(re.search(exp, text))
16-
1713
def get_cmd():
1814
sys_path = os.path.join(here, "..")
1915

‎unidecode/__init__.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
b'Knosos'
1818
"""
1919
import warnings
20-
from sys import version_info
2120
from typing import Optional
2221

2322
Cache = {}

‎unidecode/util.py‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
# vim:ts=4 sw=4 expandtab softtabstop=4
2-
from __future__ import print_function
32
import argparse
43
import locale
54
import os
65
import sys
76

87
from unidecode import unidecode
98

10-
PY3 = sys.version_info[0] >= 3
11-
129
def fatal(msg):
1310
sys.stderr.write(msg + "\n")
1411
sys.exit(1)
@@ -36,19 +33,13 @@ def main():
3633
with open(args.path, 'rb') as f:
3734
stream = f.read()
3835
elif args.text:
39-
if PY3:
40-
stream = os.fsencode(args.text)
41-
else:
42-
stream = args.text
36+
stream = os.fsencode(args.text)
4337
# add a newline to the string if it comes from the
4438
# command line so that the result is printed nicely
4539
# on the console.
4640
stream += b'\n'
4741
else:
48-
if PY3:
49-
stream = sys.stdin.buffer.read()
50-
else:
51-
stream = sys.stdin.read()
42+
stream = sys.stdin.buffer.read()
5243

5344
try:
5445
stream = stream.decode(encoding)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL