From 545ec8dda714554ac71fc24964ae96fe8ea7aec8 Mon Sep 17 00:00:00 2001 From: Thomas <34217413+thommann@users.noreply.github.com> Date: Tue, 8 Jul 2025 16:50:53 +0200 Subject: [PATCH] chore(jambo): Clean up __future__ typing (#10) * Replace forward-referenced strings with direct type annotations in `json_schema_type.py`. * refactor(ref_type_parser): eliminate unused future annotations import --- jambo/parser/ref_type_parser.py | 2 -- jambo/types/json_schema_type.py | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/jambo/parser/ref_type_parser.py b/jambo/parser/ref_type_parser.py index d3cf49e..69f43a9 100644 --- a/jambo/parser/ref_type_parser.py +++ b/jambo/parser/ref_type_parser.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from jambo.parser import GenericTypeParser from jambo.types.type_parser_options import TypeParserOptions diff --git a/jambo/types/json_schema_type.py b/jambo/types/json_schema_type.py index a30612c..be82093 100644 --- a/jambo/types/json_schema_type.py +++ b/jambo/types/json_schema_type.py @@ -35,17 +35,17 @@ class JSONSchema(TypedDict, total=False): type: JSONSchemaType | list[JSONSchemaType] # Object-specific keywords - properties: dict[str, "JSONSchema"] + properties: dict[str, JSONSchema] required: list[str] - additionalProperties: bool | "JSONSchema" + additionalProperties: bool | JSONSchema minProperties: int maxProperties: int - patternProperties: dict[str, "JSONSchema"] - dependencies: dict[str, list[str] | "JSONSchema"] + patternProperties: dict[str, JSONSchema] + dependencies: dict[str, list[str] | JSONSchema] # Array-specific keywords - items: "JSONSchema" | list["JSONSchema"] - additionalItems: bool | "JSONSchema" + items: JSONSchema | list[JSONSchema] + additionalItems: bool | JSONSchema minItems: int maxItems: int uniqueItems: bool @@ -68,15 +68,15 @@ class JSONSchema(TypedDict, total=False): const: JSONType # Conditionals - if_: "JSONSchema" # 'if' is a reserved word in Python - then: "JSONSchema" - else_: "JSONSchema" # 'else' is also a reserved word + if_: JSONSchema # 'if' is a reserved word in Python + then: JSONSchema + else_: JSONSchema # 'else' is also a reserved word # Combination keywords - allOf: list["JSONSchema"] - anyOf: list["JSONSchema"] - oneOf: list["JSONSchema"] - not_: "JSONSchema" # 'not' is a reserved word + allOf: list[JSONSchema] + anyOf: list[JSONSchema] + oneOf: list[JSONSchema] + not_: JSONSchema # 'not' is a reserved word # Fix forward references