summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2019-04-27 19:17:30 (GMT)
committerMats Wichmann <mats@linux.com>2019-04-27 19:39:27 (GMT)
commitc1ae73ae94b8437aed7e4ffd10b50620580d305f (patch)
tree7fad3106ede247c42724a6a356c2c6a5c8e81f71 /src/script
parentd642ba8c6ee147daa8155b6a354ce66a13bb9188 (diff)
downloadSCons-c1ae73ae94b8437aed7e4ffd10b50620580d305f.zip
SCons-c1ae73ae94b8437aed7e4ffd10b50620580d305f.tar.gz
SCons-c1ae73ae94b8437aed7e4ffd10b50620580d305f.tar.bz2
Some more lint-derived cleanups
Consistently use "not is" and "not in", many instances used the form "not x is y" instead, which pylint objected to. A couple of bare except clauses got a qualifier. Files otherwise touched had trailing whitespace cleaned up as well. These are all things that sider would complain about if a change happened nearby, so this is pre-emptive. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src/script')
-rw-r--r--src/script/scons-time.py18
-rw-r--r--src/script/sconsign.py6
2 files changed, 12 insertions, 12 deletions
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index 39a6e64..a7120c9 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -107,7 +107,7 @@ class Line(object):
# in the line's index number. We might want to represent
# this some way rather than just drawing the line straight
# between the two points on either side.
- if not y is None:
+ if y is not None:
print(fmt % (x, y))
print('e')
@@ -141,13 +141,13 @@ class Gnuplotter(Plotter):
result = []
for line in self.lines:
result.extend(line.get_x_values())
- return [r for r in result if not r is None]
+ return [r for r in result if r is not None]
def get_all_y_values(self):
result = []
for line in self.lines:
result.extend(line.get_y_values())
- return [r for r in result if not r is None]
+ return [r for r in result if r is not None]
def get_min_x(self):
try:
@@ -252,7 +252,7 @@ def tee_to_file(command, log):
return '%s 2>&1 | tee %s' % (command, log)
-
+
class SConsTimer(object):
"""
Usage: scons-time SUBCOMMAND [ARGUMENTS]
@@ -348,7 +348,7 @@ class SConsTimer(object):
'SCons' : 'Total SCons execution time',
'commands' : 'Total command execution time',
}
-
+
time_string_all = 'Total .* time'
#
@@ -629,7 +629,7 @@ class SConsTimer(object):
return None
result = re.findall(r'%s: ([\d\.]*)' % search_string, contents)[-4:]
result = [ float(r) for r in result ]
- if not time_string is None:
+ if time_string is not None:
try:
result = result[0]
except IndexError:
@@ -921,7 +921,7 @@ class SConsTimer(object):
elif o in ('-p', '--prefix'):
self.prefix = a
elif o in ('--stage',):
- if not a in self.stages:
+ if a not in self.stages:
sys.stderr.write('%s: mem: Unrecognized stage "%s".\n' % (self.name, a))
sys.exit(1)
stage = a
@@ -1035,7 +1035,7 @@ class SConsTimer(object):
elif o in ('-p', '--prefix'):
self.prefix = a
elif o in ('--stage',):
- if not a in self.stages:
+ if a not in self.stages:
sys.stderr.write('%s: obj: Unrecognized stage "%s".\n' % (self.name, a))
sys.stderr.write('%s Type "%s help obj" for help.\n' % (self.name_spaces, self.name))
sys.exit(1)
@@ -1423,7 +1423,7 @@ class SConsTimer(object):
elif o in ('--title',):
self.title = a
elif o in ('--which',):
- if not a in list(self.time_strings.keys()):
+ if a not in list(self.time_strings.keys()):
sys.stderr.write('%s: time: Unrecognized timer "%s".\n' % (self.name, a))
sys.stderr.write('%s Type "%s help time" for help.\n' % (self.name_spaces, self.name))
sys.exit(1)
diff --git a/src/script/sconsign.py b/src/script/sconsign.py
index 6ba0a7c..c7050bc 100644
--- a/src/script/sconsign.py
+++ b/src/script/sconsign.py
@@ -117,7 +117,7 @@ else:
# check `pwd`/lib/scons*.
temp.append(os.getcwd())
else:
- if script_dir == '.' or script_dir == '':
+ if script_dir in ('.', ''):
script_dir = os.getcwd()
head, tail = os.path.split(script_dir)
if tail == "bin":
@@ -261,7 +261,7 @@ def default_mapper(entry, name):
"""
try:
val = eval("entry." + name)
- except:
+ except AttributeError:
val = None
if sys.version_info.major >= 3 and isinstance(val, bytes):
# This is a dirty hack for py 2/3 compatibility. csig is a bytes object
@@ -596,7 +596,7 @@ for o, a in opts:
# this was handled by calling my_import('SCons.dblite')
# again in earlier versions...
SCons.dblite.ignore_corrupt_dbfiles = 0
- except:
+ except ImportError:
sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
print(helpstr)
sys.exit(2)