comparison configmix/py.py @ 207:b3b5ed34d180

Handle most flake8 errors and warnings. NOTE: E265 "block comment should start with '# ' ist not yet handled. We would need to adjust our Python style.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 05 May 2019 18:29:47 +0200
parents b5ce9a8461bf
children bbe8513ea649
comparison
equal deleted inserted replaced
206:5064e3a2e54a 207:b3b5ed34d180
7 7
8 """ 8 """
9 9
10 from __future__ import division, absolute_import, print_function 10 from __future__ import division, absolute_import, print_function
11 11
12 import locale
13 try: 12 try:
14 from collections import OrderedDict as DictImpl 13 from collections import OrderedDict as DictImpl
15 except ImportError: 14 except ImportError:
16 try: 15 try:
17 from ordereddict import OrderedDict as DictImpl 16 from ordereddict import OrderedDict as DictImpl
41 if not isinstance(extract, (type([]), type(tuple()), type(set()), )): 40 if not isinstance(extract, (type([]), type(tuple()), type(set()), )):
42 raise TypeError("`extract' must be a sequence") 41 raise TypeError("`extract' must be a sequence")
43 gcontext = DictImpl() 42 gcontext = DictImpl()
44 lcontext = DictImpl() 43 lcontext = DictImpl()
45 if PY2: 44 if PY2:
46 execfile(u2fs(filename, True), gcontext, lcontext) 45 execfile(u2fs(filename, True), gcontext, lcontext) # noqa: F821
47 else: 46 else:
48 # "rb" mode allows Python to derive the encoding automatically 47 # "rb" mode allows Python to derive the encoding automatically
49 with open(filename, "rb") as vf: 48 with open(filename, "rb") as vf:
50 code = compile(vf.read(), filename, "exec") 49 code = compile(vf.read(), filename, "exec")
51 exec(code, gcontext, lcontext) 50 exec(code, gcontext, lcontext)