Skip to content

Commit

Permalink
src: use ==/!= to compare str, bytes, and int literals
Browse files Browse the repository at this point in the history
Add a more flake8 tests

* F63 tests are usually about the confusion between identity and equality in Python.
* F7 tests logic errors and syntax errors in type hints
  • Loading branch information
cclauss authored and refack committed Jul 24, 2019
1 parent 0e5171a commit 6a5d254
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gyp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key):
if variable_name in variables:
# If the variable is already set, don't set it.
continue
if the_dict_key is 'variables' and variable_name in the_dict:
if the_dict_key == 'variables' and variable_name in the_dict:
# If the variable is set without a % in the_dict, and the_dict is a
# variables dict (making |variables| a varaibles sub-dict of a
# variables dict), use the_dict's definition.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ entry_points = {'console_scripts': ['gyp=gyp:script_main']}

[flake8]
exclude = .venv,out,testlib/SConsLib
select = E9,F8
select = E9,F63,F7,F8
14 changes: 7 additions & 7 deletions test/linux/ldflags-duplicates/check-ldflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
import sys

def CheckContainsFlags(args, substring):
if args.find(substring) is -1:
found = substring in args
if not found:
print('ERROR: Linker arguments "%s" are missing in "%s"' % (substring,
args))
return False;
return True;
return found

if __name__ == '__main__':
args = " ".join(sys.argv)
print("args = " +args)
if not CheckContainsFlags(args, 'lib1.a -Wl,--no-whole-archive') \
or not CheckContainsFlags(args, 'lib2.a -Wl,--no-whole-archive'):
sys.exit(1);
print("args = " + args)
if (not CheckContainsFlags(args, 'lib1.a -Wl,--no-whole-archive')
or not CheckContainsFlags(args, 'lib2.a -Wl,--no-whole-archive')):
sys.exit(1)
sys.exit(0)

0 comments on commit 6a5d254

Please sign in to comment.