Skip to content

Commit 49e06d9

Browse files
committed
Simplify int handling in matching code
1 parent f15da4f commit 49e06d9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dpath/segments.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ def match(segments: Path, glob: Glob):
229229
g = '*'
230230

231231
try:
232-
# If search path segment (s) is an int and the current evaluated index (g) is int-like,
233-
# then g might be a sequence index as well. Try converting it to an int.
234-
if isinstance(s, int) and isinstance(g, str):
232+
# If search path segment (s) is an int then assume currently evaluated index (g) might be a sequenc
233+
# index as well. Try converting it to an int.
234+
if isinstance(s, int):
235235
return s == int(g)
236236
except:
237237
# Will reach this point if g can't be converted to an int (e.g. when g is a RegEx pattern).

0 commit comments

Comments
 (0)