Skip to content

Commit cfb7bcb

Browse files
Update default JSONPointer backend (#37)
* fix earlier docs * my upstream bugfix was merged, so _DEFAULT_POINTER_CLS can be simpler hack
1 parent a2c4fe1 commit cfb7bcb

2 files changed

Lines changed: 1 addition & 16 deletions

File tree

.github/workflows/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ writes:
3636

3737
- [`scorecard.yml`](scorecard.yml)
3838
- [`dependabot-update-openapi-snapshots.yml`](dependabot-update-openapi-snapshots.yml)
39-
(mints app token before regenerating and committing snapshots)
4039

4140
This keeps write operations explicit and reduces default token blast radius.
4241

jsonpatchx/backend.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ def parts(self) -> Sequence[str]:
9090

9191

9292
class _DEFAULT_POINTER_CLS(JsonPointer): # type: ignore[misc]
93-
# fixes https://github.com/stefankoegl/python-json-pointer/issues/63
94-
# and https://github.com/stefankoegl/python-json-pointer/issues/70
93+
# fixes https://github.com/stefankoegl/python-json-pointer/issues/70
9594
@override
9695
@classmethod
9796
def get_part(cls, doc, part): # type: ignore[no-untyped-def]
@@ -100,21 +99,8 @@ def get_part(cls, doc, part): # type: ignore[no-untyped-def]
10099
f"Cannot apply token {part!r} to non-container type {type(doc)}"
101100
)
102101
key = super().get_part(doc, part)
103-
if isinstance(key, int) and not _NONNEGATIVE_ARRAY_INDEX_PATTERN.fullmatch(
104-
str(part)
105-
):
106-
raise JPException("'%s' is not a valid sequence index" % part)
107102
return key
108103

109-
@override
110-
def to_last(self, doc): # type: ignore[no-untyped-def] # pragma: no cover
111-
doc, key = super().to_last(doc)
112-
if isinstance(key, int) and not _NONNEGATIVE_ARRAY_INDEX_PATTERN.fullmatch(
113-
str(self.parts[-1])
114-
):
115-
raise JPException("'%s' is not a valid sequence index" % self.parts[-1])
116-
return doc, key
117-
118104
@override
119105
def walk(self, doc, part): # type: ignore[no-untyped-def]
120106
part = self.get_part(doc, part) # type: ignore[no-untyped-call]

0 commit comments

Comments
 (0)