Skip to content

Commit 2c8bd97

Browse files
authored
Merge pull request #150 from willfurnass/fix-comparisons
Use ==/!= to compare str, bytes, and int literals.
2 parents b57a173 + 032cfe1 commit 2c8bd97

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ PyDSTool.egg-info/
2626
.eggs/
2727
dist/
2828
tox.log
29+
.mypy_cache/

PyDSTool/PyCont/Continuation.py

+22-22
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,14 @@ def _createTestFuncs(self):
412412
for bftype in self.LocBifPoints:
413413
if bftype in cont_bif_points:
414414
stop = bftype in self.StopAtPoints # Set stopping flag
415-
#if bftype is 'BP':
415+
#if bftype == 'BP':
416416
#method = Branch_Det(self.CorrFunc, self, save=True,
417417
#numpoints=self.MaxNumPoints+1)
418418
#self.TestFuncs.append(method)
419419

420420
#self.BifPoints['BP'] = BranchPoint(method, iszero,
421421
#stop=stop)
422-
if bftype is 'B':
422+
if bftype == 'B':
423423
method = B_Check(self.CorrFunc, self, save=True,
424424
numpoints=self.MaxNumPoints+1)
425425
self.TestFuncs.append(method)
@@ -1878,7 +1878,7 @@ def cleanLabels(self):
18781878
def info(self):
18791879
print(self.__repr__())
18801880
print("Using model: %s\n"%self.model.name)
1881-
if self.description is not 'None':
1881+
if self.description != 'None':
18821882
print('Description')
18831883
print('----------- \n')
18841884
print(self.description, '\n')
@@ -2006,13 +2006,13 @@ def _createTestFuncs(self):
20062006
for bftype in self.LocBifPoints:
20072007
if bftype in equilibrium_bif_points:
20082008
stop = bftype in self.StopAtPoints # Set stopping flag
2009-
if bftype is 'BP':
2009+
if bftype == 'BP':
20102010
method = Branch_Det(self.CorrFunc, self, save=True,
20112011
numpoints=self.MaxNumPoints+1)
20122012
self.TestFuncs.append(method)
20132013
self.BifPoints['BP'] = BranchPoint(method, iszero,
20142014
stop=stop)
2015-
elif bftype is 'LP':
2015+
elif bftype == 'LP':
20162016
#method1 = Fold_Bor(self.CorrFunc, self, corr=False,
20172017
# save=True, numpoints=self.MaxNumPoints+1)
20182018
#method1 = Fold_Det(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
@@ -2029,7 +2029,7 @@ def _createTestFuncs(self):
20292029
self.BifPoints['LP'] = FoldPoint([method1, method2],
20302030
[iszero, isnotzero],
20312031
stop=stop)
2032-
elif bftype is 'H':
2032+
elif bftype == 'H':
20332033
method = Hopf_Bor(self.CorrFunc, self, corr=False,
20342034
save=True, numpoints=self.MaxNumPoints+1)
20352035
#method = Hopf_Det(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
@@ -2151,18 +2151,18 @@ def _createTestFuncs(self):
21512151
method2 = Hopf_Bor(self.CorrFunc.sysfunc, self,
21522152
save=True, numpoints=self.MaxNumPoints+1)
21532153
self.TestFuncs.append(method2)
2154-
if bftype is 'BT':
2154+
if bftype == 'BT':
21552155
self.BifPoints['BT'] = BTPoint([method1, method2],
21562156
[iszero, iszero], stop=stop)
21572157
else:
21582158
self.BifPoints['ZH'] = ZHPoint([method1, method2],
21592159
[isnotzero, iszero], stop=stop)
2160-
elif bftype is 'CP':
2160+
elif bftype == 'CP':
21612161
method = CP_Fold(self.CorrFunc, self, save=True,
21622162
numpoints=self.MaxNumPoints+1)
21632163
self.TestFuncs.append(method)
21642164
self.BifPoints['CP'] = CPPoint(method, iszero, stop=stop)
2165-
elif bftype is 'BP':
2165+
elif bftype == 'BP':
21662166
method1 = BP_Fold(self.CorrFunc, self, 0, save=True,
21672167
numpoints=self.MaxNumPoints+1)
21682168
self.TestFuncs.append(method1)
@@ -2280,25 +2280,25 @@ def _createTestFuncs(self):
22802280
for bftype in self.LocBifPoints:
22812281
if bftype in hopf_bif_points:
22822282
stop = bftype in self.StopAtPoints # Set stopping flag
2283-
if bftype is 'BT':
2283+
if bftype == 'BT':
22842284
method = BT_Hopf_One(self.CorrFunc, self, save=True, \
22852285
numpoints=self.MaxNumPoints+1)
22862286
self.TestFuncs.append(method)
22872287

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

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

23002300
self.BifPoints['ZH'] = ZHPoint(method, iszero, stop=stop)
2301-
elif bftype is 'GH':
2301+
elif bftype == 'GH':
23022302
method = GH_Hopf_One(self.CorrFunc, self, save=True, \
23032303
numpoints=self.MaxNumPoints+1)
23042304
self.TestFuncs.append(method)
@@ -2434,17 +2434,17 @@ def _createTestFuncs(self):
24342434
for bftype in self.LocBifPoints:
24352435
if bftype in hopf_bif_points:
24362436
stop = bftype in self.StopAtPoints # Set stopping flag
2437-
if bftype is 'BT':
2437+
if bftype == 'BT':
24382438
method = BT_Hopf(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
24392439
self.TestFuncs.append(method)
24402440

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

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

@@ -2497,7 +2497,7 @@ def _createTestFuncs(self):
24972497
for bftype in self.LocBifPoints:
24982498
if bftype in fixedpoint_bif_points:
24992499
stop = bftype in self.StopAtPoints
2500-
if bftype is 'LPC':
2500+
if bftype == 'LPC':
25012501
method1 = Fold_Tan(self.CorrFunc, self, save=True,
25022502
numpoints=self.MaxNumPoints+1)
25032503
self.TestFuncs.append(method1)
@@ -2508,17 +2508,17 @@ def _createTestFuncs(self):
25082508
method2 = self.BifPoints['BP'].testfuncs[0]
25092509

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

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

25202520
self.BifPoints['NS'] = NSPoint(method, iszero, stop=stop)
2521-
elif bftype is 'BP':
2521+
elif bftype == 'BP':
25222522
if 'LPC' not in self.BifPoints.keys():
25232523
method = Branch_Det(self.CorrFunc, self, save=True, numpoints=self.MaxNumPoints+1)
25242524
self.TestFuncs.append(method)
@@ -2626,7 +2626,7 @@ def _createTestFuncs(self):
26262626
for bftype in self.LocBifPoints:
26272627
if bftype in fold_map_bif_points:
26282628
stop = bftype in self.StopAtPoints
2629-
if bftype is 'CP':
2629+
if bftype == 'CP':
26302630
method = CP_Fold(self.CorrFunc, self, save=True,
26312631
numpoints=self.MaxNumPoints+1)
26322632
self.TestFuncs.append(method)
@@ -2914,7 +2914,7 @@ def _createTestFuncs(self):
29142914
for bftype in self.LocBifPoints:
29152915
if bftype in cusp_bif_points:
29162916
stop = bftype in self.StopAtPoints
2917-
if bftype is 'BP':
2917+
if bftype == 'BP':
29182918
method = Branch_Det(self.CorrFunc, self, save=True,
29192919
numpoints=self.MaxNumPoints+1)
29202920
self.TestFuncs.remove(self.TestFuncs[-1])

PyDSTool/Variable.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1022,11 +1022,11 @@ def __del__(self):
10221022
# to be multiple attempts to delete it (which of course
10231023
# fail after the first successful attempt)
10241024
pass
1025-
elif fname is 'funcspec':
1025+
elif fname == 'funcspec':
10261026
# doesn't refer to any dynamically-created methods
10271027
# so ignore
10281028
pass
1029-
elif fname is 'outputdata':
1029+
elif fname == 'outputdata':
10301030
# doesn't refer to any dynamically-created methods
10311031
# so ignore
10321032
pass

0 commit comments

Comments
 (0)