Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _order_by_dict_is_not_well_formed(d):
if not isinstance(d, dict):
# Bad type.
return True
if "property_name" in d and d["property_name"]:
if "direction" in d and not direction.is_valid_direction(d["direction"]):
# Bad direction provided.
return True
for k in d:
if k != "property_name" and k != "direction":
# Unexpected key.
return True
# Everything looks good!
return False
# Missing required key.
return True