docstr: TransformSpec defines a user transformation that is applied to a loaded row on a worker thread/process.
  
  The object defines the function (callable) that perform the transform as well as the
  schema transform: pre-transform-schema to post-transform-schema.
  
  ``func`` argument is a callable which takes a row as its parameter and returns a modified row.
  ``edit_fields`` and ``removed_fields`` define mutating operations performed on the original schema that
  produce a post-transform schema. ``func`` return value must comply to this post-transform schema.
  
  :param func: Optional. A callable. The function is called on the worker thread. It takes a dictionary that
    complies to the input schema and must return a dictionary that complies to a post-transform schema. User may
    In case the user wants to only remove certain fields, the user may omit this argument and specify only
    `remove_fields` argument.
  :param edit_fields: Optional. A list of 4-tuples with the following fields:
    ``(name, numpy_dtype, shape, is_nullable)``.
  :param removed_fields: Optional[list]. A list of field names that will be removed from the original schema.
  :param selected_fields: Optional[list]. A list of field names specify the fields to be selected.
    If selected_fields specified, The reader schema will preserve the field order in selected_fields.
  
  Note: For param `removed_fields` and `selected_fields`, user can only specify one of them.
docstr_tok: ["TransformSpec","defines","a","user","transformation","that","is","applied","to","a","loaded","row","on","a","worker","thread\/process",".","The","object","defines","the","function","(","callable",")","that","perform","the","transform","as","well","as","the","schema","transform",":","pre-transform-schema","to","post-transform-schema",".","``","func","``","argument","is","a","callable","which","takes","a","row","as","its","parameter","and","returns","a","modified","row",".","``","edit_fields","``","and","``","removed_fields","``","define","mutating","operations","performed","on","the","original","schema","that","produce","a","post-transform","schema",".","``","func","``","return","value","must","comply","to","this","post-transform","schema",".",":","param","func",":","Optional",".","A","callable",".","The","function","is","called","on","the","worker","thread",".","It","takes","a","dictionary","that","complies","to","the","input","schema","and","must","return","a","dictionary","that","complies","to","a","post-transform","schema",".","User","may","In","case","the","user","wants","to","only","remove","certain","fields",",","the","user","may","omit","this","argument","and","specify","only","`","remove_fields","`","argument",".",":","param","edit_fields",":","Optional",".","A","list","of","4-tuples","with","the","following","fields",":","``","(","name",",","numpy_dtype",",","shape",",","is_nullable",")","``",".",":","param","removed_fields",":","Optional","[","list","]",".","A","list","of","field","names","that","will","be","removed","from","the","original","schema",".",":","param","selected_fields",":","Optional","[","list","]",".","A","list","of","field","names","specify","the","fields","to","be","selected",".","If","selected_fields","specified",",","The","reader","schema","will","preserve","the","field","order","in","selected_fields",".","Note",":","For","param","`","removed_fields","`","and","`","selected_fields","`",",","user","can","only","specify","one","of","them","."]
code: def __init__(
      self,
      func=None,
      edit_fields=None,
      removed_fields=None,
      selected_fields=None,
  ):
      """TransformSpec defines a user transformation that is applied to a loaded row on a worker thread/process.
  
      The object defines the function (callable) that perform the transform as well as the
      schema transform: pre-transform-schema to post-transform-schema.
  
      ``func`` argument is a callable which takes a row as its parameter and returns a modified row.
      ``edit_fields`` and ``removed_fields`` define mutating operations performed on the original schema that
      produce a post-transform schema. ``func`` return value must comply to this post-transform schema.
  
      :param func: Optional. A callable. The function is called on the worker thread. It takes a dictionary that
        complies to the input schema and must return a dictionary that complies to a post-transform schema. User may
        In case the user wants to only remove certain fields, the user may omit this argument and specify only
        `remove_fields` argument.
      :param edit_fields: Optional. A list of 4-tuples with the following fields:
        ``(name, numpy_dtype, shape, is_nullable)``.
      :param removed_fields: Optional[list]. A list of field names that will be removed from the original schema.
      :param selected_fields: Optional[list]. A list of field names specify the fields to be selected.
        If selected_fields specified, The reader schema will preserve the field order in selected_fields.
  
      Note: For param `removed_fields` and `selected_fields`, user can only specify one of them.
      """
      self.func = func
      self.edit_fields = edit_fields or []
  
      if removed_fields is not None and selected_fields is not None:
          raise ValueError(
              "User can only specify one of removed_fields and selected_fields in TransformSpec."
          )
  
      self.removed_fields = removed_fields or []
      self.selected_fields = selected_fields
  
imports: import warnings
  from petastorm.unischema import UnischemaField, Unischema
label_desc: Use image node_id 1 to create a new TransformSpec object from inherited base classes: object with example: obj = TransformSpec(func, edit_fields, removed_fields, selected_fields)