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)) Level.notify.debug('creating %s %s' % (spec['type'], entId))
entity = self.entityCreator.createEntity(entId) entity = self.entityCreator.createEntity(entId)
announce = False announce = False
if entity is 'nonlocalEnt': if entity == 'nonlocalEnt':
self.nonlocalEntIds[entId] = None self.nonlocalEntIds[entId] = None
elif entity is 'nothing': elif entity == 'nothing':
self.nothingEntIds[entId] = None self.nothingEntIds[entId] = None
announce = True announce = True
else: else:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -260,7 +260,7 @@ class Estate(Place.Place):
def teleportInDone(self): def teleportInDone(self):
self.notify.debug('teleportInDone') self.notify.debug('teleportInDone')
self.toonSubmerged = -1 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()') self.notify.info('add estate-check-toon-underwater to TaskMgr in teleportInDone()')
if hasattr(self, 'fsm'): if hasattr(self, 'fsm'):
taskMgr.add(self.__checkToonUnderwater, 'estate-check-toon-underwater') taskMgr.add(self.__checkToonUnderwater, 'estate-check-toon-underwater')

View file

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

View file

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

View file

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

View file

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

View file

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