general: fix some python 3.x SyntaxWarnings

This commit is contained in:
John Cote 2020-01-12 00:25:04 -05:00
parent 4f4054a751
commit db42556289
12 changed files with 24 additions and 24 deletions

View file

@ -104,9 +104,9 @@ class Level:
Level.notify.debug('creating %s %s' % (spec['type'], entId))
entity = self.entityCreator.createEntity(entId)
announce = False
if entity is 'nonlocalEnt':
if entity == 'nonlocalEnt':
self.nonlocalEntIds[entId] = None
elif entity is 'nothing':
elif entity == 'nothing':
self.nothingEntIds[entId] = None
announce = True
else:

View file

@ -49,7 +49,7 @@ class ModelEntity(BasicEntities.NodePathEntity):
floor = colNode.find('**/floor')
floor2 = floor.copyTo(colNode)
floor2.setZ(floor2, -.75)
if self.goonHatType is not 'none':
if self.goonHatType != 'none':
self.goonType = {'hardhat': 'pg',
'security': 'sg'}[self.goonHatType]
self.hat = self.model

View file

@ -75,7 +75,7 @@ class SCTerminal(SCElement):
def setCharges(self, nCharges):
self.__numCharges = nCharges
if nCharges is 0:
if nCharges == 0:
self.setDisabled(True)
def isDisabled(self):
@ -162,7 +162,7 @@ class SCTerminal(SCElement):
self.ignore(Emote.globalEmote.EmoteEnableStateChanged)
def getDisplayText(self):
if self.getCharges() is not -1:
if self.getCharges() != -1:
return self.text + ' (%s)' % self.getCharges()
else:
return self.text

View file

@ -20,7 +20,7 @@ def makePanel(toon, showToonName):
panel.initialiseoptions(RewardPanel)
panel.setTransparency(1)
panel.hide()
if showToonName is 1:
if showToonName == 1:
panel.avNameLabel = DirectLabel(parent=panel, relief=None, pos=Vec3(0, 0, 0.3), text=toon.getName(), text_scale=0.08)
return panel

View file

@ -759,7 +759,7 @@ class RewardPanel(DirectFrame):
track.append(Func(self.vanishFrames))
track.append(Fanfare.makeFanfare(0, toon)[0])
for i in range(len(endTracks)):
if endTracks[i] is 1:
if endTracks[i] == 1:
track += self.getEndTrackIntervalList(toon, toonList, i)
track.append(Func(self.cleanupEndTrack))

View file

@ -101,7 +101,7 @@ def getItemText(textId):
value = resistanceDict[menuIndex]['values'][itemIndex]
text = resistanceDict[menuIndex]['itemText']
if menuIndex is RESISTANCE_TOONUP:
if value is -1:
if value == -1:
value = TTL.ResistanceToonupItemMax
elif menuIndex is RESISTANCE_RESTOCK:
value = resistanceDict[menuIndex]['extra'][itemIndex]

View file

@ -260,7 +260,7 @@ class Estate(Place.Place):
def teleportInDone(self):
self.notify.debug('teleportInDone')
self.toonSubmerged = -1
if self.nextState is not 'petTutorial':
if self.nextState != 'petTutorial':
self.notify.info('add estate-check-toon-underwater to TaskMgr in teleportInDone()')
if hasattr(self, 'fsm'):
taskMgr.add(self.__checkToonUnderwater, 'estate-check-toon-underwater')

View file

@ -271,7 +271,7 @@ class BingoCardGui(DirectFrame):
def __indicateMatches(self, bFlipFlop, fish):
unmarkedMatches = self.getUnmarkedMatches(fish)
if len(unmarkedMatches) is 0:
if len(unmarkedMatches) == 0:
return Task.done
if bFlipFlop:
for cell in unmarkedMatches:
@ -429,7 +429,7 @@ class BingoCardGui(DirectFrame):
self.tutorial.hide()
def onMouseEnter(self, event):
if self.gameType['text'] is not '':
if self.gameType['text'] != '':
self.showTutorial(BG.TutorialCard)
def onMouseLeave(self, event):

View file

@ -175,7 +175,7 @@ class DistributedDivingGame(DistributedMinigame):
toonSD.status])
def fishSpawn(self, timestamp, fishcode, spawnerId, offset):
if self.dead is 1:
if self.dead == 1:
return
ts = globalClockDelta.localElapsedTime(timestamp)
if not hasattr(self, 'spawners'):
@ -414,7 +414,7 @@ class DistributedDivingGame(DistributedMinigame):
cSphereNodePath = crab.attachNewNode(cSphereNode)
cSphereNodePath.setScale(1, 3, 1)
self.accept('hitby-' + 'crabby' + str(i), self.fishCollision)
if i % 2 is 0:
if i % 2 == 0:
crab.setPos(20, 0, -40)
crab.direction = -1
else:
@ -731,7 +731,7 @@ class DistributedDivingGame(DistributedMinigame):
fish.sound.setVolume(volume)
self.hitSound.play()
self.hitSound.setVolume(volume)
if fish.name is 'bear' or fish.name is 'nurse':
if fish.name == 'bear' or fish.name == 'nurse':
return
colList = fish.findAllMatches('**/fc*')
for col in colList:

View file

@ -26,22 +26,22 @@ class DivingFishSpawn(DirectObject):
def createFish(self, fishcode):
loadBase = 'phase_4/models/char/'
if fishcode is 0:
if fishcode == 0:
fish = Actor.Actor('phase_4/models/char/clownFish-zero.bam', {'anim': loadBase + 'clownFish-swim.bam'})
fish.name = 'clown'
elif fishcode is 1:
elif fishcode == 1:
fish = Actor.Actor('phase_4/models/char/PBJfish-zero.bam', {'anim': 'phase_4/models/char/PBJfish-swim.bam'})
fish.name = 'pbj'
elif fishcode is 2:
elif fishcode == 2:
fish = Actor.Actor('phase_4/models/char/BearAcuda-zero.bam', {'anim': 'phase_4/models/char/BearAcuda-swim.bam'})
fish.name = 'bear'
elif fishcode is 3:
elif fishcode == 3:
fish = Actor.Actor(loadBase + 'balloonFish-zero.bam', {'anim': loadBase + 'balloonFish-swim.bam'})
fish.name = 'balloon'
elif fishcode is 4:
elif fishcode == 4:
fish = Actor.Actor(loadBase + 'nurseShark-zero.bam', {'anim': loadBase + 'nurseShark-swim.bam'})
fish.name = 'nurse'
elif fishcode is 5:
elif fishcode == 5:
fish = Actor.Actor(loadBase + 'pianoTuna-zero.bam', {'anim': loadBase + 'pianoTuna-swim.bam'})
fish.name = 'piano'
else:
@ -86,7 +86,7 @@ class DivingFishSpawn(DirectObject):
fish.setScale(1.4)
cSphere = CollisionSphere(0, 0, 0, 1)
fishSoundName = 'Piano_Tuna.mp3'
if self.direction is -1:
if self.direction == -1:
fish.setH(0)
else:
fish.setH(180)

View file

@ -110,7 +110,7 @@ class Train(DirectObject):
self.__getCars()
trainShouldStop = random.randrange(0, 4)
nextRun = Sequence(Func(self.__showStart))
if trainShouldStop is 0:
if trainShouldStop == 0:
waitTime = 3
totalTime = random.randrange(4, (self.MarkDelta - waitTime) / 2)
sfxStopTime = 4.3

View file

@ -407,7 +407,7 @@ class ToonHead(Actor.Actor):
if not hasattr(self, 'pumpkins'):
self.pumpkins = NodePathCollection()
ppath = 'phase_4/models/estate/pumpkin_'
if headStyle is 'l':
if headStyle == 'l':
if copy:
pmodel = loader.loadModel(ppath + 'tall')
else:
@ -442,7 +442,7 @@ class ToonHead(Actor.Actor):
if not hasattr(self, 'snowMen'):
self.snowMen = NodePathCollection()
snowManPath = 'phase_4/models/props/tt_m_efx_snowmanHead_'
if headStyle is 'l':
if headStyle == 'l':
snowManPath = snowManPath + 'tall'
else:
snowManPath = snowManPath + 'short'