@@ -89,6 +89,9 @@ def in_context(self, context, path):
89
89
def full_path (self ):
90
90
return self .path if self .context is None else self .context .full_path .child (self .path )
91
91
92
+ def patch_path (self ):
93
+ return self .path .patch_path () if self .context is None else self .context .patch_path () + self .path .patch_path ()
94
+
92
95
@property
93
96
def id_pseudopath (self ):
94
97
"""
@@ -180,6 +183,9 @@ def update(self, data, val):
180
183
def __str__ (self ):
181
184
return '$'
182
185
186
+ def patch_path (self ):
187
+ return ''
188
+
183
189
def __repr__ (self ):
184
190
return 'Root()'
185
191
@@ -200,6 +206,9 @@ def update(self, data, val):
200
206
def __str__ (self ):
201
207
return '`this`'
202
208
209
+ def patch_path (self ):
210
+ return ''
211
+
203
212
def __repr__ (self ):
204
213
return 'This()'
205
214
@@ -272,7 +281,7 @@ def __init__(self, left, right):
272
281
self .right = right
273
282
274
283
def find (self , data ):
275
- return [subdata for subdata in self .left .find (data ) if self .right .find (subdata )]
284
+ return [subdata for subdata in self .left .find (data ) if self .right .find (data )]
276
285
277
286
def __str__ (self ):
278
287
return '%s where %s' % (self .left , self .right )
@@ -416,7 +425,10 @@ def find(self, datum):
416
425
if field_datum is not None ]
417
426
418
427
def __str__ (self ):
419
- return ',' .join (map (str , self .fields ))
428
+ return ',' .join (self .fields )
429
+
430
+ def patch_path (self ):
431
+ return '/' + '/' .join (self .fields )
420
432
421
433
def __repr__ (self ):
422
434
return '%s(%s)' % (self .__class__ .__name__ , ',' .join (map (repr , self .fields )))
@@ -451,6 +463,9 @@ def __eq__(self, other):
451
463
def __str__ (self ):
452
464
return '[%i]' % self .index
453
465
466
+ def patch_path (self ):
467
+ return '/%i' % self .index
468
+
454
469
class Slice (JSONPath ):
455
470
"""
456
471
JSONPath matching a slice of an ar
3773
ray.
0 commit comments