class_docstr: Basic interface class generates identity mappings
  
  Examples
  --------
  
  >>> from nipype.interfaces.utility import IdentityInterface
  >>> ii = IdentityInterface(fields=['a', 'b'], mandatory_inputs=False)
  >>> ii.inputs.a
  <undefined>
  
  >>> ii.inputs.a = 'foo'
  >>> out = ii._outputs()
  >>> out.a
  <undefined>
  
  >>> out = ii.run()
  >>> out.outputs.a
  'foo'
  
  >>> ii2 = IdentityInterface(fields=['a', 'b'], mandatory_inputs=True)
  >>> ii2.inputs.a = 'foo'
  >>> out = ii2.run() # doctest: +SKIP
  ValueError: IdentityInterface requires a value for input 'b' because it was listed in 'fields' Interface IdentityInterface failed to run.
class_docstr_tok: ["Basic","interface","class","generates","identity","mappings","Examples","--","--","--","--",">",">",">","from","nipype.interfaces.utility","import","IdentityInterface",">",">",">","ii","=","IdentityInterface","(","fields=","[","'","a","'",",","'","b","'","]",",","mandatory_inputs=False",")",">",">",">","ii.inputs.a","<","undefined",">",">",">",">","ii.inputs.a","=","'foo'",">",">",">","out","=","ii._outputs","(",")",">",">",">","out.a","<","undefined",">",">",">",">","out","=","ii.run","(",")",">",">",">","out.outputs.a","'foo'",">",">",">","ii2","=","IdentityInterface","(","fields=","[","'","a","'",",","'","b","'","]",",","mandatory_inputs=True",")",">",">",">","ii2.inputs.a","=","'foo'",">",">",">","out","=","ii2.run","(",")","#","doctest",":","+SKIP","ValueError",":","IdentityInterface","requires","a","value","for","input","'","b","'","because","it","was","listed","in","'fields","'","Interface","IdentityInterface","failed","to","run","."]
code: def __init__(self, fields=None, mandatory_inputs=True, **inputs):
      super().__init__(**inputs)
      if fields is None or not fields:
          raise ValueError(
              "Identity Interface fields must be a non-empty list"
          )
      # Each input must be in the fields.
      for in_field in inputs:
          if in_field not in fields:
              raise ValueError(
                  "Identity Interface input is not in the fields: %s"
                  % in_field
              )
      self._fields = fields
      self._mandatory_inputs = mandatory_inputs
      add_traits(self.inputs, fields)
      # Adding any traits wipes out all input values set in superclass initialization,
      # even it the trait is not in the add_traits argument. The work-around is to reset
      # the values after adding the traits.
      self.inputs.trait_set(**inputs)
  
imports: import os
  import re
  import numpy
  from ..base import traits, TraitedSpec, DynamicTraitedSpec, File, Undefined, isdefined, OutputMultiPath, InputMultiPath, BaseInterface, BaseInterfaceInputSpec, Str, SimpleInterface
  from ..io import IOBase, add_traits
  from ...utils.filemanip import ensure_list, copyfile, split_filename
label_desc: Use image node_id 1 to create a new IdentityInterface object from inherited base classes: IOBase with example: obj = IdentityInterface(fields, mandatory_inputs)