Skip to content

Commit e6f6891

Browse files
committed
Remove redundant check for invalid property name characters
1 parent 20343db commit e6f6891

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

jsonpath_rfc9535/parse.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import annotations
44

55
import json
6-
import re
76
from typing import TYPE_CHECKING
87
from typing import Callable
98
from typing import Dict
@@ -51,41 +50,6 @@
5150

5251
# ruff: noqa: D102
5352

54-
INVALID_NAME_SELECTOR_CHARS = [
55-
"\x00",
56-
"\x01",
57-
"\x02",
58-
"\x03",
59-
"\x04",
60-
"\x05",
61-
"\x06",
62-
"\x07",
63-
"\x08",
64-
"\t",
65-
"\n",
66-
"\x0b",
67-
"\x0c",
68-
"\r",
69-
"\x0e",
70-
"\x0f",
71-
"\x10",
72-
"\x11",
73-
"\x12",
74-
"\x13",
75-
"\x14",
76-
"\x15",
77-
"\x16",
78-
"\x17",
79-
"\x18",
80-
"\x19",
81-
"\x1a",
82-
"\x1b",
83-
"\x1c",
84-
"\x1d",
85-
"\x1e",
86-
"\x1f",
87-
]
88-
8953

9054
class Parser:
9155
"""A JSONPath expression parser bound to a `JSONPathEnvironment`."""
@@ -138,11 +102,6 @@ class Parser:
138102
]
139103
)
140104

141-
_INVALID_NAME_SELECTOR_CHARS = f"[{''.join(INVALID_NAME_SELECTOR_CHARS)}]"
142-
RE_INVALID_NAME_SELECTOR = re.compile(
143-
rf'(?:(?!(?<!\\)"){_INVALID_NAME_SELECTOR_CHARS})'
144-
)
145-
146105
def __init__(self, *, env: JSONPathEnvironment) -> None:
147106
self.env = env
148107

@@ -329,12 +288,6 @@ def parse_bracketed_selection(self, stream: TokenStream) -> List[JSONPathSelecto
329288
TokenType.DOUBLE_QUOTE_STRING,
330289
TokenType.SINGLE_QUOTE_STRING,
331290
):
332-
if self.RE_INVALID_NAME_SELECTOR.search(stream.current.value):
333-
raise JSONPathSyntaxError(
334-
f"invalid name selector {stream.current.value!r}",
335-
token=stream.current,
336-
)
337-
338291
selectors.append(
339292
NameSelector(
340293
env=self.env,

0 commit comments

Comments
 (0)