From ca73168e75b05b9ea8f0de9a13a1ea7083cdcbcc Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 2 May 2020 03:32:00 +0300 Subject: utils: raspberrypi: ctt: Fix pycodestyle E711 and E712 E711 comparison to None should be 'if cond is None:' E711 comparison to None should be 'if cond is not None:' E712 comparison to False should be 'if cond is False:' or 'if not cond:' E712 comparison to True should be 'if cond is True:' or 'if cond:' Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: David Plowman --- utils/raspberrypi/ctt/ctt.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'utils/raspberrypi/ctt/ctt.py') diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py index 6fedef89..2c908e15 100755 --- a/utils/raspberrypi/ctt/ctt.py +++ b/utils/raspberrypi/ctt/ctt.py @@ -534,17 +534,17 @@ class Camera: self.log_new_sec('User Arguments', cal=False) self.log += '\nJson file output: ' + json_output self.log += '\nCalibration images directory: ' + directory - if config == None: + if config is None: self.log += '\nNo configuration file input... using default options' - elif config == False: + elif config is False: self.log += '\nWARNING: Invalid configuration file path...' self.log += ' using default options' - elif config == True: + elif config is True: self.log += '\nWARNING: Invalid syntax in configuration file...' self.log += ' using default options' else: self.log += '\nConfiguration file: ' + config - if log_output == None: + if log_output is None: self.log += '\nNo log file path input... using default: ctt_log.txt' else: self.log += '\nLog file output: ' + log_output @@ -555,7 +555,7 @@ class Camera: write log file """ def write_log(self, filename): - if filename == None: + if filename is None: filename = 'ctt_log.txt' self.log += '\n' + self.log_separator with open(filename, 'w') as logfile: @@ -604,7 +604,7 @@ class Camera: """ check that image colour temperature has been successfuly obtained """ - elif col != None: + elif col is not None: """ if successful, append to list and continue to next image """ @@ -627,7 +627,7 @@ class Camera: if image isn't an alsc correction then it must have a lux and a colour temperature value to be useful """ - if lux == None: + if lux is None: print('DISCARDED') self.log += '\nWARNING: Error reading lux value' self.log += '\nImage discarded!' @@ -707,7 +707,7 @@ def run_ctt(json_output, directory, config, log_output): """ if json_output[-5:] != '.json': raise ArgError('\n\nError: Output must be a json file!') - if config != None: + if config is not None: """ check if config file is actually a json """ @@ -790,7 +790,7 @@ def run_ctt(json_output, directory, config, log_output): Cam.write_json() Cam.write_log(log_output) print('\nCalibrations written to: '+json_output) - if log_output == None: + if log_output is None: log_output = 'ctt_log.txt' print('Log file written to: '+log_output) pass -- cgit v1.2.1