From 0c64d85d8093da54bcbefe63072b3a111725c8d3 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Mon, 11 Mar 2024 09:42:28 -0400 Subject: [PATCH] Fixes for newer pygments types. --- jsonschema_lexer/_lexer.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jsonschema_lexer/_lexer.py b/jsonschema_lexer/_lexer.py index 54b28a0..4d9a81b 100644 --- a/jsonschema_lexer/_lexer.py +++ b/jsonschema_lexer/_lexer.py @@ -2,9 +2,11 @@ Contains the main functionality of the JSONSchemaLexer. """ +from __future__ import annotations + from importlib.resources import files from pathlib import Path -from typing import Any, ClassVar +from typing import TYPE_CHECKING import json from pygments.lexers.data import ( # type: ignore[reportMissingTypeStubs] @@ -12,6 +14,10 @@ ) from pygments.token import Token +if TYPE_CHECKING: + from collections.abc import Sequence + from typing import Any, ClassVar + class JSONSchemaLexer(JsonLexer): """ @@ -20,13 +26,13 @@ class JSONSchemaLexer(JsonLexer): name = "JSON Schema" url = "https://json-schema.org" - aliases: ClassVar[list[str]] = ["jsonschema", "json-schema"] - mimetypes: ClassVar[list[str]] = [ + aliases: Sequence[str] = ["jsonschema", "json-schema"] + mimetypes: Sequence[str] = [ "application/schema+json", "application/schema-instance+json", ] - data_types: ClassVar[list[str]] = [ + data_types: ClassVar[Sequence[str]] = [ '"object"', '"integer"', '"string"',