Skip to content

Commit d294b70

Browse files
committed
style: rename variable steps to segments
1 parent 4d2467c commit d294b70

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

jsonpath/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Author : zhangxianbing
33
Date : 2020-12-27 09:22:14
44
LastEditors : zhangxianbing
5-
LastEditTime : 2021-01-04 16:30:17
5+
LastEditTime : 2021-01-06 10:22:43
66
Description : JSONPath
77
"""
88
__version__ = "1.0.1"
@@ -66,17 +66,17 @@ class JSONPath:
6666
)
6767

6868
# annotations
69-
steps: list
69+
segments: list
7070
lpath: int
7171
subx = defaultdict(list)
7272
result: list
7373
result_type: str
7474

7575
def __init__(self, expr: str):
7676
expr = self._parse_expr(expr)
77-
self.steps = expr.split(JSONPath.SEP)
78-
self.lpath = len(self.steps)
79-
LOG.debug(f"steps : {self.steps}")
77+
self.segments = expr.split(JSONPath.SEP)
78+
self.lpath = len(self.segments)
79+
LOG.debug(f"segments : {self.segments}")
8080

8181
def parse(self, obj, result_type="VALUE"):
8282
if not isinstance(obj, (list, dict)):
@@ -176,7 +176,7 @@ def _trace(self, obj, i: int, path):
176176
177177
Args:
178178
obj ([type]): current operating object
179-
i (int): current operation specified by index in self.steps
179+
i (int): current operation specified by index in self.segments
180180
"""
181181

182182
# store
@@ -188,7 +188,7 @@ def _trace(self, obj, i: int, path):
188188
LOG.debug(f"path: {path} | value: {obj}")
189189
return
190190

191-
step = self.steps[i]
191+
step = self.segments[i]
192192

193193
# wildcard
194194
if step == "*":

0 commit comments

Comments
 (0)