class_docstr: Organises data transformations into a pipeline.
  
  Example
  -------
  >>> pipeline = DataPipeline(
  ...     static_data_keys=["text"],
  ...     dynamic_items=[
  ...     {"func": lambda x: x.lower(), "takes": "text", "provides": "foo"},
  ...     {"func": lambda x: x[::-1], "takes": "foo", "provides": "bar"},
  ...     ],
  ...     output_keys=["bar"],
  ... )
  >>> pipeline({"text": "Test"})
  {'bar': 'tset'}
class_docstr_tok: ["Organises","data","transformations","into","a","pipeline",".","Example","--","--","--","-",">",">",">","pipeline","=","DataPipeline","(","...","static_data_keys=","[","``","text","''","]",",","...","dynamic_items=","[","...","{","``","func","''",":","lambda","x",":","x.lower","(",")",",","``","takes","''",":","``","text","''",",","``","provides","''",":","``","foo","''","}",",","...","{","``","func","''",":","lambda","x",":","x","[",":",":-1","]",",","``","takes","''",":","``","foo","''",",","``","provides","''",":","``","bar","''","}",",","...","]",",","...","output_keys=","[","``","bar","''","]",",","...",")",">",">",">","pipeline","(","{","``","text","''",":","``","Test","''","}",")","{","'bar","'",":","'tset","'","}"]
docstr: Adds a dynamic item to the Pipeline.
  
  Two calling conventions. For DynamicItem objects, just use:
  add_dynamic_item(dynamic_item)
  But otherwise, should use:
  add_dynamic_item(func, takes, provides)
  
  Arguments
  ---------
  func : callable, DynamicItem
      If a DynamicItem is given, adds that directly. Otherwise a
      DynamicItem is created, and this specifies the callable to use. If
      a generator function is given, then create a GeneratorDynamicItem.
      Otherwise creates a normal DynamicItem.
  takes : list, str
      List of keys. When func is called, each key is resolved to
      either an entry in the data or the output of another dynamic_item.
      The func is then called with these as positional arguments,
      in the same order as specified here.
      A single key can be given as a bare string.
  provides : str, list
      For regular functions, the key or list of keys that it provides.
      If you give a generator function, key or list of keys that it
      yields, in order. Also see the provides decorator.
      A single key can be given as a bare string.
docstr_tok: ["Adds","a","dynamic","item","to","the","Pipeline",".","Two","calling","conventions",".","For","DynamicItem","objects",",","just","use",":","add_dynamic_item","(","dynamic_item",")","But","otherwise",",","should","use",":","add_dynamic_item","(","func",",","takes",",","provides",")","Arguments","--","--","--","--","-","func",":","callable",",","DynamicItem","If","a","DynamicItem","is","given",",","adds","that","directly",".","Otherwise","a","DynamicItem","is","created",",","and","this","specifies","the","callable","to","use",".","If","a","generator","function","is","given",",","then","create","a","GeneratorDynamicItem",".","Otherwise","creates","a","normal","DynamicItem",".","takes",":","list",",","str","List","of","keys",".","When","func","is","called",",","each","key","is","resolved","to","either","an","entry","in","the","data","or","the","output","of","another","dynamic_item",".","The","func","is","then","called","with","these","as","positional","arguments",",","in","the","same","order","as","specified","here",".","A","single","key","can","be","given","as","a","bare","string",".","provides",":","str",",","list","For","regular","functions",",","the","key","or","list","of","keys","that","it","provides",".","If","you","give","a","generator","function",",","key","or","list","of","keys","that","it","yields",",","in","order",".","Also","see","the","provides","decorator",".","A","single","key","can","be","given","as","a","bare","string","."]
code: def add_dynamic_item(self, func, takes=None, provides=None):
      """Adds a dynamic item to the Pipeline.
  
      Two calling conventions. For DynamicItem objects, just use:
      add_dynamic_item(dynamic_item)
      But otherwise, should use:
      add_dynamic_item(func, takes, provides)
  
      Arguments
      ---------
      func : callable, DynamicItem
          If a DynamicItem is given, adds that directly. Otherwise a
          DynamicItem is created, and this specifies the callable to use. If
          a generator function is given, then create a GeneratorDynamicItem.
          Otherwise creates a normal DynamicItem.
      takes : list, str
          List of keys. When func is called, each key is resolved to
          either an entry in the data or the output of another dynamic_item.
          The func is then called with these as positional arguments,
          in the same order as specified here.
          A single key can be given as a bare string.
      provides : str, list
          For regular functions, the key or list of keys that it provides.
          If you give a generator function, key or list of keys that it
          yields, in order. Also see the provides decorator.
          A single key can be given as a bare string.
      """
      if isinstance(func, DynamicItem):
          if takes is not None or provides is not None:
              raise ValueError(
                  "If providing a DynamicItem directly, don't "
                  "specify takes or provides"
              )
          else:
              self._add_dynamic_item_object(func)
              return
      if isinstance(takes, str):
          takes = [takes]
      if isinstance(provides, str):
          provides = [provides]
      di = takes_decorator(*takes)(provides_decorator(*provides)(func))
      self._add_dynamic_item_object(di)
  
imports: import inspect
  from dataclasses import dataclass
  from speechbrain.utils.depgraph import DependencyGraph
label_desc: Use image node_id 4 for calling the DataPipeline obj's underlying member method code with example usage: obj.add_dynamic_item(func, takes, provides) without return types