(self)
u"""There pretty much is never a reason to send the server
        something like (steer 9483.323). This comes up all the time
        and it's probably just more sensible to always clip it than to
        worry about when to. The "clip" command is still a snakeoil
        utility function, but it should be used only for non standard
        things or non obvious limits (limit the steering to the left,
        for example). For normal limits, simply don't worry about it.
u"""There pretty much is never a reason to send the server
        something like (steer 9483.323). This comes up all the time
        and it's probably just more sensible to always clip it than to
        worry about when to. The "clip" command is still a snakeoil
        utility function, but it should be used only for non standard
        things or non obvious limits (limit the steering to the left,
        for example). For normal limits, simply don't worry about it.
u There pretty much is never a reason to send the server something like ( steer 9483 . 323 ) . This comes up all the time and it s probably just more sensible to always clip it than to worry about when to . The clip command is still a snakeoil utility function but it should be used only for non standard things or non obvious limits ( limit the steering to the left for example ) . For normal limits simply don t worry about it .
def clip_to_limits(self):
        u"""There pretty much is never a reason to send the server
        something like (steer 9483.323). This comes up all the time
        and it's probably just more sensible to always clip it than to
        worry about when to. The "clip" command is still a snakeoil
        utility function, but it should be used only for non standard
        things or non obvious limits (limit the steering to the left,
        for example). For normal limits, simply don't worry about it."""
        self.d[u'steer']= clip(self.d[u'steer'], -1, 1)
        self.d[u'brake']= clip(self.d[u'brake'], 0, 1)
        self.d[u'accel']= clip(self.d[u'accel'], 0, 1)
        self.d[u'clutch']= clip(self.d[u'clutch'], 0, 1)
        if self.d[u'gear'] not in [-1, 0, 1, 2, 3, 4, 5, 6]:
            self.d[u'gear']= 0
        if self.d[u'meta'] not in [0,1]:
            self.d[u'meta']= 0
        if type(self.d[u'focus']) is not list or min(self.d[u'focus'])<-180 or max(self.d[u'focus'])>180:
            self.d[u'focus']= 0
def clip_to_limits ( self ) : self . d [ u'steer' ] = clip ( self . d [ u'steer' ] , - 1 , 1 ) self . d [ u'brake' ] = clip ( self . d [ u'brake' ] , 0 , 1 ) self . d [ u'accel' ] = clip ( self . d [ u'accel' ] , 0 , 1 ) self . d [ u'clutch' ] = clip ( self . d [ u'clutch' ] , 0 , 1 ) if self . d [ u'gear' ] not in [ - 1 , 0 , 1 , 2 , 3 , 4 , 5 , 6 ] : self . d [ u'gear' ] = 0 if self . d [ u'meta' ] not in [ 0 , 1 ] : self . d [ u'meta' ] = 0 if type ( self . d [ u'focus' ] ) is not list or min ( self . d [ u'focus' ] ) < - 180 or max ( self . d [ u'focus' ] ) > 180 : self . d [ u'focus' ] = 0