From d6a1fdde522f8824d96e51623b64bc3cf6503327 Mon Sep 17 00:00:00 2001 From: Radko Krkos <krkos@cesnet.cz> Date: Mon, 20 Mar 2023 18:22:19 +0100 Subject: [PATCH] jpath: Remove an unnecessary cast and reorder conditions in jpath_values() --- pynspect/jpath.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pynspect/jpath.py b/pynspect/jpath.py index 84f237a..86bf9b7 100644 --- a/pynspect/jpath.py +++ b/pynspect/jpath.py @@ -279,11 +279,11 @@ def jpath_values(structure, jpath): idx = chnk['i'] # Skip the node, if the key does not exist, the value is not # 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 try: # Handle '*' special index - append all nodes. - if str(idx) == '*': + if idx == '*': nodes_b.extend(node[key]) # Append only node at particular index. else: -- GitLab