Browse Source

formatting

Dave Schuyler 19 years ago
parent
commit
60356c6c94

+ 9 - 7
direct/src/directnotify/Notifier.py

@@ -113,22 +113,24 @@ class Notifier:
 
 
     # error funcs
     # error funcs
     def error(self, errorString, exception=StandardError):
     def error(self, errorString, exception=StandardError):
-        """error(self, string, Exception=StandardError)
+        """
         Raise an exception with given string and optional type:
         Raise an exception with given string and optional type:
-        Exception: error"""
+        Exception: error
+        """
         string = (self.getTime() + str(exception) + ": " + self.__name + ": " + errorString)
         string = (self.getTime() + str(exception) + ": " + self.__name + ": " + errorString)
         self.__log(string)
         self.__log(string)
         raise exception(errorString)
         raise exception(errorString)
 
 
     # warning funcs
     # warning funcs
     def warning(self, warningString):
     def warning(self, warningString):
-        """warning(self, string)
-        Issue the warning message if warn flag is on"""
+        """
+        Issue the warning message if warn flag is on
+        """
         if self.__warning:
         if self.__warning:
             string = (self.getTime() + self.__name + '(warning): ' + warningString)
             string = (self.getTime() + self.__name + '(warning): ' + warningString)
             self.__log(string)
             self.__log(string)
             self.__print(string)
             self.__print(string)
-        return 1 # to allow assert(myNotify.warning("blah"))
+        return 1 # to allow assert myNotify.warning("blah")
 
 
     def setWarning(self, bool):
     def setWarning(self, bool):
         """
         """
@@ -151,7 +153,7 @@ class Notifier:
             string = (self.getTime() + self.__name + '(debug): ' + debugString)
             string = (self.getTime() + self.__name + '(debug): ' + debugString)
             self.__log(string)
             self.__log(string)
             self.__print(string)
             self.__print(string)
-        return 1 # to allow assert(myNotify.debug("blah"))
+        return 1 # to allow assert myNotify.debug("blah")
 
 
     def setDebug(self, bool):
     def setDebug(self, bool):
         """
         """
@@ -174,7 +176,7 @@ class Notifier:
             string = (self.getTime() + self.__name + '(info): ' + infoString)
             string = (self.getTime() + self.__name + '(info): ' + infoString)
             self.__log(string)
             self.__log(string)
             self.__print(string)
             self.__print(string)
-        return 1 # to allow assert(myNotify.info("blah"))
+        return 1 # to allow assert myNotify.info("blah")
 
 
     def getInfo(self):
     def getInfo(self):
         """
         """

+ 25 - 22
direct/src/distributed/DistributedSmoothNode.py

@@ -70,8 +70,7 @@ def activateSmoothing(smoothing, prediction):
 
 
 class DistributedSmoothNode(DistributedNode.DistributedNode,
 class DistributedSmoothNode(DistributedNode.DistributedNode,
                             DistributedSmoothNodeBase.DistributedSmoothNodeBase):
                             DistributedSmoothNodeBase.DistributedSmoothNodeBase):
-    """DistributedSmoothNode class:
-
+    """
     This specializes DistributedNode to add functionality to smooth
     This specializes DistributedNode to add functionality to smooth
     motion over time, via the SmoothMover C++ object defined in
     motion over time, via the SmoothMover C++ object defined in
     DIRECT.
     DIRECT.
@@ -272,12 +271,14 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
                 self.lastSuggestResync = realTime
                 self.lastSuggestResync = realTime
                 timestampB = globalClockDelta.localToNetworkTime(realTime)
                 timestampB = globalClockDelta.localToNetworkTime(realTime)
                 serverTime = realTime - globalClockDelta.getDelta()
                 serverTime = realTime - globalClockDelta.getDelta()
-                self.notify.info("Suggesting resync for %s, with discrepency %s; local time is %s and server time is %s." % (
+                self.notify.info(
+                    "Suggesting resync for %s, with discrepency %s; local time is %s and server time is %s." % (
                     self.doId, howFarFuture - chug,
                     self.doId, howFarFuture - chug,
                     realTime, serverTime))
                     realTime, serverTime))
-                self.d_suggestResync(self.cr.localAvatarDoId, timestamp,
-                                     timestampB, serverTime,
-                                     globalClockDelta.getUncertainty())
+                self.d_suggestResync(
+                    self.cr.localAvatarDoId, timestamp,
+                    timestampB, serverTime,
+                    globalClockDelta.getUncertainty())
         
         
         self.smoother.setTimestamp(local)
         self.smoother.setTimestamp(local)
         self.smoother.markPosition()
         self.smoother.markPosition()
@@ -319,41 +320,42 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
         
         
     def suggestResync(self, avId, timestampA, timestampB,
     def suggestResync(self, avId, timestampA, timestampB,
                       serverTimeSec, serverTimeUSec, uncertainty):
                       serverTimeSec, serverTimeUSec, uncertainty):
-        """suggestResync(self, avId, ....)
-
+        """
         This message is sent from one client to another when the other
         This message is sent from one client to another when the other
         client receives a timestamp from this client that is so far
         client receives a timestamp from this client that is so far
         out of date as to suggest that one or both clients needs to
         out of date as to suggest that one or both clients needs to
         resynchronize their clock information.
         resynchronize their clock information.
         """
         """
         serverTime = float(serverTimeSec) + float(serverTimeUSec) / 10000.0
         serverTime = float(serverTimeSec) + float(serverTimeUSec) / 10000.0
-        result = \
-               self.peerToPeerResync(avId, timestampA, serverTime, uncertainty)
+        result = self.peerToPeerResync(
+            avId, timestampA, serverTime, uncertainty)
         if result >= 0 and \
         if result >= 0 and \
            globalClockDelta.getUncertainty() != None:
            globalClockDelta.getUncertainty() != None:
             other = self.cr.doId2do.get(avId)
             other = self.cr.doId2do.get(avId)
             if (not other):
             if (not other):
-                self.notify.info("Warning: couldn't find the avatar %d" % (avId))
+                self.notify.info(
+                    "Warning: couldn't find the avatar %d" % (avId))
             elif hasattr(other, "d_returnResync"):
             elif hasattr(other, "d_returnResync"):
                 realTime = globalClock.getRealTime()
                 realTime = globalClock.getRealTime()
                 serverTime = realTime - globalClockDelta.getDelta()
                 serverTime = realTime - globalClockDelta.getDelta()
-                self.notify.info("Returning resync for %s; local time is %s and server time is %s." % (
+                self.notify.info(
+                    "Returning resync for %s; local time is %s and server time is %s." % (
                     self.doId, realTime, serverTime))
                     self.doId, realTime, serverTime))
-                other.d_returnResync(self.cr.localAvatarDoId, timestampB,
-                                     serverTime,
-                                     globalClockDelta.getUncertainty())
+                other.d_returnResync(
+                    self.cr.localAvatarDoId, timestampB,
+                    serverTime,
+                    globalClockDelta.getUncertainty())
         
         
 
 
     def d_returnResync(self, avId, timestampB, serverTime, uncertainty):
     def d_returnResync(self, avId, timestampB, serverTime, uncertainty):
         serverTimeSec = math.floor(serverTime)
         serverTimeSec = math.floor(serverTime)
         serverTimeUSec = (serverTime - serverTimeSec) * 10000.0
         serverTimeUSec = (serverTime - serverTimeSec) * 10000.0
-        self.sendUpdate("returnResync", [avId, timestampB,
-                                         serverTimeSec, serverTimeUSec,
-                                         uncertainty])
+        self.sendUpdate("returnResync", [
+            avId, timestampB, serverTimeSec, serverTimeUSec, uncertainty])
         
         
-    def returnResync(self, avId, timestampB, serverTimeSec, serverTimeUSec, uncertainty):
-        """returnResync(self, avId)
-
+    def returnResync(self, avId, timestampB, serverTimeSec, serverTimeUSec,
+            uncertainty):
+        """
         A reply sent by a client whom we recently sent suggestResync
         A reply sent by a client whom we recently sent suggestResync
         to, this reports the client's new delta information so we can
         to, this reports the client's new delta information so we can
         adjust our clock as well.
         adjust our clock as well.
@@ -362,7 +364,8 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
         self.peerToPeerResync(avId, timestampB, serverTime, uncertainty)
         self.peerToPeerResync(avId, timestampB, serverTime, uncertainty)
 
 
     def peerToPeerResync(self, avId, timestamp, serverTime, uncertainty):
     def peerToPeerResync(self, avId, timestamp, serverTime, uncertainty):
-        gotSync = globalClockDelta.peerToPeerResync(avId, timestamp, serverTime, uncertainty)
+        gotSync = globalClockDelta.peerToPeerResync(
+            avId, timestamp, serverTime, uncertainty)
 
 
         # If we didn't get anything useful from the other client,
         # If we didn't get anything useful from the other client,
         # maybe our clock is just completely hosed.  Go ask the AI.
         # maybe our clock is just completely hosed.  Go ask the AI.

+ 8 - 7
direct/src/fsm/ClassicFSM.py

@@ -209,7 +209,7 @@ class ClassicFSM(DirectObject):
             ClassicFSM.notify.error("[%s]: enter: no such state" % (self.__name))
             ClassicFSM.notify.error("[%s]: enter: no such state" % (self.__name))
 
 
     def __transition(self, aState, enterArgList=[], exitArgList=[]):
     def __transition(self, aState, enterArgList=[], exitArgList=[]):
-        """__transition(self, State, enterArgList, exitArgList)
+        """
         Exit currentState and enter given one
         Exit currentState and enter given one
         """
         """
         assert not self.__internalStateInFlux
         assert not self.__internalStateInFlux
@@ -273,7 +273,8 @@ class ClassicFSM(DirectObject):
         # We can implicitly always transition to our final state.
         # We can implicitly always transition to our final state.
         elif (aStateName == self.__finalState.getName()):
         elif (aStateName == self.__finalState.getName()):
             if (self.__currentState == self.__finalState):
             if (self.__currentState == self.__finalState):
-                # Do not do the transition if we are already in the final state
+                # Do not do the transition if we are already in the
+                # final state
                 assert ClassicFSM.notify.debug(
                 assert ClassicFSM.notify.debug(
                     "[%s]: already in final state: %s" %
                     "[%s]: already in final state: %s" %
                     (self.__name, aStateName))
                     (self.__name, aStateName))
@@ -315,11 +316,11 @@ class ClassicFSM(DirectObject):
         """
         """
         'if this transition is defined, do it'
         'if this transition is defined, do it'
         Attempt transition from currentState to given one, if it exists.
         Attempt transition from currentState to given one, if it exists.
-        Return true if transition exists to given state,
-        false otherwise.  It is NOT an error/warning to attempt a cond_request
-        if the transition doesn't exist.  This lets people be sloppy about
-        ClassicFSM transitions, letting the same fn be used for different states
-        that may not have the same out transitions.
+        Return true if transition exists to given state, false otherwise.
+        It is NOT an error/warning to attempt a cond_request if the
+        transition doesn't exist.  This lets people be sloppy about
+        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:
         if not self.__currentState: