We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7cc33b2 commit e94884eCopy full SHA for e94884e
2 files changed
dpath/options.py
@@ -1 +1,2 @@
1
ALLOW_EMPTY_STRING_KEYS = False
2
+CONVERT_INT_LIKE_SEGMENTS = True
dpath/util.py
@@ -32,14 +32,15 @@ def __safe_path__(path, separator):
32
raise InvalidKeyName("{} at {}[{}] contains the separator '{}'"
33
"".format(segment, segments, i, separator))
34
35
- # Attempt to convert integer segments into actual integers.
36
- final = []
37
- for segment in segments:
38
- try:
39
- final.append(int(segment))
40
- except:
41
- final.append(segment)
42
- segments = final
+ if options.CONVERT_INT_LIKE_SEGMENTS:
+ # Attempt to convert integer segments into actual integers.
+ final = []
+ for segment in segments:
+ try:
+ final.append(int(segment))
+ except:
+ final.append(segment)
43
+ segments = final
44
45
return segments
46
0 commit comments