-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix all flake8 issues on python 3 #9209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2488d4a
66e41b8
80bc5d5
7632781
99059ac
a2d0b60
e57a65a
eb23fb5
a83e43e
6c0fb22
7c6be3b
0d13aaa
bd595fa
c8b927e
e4fbc46
5db8c65
5ed992f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -503,7 +503,7 @@ def run(args): | |
if '--version' in args: | ||
try: | ||
revision = run_process(['git', 'show'], stdout=PIPE, stderr=PIPE, cwd=shared.path_from_root()).stdout.splitlines()[0] | ||
except: | ||
except Exception: | ||
revision = '(unknown revision)' | ||
print('''emcc (Emscripten gcc/clang-like replacement) %s (%s) | ||
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt) | ||
|
@@ -631,7 +631,7 @@ def is_minus_s_for_emcc(args, i): | |
src = open(arg).read() | ||
if debug_configure: | ||
open(tempout, 'a').write('============= ' + arg + '\n' + src + '\n=============\n\n') | ||
except: | ||
except IOError: | ||
pass | ||
elif arg.endswith('.s'): | ||
if debug_configure: | ||
|
@@ -721,7 +721,7 @@ def filter_emscripten_options(argv): | |
open(target, 'w').write('#!' + full_node + '\n' + src) # add shebang | ||
try: | ||
os.chmod(target, stat.S_IMODE(os.stat(target).st_mode) | stat.S_IXUSR) # make executable | ||
except: | ||
except OSError: | ||
pass # can fail if e.g. writing the executable to /dev/null | ||
return ret | ||
|
||
|
@@ -862,7 +862,7 @@ def optimizing(opts): | |
newargs[i] = newargs[i + 1] = '' | ||
if key == 'WASM_BACKEND=1': | ||
exit_with_error('do not set -s WASM_BACKEND, instead set EMCC_WASM_BACKEND=1 in the environment') | ||
newargs = [arg for arg in newargs if arg is not ''] | ||
newargs = [arg for arg in newargs if arg != ''] | ||
|
||
settings_key_changes = set() | ||
for s in settings_changes: | ||
|
@@ -929,14 +929,14 @@ def optimizing(opts): | |
input_files.append((i, arg)) | ||
elif file_suffix.endswith(STATICLIB_ENDINGS + DYNAMICLIB_ENDINGS): | ||
# if it's not, and it's a library, just add it to libs to find later | ||
l = unsuffixed_basename(arg) | ||
libname = unsuffixed_basename(arg) | ||
for prefix in LIB_PREFIXES: | ||
if not prefix: | ||
continue | ||
if l.startswith(prefix): | ||
l = l[len(prefix):] | ||
if libname.startswith(prefix): | ||
libname = libname[len(prefix):] | ||
break | ||
libs.append((i, l)) | ||
libs.append((i, libname)) | ||
newargs[i] = '' | ||
else: | ||
logger.warning(arg + ' is not a valid input file') | ||
|
@@ -982,7 +982,7 @@ def optimizing(opts): | |
|
||
original_input_files = input_files[:] | ||
|
||
newargs = [a for a in newargs if a is not ''] | ||
newargs = [a for a in newargs if a != ''] | ||
|
||
has_dash_c = '-c' in newargs | ||
has_dash_S = '-S' in newargs | ||
|
@@ -3122,7 +3122,7 @@ def generate_minimal_runtime_html(target, options, js_target, target_basename, | |
memfile, optimizer): | ||
logger.debug('generating HTML for minimal runtime') | ||
shell = read_and_preprocess(options.shell_path) | ||
if re.search('{{{\s*SCRIPT\s*}}}', shell): | ||
if re.search(r'{{{\s*SCRIPT\s*}}}', shell): | ||
exit_with_error('--shell-file "' + options.shell_path + '": MINIMAL_RUNTIME uses a different kind of HTML page shell file than the traditional runtime! Please see $EMSCRIPTEN/src/shell_minimal_runtime.html for a template to use as a basis.') | ||
|
||
shell = shell.replace('{{{ TARGET_BASENAME }}}', target_basename) | ||
|
@@ -3528,7 +3528,7 @@ def parse_string_list(text): | |
# simpler syntaxes | ||
try: | ||
return json.loads(text) | ||
except: | ||
except ValueError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, how can we be sure this is the only type of exception that can arise here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From documentation:
This is the only kind of error we want to recover from. |
||
return parse_string_list(text) | ||
|
||
try: | ||
|
@@ -3540,12 +3540,13 @@ def parse_string_list(text): | |
def validate_arg_level(level_string, max_level, err_msg, clamp=False): | ||
try: | ||
level = int(level_string) | ||
if clamp: | ||
if level > max_level: | ||
logger.warning("optimization level '-O" + level_string + "' is not supported; using '-O" + str(max_level) + "' instead") | ||
level = max_level | ||
assert 0 <= level <= max_level | ||
except: | ||
except ValueError: | ||
raise Exception(err_msg) | ||
if clamp: | ||
if level > max_level: | ||
logger.warning("optimization level '-O" + level_string + "' is not supported; using '-O" + str(max_level) + "' instead") | ||
level = max_level | ||
if not 0 <= level <= max_level: | ||
raise Exception(err_msg) | ||
return level | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.