Skip to content

Commit

Permalink
Merge pull request #150 from willfurnass/fix-comparisons
Browse files Browse the repository at this point in the history
Use ==/!= to compare str, bytes, and int literals.
  • Loading branch information
robclewley authored Feb 10, 2020
2 parents b57a173 + 032cfe1 commit 2c8bd97
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ PyDSTool.egg-info/
.eggs/
dist/
tox.log
.mypy_cache/
44 changes: 22 additions & 22 deletions PyDSTool/PyCont/Continuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,14 @@ def _createTestFuncs(self):
for bftype in self.LocBifPoints:
if bftype in cont_bif_points:
stop = bftype in self.StopAtPoints # Set stopping flag
#if bftype is 'BP':
#if bftype == 'BP':
#method = Branch_Det(self.CorrFunc, self, save=True,
#numpoints=self.MaxNumPoints+1)
#self.TestFuncs.append(method)

#self.BifPoints['BP'] = BranchPoint(method, iszero,
#stop=stop)
if bftype is 'B':
if bftype == 'B':
method = B_Check(self.CorrFunc, self, save=True,
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)
Expand Down Expand Up @@ -1878,7 +1878,7 @@ def cleanLabels(self):
def info(self):
print(self.__repr__())
print("Using model: %s\n"%self.model.name)
if self.description is not 'None':
if self.description != 'None':
print('Description')
print('----------- \n')
print(self.description, '\n')
Expand Down Expand Up @@ -2006,13 +2006,13 @@ def _createTestFuncs(self):
for bftype in self.LocBifPoints:
if bftype in equilibrium_bif_points:
stop = bftype in self.StopAtPoints # Set stopping flag
if bftype is 'BP':
if bftype == 'BP':
method = Branch_Det(self.CorrFunc, self, save=True,
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)
self.BifPoints['BP'] = BranchPoint(method, iszero,
stop=stop)
elif bftype is 'LP':
elif bftype == 'LP':
#method1 = Fold_Bor(self.CorrFunc, self, corr=False,
# save=True, numpoints=self.MaxNumPoints+1)
#method1 = Fold_Det(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
Expand All @@ -2029,7 +2029,7 @@ def _createTestFuncs(self):
self.BifPoints['LP'] = FoldPoint([method1, method2],
[iszero, isnotzero],
stop=stop)
elif bftype is 'H':
elif bftype == 'H':
method = Hopf_Bor(self.CorrFunc, self, corr=False,
save=True, numpoints=self.MaxNumPoints+1)
#method = Hopf_Det(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
Expand Down Expand Up @@ -2151,18 +2151,18 @@ def _createTestFuncs(self):
method2 = Hopf_Bor(self.CorrFunc.sysfunc, self,
save=True, numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method2)
if bftype is 'BT':
if bftype == 'BT':
self.BifPoints['BT'] = BTPoint([method1, method2],
[iszero, iszero], stop=stop)
else:
self.BifPoints['ZH'] = ZHPoint([method1, method2],
[isnotzero, iszero], stop=stop)
elif bftype is 'CP':
elif bftype == 'CP':
method = CP_Fold(self.CorrFunc, self, save=True,
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)
self.BifPoints['CP'] = CPPoint(method, iszero, stop=stop)
elif bftype is 'BP':
elif bftype == 'BP':
method1 = BP_Fold(self.CorrFunc, self, 0, save=True,
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method1)
Expand Down Expand Up @@ -2280,25 +2280,25 @@ def _createTestFuncs(self):
for bftype in self.LocBifPoints:
if bftype in hopf_bif_points:
stop = bftype in self.StopAtPoints # Set stopping flag
if bftype is 'BT':
if bftype == 'BT':
method = BT_Hopf_One(self.CorrFunc, self, save=True, \
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)

self.BifPoints['BT'] = BTPoint(method, iszero, stop=stop)
if bftype is 'DH':
if bftype == 'DH':
method = DH_Hopf(self.CorrFunc, self, save=True, \
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)

self.BifPoints['DH'] = DHPoint(method, iszero, stop=stop)
elif bftype is 'ZH':
elif bftype == 'ZH':
method = Fold_Det(self.CorrFunc.sysfunc, self, \
save=True, numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)

self.BifPoints['ZH'] = ZHPoint(method, iszero, stop=stop)
elif bftype is 'GH':
elif bftype == 'GH':
method = GH_Hopf_One(self.CorrFunc, self, save=True, \
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)
Expand Down Expand Up @@ -2434,17 +2434,17 @@ def _createTestFuncs(self):
for bftype in self.LocBifPoints:
if bftype in hopf_bif_points:
stop = bftype in self.StopAtPoints # Set stopping flag
if bftype is 'BT':
if bftype == 'BT':
method = BT_Hopf(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)

self.BifPoints['BT'] = BTPoint(method, iszero, stop=stop)
elif bftype is 'GH':
elif bftype == 'GH':
method = GH_Hopf(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)

self.BifPoints['GH'] = GHPoint(method, iszero, stop=stop)
elif bftype is 'ZH':
elif bftype == 'ZH':
method = Fold_Det(self.CorrFunc.sysfunc, self, save=True, numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)

Expand Down Expand Up @@ -2497,7 +2497,7 @@ def _createTestFuncs(self):
for bftype in self.LocBifPoints:
if bftype in fixedpoint_bif_points:
stop = bftype in self.StopAtPoints
if bftype is 'LPC':
if bftype == 'LPC':
method1 = Fold_Tan(self.CorrFunc, self, save=True,
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method1)
Expand All @@ -2508,17 +2508,17 @@ def _createTestFuncs(self):
method2 = self.BifPoints['BP'].testfuncs[0]

self.BifPoints['LPC'] = LPCPoint([method1, method2], [iszero, isnotzero], stop=stop)
elif bftype is 'PD':
elif bftype == 'PD':
method = PD_Det(self.sysfunc, self, save=True, numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)

self.BifPoints['PD'] = PDPoint(method, iszero, stop=stop)
elif bftype is 'NS':
elif bftype == 'NS':
method = NS_Det(self.sysfunc, self, save=True, numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)

self.BifPoints['NS'] = NSPoint(method, iszero, stop=stop)
elif bftype is 'BP':
elif bftype == 'BP':
if 'LPC' not in self.BifPoints.keys():
method = Branch_Det(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)
Expand Down Expand Up @@ -2626,7 +2626,7 @@ def _createTestFuncs(self):
for bftype in self.LocBifPoints:
if bftype in fold_map_bif_points:
stop = bftype in self.StopAtPoints
if bftype is 'CP':
if bftype == 'CP':
method = CP_Fold(self.CorrFunc, self, save=True,
numpoints=self.MaxNumPoints+1)
self.TestFuncs.append(method)
Expand Down Expand Up @@ -2914,7 +2914,7 @@ def _createTestFuncs(self):
for bftype in self.LocBifPoints:
if bftype in cusp_bif_points:
stop = bftype in self.StopAtPoints
if bftype is 'BP':
if bftype == 'BP':
method = Branch_Det(self.CorrFunc, self, save=True,
numpoints=self.MaxNumPoints+1)
self.TestFuncs.remove(self.TestFuncs[-1])
Expand Down
4 changes: 2 additions & 2 deletions PyDSTool/Variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,11 +1022,11 @@ def __del__(self):
# to be multiple attempts to delete it (which of course
# fail after the first successful attempt)
pass
elif fname is 'funcspec':
elif fname == 'funcspec':
# doesn't refer to any dynamically-created methods
# so ignore
pass
elif fname is 'outputdata':
elif fname == 'outputdata':
# doesn't refer to any dynamically-created methods
# so ignore
pass
Expand Down

0 comments on commit 2c8bd97

Please sign in to comment.