Skip to content

Commit dd117af

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e1711f2 commit dd117af

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,4 @@ cython_debug/
151151

152152
# User defined
153153
_cache
154-
_templates
154+
_templates

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ It utilizes Pygments, a syntax highlighting library, to tokenize JSON Schema doc
2525
Usage
2626
-----
2727

28-
Once installed, you can use it in your Python code to highlight JSON Schema documents.
28+
Once installed, you can use it in your Python code to highlight JSON Schema documents.
2929

3030
Here's a simple example:
3131

3232
.. code-block:: python
3333
3434
# Import the JSONSchemaLexer class from the package
3535
from jsonschema_lexer import JSONSchemaLexer
36-
36+
3737
from rich.console import Console
3838
from rich.syntax import Syntax
39-
39+
4040
console = Console()
4141
4242
code = """

jsonschema_lexer/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from .lexer import JSONSchemaLexer # type: ignore

jsonschema_lexer/lexer.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pygments.lexer import include, RegexLexer
1+
from pygments.lexer import RegexLexer, include
22
from pygments.token import Token
33

44

@@ -11,6 +11,7 @@ def _get_regex_from_options(options: list[str]) -> str:
1111
1212
Returns:
1313
str: Regular expression pattern constructed from the options.
14+
1415
"""
1516
options = ['"' + option + '"' for option in options]
1617
regex_str = "(" + "|".join(options) + ")"
@@ -24,7 +25,15 @@ class JSONSchemaLexer(RegexLexer):
2425

2526
name = "JSON Schema Lexer"
2627

27-
data_types = ["object", "integer", "string", "number", "array", "boolean", "null"]
28+
data_types = [
29+
"object",
30+
"integer",
31+
"string",
32+
"number",
33+
"array",
34+
"boolean",
35+
"null",
36+
]
2837
core_keywords = [
2938
r"\$schema",
3039
r"\$id",
@@ -148,7 +157,10 @@ class JSONSchemaLexer(RegexLexer):
148157
"simplevalue": [
149158
include("data_types"),
150159
(r"(true|false)", Token.Number),
151-
(r"-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?", Token.Number.Integer),
160+
(
161+
r"-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?",
162+
Token.Number.Integer,
163+
),
152164
('"(\\|"|[^"])*"', Token.String.Double),
153165
],
154166
# the right hand side of an object, after the attribute name

0 commit comments

Comments
 (0)