parameters: (self, request, args)
return_statement: return None
docstring: This is the function that is called if there is no
          filterState() method for a particular state name.
  
          This default filter function behaves in one of two modes:
  
          (1) if self.defaultTransitions is None, allow any request
          whose name begins with a capital letter, which is assumed to
          be a direct request to a particular state.  This is similar to
          the old ClassicFSM onUndefTransition=ALLOW, with no explicit
          state transitions listed.
  
          (2) if self.defaultTransitions is not None, allow only those
          requests explicitly identified in this map.  This is similar
          to the old ClassicFSM onUndefTransition=DISALLOW, with an
          explicit list of allowed state transitions.
  
          Specialized FSM's may wish to redefine this default filter
          (for instance, to always return the request itself, thus
          allowing any transition.).
docstring_summary: This is the function that is called if there is no
          filterState() method for a particular state name.
docstring_tokens: This is the function that is called if there is no filterState () method for a particular state name .
function: def defaultFilter(self, request, args):
          """This is the function that is called if there is no
          filterState() method for a particular state name.
  
          This default filter function behaves in one of two modes:
  
          (1) if self.defaultTransitions is None, allow any request
          whose name begins with a capital letter, which is assumed to
          be a direct request to a particular state.  This is similar to
          the old ClassicFSM onUndefTransition=ALLOW, with no explicit
          state transitions listed.
  
          (2) if self.defaultTransitions is not None, allow only those
          requests explicitly identified in this map.  This is similar
          to the old ClassicFSM onUndefTransition=DISALLOW, with an
          explicit list of allowed state transitions.
  
          Specialized FSM's may wish to redefine this default filter
          (for instance, to always return the request itself, thus
          allowing any transition.)."""
  
          if request == 'Off':
              # We can always go to the "Off" state.
              return (request,) + args
  
          if self.defaultTransitions is None:
              # If self.defaultTransitions is None, it means to accept
              # all requests whose name begins with a capital letter.
              # These are direct requests to a particular state.
              if request[0].isupper():
                  return (request,) + args
          else:
              # If self.defaultTransitions is not None, it is a map of
              # allowed transitions from each state.  That is, each key
              # of the map is the current state name; for that key, the
              # value is a list of allowed transitions from the
              # indicated state.
              if request in self.defaultTransitions.get(self.state, []):
                  # This transition is listed in the defaultTransitions map;
                  # accept it.
                  return (request,) + args
  
              elif FSM.EnumStates.ANY in self.defaultTransitions.get(self.state, []):
                  # Whenever we have a '*' as our to transition, we allow
                  # to transit to any other state
                  return (request,) + args
  
              elif request in self.defaultTransitions.get(FSM.EnumStates.ANY, []):
                  # If the requested state is in the default transitions
                  # from any state list, we also alow to transit to the
                  # new state
                  return (request,) + args
  
              elif FSM.EnumStates.ANY in self.defaultTransitions.get(FSM.EnumStates.ANY, []):
                  # This is like we had set the defaultTransitions to None.
                  # Any state can transit to any other state
                  return (request,) + args
  
              elif request in self.defaultTransitions.get(FSM.EnumStates.DEFAULT, []):
                  # This is the fallback state that we use whenever no
                  # other trnasition was possible
                  return (request,) + args
  
              # If self.defaultTransitions is not None, it is an error
              # to request a direct state transition (capital letter
              # request) not listed in defaultTransitions and not
              # handled by an earlier filter.
              if request[0].isupper():
                  raise RequestDenied("%s (from state: %s)" % (request, self.state))
  
          # 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))
          return None
function_tokens: def defaultFilter ( self , request , args ) : if request == 'Off' : # We can always go to the "Off" state. return ( request , ) + args if self . defaultTransitions is None : # If self.defaultTransitions is None, it means to accept # all requests whose name begins with a capital letter. # These are direct requests to a particular state. if request [ 0 ] . isupper ( ) : return ( request , ) + args else : # If self.defaultTransitions is not None, it is a map of # allowed transitions from each state.  That is, each key # of the map is the current state name; for that key, the # value is a list of allowed transitions from the # indicated state. if request in self . defaultTransitions . get ( self . state , [ ] ) : # This transition is listed in the defaultTransitions map; # accept it. return ( request , ) + args elif FSM . EnumStates . ANY in self . defaultTransitions . get ( self . state , [ ] ) : # Whenever we have a '*' as our to transition, we allow # to transit to any other state return ( request , ) + args elif request in self . defaultTransitions . get ( FSM . EnumStates . ANY , [ ] ) : # If the requested state is in the default transitions # from any state list, we also alow to transit to the # new state return ( request , ) + args elif FSM . EnumStates . ANY in self . defaultTransitions . get ( FSM . EnumStates . ANY , [ ] ) : # This is like we had set the defaultTransitions to None. # Any state can transit to any other state return ( request , ) + args elif request in self . defaultTransitions . get ( FSM . EnumStates . DEFAULT , [ ] ) : # This is the fallback state that we use whenever no # other trnasition was possible return ( request , ) + args # If self.defaultTransitions is not None, it is an error # to request a direct state transition (capital letter # request) not listed in defaultTransitions and not # handled by an earlier filter. if request [ 0 ] . isupper ( ) : raise RequestDenied ( "%s (from state: %s)" % ( request , self . state ) ) # 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 ) ) return None