Skip to content

Commit 6a5d254

Browse files
cclaussrefack
authored andcommitted
src: use ==/!= to compare str, bytes, and int literals
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
1 parent 0e5171a commit 6a5d254

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

gyp/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key):
958958
if variable_name in variables:
959959
# If the variable is already set, don't set it.
960960
continue
961-
if the_dict_key is 'variables' and variable_name in the_dict:
961+
if the_dict_key == 'variables' and variable_name in the_dict:
962962
# If the variable is set without a % in the_dict, and the_dict is a
963963
# variables dict (making |variables| a varaibles sub-dict of a
964964
# variables dict), use the_dict's definition.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ entry_points = {'console_scripts': ['gyp=gyp:script_main']}
1111

1212
[flake8]
1313
exclude = .venv,out,testlib/SConsLib
14-
select = E9,F8
14+
select = E9,F63,F7,F8

test/linux/ldflags-duplicates/check-ldflags.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
import sys
1414

1515
def CheckContainsFlags(args, substring):
16-
if args.find(substring) is -1:
16+
found = substring in args
17+
if not found:
1718
print('ERROR: Linker arguments "%s" are missing in "%s"' % (substring,
1819
args))
19-
return False;
20-
return True;
20+
return found
2121

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

0 commit comments

Comments
 (0)