#NEWLINE# def make_md5( * data ) : #NEWLINE# #INDENT# "Make a md5 hash based on``data``.\n\n    Specifically, this knows about ``Hunk`` objects, and makes sure\n    the actual content is hashed.\n\n    This is very conservative, and raises an exception if there are\n    data types that it does not explicitly support. This is because\n    we had in the past some debugging headaches with the cache not\n    working for this very reason.\n\n    MD5 is faster than sha, and we don't care so much about collisions.\n    We care enough however not to use hash().\n    " #NEWLINE# def walk( obj ) : #NEWLINE# #INDENT# if isinstance ( obj , ( tuple , list , frozenset ) ) : #NEWLINE# #INDENT# for item in obj : #NEWLINE# #INDENT# for d in walk ( item ) : #NEWLINE# #INDENT# ( yield d ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , dict ) : #NEWLINE# #INDENT# for k in sorted ( obj . keys ( ) ) : #NEWLINE# #INDENT# for d in walk ( k ) : #NEWLINE# #INDENT# ( yield d ) #NEWLINE# #UNINDENT# for d in walk ( obj [ k ] ) : #NEWLINE# #INDENT# ( yield d ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , BaseHunk ) : #NEWLINE# #INDENT# ( yield obj . data ( ) . encode ( 'utf-8' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , int ) : #NEWLINE# #INDENT# ( yield str ( obj ) . encode ( 'utf-8' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , six . text_type ) : #NEWLINE# #INDENT# ( yield obj . encode ( 'utf-8' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , six . binary_type ) : #NEWLINE# #INDENT# ( yield obj ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( obj , 'id' ) : #NEWLINE# #INDENT# for i in walk ( obj . id ( ) ) : #NEWLINE# #INDENT# ( yield i ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( obj is None ) : #NEWLINE# #INDENT# ( yield 'None' . encode ( 'utf-8' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , types . FunctionType ) : #NEWLINE# #INDENT# ( yield str ( hash ( obj ) ) . encode ( 'utf-8' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'Cannot MD5 type %s' % type ( obj ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# md5 = md5_constructor ( ) #NEWLINE# for d in walk ( d ) : #NEWLINE# #INDENT# md5 . update ( d ) #NEWLINE# #UNINDENT# return md5 . hexdigest ( )