remove extra paren from assert

This commit is contained in:
Dave Schuyler 2006-01-09 22:18:28 +00:00
parent bd23b0968d
commit 86f4c2e68e
33 changed files with 168 additions and 168 deletions

View File

@ -18,7 +18,7 @@ class CRCache:
"""
Delete each item in the cache then clear all references to them
"""
assert(self.checkCache())
assert self.checkCache()
CRCache.notify.debug("Flushing the cache")
for distObj in self.dict.values():
distObj.deleteOrDelay()
@ -28,8 +28,8 @@ class CRCache:
def cache(self, distObj):
# Only distributed objects are allowed in the cache
assert(isinstance(distObj, DistributedObject.DistributedObject))
assert(self.checkCache())
assert isinstance(distObj, DistributedObject.DistributedObject)
assert self.checkCache()
# Get the doId
doId = distObj.getDoId()
# Error check
@ -53,10 +53,10 @@ class CRCache:
oldestDistObj.deleteOrDelay()
# Make sure that the fifo and the dictionary are sane
assert(len(self.dict) == len(self.fifo))
assert len(self.dict) == len(self.fifo)
def retrieve(self, doId):
assert(self.checkCache())
assert self.checkCache()
if self.dict.has_key(doId):
# Find the object
distObj = self.dict[doId]
@ -74,8 +74,8 @@ class CRCache:
return self.dict.has_key(doId)
def delete(self, doId):
assert(self.checkCache())
assert(self.dict.has_key(doId))
assert self.checkCache()
assert self.dict.has_key(doId)
# Look it up
distObj = self.dict[doId]
# Remove it from the dict and fifo
@ -90,5 +90,5 @@ class CRCache:
from pandac.PandaModules import NodePath
for obj in self.dict.values():
if isinstance(obj, NodePath):
assert(not obj.isEmpty() and obj.getTopNode() != render.node())
assert not obj.isEmpty() and obj.getTopNode() != render.node()
return 1

View File

@ -259,7 +259,7 @@ class ClientRepository(ConnectionRepository):
# ...it is in our dictionary.
# Just update it.
distObj = self.doId2do[doId]
assert(distObj.dclass == dclass)
assert distObj.dclass == dclass
distObj.generate()
distObj.setLocation(parentId, zoneId)
distObj.updateRequiredFields(dclass, di)
@ -268,7 +268,7 @@ class ClientRepository(ConnectionRepository):
# ...it is in the cache.
# Pull it out of the cache:
distObj = self.cache.retrieve(doId)
assert(distObj.dclass == dclass)
assert distObj.dclass == dclass
# put it in the dictionary:
self.doId2do[doId] = distObj
# and update it.
@ -330,7 +330,7 @@ class ClientRepository(ConnectionRepository):
# ...it is in our dictionary.
# Just update it.
distObj = self.doId2do[doId]
assert(distObj.dclass == dclass)
assert distObj.dclass == dclass
distObj.generate()
distObj.setLocation(parentId, zoneId)
distObj.updateRequiredOtherFields(dclass, di)
@ -339,7 +339,7 @@ class ClientRepository(ConnectionRepository):
# ...it is in the cache.
# Pull it out of the cache:
distObj = self.cache.retrieve(doId)
assert(distObj.dclass == dclass)
assert distObj.dclass == dclass
# put it in the dictionary:
self.doId2do[doId] = distObj
# and update it.
@ -372,7 +372,7 @@ class ClientRepository(ConnectionRepository):
# ...it is in our dictionary.
# Just update it.
distObj = self.doId2ownerView[doId]
assert(distObj.dclass == dclass)
assert distObj.dclass == dclass
distObj.generate()
distObj.updateRequiredOtherFields(dclass, di)
# updateRequiredOtherFields calls announceGenerate
@ -380,7 +380,7 @@ class ClientRepository(ConnectionRepository):
# ...it is in the cache.
# Pull it out of the cache:
distObj = self.cacheOwner.retrieve(doId)
assert(distObj.dclass == dclass)
assert distObj.dclass == dclass
# put it in the dictionary:
self.doId2ownerView[doId] = distObj
# and update it.
@ -754,7 +754,7 @@ class ClientRepository(ConnectionRepository):
## # server.
##
## id = obj.doId
## assert(self.isLocalId(id))
## assert self.isLocalId(id)
## self.sendDeleteMsg(id, 1)
## obj.zone = zoneId
## self.send(obj.dclass.clientFormatGenerate(obj, id, zoneId, []))

View File

@ -96,7 +96,7 @@ class ClockDelta(DirectObject.DirectObject):
timeDelta is equal to the amount of time, in seconds,
that has been added to the global clock
"""
assert(self.notify.debug("adjusting timebase by %f seconds" % timeDelta))
assert self.notify.debug("adjusting timebase by %f seconds" % timeDelta)
# adjust our timebase by the same amount
self.delta += timeDelta
@ -142,7 +142,7 @@ class ClockDelta(DirectObject.DirectObject):
# of some other request, and our local timestamp may have
# been resynced since then: ergo, the timestamp in this
# request is meaningless.
assert(self.notify.debug("Ignoring request for resync from %s within %.3f s." % (avId, now - self.lastResync)))
assert self.notify.debug("Ignoring request for resync from %s within %.3f s." % (avId, now - self.lastResync))
return -1
# The timestamp value will be a timestamp that we sent out

View File

@ -52,7 +52,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
def setParentingRules(self, style, rule):
assert self.notify.debug("setParentingRules: style: %s, rule: %s" % (style, rule))
rules = rule.split(self.RuleSeparator)
assert(len(rules) == 3)
assert len(rules) == 3
self.style = style
self.startingZone = int(rules[0])
self.gridSize = int(rules[1])

View File

@ -90,15 +90,15 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath):
self.sendUpdate("setParent", [parentToken])
def setParentStr(self, parentTokenStr):
assert(self.notify.debug('setParentStr: %s' % parentTokenStr))
assert(self.notify.debug('isGenerated: %s' % self.isGenerated()))
assert self.notify.debug('setParentStr: %s' % parentTokenStr)
assert self.notify.debug('isGenerated: %s' % self.isGenerated())
self.do_setParent(parentTokenStr)
if len(parentTokenStr) > 0:
self.gotStringParentToken = 1
def setParent(self, parentToken):
assert(self.notify.debug('setParent: %s' % parentToken))
assert(self.notify.debug('isGenerated: %s' % self.isGenerated()))
assert self.notify.debug('setParent: %s' % parentToken)
assert self.notify.debug('isGenerated: %s' % self.isGenerated())
# if we are not yet generated and we just got a parent token
# as a string, ignore whatever value comes in here
justGotRequiredParentAsStr = ((not self.isGenerated()) and

View File

@ -96,14 +96,14 @@ class DistributedObject(DistributedObjectBase):
except Exception, e: print "%serror printing status"%(spaces,), e
def setNeverDisable(self, bool):
assert((bool == 1) or (bool == 0))
assert (bool == 1) or (bool == 0)
self.neverDisable = bool
def getNeverDisable(self):
return self.neverDisable
def setCacheable(self, bool):
assert((bool == 1) or (bool == 0))
assert (bool == 1) or (bool == 0)
self.cacheable = bool
def getCacheable(self):
@ -167,7 +167,7 @@ class DistributedObject(DistributedObjectBase):
Sends a message to the world after the object has been
generated and all of its required fields filled in.
"""
assert(self.notify.debug('announceGenerate(): %s' % (self.doId)))
assert self.notify.debug('announceGenerate(): %s' % (self.doId))
if self.activeState != ESGenerated:
self.activeState = ESGenerated
messenger.send(self.uniqueName("generate"), [self])
@ -176,7 +176,7 @@ class DistributedObject(DistributedObjectBase):
"""
Inheritors should redefine this to take appropriate action on disable
"""
assert(self.notify.debug('disable(): %s' % (self.doId)))
assert self.notify.debug('disable(): %s' % (self.doId))
if self.activeState != ESDisabled:
self.activeState = ESDisabled
self.__callbacks = {}
@ -203,7 +203,7 @@ class DistributedObject(DistributedObjectBase):
"""
Inheritors should redefine this to take appropriate action on delete
"""
assert(self.notify.debug('delete(): %s' % (self.doId)))
assert self.notify.debug('delete(): %s' % (self.doId))
try:
self.DistributedObject_deleted
except:
@ -339,10 +339,10 @@ class DistributedObject(DistributedObjectBase):
if base.localAvatar.doId in avIds:
# We found localToon's id; stop here.
self.__barrierContext = (context, name)
assert(self.notify.debug('setBarrierData(%s, %s)' % (context, name)))
assert self.notify.debug('setBarrierData(%s, %s)' % (context, name))
return
assert(self.notify.debug('setBarrierData(%s)' % (None)))
assert self.notify.debug('setBarrierData(%s)' % (None))
self.__barrierContext = None
def doneBarrier(self, name = None):
@ -359,13 +359,13 @@ class DistributedObject(DistributedObjectBase):
if self.__barrierContext != None:
context, aiName = self.__barrierContext
if name == None or name == aiName:
assert(self.notify.debug('doneBarrier(%s, %s)' % (context, aiName)))
assert self.notify.debug('doneBarrier(%s, %s)' % (context, aiName))
self.sendUpdate("setBarrierReady", [context])
self.__barrierContext = None
else:
assert(self.notify.debug('doneBarrier(%s) ignored; current barrier is %s' % (name, aiName)))
assert self.notify.debug('doneBarrier(%s) ignored; current barrier is %s' % (name, aiName))
else:
assert(self.notify.debug('doneBarrier(%s) ignored; no active barrier.' % (name)))
assert self.notify.debug('doneBarrier(%s) ignored; no active barrier.' % (name))
def addInterest(self, zoneId, note="", event=None):
self.cr.addInterest(self.getDoId(), zoneId, note, event)

View File

@ -93,7 +93,7 @@ class DistributedObjectAI(DistributedObjectBase):
# prevent this code from executing multiple times
if self.air is not None:
# self.doId may not exist. The __dict__ syntax works around that.
assert(self.notify.debug('delete(): %s' % (self.__dict__.get("doId"))))
assert self.notify.debug('delete(): %s' % (self.__dict__.get("doId")))
if not self._DOAI_requestedDelete:
# this logs every delete that was not requested by us.
@ -460,7 +460,7 @@ class DistributedObjectAI(DistributedObjectBase):
# We assume the context number is passed as a uint16.
self.__nextBarrierContext = (self.__nextBarrierContext + 1) & 0xffff
assert(self.notify.debug('beginBarrier(%s, %s, %s, %s)' % (context, name, avIds, timeout)))
assert self.notify.debug('beginBarrier(%s, %s, %s, %s)' % (context, name, avIds, timeout))
if avIds:
barrier = Barrier.Barrier(
@ -499,7 +499,7 @@ class DistributedObjectAI(DistributedObjectBase):
# Generated by the clients to check in after a beginBarrier()
# call.
avId = self.air.GetAvatarIDFromSender()
assert(self.notify.debug('setBarrierReady(%s, %s)' % (context, avId)))
assert self.notify.debug('setBarrierReady(%s, %s)' % (context, avId))
barrier = self.__barriers.get(context)
if barrier == None:
# This may be None if a client was slow and missed an
@ -509,7 +509,7 @@ class DistributedObjectAI(DistributedObjectBase):
barrier.clear(avId)
def __barrierCallback(self, context, callback, avIds):
assert(self.notify.debug('barrierCallback(%s, %s)' % (context, avIds)))
assert self.notify.debug('barrierCallback(%s, %s)' % (context, avIds))
# The callback that is generated when a barrier is completed.
barrier = self.__barriers.get(context)
if barrier:

View File

@ -122,7 +122,7 @@ class DistributedObjectOV(DistributedObjectBase):
Sends a message to the world after the object has been
generated and all of its required fields filled in.
"""
assert(self.notify.debug('announceGenerate(): %s' % (self.doId)))
assert self.notify.debug('announceGenerate(): %s' % (self.doId))
if self.activeState != ESGenerated:
self.activeState = ESGenerated
messenger.send(self.uniqueName("generate"), [self])
@ -131,7 +131,7 @@ class DistributedObjectOV(DistributedObjectBase):
"""
Inheritors should redefine this to take appropriate action on disable
"""
assert(self.notify.debug('disable(): %s' % (self.doId)))
assert self.notify.debug('disable(): %s' % (self.doId))
if self.activeState != ESDisabled:
self.activeState = ESDisabled
@ -154,7 +154,7 @@ class DistributedObjectOV(DistributedObjectBase):
"""
Inheritors should redefine this to take appropriate action on delete
"""
assert(self.notify.debug('delete(): %s' % (self.doId)))
assert self.notify.debug('delete(): %s' % (self.doId))
try:
self.DistributedObjectOV_deleted
except:

View File

@ -93,7 +93,7 @@ class DistributedObjectUD(DistributedObjectBase):
# prevent this code from executing multiple times
if self.air is not None:
# self.doId may not exist. The __dict__ syntax works around that.
assert(self.notify.debug('delete(): %s' % (self.__dict__.get("doId"))))
assert self.notify.debug('delete(): %s' % (self.__dict__.get("doId")))
if not self._DOUD_requestedDelete:
# this logs every delete that was not requested by us.
@ -405,7 +405,7 @@ class DistributedObjectUD(DistributedObjectBase):
# We assume the context number is passed as a uint16.
self.__nextBarrierContext = (self.__nextBarrierContext + 1) & 0xffff
assert(self.notify.debug('beginBarrier(%s, %s, %s, %s)' % (context, name, avIds, timeout)))
assert self.notify.debug('beginBarrier(%s, %s, %s, %s)' % (context, name, avIds, timeout))
if avIds:
barrier = Barrier.Barrier(
@ -444,7 +444,7 @@ class DistributedObjectUD(DistributedObjectBase):
# Generated by the clients to check in after a beginBarrier()
# call.
avId = self.air.GetAvatarIDFromSender()
assert(self.notify.debug('setBarrierReady(%s, %s)' % (context, avId)))
assert self.notify.debug('setBarrierReady(%s, %s)' % (context, avId))
barrier = self.__barriers.get(context)
if barrier == None:
# This may be None if a client was slow and missed an
@ -454,7 +454,7 @@ class DistributedObjectUD(DistributedObjectBase):
barrier.clear(avId)
def __barrierCallback(self, context, callback, avIds):
assert(self.notify.debug('barrierCallback(%s, %s)' % (context, avIds)))
assert self.notify.debug('barrierCallback(%s, %s)' % (context, avIds))
# The callback that is generated when a barrier is completed.
barrier = self.__barriers.get(context)
if barrier:

View File

@ -126,7 +126,7 @@ class ParentMgr:
(repr(child), token))
child.reparentTo(self.token2nodepath[token])
# remove this child from the child->parent table
assert (self.pendingChild2parentToken[child] == token)
assert self.pendingChild2parentToken[child] == token
del self.pendingChild2parentToken[child]
def unregisterParent(self, token):

View File

@ -76,7 +76,7 @@ class RelatedObjectMgr(DirectObject.DirectObject):
See Also: abortRequest()
"""
assert(self.notify.debug("requestObjects(%s, timeout=%s)" % (doIdList, timeout)))
assert self.notify.debug("requestObjects(%s, timeout=%s)" % (doIdList, timeout))
# First, see if we have all of the objects already.
objects, doIdsPending = self.__generateObjectList(doIdList)
@ -91,14 +91,14 @@ class RelatedObjectMgr(DirectObject.DirectObject):
if len(doIdsPending) == 0:
# All the objects exist, so just call the callback
# immediately.
assert(self.notify.debug("All objects already exist."))
assert self.notify.debug("All objects already exist.")
if allCallback:
allCallback(objects)
return
# Some objects don't exist yet, so start listening for them, and
# also set a timeout in case they don't come.
assert(self.notify.debug("Some objects pending: %s" % (doIdsPending)))
assert self.notify.debug("Some objects pending: %s" % (doIdsPending))
# Make a copy of the original doIdList, so we can save it over
# a period of time without worrying about the caller modifying
@ -108,7 +108,7 @@ class RelatedObjectMgr(DirectObject.DirectObject):
doLaterName = None
if timeout != None:
doLaterName = "RelatedObject-%s" % (RelatedObjectMgr.doLaterSequence)
assert(self.notify.debug("doLaterName = %s" % (doLaterName)))
assert self.notify.debug("doLaterName = %s" % (doLaterName))
RelatedObjectMgr.doLaterSequence += 1
@ -141,7 +141,7 @@ class RelatedObjectMgr(DirectObject.DirectObject):
"""
if tuple:
allCallback, eachCallback, timeoutCallback, doIdsPending, doIdList, doLaterName = tuple
assert(self.notify.debug("aborting request for %s (remaining: %s)" % (doIdList, doIdsPending)))
assert self.notify.debug("aborting request for %s (remaining: %s)" % (doIdList, doIdsPending))
if doLaterName:
taskMgr.remove(doLaterName)
@ -170,7 +170,7 @@ class RelatedObjectMgr(DirectObject.DirectObject):
def __timeoutExpired(self, tuple):
allCallback, eachCallback, timeoutCallback, doIdsPending, doIdList, doLaterName = tuple
assert(self.notify.debug("timeout expired for %s (remaining: %s)" % (doIdList, doIdsPending)))
assert self.notify.debug("timeout expired for %s (remaining: %s)" % (doIdList, doIdsPending))
self.__removePending(tuple, doIdsPending)
@ -197,20 +197,20 @@ class RelatedObjectMgr(DirectObject.DirectObject):
def __listenFor(self, doId):
# Start listening for the indicated object to be generated.
assert(self.notify.debug("Now listening for generate from %s" % (doId)))
assert self.notify.debug("Now listening for generate from %s" % (doId))
announceGenerateName = "generate-%s" % (doId)
self.acceptOnce(announceGenerateName, self.__generated)
def __noListenFor(self, doId):
# Stop listening for the indicated object to be generated.
assert(self.notify.debug("No longer listening for generate from %s" % (doId)))
assert self.notify.debug("No longer listening for generate from %s" % (doId))
announceGenerateName = "generate-%s" % (doId)
self.ignore(announceGenerateName)
def __generated(self, object):
# The indicated object has been generated.
doId = object.doId
assert(self.notify.debug("Got generate from %s" % (doId)))
assert self.notify.debug("Got generate from %s" % (doId))
pendingList = self.pendingObjects[doId]
del self.pendingObjects[doId]
@ -229,7 +229,7 @@ class RelatedObjectMgr(DirectObject.DirectObject):
if len(doIdsPending) == 0:
# That was the last doId on the list. Call the
# allCallback!
assert(self.notify.debug("All objects generated on list: %s" % (doIdList,)))
assert self.notify.debug("All objects generated on list: %s" % (doIdList,))
if doLaterName:
taskMgr.remove(doLaterName)
@ -238,7 +238,7 @@ class RelatedObjectMgr(DirectObject.DirectObject):
allCallback(objects)
else:
assert(self.notify.debug("Objects still pending: %s" % (doIdsPending)))
assert self.notify.debug("Objects still pending: %s" % (doIdsPending))
def __generateObjectList(self, doIdList):
objects = []

View File

@ -311,7 +311,7 @@ class MethodSpecification(FunctionSpecification):
if (i < (len(thislessArgTypes)-1)):
file.write(', ')
file.write(')\n')
indent(file, nesting+2, 'assert(self.this != 0)\n')
indent(file, nesting+2, 'assert self.this != 0\n')
if self.typeDescriptor.userManagesMemory:
indent(file, nesting+2, 'self.userManagesMemory = 1\n')
@ -389,7 +389,7 @@ class MethodSpecification(FunctionSpecification):
# normal system, it actually deletes the old Python object causing the C++ memory
# to be deleted then returns a new Python shadow object with the old C++ pointer... BAD!
if self.getFinalName() in augmentedAssignments:
indent(file, nesting+2, 'assert(self.this == returnValue)\n')
indent(file, nesting+2, 'assert self.this == returnValue\n')
indent(file, nesting+2, 'return self\n')
else:
returnType = self.typeDescriptor.returnType.recursiveTypeDescriptor()

View File

@ -101,14 +101,14 @@ class ClassicFSM(DirectObject):
return str
def enterInitialState(self, argList=[]):
assert(not self.__internalStateInFlux)
assert not self.__internalStateInFlux
if self.__currentState == self.__initialState:
return
assert(self.__currentState == None)
assert self.__currentState == None
self.__internalStateInFlux = 1
self.__enter(self.__initialState, argList)
assert(not self.__internalStateInFlux)
assert not self.__internalStateInFlux
# setters and getters
@ -170,8 +170,8 @@ class ClassicFSM(DirectObject):
"""
Exit the current state
"""
assert(self.__internalStateInFlux)
assert(ClassicFSM.notify.debug("[%s]: exiting %s" % (self.__name, self.__currentState.getName())))
assert self.__internalStateInFlux
assert ClassicFSM.notify.debug("[%s]: exiting %s" % (self.__name, self.__currentState.getName()))
self.__currentState.exit(argList)
# Only send the state change event if we are inspecting it
# If this event turns out to be generally useful, we can
@ -185,10 +185,10 @@ class ClassicFSM(DirectObject):
"""
Enter a given state, if it exists
"""
assert(self.__internalStateInFlux)
assert self.__internalStateInFlux
stateName = aState.getName()
if (stateName in self.__states):
assert(ClassicFSM.notify.debug("[%s]: entering %s" % (self.__name, stateName)))
assert ClassicFSM.notify.debug("[%s]: entering %s" % (self.__name, stateName))
self.__currentState = aState
# Only send the state change event if we are inspecting it
# If this event turns out to be generally useful, we can
@ -212,11 +212,11 @@ class ClassicFSM(DirectObject):
"""__transition(self, State, enterArgList, exitArgList)
Exit currentState and enter given one
"""
assert(not self.__internalStateInFlux)
assert not self.__internalStateInFlux
self.__internalStateInFlux = 1
self.__exitCurrent(exitArgList)
self.__enter(aState, enterArgList)
assert(not self.__internalStateInFlux)
assert not self.__internalStateInFlux
def request(self, aStateName, enterArgList=[], exitArgList=[],
force=0):
@ -230,7 +230,7 @@ class ClassicFSM(DirectObject):
# exitState() function for the previous state. This is not
# supported because we're not fully transitioned into the new
# state yet.
assert(not self.__internalStateInFlux)
assert not self.__internalStateInFlux
if not self.__currentState:
# Make this a warning for now
@ -318,7 +318,7 @@ class ClassicFSM(DirectObject):
ClassicFSM transitions, letting the same fn be used for different states
that may not have the same out transitions.
"""
assert(not self.__internalStateInFlux)
assert not self.__internalStateInFlux
if not self.__currentState:
# Make this a warning for now
ClassicFSM.notify.warning("[%s]: request: never entered initial state" %

View File

@ -161,7 +161,7 @@ class FSM(DirectObject.DirectObject):
def cleanup(self):
# A convenience function to force the FSM to clean itself up
# by transitioning to the "Off" state.
assert(self.state)
assert self.state
if self.state != 'Off':
self.__setState('Off')
@ -187,7 +187,7 @@ class FSM(DirectObject.DirectObject):
bypasses the filterState() function, and just calls
exitState() followed by enterState()."""
assert(isinstance(request, types.StringTypes))
assert isinstance(request, types.StringTypes)
self.notify.debug("%s.forceTransition(%s, %s" % (self.name, request, str(args)[1:]))
if not self.state:
@ -209,7 +209,7 @@ class FSM(DirectObject.DirectObject):
sequence.
"""
assert(isinstance(request, types.StringTypes))
assert isinstance(request, types.StringTypes)
self.notify.debug("%s.demand(%s, %s" % (self.name, request, str(args)[1:]))
if not self.state:
# Queue up the request.
@ -242,7 +242,7 @@ class FSM(DirectObject.DirectObject):
which will queue these requests up and apply when the
transition is complete)."""
assert(isinstance(request, types.StringTypes))
assert isinstance(request, types.StringTypes)
self.notify.debug("%s.request(%s, %s" % (self.name, request, str(args)[1:]))
if not self.state:
@ -317,7 +317,7 @@ class FSM(DirectObject.DirectObject):
# In either case, we quietly ignore unhandled command
# (lowercase) requests.
assert(self.notify.debug("%s ignoring request %s from state %s." % (self.name, request, self.state)))
assert self.notify.debug("%s ignoring request %s from state %s." % (self.name, request, self.state))
return None
def filterOff(self, request, args):
@ -334,7 +334,7 @@ class FSM(DirectObject.DirectObject):
def requestNext(self, *args):
"""request the 'next' state in the predefined state array"""
assert (self.state in self.stateArray)
assert self.state in self.stateArray
curIndex = self.stateArray.index(self.state)
newIndex = (curIndex + 1) % len(self.stateArray)
@ -343,7 +343,7 @@ class FSM(DirectObject.DirectObject):
def requestPrev(self, *args):
"""request the 'previous' state in the predefined state array"""
assert (self.state in self.stateArray)
assert self.state in self.stateArray
curIndex = self.stateArray.index(self.state)
newIndex = (curIndex - 1) % len(self.stateArray)
@ -354,8 +354,8 @@ class FSM(DirectObject.DirectObject):
def __setState(self, newState, *args):
# Internal function to change unconditionally to the indicated
# state.
assert(self.state)
assert(self.notify.debug("%s to state %s." % (self.name, newState)))
assert self.state
assert self.notify.debug("%s to state %s." % (self.name, newState))
self.oldState = self.state
self.newState = newState
@ -384,13 +384,13 @@ class FSM(DirectObject.DirectObject):
if self.__requestQueue:
request = self.__requestQueue.pop(0)
assert(self.notify.debug("%s continued queued request." % (self.name)))
assert self.notify.debug("%s continued queued request." % (self.name))
request()
def __callTransitionFunc(self, name, *args):
# Calls the appropriate enter or exit function when
# transitioning between states, if it exists.
assert(self.state == None)
assert self.state == None
func = getattr(self, name, None)
if func:

View File

@ -89,7 +89,7 @@ class FourState:
off (and so is state 2 which is oposite of 4 and therefore
oposite of 'on').
"""
assert(self.debugPrint("FourState(names=%s)"%(names)))
assert self.debugPrint("FourState(names=%s)"%(names))
self.track = None
self.stateTime = 0.0
self.names = names
@ -130,7 +130,7 @@ class FourState:
self.fsm.enterInitialState()
def setTrack(self, track):
assert(self.debugPrint("setTrack(track=%s)"%(track,)))
assert self.debugPrint("setTrack(track=%s)"%(track,))
if self.track is not None:
self.track.pause()
self.track = None
@ -146,27 +146,27 @@ class FourState:
# If the client wants the state changed it needs to
# send a request to the AI.
#def setIsOn(self, isOn):
# assert(self.debugPrint("setIsOn(isOn=%s)"%(isOn,)))
# assert self.debugPrint("setIsOn(isOn=%s)"%(isOn,))
# pass
def isOn(self):
assert(self.debugPrint("isOn() returning %s (stateIndex=%s)"%(self.stateIndex==4, self.stateIndex)))
assert self.debugPrint("isOn() returning %s (stateIndex=%s)"%(self.stateIndex==4, self.stateIndex))
return self.stateIndex==4
def changedOnState(self, isOn):
"""
Allow derived classes to overide this.
"""
assert(self.debugPrint("changedOnState(isOn=%s)"%(isOn,)))
assert self.debugPrint("changedOnState(isOn=%s)"%(isOn,))
##### state 0 #####
def enterState0(self):
assert(self.debugPrint("enter0()"))
assert self.debugPrint("enter0()")
self.enterStateN(0)
def exitState0(self):
assert(self.debugPrint("exit0()"))
assert self.debugPrint("exit0()")
# It's important for FourStates to broadcast their state
# when they are generated on the client. Before I put this in,
# if a door was generated and went directly to an 'open' state,
@ -176,39 +176,39 @@ class FourState:
##### state 1 #####
def enterState1(self):
assert(self.debugPrint("enterState1()"))
assert self.debugPrint("enterState1()")
self.enterStateN(1)
def exitState1(self):
assert(self.debugPrint("exitState1()"))
assert self.debugPrint("exitState1()")
##### state 2 #####
def enterState2(self):
assert(self.debugPrint("enterState2()"))
assert self.debugPrint("enterState2()")
self.enterStateN(2)
def exitState2(self):
assert(self.debugPrint("exitState2()"))
assert self.debugPrint("exitState2()")
##### state 3 #####
def enterState3(self):
assert(self.debugPrint("enterState3()"))
assert self.debugPrint("enterState3()")
self.enterStateN(3)
def exitState3(self):
assert(self.debugPrint("exitState3()"))
assert self.debugPrint("exitState3()")
##### state 4 #####
def enterState4(self):
assert(self.debugPrint("enterState4()"))
assert self.debugPrint("enterState4()")
self.enterStateN(4)
self.changedOnState(1)
def exitState4(self):
assert(self.debugPrint("exitState4()"))
assert self.debugPrint("exitState4()")
self.changedOnState(0)
if __debug__:

View File

@ -135,7 +135,7 @@ class FourStateAI:
self.fsm.enterInitialState()
def delete(self):
assert(self.debugPrint("delete()"))
assert self.debugPrint("delete()")
if self.doLaterTask is not None:
self.doLaterTask.remove()
del self.doLaterTask
@ -143,15 +143,15 @@ class FourStateAI:
del self.fsm
def getState(self):
assert(self.debugPrint("getState() returning %s"%(self.stateIndex,)))
assert self.debugPrint("getState() returning %s"%(self.stateIndex,))
return [self.stateIndex]
def sendState(self):
assert(self.debugPrint("sendState()"))
assert self.debugPrint("sendState()")
self.sendUpdate('setState', self.getState())
def setIsOn(self, isOn):
assert(self.debugPrint("setIsOn(isOn=%s)"%(isOn,)))
assert self.debugPrint("setIsOn(isOn=%s)"%(isOn,))
if isOn:
if self.stateIndex != 4:
# ...if it's not On; request turning on:
@ -168,7 +168,7 @@ class FourStateAI:
# self.fsm.request(self.states[nextState])
def isOn(self):
assert(self.debugPrint("isOn() returning %s (stateIndex=%s)"%(self.stateIndex==4, self.stateIndex)))
assert self.debugPrint("isOn() returning %s (stateIndex=%s)"%(self.stateIndex==4, self.stateIndex))
return self.stateIndex==4
def changedOnState(self, isOn):
@ -177,12 +177,12 @@ class FourStateAI:
The self.isOn value has toggled. Call getIsOn() to
get the current state.
"""
assert(self.debugPrint("changedOnState(isOn=%s)"%(isOn,)))
assert self.debugPrint("changedOnState(isOn=%s)"%(isOn,))
##### states #####
def switchToNextStateTask(self, task):
assert(self.debugPrint("switchToNextStateTask()"))
assert self.debugPrint("switchToNextStateTask()")
self.fsm.request(self.states[self.nextStateIndex])
return Task.done
@ -191,7 +191,7 @@ class FourStateAI:
This function is intentionaly simple so that derived classes
may easily alter the network message.
"""
assert(self.debugPrint("distributeStateChange()"))
assert self.debugPrint("distributeStateChange()")
self.sendState()
def enterStateN(self, stateIndex, nextStateIndex):
@ -208,7 +208,7 @@ class FourStateAI:
"enterStateN-timer-%s"%id(self))
def exitStateN(self):
assert(self.debugPrint("exitStateN()"))
assert self.debugPrint("exitStateN()")
if self.doLaterTask:
taskMgr.remove(self.doLaterTask)
self.doLaterTask=None
@ -216,51 +216,51 @@ class FourStateAI:
##### state 0 #####
def enterState0(self):
assert(self.debugPrint("enter0()"))
assert self.debugPrint("enter0()")
self.enterStateN(0, 0)
def exitState0(self):
assert(self.debugPrint("exit0()"))
assert self.debugPrint("exit0()")
##### state 1 #####
def enterState1(self):
#assert(self.debugPrint("enterState1()"))
#assert self.debugPrint("enterState1()")
self.enterStateN(1, 2)
def exitState1(self):
assert(self.debugPrint("exitState1()"))
assert self.debugPrint("exitState1()")
self.exitStateN()
##### state 2 #####
def enterState2(self):
#assert(self.debugPrint("enterState2()"))
#assert self.debugPrint("enterState2()")
self.enterStateN(2, 3)
def exitState2(self):
assert(self.debugPrint("exitState2()"))
assert self.debugPrint("exitState2()")
self.exitStateN()
##### state 3 #####
def enterState3(self):
#assert(self.debugPrint("enterState3()"))
#assert self.debugPrint("enterState3()")
self.enterStateN(3, 4)
def exitState3(self):
assert(self.debugPrint("exitState3()"))
assert self.debugPrint("exitState3()")
self.exitStateN()
##### state 4 #####
def enterState4(self):
assert(self.debugPrint("enterState4()"))
assert self.debugPrint("enterState4()")
self.enterStateN(4, 1)
self.changedOnState(1)
def exitState4(self):
assert(self.debugPrint("exitState4()"))
assert self.debugPrint("exitState4()")
self.exitStateN()
self.changedOnState(0)

View File

@ -195,7 +195,7 @@ class LerpAnimInterval(CLerpAnimEffectInterval):
LerpAnimInterval.lerpAnimNum += 1
blendType = self.stringBlendType(blendType)
assert(blendType != self.BTInvalid)
assert blendType != self.BTInvalid
# Initialize superclass
CLerpAnimEffectInterval.__init__(self, name, duration, blendType)

View File

@ -40,7 +40,7 @@ class FunctionInterval(Interval.Interval):
if (name == None):
name = 'Func-%s-%d' % (function.__name__, FunctionInterval.functionIntervalNum)
FunctionInterval.functionIntervalNum += 1
assert(isinstance(name, types.StringType))
assert isinstance(name, types.StringType)
# Record any arguments
self.extraArgs = extraArgs
self.kw = kw
@ -269,7 +269,7 @@ class PosHprScaleInterval(FunctionInterval):
class Func(FunctionInterval):
def __init__(self, *args, **kw):
function = args[0]
assert(callable(function))
assert callable(function)
extraArgs = args[1:]
kw['extraArgs'] = extraArgs
FunctionInterval.__init__(self, function, **kw)

View File

@ -77,7 +77,7 @@ class Interval(DirectObject):
elif state == CInterval.SStarted:
# Support modifying t while the interval is playing. We
# assume is_playing() will be true in this state.
assert(self.isPlaying())
assert self.isPlaying()
self.privInterrupt()
self.privStep(t)
self.setupResume()

View File

@ -139,7 +139,7 @@ class IntervalManager(CIntervalManager):
def __storeInterval(self, interval, index):
while index >= len(self.ivals):
self.ivals.append(None)
assert(self.ivals[index] == None or self.ivals[index] == interval)
assert self.ivals[index] == None or self.ivals[index] == interval
self.ivals[index] = interval

View File

@ -24,7 +24,7 @@ class LerpNodePathInterval(CLerpNodePathInterval):
LerpNodePathInterval.lerpNodePathNum += 1
blendType = self.stringBlendType(blendType)
assert(blendType != self.BTInvalid)
assert blendType != self.BTInvalid
if other == None:
other = NodePath()

View File

@ -99,7 +99,7 @@ class MetaInterval(CMetaInterval):
# in the list right away. There's no good reason to do this,
# except that it makes it easier for the programmer to detect
# when a MetaInterval is misdefined at creation time.
assert(self.validateComponents(self.ivals))
assert self.validateComponents(self.ivals)
@ -112,7 +112,7 @@ class MetaInterval(CMetaInterval):
self.ivals = list(self.ivals)
self.ivals.append(ival)
self.__ivalsDirty = 1
assert(self.validateComponent(ival))
assert self.validateComponent(ival)
def extend(self, ivals):
# Appends a list of intervals to the list so far.
@ -132,7 +132,7 @@ class MetaInterval(CMetaInterval):
self.ivals = list(self.ivals)
self.ivals.insert(index, ival)
self.__ivalsDirty = 1
assert(self.validateComponent(ival))
assert self.validateComponent(ival)
def pop(self, index = None):
# Returns element index (or the last element) and removes it
@ -180,7 +180,7 @@ class MetaInterval(CMetaInterval):
self.ivals = list(self.ivals)
self.ivals[index] = value
self.__ivalsDirty = 1
assert(self.validateComponent(value))
assert self.validateComponent(value)
def __delitem__(self, index):
if isinstance(self.ivals, types.TupleType):
@ -198,7 +198,7 @@ class MetaInterval(CMetaInterval):
self.ivals = list(self.ivals)
self.ivals[i : j] = s
self.__ivalsDirty = 1
assert(self.validateComponents(s))
assert self.validateComponents(s)
def __delslice__(self, i, j):
if isinstance(self.ivals, types.TupleType):
@ -210,13 +210,13 @@ class MetaInterval(CMetaInterval):
if isinstance(self.ivals, types.TupleType):
self.ivals = list(self.ivals)
if isinstance(other, MetaInterval):
assert(self.__class__ == other.__class__)
assert self.__class__ == other.__class__
ivals = other.ivals
else:
ivals = list(other)
self.ivals += ivals
self.__ivalsDirty = 1
assert(self.validateComponents(ivals))
assert self.validateComponents(ivals)
return self
def __add__(self, other):

View File

@ -34,7 +34,7 @@ class ParticleInterval(Interval):
self.parent = parent
self.worldRelative = worldRelative
self.fLoop = loop
assert(duration > 0.0 or loop == 1)
assert duration > 0.0 or loop == 1
# Initialize superclass
Interval.__init__(self, name, duration)

View File

@ -996,7 +996,7 @@ class LevelEditor(NodePath, DirectObject):
else:
newZoneId = newZone
# Ensure we have vis data
assert(self.nodeDict)
assert self.nodeDict
# Hide the old zone (if there is one)
if self.__zoneId != None:
for i in self.nodeDict[self.__zoneId]:
@ -6110,7 +6110,7 @@ class LevelEditorPanel(Pmw.MegaToplevel):
"""Delete the selected sign or sign baseline"""
if (self.currentBaselineDNA):
# Remove the baseline:
assert(int((self.baselineMenu.curselection())[0]) == self.currentBaselineIndex)
assert int((self.baselineMenu.curselection())[0]) == self.currentBaselineIndex
DNARemoveChildOfClass(self.currentSignDNA, DNA_SIGN_BASELINE,
self.currentBaselineIndex-1)
self.baselineMenu.delete(self.currentBaselineIndex)
@ -6121,7 +6121,7 @@ class LevelEditorPanel(Pmw.MegaToplevel):
self.levelEditor.replaceSelected()
elif (self.currentSignDNA):
# Remove the sign:
assert(int((self.baselineMenu.curselection())[0]) == 0)
assert int((self.baselineMenu.curselection())[0]) == 0
le = self.levelEditor
le.removeSign(le.DNATarget, le.DNATargetParent)
self.currentBaselineDNA=None

View File

@ -26,7 +26,7 @@ class ParticleEffect(NodePath):
self.renderParent = None
def start(self, parent=None, renderParent=None):
assert(self.notify.debug('start() - name: %s' % self.name))
assert self.notify.debug('start() - name: %s' % self.name)
self.renderParent = renderParent
self.enable()
if parent != None:

View File

@ -32,7 +32,7 @@ class Loader:
Attempt to load a model from given file path, return
a nodepath to the model if successful or None otherwise.
"""
assert(Loader.notify.debug("Loading model: %s" % (modelPath)))
assert Loader.notify.debug("Loading model: %s" % (modelPath))
if phaseChecker:
phaseChecker(modelPath)
node = self.loader.loadSync(Filename(modelPath))
@ -52,7 +52,7 @@ class Loader:
then attempt to load it from disk. Return a nodepath to
the model if successful or None otherwise
"""
assert(Loader.notify.debug("Loading model once: %s" % (modelPath)))
assert Loader.notify.debug("Loading model once: %s" % (modelPath))
if phaseChecker:
phaseChecker(modelPath)
node = ModelPool.loadModel(modelPath)
@ -76,7 +76,7 @@ class Loader:
want to load a model and immediately set a transform on it.
But also consider loadModelCopy().
"""
assert(Loader.notify.debug("Loading model once: %s under %s" % (modelPath, underNode)))
assert Loader.notify.debug("Loading model once: %s under %s" % (modelPath, underNode))
if phaseChecker:
phaseChecker(modelPath)
node = ModelPool.loadModel(modelPath)
@ -93,7 +93,7 @@ class Loader:
then attempt to load it from disk. Return a nodepath to
a copy of the model if successful or None otherwise
"""
assert(Loader.notify.debug("Loading model copy: %s" % (modelPath)))
assert Loader.notify.debug("Loading model copy: %s" % (modelPath))
if phaseChecker:
phaseChecker(modelPath)
node = ModelPool.loadModel(modelPath)
@ -116,7 +116,7 @@ class Loader:
However, if you're loading a font, see loadFont(), below.
"""
assert(Loader.notify.debug("Loading model once node: %s" % (modelPath)))
assert Loader.notify.debug("Loading model once node: %s" % (modelPath))
if phaseChecker:
phaseChecker(modelPath)
return ModelPool.loadModel(modelPath)
@ -125,7 +125,7 @@ class Loader:
"""
modelPath is a string.
"""
assert(Loader.notify.debug("Unloading model: %s" % (modelPath)))
assert Loader.notify.debug("Unloading model: %s" % (modelPath))
ModelPool.releaseModel(modelPath)
# font loading funcs
@ -145,7 +145,7 @@ class Loader:
standard font file (like a TTF file) that is supported by
FreeType.
"""
assert(Loader.notify.debug("Loading font: %s" % (modelPath)))
assert Loader.notify.debug("Loading font: %s" % (modelPath))
if phaseChecker:
phaseChecker(modelPath)
@ -196,12 +196,12 @@ class Loader:
TexturePool class. Returns None if not found
"""
if alphaPath is None:
assert(Loader.notify.debug("Loading texture: %s" % (texturePath)))
assert Loader.notify.debug("Loading texture: %s" % (texturePath))
if phaseChecker:
phaseChecker(texturePath)
texture = TexturePool.loadTexture(texturePath)
else:
assert(Loader.notify.debug("Loading texture: %s %s" % (texturePath, alphaPath)))
assert Loader.notify.debug("Loading texture: %s %s" % (texturePath, alphaPath))
if phaseChecker:
phaseChecker(texturePath)
texture = TexturePool.loadTexture(texturePath, alphaPath)
@ -216,7 +216,7 @@ class Loader:
Returns a 3-D Texture object, suitable for rendering
volumetric textures, if successful, or None if not.
"""
assert(Loader.notify.debug("Loading 3-D texture: %s" % (texturePattern)))
assert Loader.notify.debug("Loading 3-D texture: %s" % (texturePattern))
if phaseChecker:
phaseChecker(texturePattern)
texture = TexturePool.load3dTexture(texturePattern)
@ -232,7 +232,7 @@ class Loader:
None if not.
"""
assert(Loader.notify.debug("Loading cube map: %s" % (texturePattern)))
assert Loader.notify.debug("Loading cube map: %s" % (texturePattern))
if phaseChecker:
phaseChecker(texturePattern)
texture = TexturePool.loadCubeMap(texturePattern)
@ -251,12 +251,12 @@ class Loader:
The texture parameter may be the return value of any previous
call to loadTexture(), load3DTexture(), or loadCubeMap().
"""
assert(Loader.notify.debug("Unloading texture: %s" % (texture)))
assert Loader.notify.debug("Unloading texture: %s" % (texture))
TexturePool.releaseTexture(texture)
# sound loading funcs
def loadSfx(self, name):
assert(Loader.notify.debug("Loading sound: %s" % (name)))
assert Loader.notify.debug("Loading sound: %s" % (name))
if phaseChecker:
phaseChecker(name)
# should return a valid sound obj even if soundMgr is invalid
@ -269,7 +269,7 @@ class Loader:
return sound
def loadMusic(self, name):
assert(Loader.notify.debug("Loading sound: %s" % (name)))
assert Loader.notify.debug("Loading sound: %s" % (name))
# should return a valid sound obj even if musicMgr is invalid
sound = None
if (name):

View File

@ -74,7 +74,7 @@ class OnScreenDebug:
def add(self, key, value):
self.data[key] = (self.frame, value)
return 1 # to allow assert(onScreenDebug.add("foo", bar))
return 1 # to allow assert onScreenDebug.add("foo", bar)
def has(self, key):
return key in self.data

View File

@ -1023,7 +1023,7 @@ class ParamObj:
# END PARAMSET SUBCLASS
def __init__(self, *args, **kwArgs):
assert(issubclass(self.ParamSet, ParamObj.ParamSet))
assert issubclass(self.ParamSet, ParamObj.ParamSet)
# If you pass in a ParamSet obj, its values will be applied to this
# object in the constructor.
params = None
@ -1678,7 +1678,7 @@ def weightedRand(valDict, rng=random.random):
if totalWeight <= randomWeight:
return selections[i]
assert(True, "Should never get here")
assert True, "Should never get here"
return selections[-1]
def randUint31(rng=random.random):
@ -1745,8 +1745,8 @@ class Enum:
self._stringTable = {}
# make sure we don't overwrite an existing element of the class
assert(self._checkExistingMembers(items))
assert(uniqueElements(items))
assert self._checkExistingMembers(items)
assert uniqueElements(items)
i = start
for item in items:
@ -1756,7 +1756,7 @@ class Enum:
if len(item) == 0:
continue
# make sure there are no invalid characters
assert(Enum._checkValidIdentifier(item))
assert Enum._checkValidIdentifier(item)
self.__dict__[item] = i
self._stringTable[i] = item
i += 1

View File

@ -65,8 +65,8 @@ class RandomNumGen:
# the maximum for N ought to be 0x80000000, but Python treats
# that as a negative number.
assert (N >= 0)
assert (N <= 0x7fffffff)
assert N >= 0
assert N <= 0x7fffffff
# the cast to 'long' prevents python from importing warnings.py,
# presumably to warn that the multiplication result is too
@ -122,7 +122,7 @@ class RandomNumGen:
def randint(self, a,b):
"""returns integer in [a,b]"""
assert (a <= b)
assert a <= b
range = b-a+1
r = self.__rand(range)
return a+r

View File

@ -323,7 +323,7 @@ class ShowBase(DirectObject.DirectObject):
Creates the default GraphicsPipe, which will be used to make
windows unless otherwise specified.
"""
assert(self.pipe == None)
assert self.pipe == None
selection = GraphicsPipeSelection.getGlobalPtr()
selection.printPipeTypes()
self.pipe = selection.makeDefaultPipe()

View File

@ -8,7 +8,7 @@ CollisionHandlerRayStart = 4000.0 # This is a hack, it may be better to use a li
# This should be created by the game specific "start" file
#ShowBase()
# Instead of creating a show base, assert that one has already been created
assert(base)
assert base
# Set direct notify categories now that we have config
directNotify.setDconfigLevels()

View File

@ -286,7 +286,7 @@ class TaskPriorityList(list):
self[self.__emptyIndex] = task
self.__emptyIndex += 1
def remove(self, i):
assert(i <= len(self))
assert i <= len(self)
if (len(self) == 1) and (i == 1):
self[i] = None
self.__emptyIndex = 0
@ -661,7 +661,7 @@ class TaskManager:
break
# See if this task has been removed in show code
if task.isRemoved():
# assert(TaskManager.notify.debug('__stepThroughList: task is flagged for removal %s' % (task)))
# assert TaskManager.notify.debug('__stepThroughList: task is flagged for removal %s' % (task))
# If it was removed in show code, it will need finishTask run
# If it was removed by the taskMgr, it will not, but that is ok
# because finishTask is safe to call twice
@ -681,17 +681,17 @@ class TaskManager:
taskPriList.remove(i)
continue
elif ((ret == done) or (ret == exit) or (ret == None)):
# assert(TaskManager.notify.debug('__stepThroughList: task is finished %s' % (task)))
# assert TaskManager.notify.debug('__stepThroughList: task is finished %s' % (task))
# Remove the task
if not task.isRemoved():
# assert(TaskManager.notify.debug('__stepThroughList: task not removed %s' % (task)))
# assert TaskManager.notify.debug('__stepThroughList: task not removed %s' % (task))
task.remove()
# Note: Should not need to remove from doLaterList here because
# this task is not in the doLaterList
task.finishTask(self.fVerbose)
self.__removeTaskFromNameDict(task)
else:
# assert(TaskManager.notify.debug('__stepThroughList: task already removed %s' % (task)))
# assert TaskManager.notify.debug('__stepThroughList: task already removed %s' % (task))
self.__removeTaskFromNameDict(task)
taskPriList.remove(i)
# Do not increment the iterator
@ -707,12 +707,12 @@ class TaskManager:
for taskList in self.pendingTaskDict.values():
for task in taskList:
if (task and not task.isRemoved()):
# assert(TaskManager.notify.debug('step: moving %s from pending to taskList' % (task.name)))
# assert TaskManager.notify.debug('step: moving %s from pending to taskList' % (task.name))
self.__addNewTask(task)
self.pendingTaskDict.clear()
def step(self):
# assert(TaskManager.notify.debug('step: begin'))
# assert TaskManager.notify.debug('step: begin')
self.currentTime, self.currentFrame = self.__getTimeFrame()
# Replace keyboard interrupt handler during task list processing
# so we catch the keyboard interrupt but don't handle it until
@ -726,13 +726,13 @@ class TaskManager:
while priIndex < len(self.taskList):
taskPriList = self.taskList[priIndex]
pri = taskPriList.getPriority()
# assert(TaskManager.notify.debug('step: running through taskList at pri: %s, priIndex: %s' % (pri, priIndex)))
# assert TaskManager.notify.debug('step: running through taskList at pri: %s, priIndex: %s' % (pri, priIndex))
self.__stepThroughList(taskPriList)
# Now see if that generated any pending tasks for this taskPriList
pendingTasks = self.pendingTaskDict.get(pri)
while pendingTasks:
# assert(TaskManager.notify.debug('step: running through pending tasks at pri: %s' % (pri)))
# assert TaskManager.notify.debug('step: running through pending tasks at pri: %s' % (pri))
# Remove them from the pendingTaskDict
del self.pendingTaskDict[pri]
# Execute them
@ -740,7 +740,7 @@ class TaskManager:
# Add these to the real taskList
for task in pendingTasks:
if (task and not task.isRemoved()):
# assert(TaskManager.notify.debug('step: moving %s from pending to taskList' % (task.name)))
# assert TaskManager.notify.debug('step: moving %s from pending to taskList' % (task.name))
self.__addNewTask(task)
# See if we generated any more for this pri level
pendingTasks = self.pendingTaskDict.get(pri)

View File

@ -43,8 +43,8 @@ class Timer:
return self.currT
def resume(self):
assert(self.currT <= self.finalT)
assert(self.started == 0)
assert self.currT <= self.finalT
assert self.started == 0
self.start(self.finalT - self.currT, self.name)
def restart(self):