@@ -78,7 +78,7 @@ def resolve(self, node: JSONPathNode) -> Iterable[JSONPathNode]:
7878 with suppress (KeyError ):
7979 yield JSONPathNode (
8080 value = node .value [self .name ],
81- location = node .location + (self .name , ),
81+ location = node .location . prepend (self .name ),
8282 root = node .root ,
8383 )
8484
@@ -127,7 +127,7 @@ def resolve(self, node: JSONPathNode) -> Iterable[JSONPathNode]:
127127 with suppress (IndexError ):
128128 _node = JSONPathNode (
129129 value = node .value [self .index ],
130- location = node .location + (norm_index , ),
130+ location = node .location . prepend (norm_index ),
131131 root = node .root ,
132132 )
133133 yield _node
@@ -188,7 +188,7 @@ def resolve(self, node: JSONPathNode) -> Iterable[JSONPathNode]:
188188 norm_index = self ._normalized_index (node .value , idx )
189189 _node = JSONPathNode (
190190 value = element ,
191- location = node .location + (norm_index , ),
191+ location = node .location . prepend (norm_index ),
192192 root = node .root ,
193193 )
194194 yield _node
@@ -223,7 +223,7 @@ def resolve(self, node: JSONPathNode) -> Iterable[JSONPathNode]:
223223 for name , val in members :
224224 _node = JSONPathNode (
225225 value = val ,
226- location = node .location + (name , ),
226+ location = node .location . prepend (name ),
227227 root = node .root ,
228228 )
229229 yield _node
@@ -232,7 +232,7 @@ def resolve(self, node: JSONPathNode) -> Iterable[JSONPathNode]:
232232 for i , element in enumerate (node .value ):
233233 _node = JSONPathNode (
234234 value = element ,
235- location = node .location + ( i , ),
235+ location = node .location . prepend ( i ),
236236 root = node .root ,
237237 )
238238 yield _node
@@ -286,7 +286,7 @@ def resolve(self, node: JSONPathNode) -> Iterable[JSONPathNode]: # noqa: PLR091
286286 if self .expression .evaluate (context ):
287287 yield JSONPathNode (
288288 value = val ,
289- location = node .location + (name , ),
289+ location = node .location . prepend (name ),
290290 root = node .root ,
291291 )
292292 except JSONPathTypeError as err :
@@ -305,7 +305,7 @@ def resolve(self, node: JSONPathNode) -> Iterable[JSONPathNode]: # noqa: PLR091
305305 if self .expression .evaluate (context ):
306306 yield JSONPathNode (
307307 value = element ,
308- location = node .location + ( i , ),
308+ location = node .location . prepend ( i ),
309309 root = node .root ,
310310 )
311311 except JSONPathTypeError as err :
0 commit comments