#NEWLINE# def is_consistent_with( sub , base ) : #NEWLINE# #INDENT# 'Returns whether the type a is consistent with b.\n\n  This is accordig to the terminology of PEP 483/484.  This relationship is\n  neither symmetric nor transitive, but a good mnemonic to keep in mind is that\n  is_consistent_with(a, b) is roughly equivalent to the issubclass(a, b)\n  relation, but also handles the special Any type as well as type\n  parameterization.\n  ' #NEWLINE# if ( sub == base ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# if ( isinstance ( sub , AnyTypeConstraint ) or isinstance ( base , AnyTypeConstraint ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# sub = normalize ( sub ) #NEWLINE# base = normalize ( base ) #NEWLINE# if isinstance ( base , TypeConstraint ) : #NEWLINE# #INDENT# return base . _consistent_with_check_ ( sub ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( sub , TypeConstraint ) : #NEWLINE# #INDENT# return ( sub == object ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return issubclass ( sub , base )