| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,10 +10,6 @@ | |||
| 10 | 10 | ||
| 11 | 11 | here = os.path.dirname(__file__) | |
| 12 | 12 | ||
| 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 | - | ||
| 17 | 13 | def get_cmd(): | |
| 18 | 14 | sys_path = os.path.join(here, "..") | |
| 19 | 15 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,6 @@ | |||
| 17 | 17 | b'Knosos' | |
| 18 | 18 | """ | |
| 19 | 19 | import warnings | |
| 20 | - from sys import version_info | ||
| 21 | 20 | from typing import Optional | |
| 22 | 21 | ||
| 23 | 22 | Cache = {} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,11 @@ | |||
| 1 | 1 | # vim:ts=4 sw=4 expandtab softtabstop=4 | |
| 2 | - from __future__ import print_function | ||
| 3 | 2 | import argparse | |
| 4 | 3 | import locale | |
| 5 | 4 | import os | |
| 6 | 5 | import sys | |
| 7 | 6 | ||
| 8 | 7 | from unidecode import unidecode | |
| 9 | 8 | ||
| 10 | - PY3 = sys.version_info[0] >= 3 | ||
| 11 | - | ||
| 12 | 9 | def fatal(msg): | |
| 13 | 10 | sys.stderr.write(msg + "\n") | |
| 14 | 11 | sys.exit(1) | |
@@ -36,19 +33,13 @@ def main(): | |||
| 36 | 33 | with open(args.path, 'rb') as f: | |
| 37 | 34 | stream = f.read() | |
| 38 | 35 | elif args.text: | |
| 39 | - if PY3: | ||
| 40 | - stream = os.fsencode(args.text) | ||
| 41 | - else: | ||
| 42 | - stream = args.text | ||
| 36 | + stream = os.fsencode(args.text) | ||
| 43 | 37 | # add a newline to the string if it comes from the | |
| 44 | 38 | # command line so that the result is printed nicely | |
| 45 | 39 | # on the console. | |
| 46 | 40 | stream += b'\n' | |
| 47 | 41 | else: | |
| 48 | - if PY3: | ||
| 49 | - stream = sys.stdin.buffer.read() | ||
| 50 | - else: | ||
| 51 | - stream = sys.stdin.read() | ||
| 42 | + stream = sys.stdin.buffer.read() | ||
| 52 | 43 | ||
| 53 | 44 | try: | |
| 54 | 45 | stream = stream.decode(encoding) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments