[cleanup] replace equality by "is"
This commit is contained in:
parent
e210bd8793
commit
b22d04db47
@ -369,7 +369,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
||||
net_ml = local_mag.net_magnitude(magscaling)
|
||||
if net_ml:
|
||||
print("Network local magnitude: %4.1f" % net_ml.mag)
|
||||
if magscaling == None:
|
||||
if magscaling is None:
|
||||
scaling = False
|
||||
elif magscaling[0] != 0 and magscaling[1] != 0:
|
||||
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)
|
||||
if net_ml:
|
||||
print("Network local magnitude: %4.1f" % net_ml.mag)
|
||||
if magscaling == None:
|
||||
if magscaling is None:
|
||||
scaling = False
|
||||
elif magscaling[0] != 0 and magscaling[1] != 0:
|
||||
scaling = False
|
||||
|
@ -122,7 +122,7 @@ class Magnitude(object):
|
||||
|
||||
def net_magnitude(self, magscaling=None):
|
||||
if self:
|
||||
if magscaling == None:
|
||||
if magscaling is None:
|
||||
scaling = False
|
||||
elif magscaling[0] != 0 and magscaling[1] != 0:
|
||||
scaling = False
|
||||
|
@ -299,7 +299,7 @@ class Data(object):
|
||||
for i in range(len(picks_copy)):
|
||||
if picks_copy[i].phase_hint[0] == 'P':
|
||||
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("Adjusted uncertainty: {}".format(upperErrors[0]))
|
||||
print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty']))
|
||||
@ -311,7 +311,7 @@ class Data(object):
|
||||
break
|
||||
if picks_copy[i].phase_hint[0] == 'S':
|
||||
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("Adjusted uncertainty: {}".format(upperErrors[1]))
|
||||
print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty']))
|
||||
|
@ -499,7 +499,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
|
||||
except KeyError as e:
|
||||
print(e)
|
||||
fm = None
|
||||
if fm == None:
|
||||
if fm is None:
|
||||
fm = '?'
|
||||
onset = arrivals[key]['P']['mpp']
|
||||
year = onset.year
|
||||
|
@ -90,7 +90,7 @@ def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None,
|
||||
if type(result) == dict:
|
||||
all_onsets[station] = result
|
||||
else:
|
||||
if result == None:
|
||||
if result is None:
|
||||
result = 'Picker exited unexpectedly.'
|
||||
print('Could not pick a station: {}\nReason: {}'.format(station, result))
|
||||
|
||||
|
@ -291,7 +291,7 @@ class AICPicker(AutoPicker):
|
||||
print("AICPicker: Maximum for slope determination right at the beginning of the window!")
|
||||
print("Choose longer slope determination window!")
|
||||
if self.iplot > 1:
|
||||
if self.fig == None or self.fig == 'None':
|
||||
if self.fig is None or self.fig == 'None':
|
||||
fig = plt.figure()
|
||||
plt_flag = iplot
|
||||
else:
|
||||
@ -337,7 +337,7 @@ class AICPicker(AutoPicker):
|
||||
self.slope = None
|
||||
|
||||
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)
|
||||
plt_flag = iplot
|
||||
else:
|
||||
@ -392,7 +392,7 @@ class AICPicker(AutoPicker):
|
||||
netstlc = '{}.{}.{}'.format(stats.network, stats.station, stats.location)
|
||||
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?')
|
||||
|
||||
return
|
||||
@ -509,7 +509,7 @@ class PragPicker(AutoPicker):
|
||||
pickflag = 0
|
||||
|
||||
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())
|
||||
plt_flag = 1
|
||||
else:
|
||||
|
@ -148,7 +148,7 @@ class Metadata(object):
|
||||
|
||||
try:
|
||||
invtype, robj = self._read_metadata_file(inv_fname)
|
||||
if robj == None:
|
||||
if robj is None:
|
||||
return
|
||||
except Exception as e:
|
||||
print('Could not read file {}'.format(inv_fname))
|
||||
@ -545,7 +545,7 @@ def restitute_trace(input_tuple):
|
||||
else:
|
||||
finv = invlist[0]
|
||||
inventory = read_inventory(finv, format='STATIONXML')
|
||||
elif invtype == None:
|
||||
elif invtype is None:
|
||||
return no_metadata(tr, seed_id)
|
||||
else:
|
||||
remove_trace = True
|
||||
|
@ -1110,7 +1110,7 @@ def loopIdentifyPhase(phase):
|
||||
"""
|
||||
from pylot.core.util.defaults import ALTSUFFIX
|
||||
|
||||
if phase == None:
|
||||
if phase is None:
|
||||
raise NameError('Can not identify phase that is None')
|
||||
|
||||
phase_copy = phase
|
||||
|
@ -2421,7 +2421,7 @@ class PickDlg(QDialog):
|
||||
if not x:
|
||||
return
|
||||
allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x)
|
||||
if pick_rel == None:
|
||||
if pick_rel is None:
|
||||
return
|
||||
pick = allpicks[picktype][phase]
|
||||
message = '{} {}-pick'.format(picktype, phase)
|
||||
@ -2442,7 +2442,7 @@ class PickDlg(QDialog):
|
||||
return
|
||||
x = event.mouseevent.xdata
|
||||
allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x)
|
||||
if pick_rel == None:
|
||||
if pick_rel is None:
|
||||
return
|
||||
pick = allpicks[picktype][phase]
|
||||
message = '{} {}-pick'.format(picktype, phase)
|
||||
@ -2499,7 +2499,7 @@ class PickDlg(QDialog):
|
||||
if not self.picks and not self.autopicks:
|
||||
return
|
||||
allpicks, pick_rel, phase, picktype = self.identify_selected_picks(x)
|
||||
if pick_rel == None:
|
||||
if pick_rel is None:
|
||||
return
|
||||
# delete the value from corresponding dictionary
|
||||
allpicks[picktype].pop(phase)
|
||||
|
Loading…
Reference in New Issue
Block a user