parameters: (self, topic, triglvl, depth=0, inheritance=0, inherited=False)
return_statement: return triggers
docstring: Recursively scan a topic and return a list of all triggers.
docstring_summary: Recursively scan a topic and return a list of all triggers.
docstring_tokens: Recursively scan a topic and return a list of all triggers .
function: def _topic_triggers(self, topic, triglvl, depth=0, inheritance=0, inherited=False):
          """Recursively scan a topic and return a list of all triggers."""
  
          # Break if we're in too deep.
          if depth > self._depth:
              self._warn("Deep recursion while scanning topic inheritance")
  
          # Important info about the depth vs inheritance params to this function:
          # depth increments by 1 each time this function recursively calls itself.
          # inheritance increments by 1 only when this topic inherits another
          # topic.
          #
          # This way, '> topic alpha includes beta inherits gamma' will have this
          # effect:
          #  alpha and beta's triggers are combined together into one matching
          #  pool, and then those triggers have higher matching priority than
          #  gamma's.
          #
          # The inherited option is True if this is a recursive call, from a topic
          # that inherits other topics. This forces the {inherits} tag to be added
          # to the triggers. This only applies when the top topic 'includes'
          # another topic.
          self._say("\tCollecting trigger list for topic " + topic + "(depth="
              + str(depth) + "; inheritance=" + str(inheritance) + "; "
              + "inherited=" + str(inherited) + ")")
  
          # topic:   the name of the topic
          # triglvl: reference to self._topics or self._thats
          # depth:   starts at 0 and ++'s with each recursion
  
          # Collect an array of triggers to return.
          triggers = []
  
          # Get those that exist in this topic directly.
          inThisTopic = []
          if topic in triglvl:
              for trigger in triglvl[topic]:
                  inThisTopic.append(trigger)
  
          # Does this topic include others?
          if topic in self._includes:
              # Check every included topic.
              for includes in self._includes[topic]:
                  self._say("\t\tTopic " + topic + " includes " + includes)
                  triggers.extend(self._topic_triggers(includes, triglvl, (depth + 1), inheritance, True))
  
          # Does this topic inherit others?
          if topic in self._lineage:
              # Check every inherited topic.
              for inherits in self._lineage[topic]:
                  self._say("\t\tTopic " + topic + " inherits " + inherits)
                  triggers.extend(self._topic_triggers(inherits, triglvl, (depth + 1), (inheritance + 1), False))
  
          # Collect the triggers for *this* topic. If this topic inherits any
          # other topics, it means that this topic's triggers have higher
          # priority than those in any inherited topics. Enforce this with an
          # {inherits} tag.
          if topic in self._lineage or inherited:
              for trigger in inThisTopic:
                  self._say("\t\tPrefixing trigger with {inherits=" + str(inheritance) + "}" + trigger)
                  triggers.append("{inherits=" + str(inheritance) + "}" + trigger)
          else:
              triggers.extend(inThisTopic)
  
          return triggers
function_tokens: def _topic_triggers ( self , topic , triglvl , depth = 0 , inheritance = 0 , inherited = False ) : # Break if we're in too deep. if depth > self . _depth : self . _warn ( "Deep recursion while scanning topic inheritance" ) # Important info about the depth vs inheritance params to this function: # depth increments by 1 each time this function recursively calls itself. # inheritance increments by 1 only when this topic inherits another # topic. # # This way, '> topic alpha includes beta inherits gamma' will have this # effect: #  alpha and beta's triggers are combined together into one matching #  pool, and then those triggers have higher matching priority than #  gamma's. # # The inherited option is True if this is a recursive call, from a topic # that inherits other topics. This forces the {inherits} tag to be added # to the triggers. This only applies when the top topic 'includes' # another topic. self . _say ( "\tCollecting trigger list for topic " + topic + "(depth=" + str ( depth ) + "; inheritance=" + str ( inheritance ) + "; " + "inherited=" + str ( inherited ) + ")" ) # topic:   the name of the topic # triglvl: reference to self._topics or self._thats # depth:   starts at 0 and ++'s with each recursion # Collect an array of triggers to return. triggers = [ ] # Get those that exist in this topic directly. inThisTopic = [ ] if topic in triglvl : for trigger in triglvl [ topic ] : inThisTopic . append ( trigger ) # Does this topic include others? if topic in self . _includes : # Check every included topic. for includes in self . _includes [ topic ] : self . _say ( "\t\tTopic " + topic + " includes " + includes ) triggers . extend ( self . _topic_triggers ( includes , triglvl , ( depth + 1 ) , inheritance , True ) ) # Does this topic inherit others? if topic in self . _lineage : # Check every inherited topic. for inherits in self . _lineage [ topic ] : self . _say ( "\t\tTopic " + topic + " inherits " + inherits ) triggers . extend ( self . _topic_triggers ( inherits , triglvl , ( depth + 1 ) , ( inheritance + 1 ) , False ) ) # Collect the triggers for *this* topic. If this topic inherits any # other topics, it means that this topic's triggers have higher # priority than those in any inherited topics. Enforce this with an # {inherits} tag. if topic in self . _lineage or inherited : for trigger in inThisTopic : self . _say ( "\t\tPrefixing trigger with {inherits=" + str ( inheritance ) + "}" + trigger ) triggers . append ( "{inherits=" + str ( inheritance ) + "}" + trigger ) else : triggers . extend ( inThisTopic ) return triggers