class_docstr: Provide a few methods necessary to support nipype interface api
  
  The inputs attribute of interfaces call certain methods that are not
  available in traits.HasTraits. These are provided here.
  
  new metadata:
  
  * usedefault : set this to True if the default value of the trait should be
    used. Unless this is set, the attributes are set to traits.Undefined
  
  new attribute:
  
  * get_hashval : returns a tuple containing the state of the trait as a dict
    and hashvalue corresponding to dict.
  
  XXX Reconsider this in the long run, but it seems like the best
  solution to move forward on the refactoring.
class_docstr_tok: ["Provide","a","few","methods","necessary","to","support","nipype","interface","api","The","inputs","attribute","of","interfaces","call","certain","methods","that","are","not","available","in","traits.HasTraits",".","These","are","provided","here",".","new","metadata",":","*","usedefault",":","set","this","to","True","if","the","default","value","of","the","trait","should","be","used",".","Unless","this","is","set",",","the","attributes","are","set","to","traits.Undefined","new","attribute",":","*","get_hashval",":","returns","a","tuple","containing","the","state","of","the","trait","as","a","dict","and","hashvalue","corresponding","to","dict",".","XXX","Reconsider","this","in","the","long","run",",","but","it","seems","like","the","best","solution","to","move","forward","on","the","refactoring","."]
docstr: Return a dictionary of our items with hashes for each file.
  
  Searches through dictionary items and if an item is a file, it
  calculates the md5 hash of the file contents and stores the
  file name and hash value as the new key value.
  
  However, the overall bunch hash is calculated only on the hash
  value of a file. The path and name of the file are not used in
  the overall hash calculation.
  
  Returns
  -------
  list_withhash : dict
      Copy of our dictionary with the new file hashes included
      with each file.
  hashvalue : str
      The md5 hash value of the traited spec
docstr_tok: ["Return","a","dictionary","of","our","items","with","hashes","for","each","file",".","Searches","through","dictionary","items","and","if","an","item","is","a","file",",","it","calculates","the","md5","hash","of","the","file","contents","and","stores","the","file","name","and","hash","value","as","the","new","key","value",".","However",",","the","overall","bunch","hash","is","calculated","only","on","the","hash","value","of","a","file",".","The","path","and","name","of","the","file","are","not","used","in","the","overall","hash","calculation",".","Returns","--","--","--","-","list_withhash",":","dict","Copy","of","our","dictionary","with","the","new","file","hashes","included","with","each","file",".","hashvalue",":","str","The","md5","hash","value","of","the","traited","spec"]
code: def get_hashval(self, hash_method=None):
      """Return a dictionary of our items with hashes for each file.
  
      Searches through dictionary items and if an item is a file, it
      calculates the md5 hash of the file contents and stores the
      file name and hash value as the new key value.
  
      However, the overall bunch hash is calculated only on the hash
      value of a file. The path and name of the file are not used in
      the overall hash calculation.
  
      Returns
      -------
      list_withhash : dict
          Copy of our dictionary with the new file hashes included
          with each file.
      hashvalue : str
          The md5 hash value of the traited spec
  
      """
      list_withhash = []
      list_nofilename = []
      for name, val in sorted(self.trait_get().items()):
          if not isdefined(val) or self.has_metadata(
              name, "nohash", True
          ):
              # skip undefined traits and traits with nohash=True
              continue
  
          hash_files = not self.has_metadata(
              name, "hash_files", False
          ) and not self.has_metadata(name, "name_source")
          list_nofilename.append(
              (
                  name,
                  self._get_sorteddict(
                      val,
                      hash_method=hash_method,
                      hash_files=hash_files,
                  ),
              )
          )
          list_withhash.append(
              (
                  name,
                  self._get_sorteddict(
                      val,
                      True,
                      hash_method=hash_method,
                      hash_files=hash_files,
                  ),
              )
          )
      return (
          list_withhash,
          md5(str(list_nofilename).encode()).hexdigest(),
      )
  
imports: import os
  from inspect import isclass
  from copy import deepcopy
  from warnings import warn
  from packaging.version import Version
  from traits.trait_errors import TraitError
  from traits.trait_handlers import TraitDictObject, TraitListObject
  from ...utils.filemanip import md5, hash_infile, hash_timestamp
  from .traits_extension import traits, File, Str, Undefined, isdefined, has_metadata, OutputMultiObject
  from ...None import config, __version__
label_desc: Use image node_id 11 for calling the BaseTraitedSpec obj's underlying member method code with example usage: obj.get_hashval(hash_method) and returns: list_withhash,  md5