def get_hashval(inputdict, skip=None):
 dict_withhash = {}
 dict_nofilename = OrderedDict()
 keys = {}
 for key in inputdict:
  if ((skip is not None) and (key in skip)):
   continue
  keys[key.uri] = key
 for key in sorted(keys):
  val = inputdict[keys[key]]
  outname = key
  try:
   if isinstance(val, pm.URIRef):
    val = val.decode()
  except AttributeError:
   pass
  if isinstance(val, pm.QualifiedName):
   val = val.uri
  if isinstance(val, pm.Literal):
   val = val.value
  dict_nofilename[outname] = _get_sorteddict(val)
  dict_withhash[outname] = _get_sorteddict(val, True)
  sorted_dict = str(sorted(dict_nofilename.items()))
 return (dict_withhash, md5(sorted_dict.encode()).hexdigest())

def get_hashval ( inputdict , skip = None ) : dict_withhash = { } dict_nofilename = OrderedDict ( ) keys = { } for key in inputdict : if ( ( skip is not None ) and ( key in skip ) ) : continue keys [ key . uri ] = key for key in sorted ( keys ) : val = inputdict [ keys [ key ] ] outname = key try : if isinstance ( val , pm . URIRef ) : val = val . decode ( ) except AttributeError : pass if isinstance ( val , pm . QualifiedName ) : val = val . uri if isinstance ( val , pm . Literal ) : val = val . value dict_nofilename [ outname ] = _get_sorteddict ( val ) dict_withhash [ outname ] = _get_sorteddict ( val , True ) sorted_dict = str ( sorted ( dict_nofilename . items ( ) ) ) return ( dict_withhash , md5 ( sorted_dict . encode ( ) ) . hexdigest ( ) )
return a dictionary of our items with hashes for each file .