def key_match_invariant(pmap): for (key, value) in pmap.items(): if key != getattr(value, attribute): return ( False, "{} is not correct key for {}".format(key, value) ) return (True, "")
def key_match_invariant(pmap): # Either the field allows None, in which case this is necessary, # or it doesn't in which case this won't do any harm since # invalidity of None will be enforced elsewhere: if pmap is None: return (True, "") for (key, value) in pmap.items(): if key != getattr(value, attribute): return (False, "{} is not correct key for {}".format(key, value)) return (True, "")
def key_match_invariant(pmap): # Either the field allows None, in which case this is necessary, # or it doesn't in which case this won't do any harm since # invalidity of None will be enforced elsewhere: if pmap is None: return (True, "") for (key, value) in pmap.items(): if key != getattr(value, attribute): return ( False, "{} is not correct key for {}".format(key, value) ) return (True, "")
def key_match_invariant(pmap): for (key, value) in pmap.items(): if key != getattr(value, attribute): return (False, "{} is not correct key for {}".format(key, value)) return (True, "")