Skip to content
Snippets Groups Projects
Commit d6a1fdde authored by Radko Krkoš's avatar Radko Krkoš
Browse files

jpath: Remove an unnecessary cast and reorder conditions in jpath_values()

parent 3af1c01a
No related branches found
No related tags found
No related merge requests found
Pipeline #3439 passed
...@@ -279,11 +279,11 @@ def jpath_values(structure, jpath): ...@@ -279,11 +279,11 @@ def jpath_values(structure, jpath):
idx = chnk['i'] idx = chnk['i']
# Skip the node, if the key does not exist, the value is not # Skip the node, if the key does not exist, the value is not
# a list-like object or the list is empty. # a list-like object or the list is empty.
if not key in node or not (isinstance(node[key], (list, MutableSequence))) or not node[key]: if key not in node or not node[key] or not isinstance(node[key], (list, MutableSequence)):
continue continue
try: try:
# Handle '*' special index - append all nodes. # Handle '*' special index - append all nodes.
if str(idx) == '*': if idx == '*':
nodes_b.extend(node[key]) nodes_b.extend(node[key])
# Append only node at particular index. # Append only node at particular index.
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment