dts: edtlib: Improve naming in _check_binding()
'keys' is really a dictionary of options (like {"type": "int", ...}) for a property. Calling it 'options' makes it clearer. Also s/prop/prop_name/. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
parent
e328e56b30
commit
c0c8dd1b85
1 changed files with 9 additions and 7 deletions
|
@ -1189,22 +1189,24 @@ def _check_binding(binding, binding_path):
|
|||
ok_prop_keys = {"description", "type", "category", "constraint", "enum"}
|
||||
ok_categories = {"required", "optional"}
|
||||
|
||||
for prop, keys in binding["properties"].items():
|
||||
for key in keys:
|
||||
for prop_name, options in binding["properties"].items():
|
||||
for key in options:
|
||||
if key not in ok_prop_keys:
|
||||
_err("unknown setting '{}' in 'properties: {}: ...' in {}, "
|
||||
"expected one of {}".format(
|
||||
key, prop, binding_path, ", ".join(ok_prop_keys)))
|
||||
key, prop_name, binding_path,
|
||||
", ".join(ok_prop_keys)))
|
||||
|
||||
if "category" in keys and keys["category"] not in ok_categories:
|
||||
if "category" in options and options["category"] not in ok_categories:
|
||||
_err("unrecognized category '{}' for '{}' in 'properties' in {}, "
|
||||
"expected one of {}".format(
|
||||
keys["category"], prop, binding_path,
|
||||
options["category"], prop_name, binding_path,
|
||||
", ".join(ok_categories)))
|
||||
|
||||
if "description" in keys and not isinstance(keys["description"], str):
|
||||
if "description" in options and \
|
||||
not isinstance(options["description"], str):
|
||||
_err("missing, malformed, or empty 'description' for '{}' in "
|
||||
"'properties' in {}".format(prop, binding_path))
|
||||
"'properties' in {}".format(prop_name, binding_path))
|
||||
|
||||
|
||||
def _translate(addr, node):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue