[cleanup] replace equality by "is"

This commit is contained in:
Marcel Paffrath 2018-07-16 13:52:28 +02:00
parent e210bd8793
commit b22d04db47
9 changed files with 17 additions and 17 deletions

View File

@ -369,7 +369,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
net_ml = local_mag.net_magnitude(magscaling) net_ml = local_mag.net_magnitude(magscaling)
if net_ml: if net_ml:
print("Network local magnitude: %4.1f" % net_ml.mag) print("Network local magnitude: %4.1f" % net_ml.mag)
if magscaling == None: if magscaling is None:
scaling = False scaling = False
elif magscaling[0] != 0 and magscaling[1] != 0: elif magscaling[0] != 0 and magscaling[1] != 0:
scaling = False scaling = False
@ -454,7 +454,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
net_ml = local_mag.net_magnitude(magscaling) net_ml = local_mag.net_magnitude(magscaling)
if net_ml: if net_ml:
print("Network local magnitude: %4.1f" % net_ml.mag) print("Network local magnitude: %4.1f" % net_ml.mag)
if magscaling == None: if magscaling is None:
scaling = False scaling = False
elif magscaling[0] != 0 and magscaling[1] != 0: elif magscaling[0] != 0 and magscaling[1] != 0:
scaling = False scaling = False

View File

@ -122,7 +122,7 @@ class Magnitude(object):
def net_magnitude(self, magscaling=None): def net_magnitude(self, magscaling=None):
if self: if self:
if magscaling == None: if magscaling is None:
scaling = False scaling = False
elif magscaling[0] != 0 and magscaling[1] != 0: elif magscaling[0] != 0 and magscaling[1] != 0:
scaling = False scaling = False

View File

@ -299,7 +299,7 @@ class Data(object):
for i in range(len(picks_copy)): for i in range(len(picks_copy)):
if picks_copy[i].phase_hint[0] == 'P': if picks_copy[i].phase_hint[0] == 'P':
if (picks_copy[i].time_errors['upper_uncertainty'] >= upperErrors[0]) or \ if (picks_copy[i].time_errors['upper_uncertainty'] >= upperErrors[0]) or \
(picks_copy[i].time_errors['uncertainty'] == None): (picks_copy[i].time_errors['uncertainty'] is None):
print("Uncertainty exceeds or equal adjusted upper time error!") print("Uncertainty exceeds or equal adjusted upper time error!")
print("Adjusted uncertainty: {}".format(upperErrors[0])) print("Adjusted uncertainty: {}".format(upperErrors[0]))
print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty'])) print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty']))
@ -311,7 +311,7 @@ class Data(object):
break break
if picks_copy[i].phase_hint[0] == 'S': if picks_copy[i].phase_hint[0] == 'S':
if (picks_copy[i].time_errors['upper_uncertainty'] >= upperErrors[1]) or \ if (picks_copy[i].time_errors['upper_uncertainty'] >= upperErrors[1]) or \
(picks_copy[i].time_errors['uncertainty'] == None): (picks_copy[i].time_errors['uncertainty'] is None):
print("Uncertainty exceeds or equal adjusted upper time error!") print("Uncertainty exceeds or equal adjusted upper time error!")
print("Adjusted uncertainty: {}".format(upperErrors[1])) print("Adjusted uncertainty: {}".format(upperErrors[1]))
print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty'])) print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty']))

View File

@ -499,7 +499,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
except KeyError as e: except KeyError as e:
print(e) print(e)
fm = None fm = None
if fm == None: if fm is None:
fm = '?' fm = '?'
onset = arrivals[key]['P']['mpp'] onset = arrivals[key]['P']['mpp']
year = onset.year year = onset.year

View File

@ -90,7 +90,7 @@ def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None,
if type(result) == dict: if type(result) == dict:
all_onsets[station] = result all_onsets[station] = result
else: else:
if result == None: if result is None:
result = 'Picker exited unexpectedly.' result = 'Picker exited unexpectedly.'
print('Could not pick a station: {}\nReason: {}'.format(station, result)) print('Could not pick a station: {}\nReason: {}'.format(station, result))

View File

@ -291,7 +291,7 @@ class AICPicker(AutoPicker):
print("AICPicker: Maximum for slope determination right at the beginning of the window!") print("AICPicker: Maximum for slope determination right at the beginning of the window!")
print("Choose longer slope determination window!") print("Choose longer slope determination window!")
if self.iplot > 1: if self.iplot > 1:
if self.fig == None or self.fig == 'None': if self.fig is None or self.fig == 'None':
fig = plt.figure() fig = plt.figure()
plt_flag = iplot plt_flag = iplot
else: else:
@ -337,7 +337,7 @@ class AICPicker(AutoPicker):
self.slope = None self.slope = None
if iplot > 1: if iplot > 1:
if self.fig == None or self.fig == 'None': if self.fig is None or self.fig == 'None':
fig = plt.figure() # self.iplot) fig = plt.figure() # self.iplot)
plt_flag = iplot plt_flag = iplot
else: else:
@ -392,7 +392,7 @@ class AICPicker(AutoPicker):
netstlc = '{}.{}.{}'.format(stats.network, stats.station, stats.location) netstlc = '{}.{}.{}'.format(stats.network, stats.station, stats.location)
fig.savefig('aicfig_{}_{}.png'.format(netstlc, stats.channel)) fig.savefig('aicfig_{}_{}.png'.format(netstlc, stats.channel))
if self.Pick == None: if self.Pick is None:
print('AICPicker: Could not find minimum, picking window too short?') print('AICPicker: Could not find minimum, picking window too short?')
return return
@ -509,7 +509,7 @@ class PragPicker(AutoPicker):
pickflag = 0 pickflag = 0
if iplot > 1: if iplot > 1:
if self.fig == None or self.fig == 'None': if self.fig is None or self.fig == 'None':
fig = plt.figure() # self.getiplot()) fig = plt.figure() # self.getiplot())
plt_flag = 1 plt_flag = 1
else: else:

View File

@ -148,7 +148,7 @@ class Metadata(object):
try: try:
invtype, robj = self._read_metadata_file(inv_fname) invtype, robj = self._read_metadata_file(inv_fname)
if robj == None: if robj is None:
return return
except Exception as e: except Exception as e:
print('Could not read file {}'.format(inv_fname)) print('Could not read file {}'.format(inv_fname))
@ -545,7 +545,7 @@ def restitute_trace(input_tuple):
else: else:
finv = invlist[0] finv = invlist[0]
inventory = read_inventory(finv, format='STATIONXML') inventory = read_inventory(finv, format='STATIONXML')
elif invtype == None: elif invtype is None:
return no_metadata(tr, seed_id) return no_metadata(tr, seed_id)
else: else:
remove_trace = True remove_trace = True

View File

@ -1110,7 +1110,7 @@ def loopIdentifyPhase(phase):
""" """
from pylot.core.util.defaults import ALTSUFFIX from pylot.core.util.defaults import ALTSUFFIX
if phase == None: if phase is None:
raise NameError('Can not identify phase that is None') raise NameError('Can not identify phase that is None')
phase_copy = phase phase_copy = phase

View File

@ -2421,7 +2421,7 @@ class PickDlg(QDialog):
if not x: if not x:
return return
allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x) allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x)
if pick_rel == None: if pick_rel is None:
return return
pick = allpicks[picktype][phase] pick = allpicks[picktype][phase]
message = '{} {}-pick'.format(picktype, phase) message = '{} {}-pick'.format(picktype, phase)
@ -2442,7 +2442,7 @@ class PickDlg(QDialog):
return return
x = event.mouseevent.xdata x = event.mouseevent.xdata
allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x) allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x)
if pick_rel == None: if pick_rel is None:
return return
pick = allpicks[picktype][phase] pick = allpicks[picktype][phase]
message = '{} {}-pick'.format(picktype, phase) message = '{} {}-pick'.format(picktype, phase)
@ -2499,7 +2499,7 @@ class PickDlg(QDialog):
if not self.picks and not self.autopicks: if not self.picks and not self.autopicks:
return return
allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x) allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x)
if pick_rel == None: if pick_rel is None:
return return
# delete the value from corresponding dictionary # delete the value from corresponding dictionary
allpicks[picktype].pop(phase) allpicks[picktype].pop(phase)