From db425562899d7343e3e6ee7af6c4a24f28bfdf43 Mon Sep 17 00:00:00 2001 From: John Cote Date: Sun, 12 Jan 2020 00:25:04 -0500 Subject: [PATCH] general: fix some python 3.x SyntaxWarnings --- otp/level/Level.py | 4 ++-- otp/level/ModelEntity.py | 2 +- otp/speedchat/SCTerminal.py | 4 ++-- toontown/battle/Fanfare.py | 2 +- toontown/battle/RewardPanel.py | 2 +- toontown/chat/ResistanceChat.py | 2 +- toontown/estate/Estate.py | 2 +- toontown/fishing/BingoCardGui.py | 4 ++-- toontown/minigame/DistributedDivingGame.py | 6 +++--- toontown/minigame/DivingFishSpawn.py | 14 +++++++------- toontown/safezone/Train.py | 2 +- toontown/toon/ToonHead.py | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/otp/level/Level.py b/otp/level/Level.py index 875e92a..ed57433 100644 --- a/otp/level/Level.py +++ b/otp/level/Level.py @@ -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: diff --git a/otp/level/ModelEntity.py b/otp/level/ModelEntity.py index 2381f55..cb3b147 100644 --- a/otp/level/ModelEntity.py +++ b/otp/level/ModelEntity.py @@ -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 diff --git a/otp/speedchat/SCTerminal.py b/otp/speedchat/SCTerminal.py index d40a948..4674a28 100644 --- a/otp/speedchat/SCTerminal.py +++ b/otp/speedchat/SCTerminal.py @@ -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 diff --git a/toontown/battle/Fanfare.py b/toontown/battle/Fanfare.py index d93dedb..d5e4e30 100644 --- a/toontown/battle/Fanfare.py +++ b/toontown/battle/Fanfare.py @@ -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 diff --git a/toontown/battle/RewardPanel.py b/toontown/battle/RewardPanel.py index 0a4db0a..c02f3bd 100644 --- a/toontown/battle/RewardPanel.py +++ b/toontown/battle/RewardPanel.py @@ -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)) diff --git a/toontown/chat/ResistanceChat.py b/toontown/chat/ResistanceChat.py index d15cbc6..777753f 100644 --- a/toontown/chat/ResistanceChat.py +++ b/toontown/chat/ResistanceChat.py @@ -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] diff --git a/toontown/estate/Estate.py b/toontown/estate/Estate.py index 6368bcb..9f6e979 100644 --- a/toontown/estate/Estate.py +++ b/toontown/estate/Estate.py @@ -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') diff --git a/toontown/fishing/BingoCardGui.py b/toontown/fishing/BingoCardGui.py index 630658e..7680632 100644 --- a/toontown/fishing/BingoCardGui.py +++ b/toontown/fishing/BingoCardGui.py @@ -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): diff --git a/toontown/minigame/DistributedDivingGame.py b/toontown/minigame/DistributedDivingGame.py index 4abd274..9153dc6 100644 --- a/toontown/minigame/DistributedDivingGame.py +++ b/toontown/minigame/DistributedDivingGame.py @@ -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: diff --git a/toontown/minigame/DivingFishSpawn.py b/toontown/minigame/DivingFishSpawn.py index 84bdcef..5a093ac 100644 --- a/toontown/minigame/DivingFishSpawn.py +++ b/toontown/minigame/DivingFishSpawn.py @@ -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) diff --git a/toontown/safezone/Train.py b/toontown/safezone/Train.py index 1c34c7a..a38a677 100644 --- a/toontown/safezone/Train.py +++ b/toontown/safezone/Train.py @@ -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 diff --git a/toontown/toon/ToonHead.py b/toontown/toon/ToonHead.py index 9e04ee0..7a0769b 100644 --- a/toontown/toon/ToonHead.py +++ b/toontown/toon/ToonHead.py @@ -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'