general: undo some questional python 3.x conversions

This commit is contained in:
John Cote 2020-01-08 21:22:39 -05:00
parent 6bbd89c342
commit b03e2d6171
12 changed files with 16 additions and 26 deletions

View file

@ -20,7 +20,7 @@ class SuitPlannerInteriorAI:
self.dbg_defaultSuitType = None
else:
self.dbg_defaultSuitType = SuitDNA.getSuitType(dbg_defaultSuitName)
if isinstance(bldgLevel, bytes):
if isinstance(bldgLevel, str):
self.notify.warning('bldgLevel is a string!')
bldgLevel = int(bldgLevel)
self._genSuitInfos(numFloors, bldgLevel, bldgTrack)

View file

@ -3,7 +3,7 @@ from .CatalogAccessoryItemGlobals import *
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from toontown.toon import ToonDNA
import random, types
import random
from direct.showbase import PythonUtil
from direct.gui.DirectGui import *
from pandac.PandaModules import *
@ -231,7 +231,7 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
def applyColor(self, model, color):
if model == None or color == None:
return
if isinstance(color, bytes):
if isinstance(color, str):
tex = loader.loadTexture(color)
tex.setMinfilter(Texture.FTLinearMipmapLinear)
tex.setMagfilter(Texture.FTLinear)

View file

@ -5,7 +5,6 @@ from toontown.toonbase import ToontownGlobals
from direct.interval.IntervalGlobal import *
from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.PyDatagramIterator import PyDatagramIterator
import types
import sys
CatalogReverseType = None
CatalogItemVersion = 8
@ -333,7 +332,7 @@ class CatalogItem:
matches = model.findAllMatches(partName)
if color == None:
matches.hide()
elif isinstance(color, bytes):
elif isinstance(color, str):
tex = loader.loadTexture(color)
tex.setMinfilter(Texture.FTLinearMipmapLinear)
tex.setMagfilter(Texture.FTLinear)

View file

@ -1,6 +1,5 @@
from . import CatalogItem
from pandac.PandaModules import *
import types
from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.PyDatagramIterator import PyDatagramIterator
@ -10,7 +9,7 @@ class CatalogItemList:
self.store = store
self.__blob = None
self.__list = None
if isinstance(source, bytes):
if isinstance(source, str):
self.__blob = source
elif isinstance(source, list):
self.__list = source[:]

View file

@ -16,7 +16,6 @@ from direct.tkwidgets import Valuator
from direct.tkwidgets import VectorWidgets
from otp.level import LevelConstants
from direct.directtools import DirectSession
import types
import Pmw
class InGameEditor(AppShell):
@ -376,7 +375,7 @@ class InGameEditor(AppShell):
label = Label(frame, text=attribName, width=15, anchor=W, justify=LEFT)
label.pack(side=LEFT, expand=0)
for choice in params.get('choiceSet', []):
if type(choice) is bytes:
if type(choice) is str:
choiceStr = choice
else:
choiceStr = repr(choice)
@ -427,7 +426,7 @@ class InGameEditor(AppShell):
print('SENDING', value)
self.level.setAttribEdit(entId, attribName, value)
if type(choice) is bytes:
if type(choice) is str:
labelStr = choice
else:
labelStr = repr(choice)

View file

@ -1,4 +1,3 @@
import types
import time
from pandac.PandaModules import *
from direct.distributed.ClockDelta import *
@ -467,7 +466,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
dclass = self.dclassesByName[dclassName]
pad.avatar.updateAllRequiredFields(dclass, di)
gotData = 1
if isinstance(pad.func, bytes):
if isinstance(pad.func, str):
messenger.send(pad.func, list((gotData, pad.avatar) + pad.args))
else:
pad.func(*(gotData, pad.avatar) + pad.args)

View file

@ -1,7 +1,6 @@
import os
import sys
import time
import types
ltime = 1 and time.localtime()
logSuffix = '%02d%02d%02d_%02d%02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2],
@ -152,7 +151,7 @@ class ToontownLauncher(LauncherBase):
t = type(value)
if t == int:
WindowsRegistry.setIntValue(self.toontownRegistryKey, name, value)
elif t == bytes:
elif t == str:
WindowsRegistry.setStringValue(self.toontownRegistryKey, name, value)
else:
self.notify.warning('setRegistry: Invalid type for registry value: ' + repr(value))

View file

@ -13,7 +13,6 @@ from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from direct.showbase import PythonUtil
import random
import types
Component2IconDict = {'boredom': 'Bored',
'restlessness': None,
'playfulness': 'Play',
@ -633,7 +632,7 @@ class Pet(Avatar.Avatar):
def getInteractIval(self, interactId):
anims = self.InteractAnims[interactId]
if type(anims) == bytes:
if type(anims) == str:
animIval = ActorInterval(self, anims)
else:
animIval = Sequence()

View file

@ -1,6 +1,5 @@
from direct.showbase.PythonUtil import Enum, invertDictLossless
from direct.interval.IntervalGlobal import *
import types
import random
Tricks = Enum('JUMP, BEG, PLAYDEAD, ROLLOVER, BACKFLIP, DANCE, SPEAK, BALK,')
NonHappyMinActualTrickAptitude = 0.1
@ -62,7 +61,7 @@ TrickSounds = {Tricks.BACKFLIP: 'phase_5/audio/sfx/backflip.mp3',
def getSoundIval(trickId):
sounds = TrickSounds.get(trickId, None)
if sounds:
if type(sounds) == bytes:
if type(sounds) == str:
sound = loader.loadSfx(sounds)
return SoundInterval(sound)
else:
@ -79,7 +78,7 @@ def getTrickIval(pet, trickId):
anims = TrickAnims[trickId]
animRate = random.uniform(0.9, 1.1)
waitTime = random.uniform(0.0, 1.0)
if type(anims) == bytes:
if type(anims) == str:
if trickId == Tricks.JUMP:
animIval = Parallel()
animIval.append(ActorInterval(pet, anims, playRate=animRate))

View file

@ -14,7 +14,6 @@ from . import SuitDNA
from toontown.battle import BattleProps
from direct.showbase.PythonUtil import Functor
import string
import types
GenericModel = 'phase_9/models/char/bossCog'
ModelDict = {'s': 'phase_9/models/char/sellbotBoss',
'm': 'phase_10/models/char/cashbotBoss',
@ -535,7 +534,7 @@ class BossCog(Avatar.Avatar):
self.raised = 1
elif anim == 'Fb_fall':
ival = Parallel(ActorInterval(self, 'Fb_fall'), Sequence(SoundInterval(self.reelSfx, node=self), SoundInterval(self.deathSfx)))
elif isinstance(anim, bytes):
elif isinstance(anim, str):
ival = ActorInterval(self, anim)
else:
ival = anim

View file

@ -3,7 +3,6 @@ from direct.interval.IntervalGlobal import *
from otp.otpbase import OTPLocalizer
from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPLocalizer
import types
from direct.showbase import PythonUtil
from pandac.PandaModules import *
from libotp import *
@ -563,7 +562,7 @@ class TTEmote(Emote.Emote):
self.unlockStateChangeMsg()
def disable(self, index, toon):
if isinstance(index, bytes):
if isinstance(index, str):
index = OTPLocalizer.EmoteFuncDict[index]
self.emoteFunc[index][1] = self.emoteFunc[index][1] + 1
if toon is base.localAvatar:
@ -571,7 +570,7 @@ class TTEmote(Emote.Emote):
self.emoteEnableStateChanged()
def enable(self, index, toon):
if isinstance(index, bytes):
if isinstance(index, str):
index = OTPLocalizer.EmoteFuncDict[index]
self.emoteFunc[index][1] = self.emoteFunc[index][1] - 1
if toon is base.localAvatar:

View file

@ -25,7 +25,6 @@ from toontown.effects import DustCloud
from direct.showbase.PythonUtil import Functor
from toontown.distributed import DelayDelete
from . import AccessoryGlobals
import types
import importlib
import functools
@ -2196,7 +2195,7 @@ class Toon(Avatar.Avatar, ToonHead):
for partName, pieceNames in pieces:
part = self.getPart(partName, lodName)
if part:
if type(pieceNames) == bytes:
if type(pieceNames) == str:
pieceNames = (pieceNames,)
for pieceName in pieceNames:
npc = part.findAllMatches('**/%s;+s' % pieceName)