Skip to content

Commit 0856085

Browse files
committed
refactor: simplify JSONPointer._parse()
1 parent 72a7c4f commit 0856085

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎jsonpath/pointer.py‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,9 @@ def _parse(
8787
.decode("utf-16")
8888
)
8989

90-
parts = tuple(
90+
return tuple(
9191
self._index(p.replace("~1", "/").replace("~0", "~")) for p in s.split("/")
92-
)
93-
94-
if parts == ("",):
95-
return ()
96-
if parts == ("", ""):
97-
return ("",)
98-
return parts[1:]
92+
)[1:]
9993

10094
def _index(self, s: str) -> Union[str, int]:
10195
try:

0 commit comments

Comments
 (0)