python scripts: Use "not in" operator to test membership

As per suggestion from Pyls, this changes
  if not needle in haystack:
to
  if needle not in haystack:

Change-Id: I4a482604e13e61ecee9e02935479632419710ff7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Alessandro Portale
2019-05-02 18:16:47 +02:00
committed by hjk
parent 4f989d6543
commit 5311708845
6 changed files with 8 additions and 8 deletions

View File

@@ -1078,7 +1078,7 @@ class DumperBase:
reslist = [] reslist = []
for item in res.get('variables', {}): for item in res.get('variables', {}):
if not 'iname' in item: if 'iname' not in item:
item['iname'] = '.' + item.get('name') item['iname'] = '.' + item.get('name')
reslist.append(self.variablesToMi(item, 'local')) reslist.append(self.variablesToMi(item, 'local'))

View File

@@ -2216,7 +2216,7 @@ class SyntheticChildrenProvider(SummaryProvider):
SummaryProvider.update(self) SummaryProvider.update(self)
self.synthetic_children = [] self.synthetic_children = []
if not 'children' in self.summary: if 'children' not in self.summary:
return return
dereference_child = None dereference_child = None

View File

@@ -255,7 +255,7 @@ def verifyBreakPoint(bpToVerify):
def __isWinFirewallRunning__(): def __isWinFirewallRunning__():
if hasattr(__isWinFirewallRunning__, "fireWallState"): if hasattr(__isWinFirewallRunning__, "fireWallState"):
return __isWinFirewallRunning__.fireWallState return __isWinFirewallRunning__.fireWallState
if not platform.system() in ('Microsoft' 'Windows'): if platform.system() not in ('Microsoft' 'Windows'):
__isWinFirewallRunning__.fireWallState = False __isWinFirewallRunning__.fireWallState = False
return False return False
result = getOutputFromCmdline(["netsh", "firewall", "show", "state"]) result = getOutputFromCmdline(["netsh", "firewall", "show", "state"])

View File

@@ -292,7 +292,7 @@ def copySettingsToTmpDir(destination=None, omitFiles=[]):
if not os.path.exists(folder): if not os.path.exists(folder):
os.makedirs(folder) os.makedirs(folder)
for ff in f: for ff in f:
if not ff in omitFiles: if ff not in omitFiles:
shutil.copy(os.path.join(r, ff), currentPath) shutil.copy(os.path.join(r, ff), currentPath)
if platform.system() in ('Linux', 'Darwin'): if platform.system() in ('Linux', 'Darwin'):
substituteTildeWithinToolchains(tmpSettingsDir) substituteTildeWithinToolchains(tmpSettingsDir)

View File

@@ -61,7 +61,7 @@ def main():
for template in dumpItems(templatesView.model(), templatesView.rootIndex()): for template in dumpItems(templatesView.model(), templatesView.rootIndex()):
template = template.replace(".", "\\.") template = template.replace(".", "\\.")
# skip non-configurable # skip non-configurable
if not template in ["Qt Quick UI Prototype", "Auto Test Project", # FIXME if template not in ["Qt Quick UI Prototype", "Auto Test Project", # FIXME
"Qt for Python - Empty", "Qt for Python - Window"]: "Qt for Python - Empty", "Qt for Python - Window"]:
availableProjectTypes.append({category:template}) availableProjectTypes.append({category:template})
safeClickButton("Cancel") safeClickButton("Cancel")

View File

@@ -114,11 +114,11 @@ def renameFile(projectDir, proFile, branch, oldname, newname):
"Comparing content of file before and after renaming") "Comparing content of file before and after renaming")
test.verify(waitFor("newname in safeReadFile(proFile)", 2000), test.verify(waitFor("newname in safeReadFile(proFile)", 2000),
"Verify that new filename '%s' was added to pro-file." % newname) "Verify that new filename '%s' was added to pro-file." % newname)
if not oldname in newname: if oldname not in newname:
test.verify(not oldname in readFile(proFile), test.verify(oldname not in readFile(proFile),
"Verify that old filename '%s' was removed from pro-file." % oldname) "Verify that old filename '%s' was removed from pro-file." % oldname)
if not (oldname.lower() == newname.lower() and platform.system() in ('Windows', 'Microsoft')): if not (oldname.lower() == newname.lower() and platform.system() in ('Windows', 'Microsoft')):
test.verify(not oldname in os.listdir(projectDir), test.verify(oldname not in os.listdir(projectDir),
"Verify that file with old name does not exist: %s" % oldFilePath) "Verify that file with old name does not exist: %s" % oldFilePath)
def safeReadFile(filename): def safeReadFile(filename):