Skip to content

Commit 0ec08ee

Browse files
authored
Update to latest version of flake8. NFC (#18009)
1 parent f8dc4ba commit 0ec08ee

14 files changed

+25
-25
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
ignore = E111,E114,E501,E261,E266,E121,E402,E241,W504,E741,B011
2+
ignore = E111,E114,E501,E261,E266,E121,E402,E241,W504,E741,B011,B023,U101
33
exclude =
44
./third_party/, # third-party code
55
./tools/filelock.py, # third-party code

emcc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4035,7 +4035,7 @@ def parse_string_list_members(text):
40354035
if not len(current):
40364036
exit_with_error('string array should not contain an empty value')
40374037
first = current[0]
4038-
if not(first == "'" or first == '"'):
4038+
if not (first == "'" or first == '"'):
40394039
result.append(current.rstrip())
40404040
else:
40414041
start = index

emrun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ def subprocess_env():
13601360
def remove_tree(d):
13611361
os.chmod(d, stat.S_IWRITE)
13621362
try:
1363-
def remove_readonly_and_try_again(func, path, exc_info):
1363+
def remove_readonly_and_try_again(func, path, _exc_info):
13641364
if not (os.stat(path).st_mode & stat.S_IWRITE):
13651365
os.chmod(path, stat.S_IWRITE)
13661366
func(path)

emscripten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def emscript(in_wasm, out_wasm, outfile_js, memfile):
328328
c_sig = c_sig.split(',')
329329
if em_js_func in import_map:
330330
imp = import_map[em_js_func]
331-
assert(imp.kind == webassembly.ExternType.FUNC)
331+
assert imp.kind == webassembly.ExternType.FUNC
332332
signature = types[imp.type]
333333
if len(signature.params) != len(c_sig):
334334
diagnostics.warning('em-js-i64', 'using 64-bit arguments in EM_JS function without WASM_BIGINT is not yet fully supported: `%s` (%s, %s)', em_js_func, c_sig, signature.params)

requirements-dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# the codebase and generate docs using Sphinx, not for users of emscripten.
55
# Install with `pip3 install -r requirements-dev.txt`
66

7-
flake8==3.9.0
8-
flake8-bugbear==22.4.25
9-
flake8-unused-arguments==0.0.6
7+
flake8==5.0.4
8+
flake8-bugbear==22.9.23
9+
flake8-unused-arguments==0.0.11
1010
coverage==5.5
1111
mypy==0.971
1212
types-requests==2.27.14

test/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,8 +1753,8 @@ def btest_exit(self, filename, assert_returncode=0, *args, **kwargs):
17531753
REPORT_RESULT macro to the C code.
17541754
"""
17551755
self.set_setting('EXIT_RUNTIME')
1756-
assert('reporting' not in kwargs)
1757-
assert('expected' not in kwargs)
1756+
assert 'reporting' not in kwargs
1757+
assert 'expected' not in kwargs
17581758
kwargs['reporting'] = Reporting.JS_ONLY
17591759
kwargs['expected'] = 'exit:%d' % assert_returncode
17601760
return self.btest(filename, *args, **kwargs)

test/jsrun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def run_js(filename, engine, args=None,
9393
"""Execute javascript code generated by tests, with possible timeout."""
9494

9595
# We used to support True here but we no longer do. Assert here just in case.
96-
assert(type(assert_returncode) == int)
96+
assert type(assert_returncode) == int
9797

9898
if not os.path.exists(filename):
9999
raise Exception('output file not found: ' + filename)

test/test_other.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7463,11 +7463,11 @@ def run_metadce_test(self, filename, args=[], expected_exists=[], expected_not_e
74637463
# find the imports we send from JS
74647464
js = read_file('a.out.js')
74657465
start = js.find('asmLibraryArg = ')
7466-
assert(start != -1)
7466+
assert start != -1
74677467
end = js.find('}', start)
7468-
assert(end != -1)
7468+
assert end != -1
74697469
start = js.find('{', start)
7470-
assert(start != -1)
7470+
assert start != -1
74717471
relevant = js[start + 2:end - 1]
74727472
relevant = relevant.replace(' ', '').replace('"', '').replace("'", '').split(',')
74737473
sent = [x.split(':')[0].strip() for x in relevant]
@@ -11530,7 +11530,7 @@ def create_o(name, i):
1153011530
main = '#include<stdio.h>\n%s int main() { int value = 0; %s printf("%%d\\n", value); }' % (decls, calls)
1153111531
open('main.c', 'w').write(main)
1153211532

11533-
assert(sum(len(f) for f in files) > 32767)
11533+
assert sum(len(f) for f in files) > 32767
1153411534

1153511535
self.run_process(building.get_command_with_possible_response_file([EMCC, 'main.c'] + files))
1153611536
self.assertContained(str(count * (count - 1) // 2), self.run_js('a.out.js'))

tools/colored_logger.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ def new(*args):
7272
BACKGROUND_GREY = 0x0070 # noqa
7373
BACKGROUND_INTENSITY = 0x0080 # background color is intensified.
7474
levelno = args[1].levelno
75-
if(levelno >= 50):
75+
if (levelno >= 50):
7676
color = BACKGROUND_YELLOW | FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY
77-
elif(levelno >= 40):
77+
elif (levelno >= 40):
7878
color = FOREGROUND_RED | FOREGROUND_INTENSITY
79-
elif(levelno >= 30):
79+
elif (levelno >= 30):
8080
color = FOREGROUND_YELLOW | FOREGROUND_INTENSITY
81-
elif(levelno >= 20):
81+
elif (levelno >= 20):
8282
color = FOREGROUND_GREEN
83-
elif(levelno >= 10):
83+
elif (levelno >= 10):
8484
color = FOREGROUND_MAGENTA
8585
else:
8686
color = FOREGROUND_WHITE

tools/shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ def strip_prefix(string, prefix):
644644

645645

646646
def make_writable(filename):
647-
assert(os.path.isfile(filename))
647+
assert os.path.isfile(filename)
648648
old_mode = stat.S_IMODE(os.stat(filename).st_mode)
649649
os.chmod(filename, old_mode | stat.S_IWUSR)
650650

0 commit comments

Comments
 (0)