def get_defaults_for(parent="__default"):
	"""get all defaults"""
	defaults = frappe.cache().hget("defaults", parent)

	if defaults==None:
		# sort descending because first default must get precedence
		res = frappe.db.sql("""select defkey, defvalue from `tabDefaultValue`
			where parent = %s order by creation""", (parent,), as_dict=1)

		defaults = frappe._dict({})
		for d in res:
			if d.defkey in defaults:
				# listify
				if not isinstance(defaults[d.defkey], list) and defaults[d.defkey] != d.defvalue:
					defaults[d.defkey] = [defaults[d.defkey]]

				if defaults[d.defkey] not in d.defvalue:
					defaults[d.defkey].append(d.defvalue)

			elif d.defvalue is not None:
				defaults[d.defkey] = d.defvalue

		frappe.cache().hset("defaults", parent, defaults)

	return defaults
dataset/ETHPy150Open frappe/frappe/frappe/defaults.py/get_defaults_for/swapped operands of `not in`