parameters: (
          self, datasrc: str, filter_text: str, reaction_data: Dict[str, List["Reaction"]]
      )
docstring: Filter the reaction_data list to only include specified reactions.
  
          :param datasrc:
              The XML source of the reaction data that is being filtered.
          :param filter_text:
              The text specified in the ``filter`` node telling which reactions are being
              filtered.
          :param reaction_data:
              Mapping of reaction data sources (i.e., ``id`` attributes on
              ``reactionData`` nodes) to lists of `Reaction` instances.
  
          The YAML format does not support filtering reactions by setting options in the
          `Phase` node, like the XML format does. Instead, when filters are used in XML,
          the reactions should be split into separate top-level nodes in the YAML file,
          which then become the data source in the YAML reactions specification. Returns
          a string that should be used as the data source in the YAML file.
docstring_summary: Filter the reaction_data list to only include specified reactions.
docstring_tokens: Filter the reaction_data list to only include specified reactions .
function: def filter_reaction_list(
          self, datasrc: str, filter_text: str, reaction_data: Dict[str, List["Reaction"]]
      ) -> str:
          """Filter the reaction_data list to only include specified reactions.
  
          :param datasrc:
              The XML source of the reaction data that is being filtered.
          :param filter_text:
              The text specified in the ``filter`` node telling which reactions are being
              filtered.
          :param reaction_data:
              Mapping of reaction data sources (i.e., ``id`` attributes on
              ``reactionData`` nodes) to lists of `Reaction` instances.
  
          The YAML format does not support filtering reactions by setting options in the
          `Phase` node, like the XML format does. Instead, when filters are used in XML,
          the reactions should be split into separate top-level nodes in the YAML file,
          which then become the data source in the YAML reactions specification. Returns
          a string that should be used as the data source in the YAML file.
          """
          all_reactions = reaction_data[datasrc.lstrip("#")]
          hits = []
          misses = []
          re_pattern = re.compile(filter_text.replace("*", ".*"))
          for reaction in all_reactions:
              reaction_id = reaction.attribs.get("id")
              if re_pattern.match(reaction_id):
                  hits.append(reaction)
              else:
                  misses.append(reaction)
  
          if not hits:
              raise ValueError(
                  "The filter text '{}' resulted in an empty set of "
                  "reactions".format(filter_text)
              )
          else:
              new_datasrc = self.attribs["name"] + "-reactions"
              reaction_data[new_datasrc] = hits
              # If misses is not empty, replace the old list of reactions with
              # a new list where filtered out reactions are removed. If there
              # are no remaining reactions, remove the entry for this datasrc
              # from the dictionary
              if misses:
                  reaction_data[datasrc] = misses
              else:
                  del reaction_data[datasrc]
  
              return new_datasrc
function_tokens: def filter_reaction_list ( self , datasrc : str , filter_text : str , reaction_data : Dict [ str , List [ "Reaction" ] ] ) -> str : all_reactions = reaction_data [ datasrc . lstrip ( "#" ) ] hits = [ ] misses = [ ] re_pattern = re . compile ( filter_text . replace ( "*" , ".*" ) ) for reaction in all_reactions : reaction_id = reaction . attribs . get ( "id" ) if re_pattern . match ( reaction_id ) : hits . append ( reaction ) else : misses . append ( reaction ) if not hits : raise ValueError ( "The filter text '{}' resulted in an empty set of " "reactions" . format ( filter_text ) ) else : new_datasrc = self . attribs [ "name" ] + "-reactions" reaction_data [ new_datasrc ] = hits # If misses is not empty, replace the old list of reactions with # a new list where filtered out reactions are removed. If there # are no remaining reactions, remove the entry for this datasrc # from the dictionary if misses : reaction_data [ datasrc ] = misses else : del reaction_data [ datasrc ] return new_datasrc