Skip to content

Commit 0ba7b27

Browse files
committed
Minor fixes: use f string , fix path
1 parent 302d715 commit 0ba7b27

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

jsonschema_lexer/_lexer.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,16 @@ def __init__(self, default_dialect: str | None = None):
5353
def _populate_keywords_and_identifiers(self):
5454
dialect_files = files("jsonschema_lexer") / "data" / "keywords"
5555
if not dialect_files.is_dir():
56-
dialect_files = Path(__file__).parent.parent / "data" / "keywords"
56+
dialect_files = Path(__file__).parent / "data" / "keywords"
5757
for dialect_file in dialect_files.iterdir():
5858
with dialect_file.open() as file:
5959
json_content = json.load(file)
60-
dialect_name = self._make_string_double_quoted(
61-
json_content["dialect"],
62-
)
60+
dialect_name = f'"{json_content["dialect"]}"'
6361
self.keywords[dialect_name] = json_content["keywords"]
6462
self.identifier[dialect_name] = (
65-
self._make_string_double_quoted(
66-
json_content["identifier"],
67-
)
63+
f'"{json_content["identifier"]}"'
6864
)
6965

70-
def _make_string_double_quoted(self, string: str):
71-
return '"' + string + '"'
72-
7366
def _find_rightmost_token_index(
7467
self,
7568
syntax_stack: list[tuple[int, str]],

0 commit comments

Comments
 (0)