Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pynspect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
713
Mentat
Pynspect
Commits
d6a1fdde
Commit
d6a1fdde
authored
2 years ago
by
Radko Krkoš
Browse files
Options
Downloads
Patches
Plain Diff
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
2 years ago
Stage: test
Stage: check-warnings
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pynspect/jpath.py
+2
-2
2 additions, 2 deletions
pynspect/jpath.py
with
2 additions
and
2 deletions
pynspect/jpath.py
+
2
−
2
View file @
d6a1fdde
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment