We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cb6b94b commit 42ad0a1Copy full SHA for 42ad0a1
1 file changed
dpath/segments.py
@@ -232,11 +232,12 @@ def match(segments: Path, glob: Glob):
232
# If search path segment (s) is an int and the current evaluated index (g) is int-like,
233
# then g is surely a sequence index as well. Convert it to int and compare.
234
if isinstance(s, int) and isinstance(g, str):
235
- neg_c = g.count("-")
236
-
237
- if (neg_c == 0 and g.isdigit()) or (neg_c == 1 and g.lstrip("-").isdigit()):
238
- return s == int(g)
+ return s == int(g)
+ except:
+ # Will reach this point if g can't be converted to an int...
+ pass
239
240
+ try:
241
# Let's see if the glob matches. We will turn any kind of
242
# exception while attempting to match into a False for the
243
# match.
0 commit comments