diff --git a/generators/python/sdk/CHANGELOG.md b/generators/python/sdk/CHANGELOG.md index 2fda0eac81f..49b79f3833c 100644 --- a/generators/python/sdk/CHANGELOG.md +++ b/generators/python/sdk/CHANGELOG.md @@ -5,32 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.2.0-rc1] - 2024-04-04 - -- Fix: Discriminated union variants that are objects now have inlined properties instead of - extending a base type. - - ```python - - Circle_Shape(pydantic_v1.BaseModel): - type: typing.Literal["circle"] - radius: integer - - Square_Shape(pydantic_v1.BaseModel): - type: typing.Literal["circle"] - side: integer - ``` - - instead of - - ```python - Circle_Shape(Circle): - type: typing.Literal["circle"] - - Square_Shape(Square): - type: typing.Literal["circle"] - ``` - ## [1.2.0-rc0] - 2024-04-04 - Feature: The generator now depends on v38 of Intermediate Representation which requires the latest diff --git a/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/discriminated_union/simple_discriminated_union_generator.py b/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/discriminated_union/simple_discriminated_union_generator.py index c4159684f71..5081c03cee6 100644 --- a/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/discriminated_union/simple_discriminated_union_generator.py +++ b/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/discriminated_union/simple_discriminated_union_generator.py @@ -80,7 +80,15 @@ def generate(self) -> None: ) for single_union_type in self._union.types: + single_union_type_base = single_union_type.shape.visit( + same_properties_as_object=lambda type_name: type_name, + single_property=lambda property_: None, + no_properties=lambda: None, + ) base_models = [] + if single_union_type_base is not None: + base_models.append(self._context.get_class_reference_for_type_id(single_union_type_base.type_id)) + all_referenced_types.append(ir_types.TypeReference.factory.named(single_union_type_base)) if class_reference_for_base is not None: base_models.append(class_reference_for_base) @@ -117,19 +125,6 @@ def generate(self) -> None: ) ) all_referenced_types.append(shape.type) - elif shape.properties_type == "samePropertiesAsObject": - object_properties = self._context.get_all_properties_including_extensions(shape.type_id) - for object_property in object_properties: - internal_pydantic_model_for_single_union_type.add_field( - PydanticField( - name=object_property.name.name.snake_case.unsafe_name, - pascal_case_field_name=object_property.name.name.pascal_case.unsafe_name, - json_field_name=object_property.name.wire_value, - type_hint=self._context.get_type_hint_for_type_reference( - type_reference=object_property.value_type - ), - ) - ) # if any of our fields are forward refs, we need to call # update_forwards_refs() diff --git a/seed/fastapi/seed.yml b/seed/fastapi/seed.yml index 3da837a66f2..6e8feef1c58 100644 --- a/seed/fastapi/seed.yml +++ b/seed/fastapi/seed.yml @@ -30,4 +30,4 @@ allowedFailures: - literal - websocket - enum - - server-sent-events + - server-sent-events. diff --git a/seed/fastapi/server-sent-events/.inputs/ir.json b/seed/fastapi/server-sent-events/.inputs/ir.json index bc3d2baa515..ff83b77af06 100644 --- a/seed/fastapi/server-sent-events/.inputs/ir.json +++ b/seed/fastapi/server-sent-events/.inputs/ir.json @@ -384,80 +384,7 @@ } } }, - "response": { - "type": "streaming", - "value": { - "type": "sse", - "payload": { - "_type": "named", - "name": { - "originalName": "StreamedCompletion", - "camelCase": { - "unsafeName": "streamedCompletion", - "safeName": "streamedCompletion" - }, - "snakeCase": { - "unsafeName": "streamed_completion", - "safeName": "streamed_completion" - }, - "screamingSnakeCase": { - "unsafeName": "STREAMED_COMPLETION", - "safeName": "STREAMED_COMPLETION" - }, - "pascalCase": { - "unsafeName": "StreamedCompletion", - "safeName": "StreamedCompletion" - } - }, - "fernFilepath": { - "allParts": [ - { - "originalName": "completions", - "camelCase": { - "unsafeName": "completions", - "safeName": "completions" - }, - "snakeCase": { - "unsafeName": "completions", - "safeName": "completions" - }, - "screamingSnakeCase": { - "unsafeName": "COMPLETIONS", - "safeName": "COMPLETIONS" - }, - "pascalCase": { - "unsafeName": "Completions", - "safeName": "Completions" - } - } - ], - "packagePath": [], - "file": { - "originalName": "completions", - "camelCase": { - "unsafeName": "completions", - "safeName": "completions" - }, - "snakeCase": { - "unsafeName": "completions", - "safeName": "completions" - }, - "screamingSnakeCase": { - "unsafeName": "COMPLETIONS", - "safeName": "COMPLETIONS" - }, - "pascalCase": { - "unsafeName": "Completions", - "safeName": "Completions" - } - } - }, - "typeId": "type_completions:StreamedCompletion" - }, - "terminator": "[[DONE]]", - "docs": null - } - }, + "response": null, "errors": [], "examples": [ { diff --git a/seed/fastapi/streaming/.inputs/ir.json b/seed/fastapi/streaming/.inputs/ir.json index bf317fd0643..94481401a1b 100644 --- a/seed/fastapi/streaming/.inputs/ir.json +++ b/seed/fastapi/streaming/.inputs/ir.json @@ -386,9 +386,9 @@ }, "response": { "type": "streaming", - "value": { + "dataEventType": { "type": "json", - "payload": { + "json": { "_type": "named", "name": { "originalName": "StreamResponse", @@ -453,10 +453,10 @@ } }, "typeId": "type_dummy:StreamResponse" - }, - "terminator": null, - "docs": null - } + } + }, + "terminator": null, + "docs": null }, "errors": [], "examples": [ diff --git a/seed/pydantic/circular-references-advanced/src/seed/api/resources/ast/field_value.py b/seed/pydantic/circular-references-advanced/src/seed/api/resources/ast/field_value.py index 877d2230b8b..ffb7f6f16a4 100644 --- a/seed/pydantic/circular-references-advanced/src/seed/api/resources/ast/field_value.py +++ b/seed/pydantic/circular-references-advanced/src/seed/api/resources/ast/field_value.py @@ -5,6 +5,7 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .object_value import ObjectValue from .primitive_value import PrimitiveValue @@ -13,9 +14,13 @@ class FieldValue_PrimitiveValue(pydantic_v1.BaseModel): value: PrimitiveValue -class FieldValue_ObjectValue(pydantic_v1.BaseModel): +class FieldValue_ObjectValue(ObjectValue): type: typing.Literal["object_value"] = "object_value" + class Config: + allow_population_by_field_name = True + populate_by_name = True + class FieldValue_ContainerValue(pydantic_v1.BaseModel): type: typing.Literal["container_value"] = "container_value" diff --git a/seed/pydantic/circular-references/src/seed/api/resources/ast/field_value.py b/seed/pydantic/circular-references/src/seed/api/resources/ast/field_value.py index 877d2230b8b..ffb7f6f16a4 100644 --- a/seed/pydantic/circular-references/src/seed/api/resources/ast/field_value.py +++ b/seed/pydantic/circular-references/src/seed/api/resources/ast/field_value.py @@ -5,6 +5,7 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .object_value import ObjectValue from .primitive_value import PrimitiveValue @@ -13,9 +14,13 @@ class FieldValue_PrimitiveValue(pydantic_v1.BaseModel): value: PrimitiveValue -class FieldValue_ObjectValue(pydantic_v1.BaseModel): +class FieldValue_ObjectValue(ObjectValue): type: typing.Literal["object_value"] = "object_value" + class Config: + allow_population_by_field_name = True + populate_by_name = True + class FieldValue_ContainerValue(pydantic_v1.BaseModel): type: typing.Literal["container_value"] = "container_value" diff --git a/seed/pydantic/examples/src/seed/examples/resources/commons/resources/types/event_info.py b/seed/pydantic/examples/src/seed/examples/resources/commons/resources/types/event_info.py index 6d24caa1aa6..e39d6c6f9ef 100644 --- a/seed/pydantic/examples/src/seed/examples/resources/commons/resources/types/event_info.py +++ b/seed/pydantic/examples/src/seed/examples/resources/commons/resources/types/event_info.py @@ -5,14 +5,12 @@ import typing from .....core.pydantic_utilities import pydantic_v1 +from .metadata import Metadata from .tag import Tag -class EventInfo_Metadata(pydantic_v1.BaseModel): +class EventInfo_Metadata(Metadata): type: typing.Literal["metadata"] = "metadata" - id: str - data: typing.Optional[typing.Dict[str, str]] - json_string: typing.Optional[str] = pydantic_v1.Field(alias="jsonString") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/examples/src/seed/examples/resources/types/exception.py b/seed/pydantic/examples/src/seed/examples/resources/types/exception.py index f96c064f28c..ca3aeff8801 100644 --- a/seed/pydantic/examples/src/seed/examples/resources/types/exception.py +++ b/seed/pydantic/examples/src/seed/examples/resources/types/exception.py @@ -5,13 +5,11 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .exception_info import ExceptionInfo -class Exception_Generic(pydantic_v1.BaseModel): +class Exception_Generic(ExceptionInfo): type: typing.Literal["generic"] = "generic" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/exhaustive/pydantic-v1/src/seed/exhaustive/resources/types/resources/union/animal.py b/seed/pydantic/exhaustive/pydantic-v1/src/seed/exhaustive/resources/types/resources/union/animal.py index 52c481a9817..2dd1679bb78 100644 --- a/seed/pydantic/exhaustive/pydantic-v1/src/seed/exhaustive/resources/types/resources/union/animal.py +++ b/seed/pydantic/exhaustive/pydantic-v1/src/seed/exhaustive/resources/types/resources/union/animal.py @@ -4,23 +4,20 @@ import typing -import pydantic +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic.Field(alias="likesToWoof") class Config: allow_population_by_field_name = True populate_by_name = True -class Animal_Cat(pydantic.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic.Field(alias="likesToMeow") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/exhaustive/pydantic-v2/src/seed/exhaustive/resources/types/resources/union/animal.py b/seed/pydantic/exhaustive/pydantic-v2/src/seed/exhaustive/resources/types/resources/union/animal.py index b019a6ed59e..2dd1679bb78 100644 --- a/seed/pydantic/exhaustive/pydantic-v2/src/seed/exhaustive/resources/types/resources/union/animal.py +++ b/seed/pydantic/exhaustive/pydantic-v2/src/seed/exhaustive/resources/types/resources/union/animal.py @@ -4,23 +4,20 @@ import typing -import pydantic.v1 as pydantic +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic.Field(alias="likesToWoof") class Config: allow_population_by_field_name = True populate_by_name = True -class Animal_Cat(pydantic.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic.Field(alias="likesToMeow") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/mixed-case/src/seed/mixed_case/resources/service/resource.py b/seed/pydantic/mixed-case/src/seed/mixed_case/resources/service/resource.py index a3ab8e12972..a936bfd12e5 100644 --- a/seed/pydantic/mixed-case/src/seed/mixed_case/resources/service/resource.py +++ b/seed/pydantic/mixed-case/src/seed/mixed_case/resources/service/resource.py @@ -7,7 +7,9 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import pydantic_v1 +from .organization import Organization from .resource_status import ResourceStatus +from .user import User class Base(pydantic_v1.BaseModel): @@ -36,20 +38,16 @@ class Config: json_encoders = {dt.datetime: serialize_datetime} -class Resource_User(Base): +class Resource_User(User, Base): resource_type: typing.Literal["user"] = "user" - user_name: str = pydantic_v1.Field(alias="userName") - metadata_tags: typing.List[str] - extra_properties: typing.Dict[str, str] = pydantic_v1.Field(alias="EXTRA_PROPERTIES") class Config: allow_population_by_field_name = True populate_by_name = True -class Resource_Organization(Base): +class Resource_Organization(Organization, Base): resource_type: typing.Literal["Organization"] = "Organization" - name: str class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/commons/debug_variable_value.py b/seed/pydantic/trace/src/seed/trace/resources/commons/debug_variable_value.py index 21517f5ad7d..3306b800f42 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/commons/debug_variable_value.py +++ b/seed/pydantic/trace/src/seed/trace/resources/commons/debug_variable_value.py @@ -43,9 +43,8 @@ class DebugVariableValue_CharValue(pydantic_v1.BaseModel): value: str -class DebugVariableValue_MapValue(pydantic_v1.BaseModel): +class DebugVariableValue_MapValue(DebugMapValue): type: typing.Literal["mapValue"] = "mapValue" - key_value_pairs: typing.List[DebugKeyValuePairs] = pydantic_v1.Field(alias="keyValuePairs") class Config: allow_population_by_field_name = True @@ -57,30 +56,24 @@ class DebugVariableValue_ListValue(pydantic_v1.BaseModel): value: typing.List[DebugVariableValue] -class DebugVariableValue_BinaryTreeNodeValue(pydantic_v1.BaseModel): +class DebugVariableValue_BinaryTreeNodeValue(BinaryTreeNodeAndTreeValue): type: typing.Literal["binaryTreeNodeValue"] = "binaryTreeNodeValue" - node_id: NodeId = pydantic_v1.Field(alias="nodeId") - full_tree: BinaryTreeValue = pydantic_v1.Field(alias="fullTree") class Config: allow_population_by_field_name = True populate_by_name = True -class DebugVariableValue_SinglyLinkedListNodeValue(pydantic_v1.BaseModel): +class DebugVariableValue_SinglyLinkedListNodeValue(SinglyLinkedListNodeAndListValue): type: typing.Literal["singlyLinkedListNodeValue"] = "singlyLinkedListNodeValue" - node_id: NodeId = pydantic_v1.Field(alias="nodeId") - full_list: SinglyLinkedListValue = pydantic_v1.Field(alias="fullList") class Config: allow_population_by_field_name = True populate_by_name = True -class DebugVariableValue_DoublyLinkedListNodeValue(pydantic_v1.BaseModel): +class DebugVariableValue_DoublyLinkedListNodeValue(DoublyLinkedListNodeAndListValue): type: typing.Literal["doublyLinkedListNodeValue"] = "doublyLinkedListNodeValue" - node_id: NodeId = pydantic_v1.Field(alias="nodeId") - full_list: DoublyLinkedListValue = pydantic_v1.Field(alias="fullList") class Config: allow_population_by_field_name = True @@ -95,10 +88,8 @@ class DebugVariableValue_NullValue(pydantic_v1.BaseModel): type: typing.Literal["nullValue"] = "nullValue" -class DebugVariableValue_GenericValue(pydantic_v1.BaseModel): +class DebugVariableValue_GenericValue(GenericValue): type: typing.Literal["genericValue"] = "genericValue" - stringified_type: typing.Optional[str] = pydantic_v1.Field(alias="stringifiedType") - stringified_value: str = pydantic_v1.Field(alias="stringifiedValue") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/commons/variable_type.py b/seed/pydantic/trace/src/seed/trace/resources/commons/variable_type.py index 3fa2f559353..f15381c8353 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/commons/variable_type.py +++ b/seed/pydantic/trace/src/seed/trace/resources/commons/variable_type.py @@ -5,8 +5,6 @@ import typing from ...core.pydantic_utilities import pydantic_v1 -from .list_type import ListType -from .map_type import MapType class VariableType_IntegerType(pydantic_v1.BaseModel): @@ -29,20 +27,16 @@ class VariableType_CharType(pydantic_v1.BaseModel): type: typing.Literal["charType"] = "charType" -class VariableType_ListType(pydantic_v1.BaseModel): +class VariableType_ListType(ListType): type: typing.Literal["listType"] = "listType" - value_type: VariableType = pydantic_v1.Field(alias="valueType") - is_fixed_length: typing.Optional[bool] = pydantic_v1.Field(alias="isFixedLength") class Config: allow_population_by_field_name = True populate_by_name = True -class VariableType_MapType(pydantic_v1.BaseModel): +class VariableType_MapType(MapType): type: typing.Literal["mapType"] = "mapType" - key_type: VariableType = pydantic_v1.Field(alias="keyType") - value_type: VariableType = pydantic_v1.Field(alias="valueType") class Config: allow_population_by_field_name = True @@ -73,5 +67,8 @@ class VariableType_DoublyLinkedListType(pydantic_v1.BaseModel): VariableType_SinglyLinkedListType, VariableType_DoublyLinkedListType, ] +from .list_type import ListType # noqa: E402 +from .map_type import MapType # noqa: E402 + VariableType_ListType.update_forward_refs(ListType=ListType, MapType=MapType, VariableType=VariableType) VariableType_MapType.update_forward_refs(ListType=ListType, MapType=MapType, VariableType=VariableType) diff --git a/seed/pydantic/trace/src/seed/trace/resources/commons/variable_value.py b/seed/pydantic/trace/src/seed/trace/resources/commons/variable_value.py index a37438c3f59..5c13389e7ad 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/commons/variable_value.py +++ b/seed/pydantic/trace/src/seed/trace/resources/commons/variable_value.py @@ -39,9 +39,8 @@ class VariableValue_CharValue(pydantic_v1.BaseModel): value: str -class VariableValue_MapValue(pydantic_v1.BaseModel): +class VariableValue_MapValue(MapValue): type: typing.Literal["mapValue"] = "mapValue" - key_value_pairs: typing.List[KeyValuePair] = pydantic_v1.Field(alias="keyValuePairs") class Config: allow_population_by_field_name = True @@ -53,22 +52,28 @@ class VariableValue_ListValue(pydantic_v1.BaseModel): value: typing.List[VariableValue] -class VariableValue_BinaryTreeValue(pydantic_v1.BaseModel): +class VariableValue_BinaryTreeValue(BinaryTreeValue): type: typing.Literal["binaryTreeValue"] = "binaryTreeValue" - root: typing.Optional[NodeId] - nodes: typing.Dict[NodeId, BinaryTreeNodeValue] + class Config: + allow_population_by_field_name = True + populate_by_name = True -class VariableValue_SinglyLinkedListValue(pydantic_v1.BaseModel): + +class VariableValue_SinglyLinkedListValue(SinglyLinkedListValue): type: typing.Literal["singlyLinkedListValue"] = "singlyLinkedListValue" - head: typing.Optional[NodeId] - nodes: typing.Dict[NodeId, SinglyLinkedListNodeValue] + + class Config: + allow_population_by_field_name = True + populate_by_name = True -class VariableValue_DoublyLinkedListValue(pydantic_v1.BaseModel): +class VariableValue_DoublyLinkedListValue(DoublyLinkedListValue): type: typing.Literal["doublyLinkedListValue"] = "doublyLinkedListValue" - head: typing.Optional[NodeId] - nodes: typing.Dict[NodeId, DoublyLinkedListNodeValue] + + class Config: + allow_population_by_field_name = True + populate_by_name = True class VariableValue_NullValue(pydantic_v1.BaseModel): diff --git a/seed/pydantic/trace/src/seed/trace/resources/problem/create_problem_error.py b/seed/pydantic/trace/src/seed/trace/resources/problem/create_problem_error.py index 4dd45f461a8..1b9bfae7cbd 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/problem/create_problem_error.py +++ b/seed/pydantic/trace/src/seed/trace/resources/problem/create_problem_error.py @@ -5,13 +5,11 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .generic_create_problem_error import GenericCreateProblemError -class CreateProblemError_Generic(pydantic_v1.BaseModel): +class CreateProblemError_Generic(GenericCreateProblemError): error_type: typing.Literal["generic"] = pydantic_v1.Field(alias="_type", default="generic") - message: str - type: str - stacktrace: str class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/actual_result.py b/seed/pydantic/trace/src/seed/trace/resources/submission/actual_result.py index 109fa84929d..8f1d1f5aefb 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/actual_result.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/actual_result.py @@ -5,6 +5,7 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .exception_info import ExceptionInfo from .exception_v_2 import ExceptionV2 @@ -13,11 +14,8 @@ class ActualResult_Value(pydantic_v1.BaseModel): value: VariableValue -class ActualResult_Exception(pydantic_v1.BaseModel): +class ActualResult_Exception(ExceptionInfo): type: typing.Literal["exception"] = "exception" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/code_execution_update.py b/seed/pydantic/trace/src/seed/trace/resources/submission/code_execution_update.py index 4a87f2afa15..ed895e59adb 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/code_execution_update.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/code_execution_update.py @@ -4,123 +4,101 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 -from ..v_2.resources.problem.test_case_id import TestCaseId -from .error_info import ErrorInfo -from .execution_session_status import ExecutionSessionStatus -from .invalid_request_cause import InvalidRequestCause -from .lightweight_stackframe_information import LightweightStackframeInformation -from .running_submission_state import RunningSubmissionState -from .submission_id import SubmissionId -from .submission_request import SubmissionRequest -from .test_case_grade import TestCaseGrade -from .test_case_result_with_stdout import TestCaseResultWithStdout -from .traced_file import TracedFile -from .workspace_run_details import WorkspaceRunDetails - - -class CodeExecutionUpdate_BuildingExecutor(pydantic_v1.BaseModel): +from .building_executor_response import BuildingExecutorResponse +from .errored_response import ErroredResponse +from .finished_response import FinishedResponse +from .graded_response import GradedResponse +from .graded_response_v_2 import GradedResponseV2 +from .invalid_request_response import InvalidRequestResponse +from .recorded_response_notification import RecordedResponseNotification +from .recording_response_notification import RecordingResponseNotification +from .running_response import RunningResponse +from .stopped_response import StoppedResponse +from .workspace_ran_response import WorkspaceRanResponse + + +class CodeExecutionUpdate_BuildingExecutor(BuildingExecutorResponse): type: typing.Literal["buildingExecutor"] = "buildingExecutor" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - status: ExecutionSessionStatus class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_Running(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Running(RunningResponse): type: typing.Literal["running"] = "running" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - state: RunningSubmissionState class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_Errored(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Errored(ErroredResponse): type: typing.Literal["errored"] = "errored" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - error_info: ErrorInfo = pydantic_v1.Field(alias="errorInfo") class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_Stopped(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Stopped(StoppedResponse): type: typing.Literal["stopped"] = "stopped" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_Graded(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Graded(GradedResponse): type: typing.Literal["graded"] = "graded" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - test_cases: typing.Dict[str, TestCaseResultWithStdout] = pydantic_v1.Field(alias="testCases") class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_GradedV2(pydantic_v1.BaseModel): +class CodeExecutionUpdate_GradedV2(GradedResponseV2): type: typing.Literal["gradedV2"] = "gradedV2" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - test_cases: typing.Dict[TestCaseId, TestCaseGrade] = pydantic_v1.Field(alias="testCases") class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_WorkspaceRan(pydantic_v1.BaseModel): +class CodeExecutionUpdate_WorkspaceRan(WorkspaceRanResponse): type: typing.Literal["workspaceRan"] = "workspaceRan" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - run_details: WorkspaceRunDetails = pydantic_v1.Field(alias="runDetails") class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_Recording(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Recording(RecordingResponseNotification): type: typing.Literal["recording"] = "recording" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - test_case_id: typing.Optional[str] = pydantic_v1.Field(alias="testCaseId") - line_number: int = pydantic_v1.Field(alias="lineNumber") - lightweight_stack_info: LightweightStackframeInformation = pydantic_v1.Field(alias="lightweightStackInfo") - traced_file: typing.Optional[TracedFile] = pydantic_v1.Field(alias="tracedFile") class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_Recorded(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Recorded(RecordedResponseNotification): type: typing.Literal["recorded"] = "recorded" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - trace_responses_size: int = pydantic_v1.Field(alias="traceResponsesSize") - test_case_id: typing.Optional[str] = pydantic_v1.Field(alias="testCaseId") class Config: allow_population_by_field_name = True populate_by_name = True -class CodeExecutionUpdate_InvalidRequest(pydantic_v1.BaseModel): +class CodeExecutionUpdate_InvalidRequest(InvalidRequestResponse): type: typing.Literal["invalidRequest"] = "invalidRequest" - request: SubmissionRequest - cause: InvalidRequestCause + + class Config: + allow_population_by_field_name = True + populate_by_name = True -class CodeExecutionUpdate_Finished(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Finished(FinishedResponse): type: typing.Literal["finished"] = "finished" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/error_info.py b/seed/pydantic/trace/src/seed/trace/resources/submission/error_info.py index 4a402365ddc..67b450cb5ed 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/error_info.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/error_info.py @@ -4,23 +4,29 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 -from .exception_info import ExceptionInfo +from .compile_error import CompileError +from .internal_error import InternalError +from .runtime_error import RuntimeError -class ErrorInfo_CompileError(pydantic_v1.BaseModel): +class ErrorInfo_CompileError(CompileError): type: typing.Literal["compileError"] = "compileError" - message: str + + class Config: + allow_population_by_field_name = True + populate_by_name = True -class ErrorInfo_RuntimeError(pydantic_v1.BaseModel): +class ErrorInfo_RuntimeError(RuntimeError): type: typing.Literal["runtimeError"] = "runtimeError" - message: str + + class Config: + allow_population_by_field_name = True + populate_by_name = True -class ErrorInfo_InternalError(pydantic_v1.BaseModel): +class ErrorInfo_InternalError(InternalError): type: typing.Literal["internalError"] = "internalError" - exception_info: ExceptionInfo = pydantic_v1.Field(alias="exceptionInfo") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/exception_v_2.py b/seed/pydantic/trace/src/seed/trace/resources/submission/exception_v_2.py index 1c0f3efd8bd..3c74360702d 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/exception_v_2.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/exception_v_2.py @@ -5,13 +5,11 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .exception_info import ExceptionInfo -class ExceptionV2_Generic(pydantic_v1.BaseModel): +class ExceptionV2_Generic(ExceptionInfo): type: typing.Literal["generic"] = "generic" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/invalid_request_cause.py b/seed/pydantic/trace/src/seed/trace/resources/submission/invalid_request_cause.py index c2de3cced2b..968fbba0cbe 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/invalid_request_cause.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/invalid_request_cause.py @@ -4,35 +4,29 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 -from ..commons.language import Language -from ..commons.problem_id import ProblemId -from .submission_id import SubmissionId +from .custom_test_cases_unsupported import CustomTestCasesUnsupported +from .submission_id_not_found import SubmissionIdNotFound +from .unexpected_language_error import UnexpectedLanguageError -class InvalidRequestCause_SubmissionIdNotFound(pydantic_v1.BaseModel): +class InvalidRequestCause_SubmissionIdNotFound(SubmissionIdNotFound): type: typing.Literal["submissionIdNotFound"] = "submissionIdNotFound" - missing_submission_id: SubmissionId = pydantic_v1.Field(alias="missingSubmissionId") class Config: allow_population_by_field_name = True populate_by_name = True -class InvalidRequestCause_CustomTestCasesUnsupported(pydantic_v1.BaseModel): +class InvalidRequestCause_CustomTestCasesUnsupported(CustomTestCasesUnsupported): type: typing.Literal["customTestCasesUnsupported"] = "customTestCasesUnsupported" - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") class Config: allow_population_by_field_name = True populate_by_name = True -class InvalidRequestCause_UnexpectedLanguage(pydantic_v1.BaseModel): +class InvalidRequestCause_UnexpectedLanguage(UnexpectedLanguageError): type: typing.Literal["unexpectedLanguage"] = "unexpectedLanguage" - expected_language: Language = pydantic_v1.Field(alias="expectedLanguage") - actual_language: Language = pydantic_v1.Field(alias="actualLanguage") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_request.py b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_request.py index 1203d92af51..52cd17e837d 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_request.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_request.py @@ -5,16 +5,14 @@ import typing from ...core.pydantic_utilities import pydantic_v1 -from ..commons.language import Language -from ..commons.problem_id import ProblemId -from .submission_file_info import SubmissionFileInfo -from .submission_id import SubmissionId +from .initialize_problem_request import InitializeProblemRequest +from .stop_request import StopRequest +from .submit_request_v_2 import SubmitRequestV2 +from .workspace_submit_request import WorkspaceSubmitRequest -class SubmissionRequest_InitializeProblemRequest(pydantic_v1.BaseModel): +class SubmissionRequest_InitializeProblemRequest(InitializeProblemRequest): type: typing.Literal["initializeProblemRequest"] = "initializeProblemRequest" - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - problem_version: typing.Optional[int] = pydantic_v1.Field(alias="problemVersion") class Config: allow_population_by_field_name = True @@ -25,35 +23,24 @@ class SubmissionRequest_InitializeWorkspaceRequest(pydantic_v1.BaseModel): type: typing.Literal["initializeWorkspaceRequest"] = "initializeWorkspaceRequest" -class SubmissionRequest_SubmitV2(pydantic_v1.BaseModel): +class SubmissionRequest_SubmitV2(SubmitRequestV2): type: typing.Literal["submitV2"] = "submitV2" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - language: Language - submission_files: typing.List[SubmissionFileInfo] = pydantic_v1.Field(alias="submissionFiles") - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - problem_version: typing.Optional[int] = pydantic_v1.Field(alias="problemVersion") - user_id: typing.Optional[str] = pydantic_v1.Field(alias="userId") class Config: allow_population_by_field_name = True populate_by_name = True -class SubmissionRequest_WorkspaceSubmit(pydantic_v1.BaseModel): +class SubmissionRequest_WorkspaceSubmit(WorkspaceSubmitRequest): type: typing.Literal["workspaceSubmit"] = "workspaceSubmit" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - language: Language - submission_files: typing.List[SubmissionFileInfo] = pydantic_v1.Field(alias="submissionFiles") - user_id: typing.Optional[str] = pydantic_v1.Field(alias="userId") class Config: allow_population_by_field_name = True populate_by_name = True -class SubmissionRequest_Stop(pydantic_v1.BaseModel): +class SubmissionRequest_Stop(StopRequest): type: typing.Literal["stop"] = "stop" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_response.py b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_response.py index e9039d3456b..ffd28522b71 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_response.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_response.py @@ -7,6 +7,8 @@ from ...core.pydantic_utilities import pydantic_v1 from ..commons.problem_id import ProblemId from .code_execution_update import CodeExecutionUpdate +from .exception_info import ExceptionInfo +from .terminated_response import TerminatedResponse class SubmissionResponse_ServerInitialized(pydantic_v1.BaseModel): @@ -22,11 +24,8 @@ class SubmissionResponse_WorkspaceInitialized(pydantic_v1.BaseModel): type: typing.Literal["workspaceInitialized"] = "workspaceInitialized" -class SubmissionResponse_ServerErrored(pydantic_v1.BaseModel): +class SubmissionResponse_ServerErrored(ExceptionInfo): type: typing.Literal["serverErrored"] = "serverErrored" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: allow_population_by_field_name = True @@ -38,9 +37,13 @@ class SubmissionResponse_CodeExecutionUpdate(pydantic_v1.BaseModel): value: CodeExecutionUpdate -class SubmissionResponse_Terminated(pydantic_v1.BaseModel): +class SubmissionResponse_Terminated(TerminatedResponse): type: typing.Literal["terminated"] = "terminated" + class Config: + allow_population_by_field_name = True + populate_by_name = True + SubmissionResponse = typing.Union[ SubmissionResponse_ServerInitialized, diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_status_for_test_case.py b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_status_for_test_case.py index 4bd7e5ffd7a..1bb6c2bc7b1 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_status_for_test_case.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_status_for_test_case.py @@ -6,14 +6,16 @@ from ...core.pydantic_utilities import pydantic_v1 from .test_case_grade import TestCaseGrade -from .test_case_result import TestCaseResult from .test_case_result_with_stdout import TestCaseResultWithStdout +from .traced_test_case import TracedTestCase -class SubmissionStatusForTestCase_Graded(pydantic_v1.BaseModel): +class SubmissionStatusForTestCase_Graded(TestCaseResultWithStdout): type: typing.Literal["graded"] = "graded" - result: TestCaseResult - stdout: str + + class Config: + allow_population_by_field_name = True + populate_by_name = True class SubmissionStatusForTestCase_GradedV2(pydantic_v1.BaseModel): @@ -21,10 +23,8 @@ class SubmissionStatusForTestCase_GradedV2(pydantic_v1.BaseModel): value: TestCaseGrade -class SubmissionStatusForTestCase_Traced(pydantic_v1.BaseModel): +class SubmissionStatusForTestCase_Traced(TracedTestCase): type: typing.Literal["traced"] = "traced" - result: TestCaseResultWithStdout - trace_responses_size: int = pydantic_v1.Field(alias="traceResponsesSize") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_status_v_2.py b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_status_v_2.py index d640a457227..08a0f46a533 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_status_v_2.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_status_v_2.py @@ -4,28 +4,24 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 -from ..commons.problem_id import ProblemId -from ..v_2.resources.problem.problem_info_v_2 import ProblemInfoV2 -from .test_submission_update import TestSubmissionUpdate -from .workspace_submission_update import WorkspaceSubmissionUpdate +from .test_submission_status_v_2 import TestSubmissionStatusV2 +from .workspace_submission_status_v_2 import WorkspaceSubmissionStatusV2 -class SubmissionStatusV2_Test(pydantic_v1.BaseModel): +class SubmissionStatusV2_Test(TestSubmissionStatusV2): type: typing.Literal["test"] = "test" - updates: typing.List[TestSubmissionUpdate] - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - problem_version: int = pydantic_v1.Field(alias="problemVersion") - problem_info: ProblemInfoV2 = pydantic_v1.Field(alias="problemInfo") class Config: allow_population_by_field_name = True populate_by_name = True -class SubmissionStatusV2_Workspace(pydantic_v1.BaseModel): +class SubmissionStatusV2_Workspace(WorkspaceSubmissionStatusV2): type: typing.Literal["workspace"] = "workspace" - updates: typing.List[WorkspaceSubmissionUpdate] + + class Config: + allow_population_by_field_name = True + populate_by_name = True SubmissionStatusV2 = typing.Union[SubmissionStatusV2_Test, SubmissionStatusV2_Workspace] diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_type_state.py b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_type_state.py index c501c498e37..6a18b67b73f 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/submission_type_state.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/submission_type_state.py @@ -4,28 +4,24 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 -from ..commons.problem_id import ProblemId -from ..commons.test_case import TestCase -from .test_submission_status import TestSubmissionStatus -from .workspace_submission_status import WorkspaceSubmissionStatus +from .test_submission_state import TestSubmissionState +from .workspace_submission_state import WorkspaceSubmissionState -class SubmissionTypeState_Test(pydantic_v1.BaseModel): +class SubmissionTypeState_Test(TestSubmissionState): type: typing.Literal["test"] = "test" - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - default_test_cases: typing.List[TestCase] = pydantic_v1.Field(alias="defaultTestCases") - custom_test_cases: typing.List[TestCase] = pydantic_v1.Field(alias="customTestCases") - status: TestSubmissionStatus class Config: allow_population_by_field_name = True populate_by_name = True -class SubmissionTypeState_Workspace(pydantic_v1.BaseModel): +class SubmissionTypeState_Workspace(WorkspaceSubmissionState): type: typing.Literal["workspace"] = "workspace" - status: WorkspaceSubmissionStatus + + class Config: + allow_population_by_field_name = True + populate_by_name = True SubmissionTypeState = typing.Union[SubmissionTypeState_Test, SubmissionTypeState_Workspace] diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/test_case_grade.py b/seed/pydantic/trace/src/seed/trace/resources/submission/test_case_grade.py index fd896fc82f2..a66f767fa0b 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/test_case_grade.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/test_case_grade.py @@ -4,22 +4,20 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 -from ..commons.variable_value import VariableValue -from .exception_v_2 import ExceptionV2 +from .test_case_hidden_grade import TestCaseHiddenGrade +from .test_case_non_hidden_grade import TestCaseNonHiddenGrade -class TestCaseGrade_Hidden(pydantic_v1.BaseModel): +class TestCaseGrade_Hidden(TestCaseHiddenGrade): type: typing.Literal["hidden"] = "hidden" - passed: bool + + class Config: + allow_population_by_field_name = True + populate_by_name = True -class TestCaseGrade_NonHidden(pydantic_v1.BaseModel): +class TestCaseGrade_NonHidden(TestCaseNonHiddenGrade): type: typing.Literal["nonHidden"] = "nonHidden" - passed: bool - actual_result: typing.Optional[VariableValue] = pydantic_v1.Field(alias="actualResult") - exception: typing.Optional[ExceptionV2] - stdout: str class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/test_submission_update_info.py b/seed/pydantic/trace/src/seed/trace/resources/submission/test_submission_update_info.py index 29c241da4bc..4547c4f2f70 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/test_submission_update_info.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/test_submission_update_info.py @@ -5,10 +5,10 @@ import typing from ...core.pydantic_utilities import pydantic_v1 -from ..v_2.resources.problem.test_case_id import TestCaseId from .error_info import ErrorInfo +from .graded_test_case_update import GradedTestCaseUpdate +from .recorded_test_case_update import RecordedTestCaseUpdate from .running_submission_state import RunningSubmissionState -from .test_case_grade import TestCaseGrade class TestSubmissionUpdateInfo_Running(pydantic_v1.BaseModel): @@ -25,20 +25,16 @@ class TestSubmissionUpdateInfo_Errored(pydantic_v1.BaseModel): value: ErrorInfo -class TestSubmissionUpdateInfo_GradedTestCase(pydantic_v1.BaseModel): +class TestSubmissionUpdateInfo_GradedTestCase(GradedTestCaseUpdate): type: typing.Literal["gradedTestCase"] = "gradedTestCase" - test_case_id: TestCaseId = pydantic_v1.Field(alias="testCaseId") - grade: TestCaseGrade class Config: allow_population_by_field_name = True populate_by_name = True -class TestSubmissionUpdateInfo_RecordedTestCase(pydantic_v1.BaseModel): +class TestSubmissionUpdateInfo_RecordedTestCase(RecordedTestCaseUpdate): type: typing.Literal["recordedTestCase"] = "recordedTestCase" - test_case_id: TestCaseId = pydantic_v1.Field(alias="testCaseId") - trace_responses_size: int = pydantic_v1.Field(alias="traceResponsesSize") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/workspace_submission_status.py b/seed/pydantic/trace/src/seed/trace/resources/submission/workspace_submission_status.py index a2685ac546d..b94db5aa2e5 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/workspace_submission_status.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/workspace_submission_status.py @@ -6,9 +6,8 @@ from ...core.pydantic_utilities import pydantic_v1 from .error_info import ErrorInfo -from .exception_info import ExceptionInfo -from .exception_v_2 import ExceptionV2 from .running_submission_state import RunningSubmissionState +from .workspace_run_details import WorkspaceRunDetails class WorkspaceSubmissionStatus_Stopped(pydantic_v1.BaseModel): @@ -25,22 +24,16 @@ class WorkspaceSubmissionStatus_Running(pydantic_v1.BaseModel): value: RunningSubmissionState -class WorkspaceSubmissionStatus_Ran(pydantic_v1.BaseModel): +class WorkspaceSubmissionStatus_Ran(WorkspaceRunDetails): type: typing.Literal["ran"] = "ran" - exception_v_2: typing.Optional[ExceptionV2] = pydantic_v1.Field(alias="exceptionV2") - exception: typing.Optional[ExceptionInfo] - stdout: str class Config: allow_population_by_field_name = True populate_by_name = True -class WorkspaceSubmissionStatus_Traced(pydantic_v1.BaseModel): +class WorkspaceSubmissionStatus_Traced(WorkspaceRunDetails): type: typing.Literal["traced"] = "traced" - exception_v_2: typing.Optional[ExceptionV2] = pydantic_v1.Field(alias="exceptionV2") - exception: typing.Optional[ExceptionInfo] - stdout: str class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/submission/workspace_submission_update_info.py b/seed/pydantic/trace/src/seed/trace/resources/submission/workspace_submission_update_info.py index fb879858dbf..7818e96ec07 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/submission/workspace_submission_update_info.py +++ b/seed/pydantic/trace/src/seed/trace/resources/submission/workspace_submission_update_info.py @@ -6,9 +6,9 @@ from ...core.pydantic_utilities import pydantic_v1 from .error_info import ErrorInfo -from .exception_info import ExceptionInfo -from .exception_v_2 import ExceptionV2 from .running_submission_state import RunningSubmissionState +from .workspace_run_details import WorkspaceRunDetails +from .workspace_traced_update import WorkspaceTracedUpdate class WorkspaceSubmissionUpdateInfo_Running(pydantic_v1.BaseModel): @@ -16,11 +16,8 @@ class WorkspaceSubmissionUpdateInfo_Running(pydantic_v1.BaseModel): value: RunningSubmissionState -class WorkspaceSubmissionUpdateInfo_Ran(pydantic_v1.BaseModel): +class WorkspaceSubmissionUpdateInfo_Ran(WorkspaceRunDetails): type: typing.Literal["ran"] = "ran" - exception_v_2: typing.Optional[ExceptionV2] = pydantic_v1.Field(alias="exceptionV2") - exception: typing.Optional[ExceptionInfo] - stdout: str class Config: allow_population_by_field_name = True @@ -35,9 +32,8 @@ class WorkspaceSubmissionUpdateInfo_Traced(pydantic_v1.BaseModel): type: typing.Literal["traced"] = "traced" -class WorkspaceSubmissionUpdateInfo_TracedV2(pydantic_v1.BaseModel): +class WorkspaceSubmissionUpdateInfo_TracedV2(WorkspaceTracedUpdate): type: typing.Literal["tracedV2"] = "tracedV2" - trace_responses_size: int = pydantic_v1.Field(alias="traceResponsesSize") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/assert_correctness_check.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/assert_correctness_check.py index 8fbc5417bcd..a1323361e7f 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/assert_correctness_check.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/assert_correctness_check.py @@ -4,25 +4,20 @@ import typing -from .....core.pydantic_utilities import pydantic_v1 -from .function_implementation_for_multiple_languages import FunctionImplementationForMultipleLanguages -from .parameter import Parameter -from .parameter_id import ParameterId +from .deep_equality_correctness_check import DeepEqualityCorrectnessCheck +from .void_function_definition_that_takes_actual_result import VoidFunctionDefinitionThatTakesActualResult -class AssertCorrectnessCheck_DeepEquality(pydantic_v1.BaseModel): +class AssertCorrectnessCheck_DeepEquality(DeepEqualityCorrectnessCheck): type: typing.Literal["deepEquality"] = "deepEquality" - expected_value_parameter_id: ParameterId = pydantic_v1.Field(alias="expectedValueParameterId") class Config: allow_population_by_field_name = True populate_by_name = True -class AssertCorrectnessCheck_Custom(pydantic_v1.BaseModel): +class AssertCorrectnessCheck_Custom(VoidFunctionDefinitionThatTakesActualResult): type: typing.Literal["custom"] = "custom" - additional_parameters: typing.List[Parameter] = pydantic_v1.Field(alias="additionalParameters") - code: FunctionImplementationForMultipleLanguages class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/custom_files.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/custom_files.py index 84bfafb3aa8..46de3a3f4b0 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/custom_files.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/custom_files.py @@ -6,18 +6,13 @@ from .....core.pydantic_utilities import pydantic_v1 from ....commons.language import Language -from .basic_test_case_template import BasicTestCaseTemplate +from .basic_custom_files import BasicCustomFiles from .file_info_v_2 import FileInfoV2 from .files import Files -from .non_void_function_signature import NonVoidFunctionSignature -class CustomFiles_Basic(pydantic_v1.BaseModel): +class CustomFiles_Basic(BasicCustomFiles): type: typing.Literal["basic"] = "basic" - method_name: str = pydantic_v1.Field(alias="methodName") - signature: NonVoidFunctionSignature - additional_files: typing.Dict[Language, Files] = pydantic_v1.Field(alias="additionalFiles") - basic_test_case_template: BasicTestCaseTemplate = pydantic_v1.Field(alias="basicTestCaseTemplate") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/function_signature.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/function_signature.py index 44aa63bdddd..138aaf5f1c3 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/function_signature.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/function_signature.py @@ -4,30 +4,29 @@ import typing -from .....core.pydantic_utilities import pydantic_v1 -from ....commons.variable_type import VariableType -from .parameter import Parameter +from .non_void_function_signature import NonVoidFunctionSignature +from .void_function_signature import VoidFunctionSignature +from .void_function_signature_that_takes_actual_result import VoidFunctionSignatureThatTakesActualResult -class FunctionSignature_Void(pydantic_v1.BaseModel): +class FunctionSignature_Void(VoidFunctionSignature): type: typing.Literal["void"] = "void" - parameters: typing.List[Parameter] + + class Config: + allow_population_by_field_name = True + populate_by_name = True -class FunctionSignature_NonVoid(pydantic_v1.BaseModel): +class FunctionSignature_NonVoid(NonVoidFunctionSignature): type: typing.Literal["nonVoid"] = "nonVoid" - parameters: typing.List[Parameter] - return_type: VariableType = pydantic_v1.Field(alias="returnType") class Config: allow_population_by_field_name = True populate_by_name = True -class FunctionSignature_VoidThatTakesActualResult(pydantic_v1.BaseModel): +class FunctionSignature_VoidThatTakesActualResult(VoidFunctionSignatureThatTakesActualResult): type: typing.Literal["voidThatTakesActualResult"] = "voidThatTakesActualResult" - parameters: typing.List[Parameter] - actual_result_type: VariableType = pydantic_v1.Field(alias="actualResultType") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/test_case_function.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/test_case_function.py index 8d0cd021f66..b6b99145e01 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/test_case_function.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/test_case_function.py @@ -4,27 +4,24 @@ import typing -from .....core.pydantic_utilities import pydantic_v1 -from .assert_correctness_check import AssertCorrectnessCheck -from .function_implementation_for_multiple_languages import FunctionImplementationForMultipleLanguages -from .non_void_function_definition import NonVoidFunctionDefinition -from .parameter import Parameter +from .test_case_with_actual_result_implementation import TestCaseWithActualResultImplementation +from .void_function_definition import VoidFunctionDefinition -class TestCaseFunction_WithActualResult(pydantic_v1.BaseModel): +class TestCaseFunction_WithActualResult(TestCaseWithActualResultImplementation): type: typing.Literal["withActualResult"] = "withActualResult" - get_actual_result: NonVoidFunctionDefinition = pydantic_v1.Field(alias="getActualResult") - assert_correctness_check: AssertCorrectnessCheck = pydantic_v1.Field(alias="assertCorrectnessCheck") class Config: allow_population_by_field_name = True populate_by_name = True -class TestCaseFunction_Custom(pydantic_v1.BaseModel): +class TestCaseFunction_Custom(VoidFunctionDefinition): type: typing.Literal["custom"] = "custom" - parameters: typing.List[Parameter] - code: FunctionImplementationForMultipleLanguages + + class Config: + allow_population_by_field_name = True + populate_by_name = True TestCaseFunction = typing.Union[TestCaseFunction_WithActualResult, TestCaseFunction_Custom] diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/test_case_implementation_reference.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/test_case_implementation_reference.py index 9f3d6080a05..3a32f56ff52 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/test_case_implementation_reference.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/problem/test_case_implementation_reference.py @@ -5,8 +5,7 @@ import typing from .....core.pydantic_utilities import pydantic_v1 -from .test_case_function import TestCaseFunction -from .test_case_implementation_description import TestCaseImplementationDescription +from .test_case_implementation import TestCaseImplementation from .test_case_template_id import TestCaseTemplateId @@ -15,10 +14,12 @@ class TestCaseImplementationReference_TemplateId(pydantic_v1.BaseModel): value: TestCaseTemplateId -class TestCaseImplementationReference_Implementation(pydantic_v1.BaseModel): +class TestCaseImplementationReference_Implementation(TestCaseImplementation): type: typing.Literal["implementation"] = "implementation" - description: TestCaseImplementationDescription - function: TestCaseFunction + + class Config: + allow_population_by_field_name = True + populate_by_name = True TestCaseImplementationReference = typing.Union[ diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/assert_correctness_check.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/assert_correctness_check.py index 4ec5d8c9dc8..a1323361e7f 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/assert_correctness_check.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/assert_correctness_check.py @@ -4,25 +4,20 @@ import typing -from .......core.pydantic_utilities import pydantic_v1 -from .function_implementation_for_multiple_languages import FunctionImplementationForMultipleLanguages -from .parameter import Parameter -from .parameter_id import ParameterId +from .deep_equality_correctness_check import DeepEqualityCorrectnessCheck +from .void_function_definition_that_takes_actual_result import VoidFunctionDefinitionThatTakesActualResult -class AssertCorrectnessCheck_DeepEquality(pydantic_v1.BaseModel): +class AssertCorrectnessCheck_DeepEquality(DeepEqualityCorrectnessCheck): type: typing.Literal["deepEquality"] = "deepEquality" - expected_value_parameter_id: ParameterId = pydantic_v1.Field(alias="expectedValueParameterId") class Config: allow_population_by_field_name = True populate_by_name = True -class AssertCorrectnessCheck_Custom(pydantic_v1.BaseModel): +class AssertCorrectnessCheck_Custom(VoidFunctionDefinitionThatTakesActualResult): type: typing.Literal["custom"] = "custom" - additional_parameters: typing.List[Parameter] = pydantic_v1.Field(alias="additionalParameters") - code: FunctionImplementationForMultipleLanguages class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/custom_files.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/custom_files.py index 580d3313247..ca606812cb0 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/custom_files.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/custom_files.py @@ -6,18 +6,13 @@ from .......core.pydantic_utilities import pydantic_v1 from ......commons.language import Language -from .basic_test_case_template import BasicTestCaseTemplate +from .basic_custom_files import BasicCustomFiles from .file_info_v_2 import FileInfoV2 from .files import Files -from .non_void_function_signature import NonVoidFunctionSignature -class CustomFiles_Basic(pydantic_v1.BaseModel): +class CustomFiles_Basic(BasicCustomFiles): type: typing.Literal["basic"] = "basic" - method_name: str = pydantic_v1.Field(alias="methodName") - signature: NonVoidFunctionSignature - additional_files: typing.Dict[Language, Files] = pydantic_v1.Field(alias="additionalFiles") - basic_test_case_template: BasicTestCaseTemplate = pydantic_v1.Field(alias="basicTestCaseTemplate") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/function_signature.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/function_signature.py index be732600894..138aaf5f1c3 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/function_signature.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/function_signature.py @@ -4,30 +4,29 @@ import typing -from .......core.pydantic_utilities import pydantic_v1 -from ......commons.variable_type import VariableType -from .parameter import Parameter +from .non_void_function_signature import NonVoidFunctionSignature +from .void_function_signature import VoidFunctionSignature +from .void_function_signature_that_takes_actual_result import VoidFunctionSignatureThatTakesActualResult -class FunctionSignature_Void(pydantic_v1.BaseModel): +class FunctionSignature_Void(VoidFunctionSignature): type: typing.Literal["void"] = "void" - parameters: typing.List[Parameter] + + class Config: + allow_population_by_field_name = True + populate_by_name = True -class FunctionSignature_NonVoid(pydantic_v1.BaseModel): +class FunctionSignature_NonVoid(NonVoidFunctionSignature): type: typing.Literal["nonVoid"] = "nonVoid" - parameters: typing.List[Parameter] - return_type: VariableType = pydantic_v1.Field(alias="returnType") class Config: allow_population_by_field_name = True populate_by_name = True -class FunctionSignature_VoidThatTakesActualResult(pydantic_v1.BaseModel): +class FunctionSignature_VoidThatTakesActualResult(VoidFunctionSignatureThatTakesActualResult): type: typing.Literal["voidThatTakesActualResult"] = "voidThatTakesActualResult" - parameters: typing.List[Parameter] - actual_result_type: VariableType = pydantic_v1.Field(alias="actualResultType") class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/test_case_function.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/test_case_function.py index 928d6a06e65..b6b99145e01 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/test_case_function.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/test_case_function.py @@ -4,27 +4,24 @@ import typing -from .......core.pydantic_utilities import pydantic_v1 -from .assert_correctness_check import AssertCorrectnessCheck -from .function_implementation_for_multiple_languages import FunctionImplementationForMultipleLanguages -from .non_void_function_definition import NonVoidFunctionDefinition -from .parameter import Parameter +from .test_case_with_actual_result_implementation import TestCaseWithActualResultImplementation +from .void_function_definition import VoidFunctionDefinition -class TestCaseFunction_WithActualResult(pydantic_v1.BaseModel): +class TestCaseFunction_WithActualResult(TestCaseWithActualResultImplementation): type: typing.Literal["withActualResult"] = "withActualResult" - get_actual_result: NonVoidFunctionDefinition = pydantic_v1.Field(alias="getActualResult") - assert_correctness_check: AssertCorrectnessCheck = pydantic_v1.Field(alias="assertCorrectnessCheck") class Config: allow_population_by_field_name = True populate_by_name = True -class TestCaseFunction_Custom(pydantic_v1.BaseModel): +class TestCaseFunction_Custom(VoidFunctionDefinition): type: typing.Literal["custom"] = "custom" - parameters: typing.List[Parameter] - code: FunctionImplementationForMultipleLanguages + + class Config: + allow_population_by_field_name = True + populate_by_name = True TestCaseFunction = typing.Union[TestCaseFunction_WithActualResult, TestCaseFunction_Custom] diff --git a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/test_case_implementation_reference.py b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/test_case_implementation_reference.py index c124f3b1dcf..bd14fcf3bc2 100644 --- a/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/test_case_implementation_reference.py +++ b/seed/pydantic/trace/src/seed/trace/resources/v_2/resources/v_3/resources/problem/test_case_implementation_reference.py @@ -5,8 +5,7 @@ import typing from .......core.pydantic_utilities import pydantic_v1 -from .test_case_function import TestCaseFunction -from .test_case_implementation_description import TestCaseImplementationDescription +from .test_case_implementation import TestCaseImplementation from .test_case_template_id import TestCaseTemplateId @@ -15,10 +14,12 @@ class TestCaseImplementationReference_TemplateId(pydantic_v1.BaseModel): value: TestCaseTemplateId -class TestCaseImplementationReference_Implementation(pydantic_v1.BaseModel): +class TestCaseImplementationReference_Implementation(TestCaseImplementation): type: typing.Literal["implementation"] = "implementation" - description: TestCaseImplementationDescription - function: TestCaseFunction + + class Config: + allow_population_by_field_name = True + populate_by_name = True TestCaseImplementationReference = typing.Union[ diff --git a/seed/pydantic/unions/src/seed/unions/resources/types/union_with_base_properties.py b/seed/pydantic/unions/src/seed/unions/resources/types/union_with_base_properties.py index dac83d05ad3..b888bda261e 100644 --- a/seed/pydantic/unions/src/seed/unions/resources/types/union_with_base_properties.py +++ b/seed/pydantic/unions/src/seed/unions/resources/types/union_with_base_properties.py @@ -7,6 +7,7 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import pydantic_v1 +from .foo import Foo class Base(pydantic_v1.BaseModel): @@ -43,9 +44,8 @@ class Config: populate_by_name = True -class UnionWithBaseProperties_Foo(Base): +class UnionWithBaseProperties_Foo(Foo, Base): type: typing.Literal["foo"] = "foo" - name: str class Config: allow_population_by_field_name = True diff --git a/seed/pydantic/unions/src/seed/unions/resources/types/union_with_unknown.py b/seed/pydantic/unions/src/seed/unions/resources/types/union_with_unknown.py index cca2354f059..1012e290ce3 100644 --- a/seed/pydantic/unions/src/seed/unions/resources/types/union_with_unknown.py +++ b/seed/pydantic/unions/src/seed/unions/resources/types/union_with_unknown.py @@ -5,11 +5,15 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .foo import Foo -class UnionWithUnknown_Foo(pydantic_v1.BaseModel): +class UnionWithUnknown_Foo(Foo): type: typing.Literal["foo"] = "foo" - name: str + + class Config: + allow_population_by_field_name = True + populate_by_name = True class UnionWithUnknown_Unknown(pydantic_v1.BaseModel): diff --git a/seed/pydantic/unions/src/seed/unions/resources/types/union_without_key.py b/seed/pydantic/unions/src/seed/unions/resources/types/union_without_key.py index d7cbb722543..735c05b7d92 100644 --- a/seed/pydantic/unions/src/seed/unions/resources/types/union_without_key.py +++ b/seed/pydantic/unions/src/seed/unions/resources/types/union_without_key.py @@ -4,17 +4,24 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 +from .bar import Bar +from .foo import Foo -class UnionWithoutKey_Foo(pydantic_v1.BaseModel): +class UnionWithoutKey_Foo(Foo): type: typing.Literal["foo"] = "foo" - name: str + class Config: + allow_population_by_field_name = True + populate_by_name = True -class UnionWithoutKey_Bar(pydantic_v1.BaseModel): + +class UnionWithoutKey_Bar(Bar): type: typing.Literal["bar"] = "bar" - name: str + + class Config: + allow_population_by_field_name = True + populate_by_name = True UnionWithoutKey = typing.Union[UnionWithoutKey_Foo, UnionWithoutKey_Bar] diff --git a/seed/pydantic/unions/src/seed/unions/resources/union/shape.py b/seed/pydantic/unions/src/seed/unions/resources/union/shape.py index c857c746c9e..e6234051c61 100644 --- a/seed/pydantic/unions/src/seed/unions/resources/union/shape.py +++ b/seed/pydantic/unions/src/seed/unions/resources/union/shape.py @@ -7,6 +7,8 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import pydantic_v1 +from .circle import Circle +from .square import Square class Base(pydantic_v1.BaseModel): @@ -25,18 +27,16 @@ class Config: json_encoders = {dt.datetime: serialize_datetime} -class Shape_Circle(Base): +class Shape_Circle(Circle, Base): type: typing.Literal["circle"] = "circle" - radius: float class Config: allow_population_by_field_name = True populate_by_name = True -class Shape_Square(Base): +class Shape_Square(Square, Base): type: typing.Literal["square"] = "square" - length: float class Config: allow_population_by_field_name = True diff --git a/seed/python-sdk/circular-references-advanced/src/seed/ast/types/field_value.py b/seed/python-sdk/circular-references-advanced/src/seed/ast/types/field_value.py index b3b25f50fc4..3ddd8e89409 100644 --- a/seed/python-sdk/circular-references-advanced/src/seed/ast/types/field_value.py +++ b/seed/python-sdk/circular-references-advanced/src/seed/ast/types/field_value.py @@ -5,6 +5,7 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .object_value import ObjectValue from .primitive_value import PrimitiveValue @@ -17,12 +18,14 @@ class Config: smart_union = True -class FieldValue_ObjectValue(pydantic_v1.BaseModel): +class FieldValue_ObjectValue(ObjectValue): type: typing.Literal["object_value"] = "object_value" class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True class FieldValue_ContainerValue(pydantic_v1.BaseModel): diff --git a/seed/python-sdk/circular-references/src/seed/ast/types/field_value.py b/seed/python-sdk/circular-references/src/seed/ast/types/field_value.py index b3b25f50fc4..3ddd8e89409 100644 --- a/seed/python-sdk/circular-references/src/seed/ast/types/field_value.py +++ b/seed/python-sdk/circular-references/src/seed/ast/types/field_value.py @@ -5,6 +5,7 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .object_value import ObjectValue from .primitive_value import PrimitiveValue @@ -17,12 +18,14 @@ class Config: smart_union = True -class FieldValue_ObjectValue(pydantic_v1.BaseModel): +class FieldValue_ObjectValue(ObjectValue): type: typing.Literal["object_value"] = "object_value" class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True class FieldValue_ContainerValue(pydantic_v1.BaseModel): diff --git a/seed/python-sdk/examples/client-filename/src/seed/commons/types/types/event_info.py b/seed/python-sdk/examples/client-filename/src/seed/commons/types/types/event_info.py index f630791a5f7..d0fe828281b 100644 --- a/seed/python-sdk/examples/client-filename/src/seed/commons/types/types/event_info.py +++ b/seed/python-sdk/examples/client-filename/src/seed/commons/types/types/event_info.py @@ -5,14 +5,12 @@ import typing from ....core.pydantic_utilities import pydantic_v1 +from .metadata import Metadata from .tag import Tag -class EventInfo_Metadata(pydantic_v1.BaseModel): +class EventInfo_Metadata(Metadata): type: typing.Literal["metadata"] = "metadata" - id: str - data: typing.Optional[typing.Dict[str, str]] - json_string: typing.Optional[str] = pydantic_v1.Field(alias="jsonString") class Config: frozen = True diff --git a/seed/python-sdk/examples/client-filename/src/seed/types/types/exception.py b/seed/python-sdk/examples/client-filename/src/seed/types/types/exception.py index 15ce038617f..d1a0f54abfe 100644 --- a/seed/python-sdk/examples/client-filename/src/seed/types/types/exception.py +++ b/seed/python-sdk/examples/client-filename/src/seed/types/types/exception.py @@ -5,13 +5,11 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .exception_info import ExceptionInfo -class Exception_Generic(pydantic_v1.BaseModel): +class Exception_Generic(ExceptionInfo): type: typing.Literal["generic"] = "generic" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: frozen = True diff --git a/seed/python-sdk/examples/no-custom-config/src/seed/commons/types/types/event_info.py b/seed/python-sdk/examples/no-custom-config/src/seed/commons/types/types/event_info.py index f630791a5f7..d0fe828281b 100644 --- a/seed/python-sdk/examples/no-custom-config/src/seed/commons/types/types/event_info.py +++ b/seed/python-sdk/examples/no-custom-config/src/seed/commons/types/types/event_info.py @@ -5,14 +5,12 @@ import typing from ....core.pydantic_utilities import pydantic_v1 +from .metadata import Metadata from .tag import Tag -class EventInfo_Metadata(pydantic_v1.BaseModel): +class EventInfo_Metadata(Metadata): type: typing.Literal["metadata"] = "metadata" - id: str - data: typing.Optional[typing.Dict[str, str]] - json_string: typing.Optional[str] = pydantic_v1.Field(alias="jsonString") class Config: frozen = True diff --git a/seed/python-sdk/examples/no-custom-config/src/seed/types/types/exception.py b/seed/python-sdk/examples/no-custom-config/src/seed/types/types/exception.py index 15ce038617f..d1a0f54abfe 100644 --- a/seed/python-sdk/examples/no-custom-config/src/seed/types/types/exception.py +++ b/seed/python-sdk/examples/no-custom-config/src/seed/types/types/exception.py @@ -5,13 +5,11 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .exception_info import ExceptionInfo -class Exception_Generic(pydantic_v1.BaseModel): +class Exception_Generic(ExceptionInfo): type: typing.Literal["generic"] = "generic" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: frozen = True diff --git a/seed/python-sdk/exhaustive/extra_dependencies/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/extra_dependencies/src/seed/types/union/types/animal.py index a3a3de4a423..0188a149614 100644 --- a/seed/python-sdk/exhaustive/extra_dependencies/src/seed/types/union/types/animal.py +++ b/seed/python-sdk/exhaustive/extra_dependencies/src/seed/types/union/types/animal.py @@ -4,13 +4,12 @@ import typing -from ....core.pydantic_utilities import pydantic_v1 +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic_v1.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic_v1.Field(alias="likesToWoof") class Config: frozen = True @@ -19,10 +18,8 @@ class Config: populate_by_name = True -class Animal_Cat(pydantic_v1.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic_v1.Field(alias="likesToMeow") class Config: frozen = True diff --git a/seed/python-sdk/exhaustive/five-second-timeout/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/five-second-timeout/src/seed/types/union/types/animal.py index a3a3de4a423..0188a149614 100644 --- a/seed/python-sdk/exhaustive/five-second-timeout/src/seed/types/union/types/animal.py +++ b/seed/python-sdk/exhaustive/five-second-timeout/src/seed/types/union/types/animal.py @@ -4,13 +4,12 @@ import typing -from ....core.pydantic_utilities import pydantic_v1 +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic_v1.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic_v1.Field(alias="likesToWoof") class Config: frozen = True @@ -19,10 +18,8 @@ class Config: populate_by_name = True -class Animal_Cat(pydantic_v1.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic_v1.Field(alias="likesToMeow") class Config: frozen = True diff --git a/seed/python-sdk/exhaustive/improved_imports/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/improved_imports/src/seed/types/union/types/animal.py index a3a3de4a423..0188a149614 100644 --- a/seed/python-sdk/exhaustive/improved_imports/src/seed/types/union/types/animal.py +++ b/seed/python-sdk/exhaustive/improved_imports/src/seed/types/union/types/animal.py @@ -4,13 +4,12 @@ import typing -from ....core.pydantic_utilities import pydantic_v1 +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic_v1.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic_v1.Field(alias="likesToWoof") class Config: frozen = True @@ -19,10 +18,8 @@ class Config: populate_by_name = True -class Animal_Cat(pydantic_v1.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic_v1.Field(alias="likesToMeow") class Config: frozen = True diff --git a/seed/python-sdk/exhaustive/infinite-timeout/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/infinite-timeout/src/seed/types/union/types/animal.py index a3a3de4a423..0188a149614 100644 --- a/seed/python-sdk/exhaustive/infinite-timeout/src/seed/types/union/types/animal.py +++ b/seed/python-sdk/exhaustive/infinite-timeout/src/seed/types/union/types/animal.py @@ -4,13 +4,12 @@ import typing -from ....core.pydantic_utilities import pydantic_v1 +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic_v1.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic_v1.Field(alias="likesToWoof") class Config: frozen = True @@ -19,10 +18,8 @@ class Config: populate_by_name = True -class Animal_Cat(pydantic_v1.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic_v1.Field(alias="likesToMeow") class Config: frozen = True diff --git a/seed/python-sdk/exhaustive/no-custom-config/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/no-custom-config/src/seed/types/union/types/animal.py index a3a3de4a423..0188a149614 100644 --- a/seed/python-sdk/exhaustive/no-custom-config/src/seed/types/union/types/animal.py +++ b/seed/python-sdk/exhaustive/no-custom-config/src/seed/types/union/types/animal.py @@ -4,13 +4,12 @@ import typing -from ....core.pydantic_utilities import pydantic_v1 +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic_v1.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic_v1.Field(alias="likesToWoof") class Config: frozen = True @@ -19,10 +18,8 @@ class Config: populate_by_name = True -class Animal_Cat(pydantic_v1.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic_v1.Field(alias="likesToMeow") class Config: frozen = True diff --git a/seed/python-sdk/exhaustive/pydantic-extra-fields/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/pydantic-extra-fields/src/seed/types/union/types/animal.py index a3a3de4a423..0188a149614 100644 --- a/seed/python-sdk/exhaustive/pydantic-extra-fields/src/seed/types/union/types/animal.py +++ b/seed/python-sdk/exhaustive/pydantic-extra-fields/src/seed/types/union/types/animal.py @@ -4,13 +4,12 @@ import typing -from ....core.pydantic_utilities import pydantic_v1 +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic_v1.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic_v1.Field(alias="likesToWoof") class Config: frozen = True @@ -19,10 +18,8 @@ class Config: populate_by_name = True -class Animal_Cat(pydantic_v1.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic_v1.Field(alias="likesToMeow") class Config: frozen = True diff --git a/seed/python-sdk/exhaustive/pydantic-v1/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/pydantic-v1/src/seed/types/union/types/animal.py index 4c039e4a80c..0188a149614 100644 --- a/seed/python-sdk/exhaustive/pydantic-v1/src/seed/types/union/types/animal.py +++ b/seed/python-sdk/exhaustive/pydantic-v1/src/seed/types/union/types/animal.py @@ -4,13 +4,12 @@ import typing -import pydantic +from .cat import Cat +from .dog import Dog -class Animal_Dog(pydantic.BaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic.Field(alias="likesToWoof") class Config: frozen = True @@ -19,10 +18,8 @@ class Config: populate_by_name = True -class Animal_Cat(pydantic.BaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic.Field(alias="likesToMeow") class Config: frozen = True diff --git a/seed/python-sdk/exhaustive/skip-pydantic-validation/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/skip-pydantic-validation/src/seed/types/union/types/animal.py index adb2707675b..96ba417f73c 100644 --- a/seed/python-sdk/exhaustive/skip-pydantic-validation/src/seed/types/union/types/animal.py +++ b/seed/python-sdk/exhaustive/skip-pydantic-validation/src/seed/types/union/types/animal.py @@ -6,14 +6,13 @@ import typing_extensions -from ....core.pydantic_utilities import pydantic_v1 -from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....core.unchecked_base_model import UnionMetadata +from .cat import Cat +from .dog import Dog -class Animal_Dog(UncheckedBaseModel): +class Animal_Dog(Dog): animal: typing.Literal["dog"] = "dog" - name: str - likes_to_woof: bool = pydantic_v1.Field(alias="likesToWoof") class Config: frozen = True @@ -22,10 +21,8 @@ class Config: populate_by_name = True -class Animal_Cat(UncheckedBaseModel): +class Animal_Cat(Cat): animal: typing.Literal["cat"] = "cat" - name: str - likes_to_meow: bool = pydantic_v1.Field(alias="likesToMeow") class Config: frozen = True diff --git a/seed/python-sdk/mixed-case/src/seed/service/types/resource.py b/seed/python-sdk/mixed-case/src/seed/service/types/resource.py index 9701c196384..8b3ec150569 100644 --- a/seed/python-sdk/mixed-case/src/seed/service/types/resource.py +++ b/seed/python-sdk/mixed-case/src/seed/service/types/resource.py @@ -7,7 +7,9 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import pydantic_v1 +from .organization import Organization from .resource_status import ResourceStatus +from .user import User class Base(pydantic_v1.BaseModel): @@ -38,11 +40,8 @@ class Config: json_encoders = {dt.datetime: serialize_datetime} -class Resource_User(Base): +class Resource_User(User, Base): resource_type: typing.Literal["user"] = "user" - user_name: str = pydantic_v1.Field(alias="userName") - metadata_tags: typing.List[str] - extra_properties: typing.Dict[str, str] = pydantic_v1.Field(alias="EXTRA_PROPERTIES") class Config: frozen = True @@ -51,9 +50,8 @@ class Config: populate_by_name = True -class Resource_Organization(Base): +class Resource_Organization(Organization, Base): resource_type: typing.Literal["Organization"] = "Organization" - name: str class Config: frozen = True diff --git a/seed/python-sdk/trace/.inputs/config.json b/seed/python-sdk/trace/.inputs/config.json index 6ca779fc154..5a26d77a8d6 100644 --- a/seed/python-sdk/trace/.inputs/config.json +++ b/seed/python-sdk/trace/.inputs/config.json @@ -1,27 +1,24 @@ { - "irFilepath": "/fern/ir.json", + "irFilepath": "./ir.json", "output": { "mode": { - "type": "github", "repoUrl": "https://github.com/trace/fern", "version": "0.0.1", "publishInfo": { - "type": "pypi", "registryUrl": "", "packageName": "fern_trace", "usernameEnvironmentVariable": "", - "passwordEnvironmentVariable": "" - } + "passwordEnvironmentVariable": "", + "type": "pypi" + }, + "type": "github" }, - "path": "/fern/output", - "publishingMetadata": null, - "snippetFilepath": "/fern/snippet.json" + "path": "../" }, - "publish": null, "workspaceName": "trace", "organization": "seed", "environment": { - "_type": "local" + "type": "local" }, "dryRun": false, "whitelabel": false, diff --git a/seed/python-sdk/trace/src/seed/commons/types/debug_variable_value.py b/seed/python-sdk/trace/src/seed/commons/types/debug_variable_value.py index 7b484a5adeb..6103c9bef6f 100644 --- a/seed/python-sdk/trace/src/seed/commons/types/debug_variable_value.py +++ b/seed/python-sdk/trace/src/seed/commons/types/debug_variable_value.py @@ -63,9 +63,8 @@ class Config: smart_union = True -class DebugVariableValue_MapValue(pydantic_v1.BaseModel): +class DebugVariableValue_MapValue(DebugMapValue): type: typing.Literal["mapValue"] = "mapValue" - key_value_pairs: typing.List[DebugKeyValuePairs] = pydantic_v1.Field(alias="keyValuePairs") class Config: frozen = True @@ -83,10 +82,8 @@ class Config: smart_union = True -class DebugVariableValue_BinaryTreeNodeValue(pydantic_v1.BaseModel): +class DebugVariableValue_BinaryTreeNodeValue(BinaryTreeNodeAndTreeValue): type: typing.Literal["binaryTreeNodeValue"] = "binaryTreeNodeValue" - node_id: NodeId = pydantic_v1.Field(alias="nodeId") - full_tree: BinaryTreeValue = pydantic_v1.Field(alias="fullTree") class Config: frozen = True @@ -95,10 +92,8 @@ class Config: populate_by_name = True -class DebugVariableValue_SinglyLinkedListNodeValue(pydantic_v1.BaseModel): +class DebugVariableValue_SinglyLinkedListNodeValue(SinglyLinkedListNodeAndListValue): type: typing.Literal["singlyLinkedListNodeValue"] = "singlyLinkedListNodeValue" - node_id: NodeId = pydantic_v1.Field(alias="nodeId") - full_list: SinglyLinkedListValue = pydantic_v1.Field(alias="fullList") class Config: frozen = True @@ -107,10 +102,8 @@ class Config: populate_by_name = True -class DebugVariableValue_DoublyLinkedListNodeValue(pydantic_v1.BaseModel): +class DebugVariableValue_DoublyLinkedListNodeValue(DoublyLinkedListNodeAndListValue): type: typing.Literal["doublyLinkedListNodeValue"] = "doublyLinkedListNodeValue" - node_id: NodeId = pydantic_v1.Field(alias="nodeId") - full_list: DoublyLinkedListValue = pydantic_v1.Field(alias="fullList") class Config: frozen = True @@ -135,10 +128,8 @@ class Config: smart_union = True -class DebugVariableValue_GenericValue(pydantic_v1.BaseModel): +class DebugVariableValue_GenericValue(GenericValue): type: typing.Literal["genericValue"] = "genericValue" - stringified_type: typing.Optional[str] = pydantic_v1.Field(alias="stringifiedType") - stringified_value: str = pydantic_v1.Field(alias="stringifiedValue") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/commons/types/variable_type.py b/seed/python-sdk/trace/src/seed/commons/types/variable_type.py index 73fe1c85f1b..71a04989c47 100644 --- a/seed/python-sdk/trace/src/seed/commons/types/variable_type.py +++ b/seed/python-sdk/trace/src/seed/commons/types/variable_type.py @@ -5,8 +5,6 @@ import typing from ...core.pydantic_utilities import pydantic_v1 -from .list_type import ListType -from .map_type import MapType class VariableType_IntegerType(pydantic_v1.BaseModel): @@ -49,10 +47,8 @@ class Config: smart_union = True -class VariableType_ListType(pydantic_v1.BaseModel): +class VariableType_ListType(ListType): type: typing.Literal["listType"] = "listType" - value_type: VariableType = pydantic_v1.Field(alias="valueType") - is_fixed_length: typing.Optional[bool] = pydantic_v1.Field(alias="isFixedLength") class Config: frozen = True @@ -61,10 +57,8 @@ class Config: populate_by_name = True -class VariableType_MapType(pydantic_v1.BaseModel): +class VariableType_MapType(MapType): type: typing.Literal["mapType"] = "mapType" - key_type: VariableType = pydantic_v1.Field(alias="keyType") - value_type: VariableType = pydantic_v1.Field(alias="valueType") class Config: frozen = True @@ -109,5 +103,8 @@ class Config: VariableType_SinglyLinkedListType, VariableType_DoublyLinkedListType, ] +from .list_type import ListType # noqa: E402 +from .map_type import MapType # noqa: E402 + VariableType_ListType.update_forward_refs(ListType=ListType, MapType=MapType, VariableType=VariableType) VariableType_MapType.update_forward_refs(ListType=ListType, MapType=MapType, VariableType=VariableType) diff --git a/seed/python-sdk/trace/src/seed/commons/types/variable_value.py b/seed/python-sdk/trace/src/seed/commons/types/variable_value.py index 57f154538a2..d2743f6d9b9 100644 --- a/seed/python-sdk/trace/src/seed/commons/types/variable_value.py +++ b/seed/python-sdk/trace/src/seed/commons/types/variable_value.py @@ -59,9 +59,8 @@ class Config: smart_union = True -class VariableValue_MapValue(pydantic_v1.BaseModel): +class VariableValue_MapValue(MapValue): type: typing.Literal["mapValue"] = "mapValue" - key_value_pairs: typing.List[KeyValuePair] = pydantic_v1.Field(alias="keyValuePairs") class Config: frozen = True @@ -79,34 +78,34 @@ class Config: smart_union = True -class VariableValue_BinaryTreeValue(pydantic_v1.BaseModel): +class VariableValue_BinaryTreeValue(BinaryTreeValue): type: typing.Literal["binaryTreeValue"] = "binaryTreeValue" - root: typing.Optional[NodeId] - nodes: typing.Dict[NodeId, BinaryTreeNodeValue] class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class VariableValue_SinglyLinkedListValue(pydantic_v1.BaseModel): +class VariableValue_SinglyLinkedListValue(SinglyLinkedListValue): type: typing.Literal["singlyLinkedListValue"] = "singlyLinkedListValue" - head: typing.Optional[NodeId] - nodes: typing.Dict[NodeId, SinglyLinkedListNodeValue] class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class VariableValue_DoublyLinkedListValue(pydantic_v1.BaseModel): +class VariableValue_DoublyLinkedListValue(DoublyLinkedListValue): type: typing.Literal["doublyLinkedListValue"] = "doublyLinkedListValue" - head: typing.Optional[NodeId] - nodes: typing.Dict[NodeId, DoublyLinkedListNodeValue] class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True class VariableValue_NullValue(pydantic_v1.BaseModel): diff --git a/seed/python-sdk/trace/src/seed/problem/types/create_problem_error.py b/seed/python-sdk/trace/src/seed/problem/types/create_problem_error.py index 5c75cf9fa52..76b97e460a9 100644 --- a/seed/python-sdk/trace/src/seed/problem/types/create_problem_error.py +++ b/seed/python-sdk/trace/src/seed/problem/types/create_problem_error.py @@ -5,13 +5,11 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .generic_create_problem_error import GenericCreateProblemError -class CreateProblemError_Generic(pydantic_v1.BaseModel): +class CreateProblemError_Generic(GenericCreateProblemError): error_type: typing.Literal["generic"] = pydantic_v1.Field(alias="_type", default="generic") - message: str - type: str - stacktrace: str class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/actual_result.py b/seed/python-sdk/trace/src/seed/submission/types/actual_result.py index 962ddbc17e1..c4f553b8591 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/actual_result.py +++ b/seed/python-sdk/trace/src/seed/submission/types/actual_result.py @@ -5,6 +5,7 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .exception_info import ExceptionInfo from .exception_v_2 import ExceptionV2 @@ -17,11 +18,8 @@ class Config: smart_union = True -class ActualResult_Exception(pydantic_v1.BaseModel): +class ActualResult_Exception(ExceptionInfo): type: typing.Literal["exception"] = "exception" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/code_execution_update.py b/seed/python-sdk/trace/src/seed/submission/types/code_execution_update.py index aa9e803d603..7d628d070da 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/code_execution_update.py +++ b/seed/python-sdk/trace/src/seed/submission/types/code_execution_update.py @@ -4,25 +4,21 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 -from ...v_2.problem.types.test_case_id import TestCaseId -from .error_info import ErrorInfo -from .execution_session_status import ExecutionSessionStatus -from .invalid_request_cause import InvalidRequestCause -from .lightweight_stackframe_information import LightweightStackframeInformation -from .running_submission_state import RunningSubmissionState -from .submission_id import SubmissionId -from .submission_request import SubmissionRequest -from .test_case_grade import TestCaseGrade -from .test_case_result_with_stdout import TestCaseResultWithStdout -from .traced_file import TracedFile -from .workspace_run_details import WorkspaceRunDetails - - -class CodeExecutionUpdate_BuildingExecutor(pydantic_v1.BaseModel): +from .building_executor_response import BuildingExecutorResponse +from .errored_response import ErroredResponse +from .finished_response import FinishedResponse +from .graded_response import GradedResponse +from .graded_response_v_2 import GradedResponseV2 +from .invalid_request_response import InvalidRequestResponse +from .recorded_response_notification import RecordedResponseNotification +from .recording_response_notification import RecordingResponseNotification +from .running_response import RunningResponse +from .stopped_response import StoppedResponse +from .workspace_ran_response import WorkspaceRanResponse + + +class CodeExecutionUpdate_BuildingExecutor(BuildingExecutorResponse): type: typing.Literal["buildingExecutor"] = "buildingExecutor" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - status: ExecutionSessionStatus class Config: frozen = True @@ -31,10 +27,8 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_Running(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Running(RunningResponse): type: typing.Literal["running"] = "running" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - state: RunningSubmissionState class Config: frozen = True @@ -43,10 +37,8 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_Errored(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Errored(ErroredResponse): type: typing.Literal["errored"] = "errored" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - error_info: ErrorInfo = pydantic_v1.Field(alias="errorInfo") class Config: frozen = True @@ -55,9 +47,8 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_Stopped(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Stopped(StoppedResponse): type: typing.Literal["stopped"] = "stopped" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") class Config: frozen = True @@ -66,10 +57,8 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_Graded(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Graded(GradedResponse): type: typing.Literal["graded"] = "graded" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - test_cases: typing.Dict[str, TestCaseResultWithStdout] = pydantic_v1.Field(alias="testCases") class Config: frozen = True @@ -78,10 +67,8 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_GradedV2(pydantic_v1.BaseModel): +class CodeExecutionUpdate_GradedV2(GradedResponseV2): type: typing.Literal["gradedV2"] = "gradedV2" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - test_cases: typing.Dict[TestCaseId, TestCaseGrade] = pydantic_v1.Field(alias="testCases") class Config: frozen = True @@ -90,10 +77,8 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_WorkspaceRan(pydantic_v1.BaseModel): +class CodeExecutionUpdate_WorkspaceRan(WorkspaceRanResponse): type: typing.Literal["workspaceRan"] = "workspaceRan" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - run_details: WorkspaceRunDetails = pydantic_v1.Field(alias="runDetails") class Config: frozen = True @@ -102,13 +87,8 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_Recording(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Recording(RecordingResponseNotification): type: typing.Literal["recording"] = "recording" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - test_case_id: typing.Optional[str] = pydantic_v1.Field(alias="testCaseId") - line_number: int = pydantic_v1.Field(alias="lineNumber") - lightweight_stack_info: LightweightStackframeInformation = pydantic_v1.Field(alias="lightweightStackInfo") - traced_file: typing.Optional[TracedFile] = pydantic_v1.Field(alias="tracedFile") class Config: frozen = True @@ -117,11 +97,8 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_Recorded(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Recorded(RecordedResponseNotification): type: typing.Literal["recorded"] = "recorded" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - trace_responses_size: int = pydantic_v1.Field(alias="traceResponsesSize") - test_case_id: typing.Optional[str] = pydantic_v1.Field(alias="testCaseId") class Config: frozen = True @@ -130,19 +107,18 @@ class Config: populate_by_name = True -class CodeExecutionUpdate_InvalidRequest(pydantic_v1.BaseModel): +class CodeExecutionUpdate_InvalidRequest(InvalidRequestResponse): type: typing.Literal["invalidRequest"] = "invalidRequest" - request: SubmissionRequest - cause: InvalidRequestCause class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class CodeExecutionUpdate_Finished(pydantic_v1.BaseModel): +class CodeExecutionUpdate_Finished(FinishedResponse): type: typing.Literal["finished"] = "finished" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/error_info.py b/seed/python-sdk/trace/src/seed/submission/types/error_info.py index 56a2534c343..042ad913add 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/error_info.py +++ b/seed/python-sdk/trace/src/seed/submission/types/error_info.py @@ -4,31 +4,33 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 -from .exception_info import ExceptionInfo +from .compile_error import CompileError +from .internal_error import InternalError +from .runtime_error import RuntimeError -class ErrorInfo_CompileError(pydantic_v1.BaseModel): +class ErrorInfo_CompileError(CompileError): type: typing.Literal["compileError"] = "compileError" - message: str class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class ErrorInfo_RuntimeError(pydantic_v1.BaseModel): +class ErrorInfo_RuntimeError(RuntimeError): type: typing.Literal["runtimeError"] = "runtimeError" - message: str class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class ErrorInfo_InternalError(pydantic_v1.BaseModel): +class ErrorInfo_InternalError(InternalError): type: typing.Literal["internalError"] = "internalError" - exception_info: ExceptionInfo = pydantic_v1.Field(alias="exceptionInfo") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/exception_v_2.py b/seed/python-sdk/trace/src/seed/submission/types/exception_v_2.py index 3524a54645d..0c143b8b5bf 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/exception_v_2.py +++ b/seed/python-sdk/trace/src/seed/submission/types/exception_v_2.py @@ -5,13 +5,11 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .exception_info import ExceptionInfo -class ExceptionV2_Generic(pydantic_v1.BaseModel): +class ExceptionV2_Generic(ExceptionInfo): type: typing.Literal["generic"] = "generic" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/invalid_request_cause.py b/seed/python-sdk/trace/src/seed/submission/types/invalid_request_cause.py index c6f9d4927b3..a9c6f9b4b0a 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/invalid_request_cause.py +++ b/seed/python-sdk/trace/src/seed/submission/types/invalid_request_cause.py @@ -4,15 +4,13 @@ import typing -from ...commons.types.language import Language -from ...commons.types.problem_id import ProblemId -from ...core.pydantic_utilities import pydantic_v1 -from .submission_id import SubmissionId +from .custom_test_cases_unsupported import CustomTestCasesUnsupported +from .submission_id_not_found import SubmissionIdNotFound +from .unexpected_language_error import UnexpectedLanguageError -class InvalidRequestCause_SubmissionIdNotFound(pydantic_v1.BaseModel): +class InvalidRequestCause_SubmissionIdNotFound(SubmissionIdNotFound): type: typing.Literal["submissionIdNotFound"] = "submissionIdNotFound" - missing_submission_id: SubmissionId = pydantic_v1.Field(alias="missingSubmissionId") class Config: frozen = True @@ -21,10 +19,8 @@ class Config: populate_by_name = True -class InvalidRequestCause_CustomTestCasesUnsupported(pydantic_v1.BaseModel): +class InvalidRequestCause_CustomTestCasesUnsupported(CustomTestCasesUnsupported): type: typing.Literal["customTestCasesUnsupported"] = "customTestCasesUnsupported" - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") class Config: frozen = True @@ -33,10 +29,8 @@ class Config: populate_by_name = True -class InvalidRequestCause_UnexpectedLanguage(pydantic_v1.BaseModel): +class InvalidRequestCause_UnexpectedLanguage(UnexpectedLanguageError): type: typing.Literal["unexpectedLanguage"] = "unexpectedLanguage" - expected_language: Language = pydantic_v1.Field(alias="expectedLanguage") - actual_language: Language = pydantic_v1.Field(alias="actualLanguage") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/submission_request.py b/seed/python-sdk/trace/src/seed/submission/types/submission_request.py index 2556c232d51..792bcaafca4 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/submission_request.py +++ b/seed/python-sdk/trace/src/seed/submission/types/submission_request.py @@ -4,17 +4,15 @@ import typing -from ...commons.types.language import Language -from ...commons.types.problem_id import ProblemId from ...core.pydantic_utilities import pydantic_v1 -from .submission_file_info import SubmissionFileInfo -from .submission_id import SubmissionId +from .initialize_problem_request import InitializeProblemRequest +from .stop_request import StopRequest +from .submit_request_v_2 import SubmitRequestV2 +from .workspace_submit_request import WorkspaceSubmitRequest -class SubmissionRequest_InitializeProblemRequest(pydantic_v1.BaseModel): +class SubmissionRequest_InitializeProblemRequest(InitializeProblemRequest): type: typing.Literal["initializeProblemRequest"] = "initializeProblemRequest" - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - problem_version: typing.Optional[int] = pydantic_v1.Field(alias="problemVersion") class Config: frozen = True @@ -31,14 +29,8 @@ class Config: smart_union = True -class SubmissionRequest_SubmitV2(pydantic_v1.BaseModel): +class SubmissionRequest_SubmitV2(SubmitRequestV2): type: typing.Literal["submitV2"] = "submitV2" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - language: Language - submission_files: typing.List[SubmissionFileInfo] = pydantic_v1.Field(alias="submissionFiles") - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - problem_version: typing.Optional[int] = pydantic_v1.Field(alias="problemVersion") - user_id: typing.Optional[str] = pydantic_v1.Field(alias="userId") class Config: frozen = True @@ -47,12 +39,8 @@ class Config: populate_by_name = True -class SubmissionRequest_WorkspaceSubmit(pydantic_v1.BaseModel): +class SubmissionRequest_WorkspaceSubmit(WorkspaceSubmitRequest): type: typing.Literal["workspaceSubmit"] = "workspaceSubmit" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") - language: Language - submission_files: typing.List[SubmissionFileInfo] = pydantic_v1.Field(alias="submissionFiles") - user_id: typing.Optional[str] = pydantic_v1.Field(alias="userId") class Config: frozen = True @@ -61,9 +49,8 @@ class Config: populate_by_name = True -class SubmissionRequest_Stop(pydantic_v1.BaseModel): +class SubmissionRequest_Stop(StopRequest): type: typing.Literal["stop"] = "stop" - submission_id: SubmissionId = pydantic_v1.Field(alias="submissionId") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/submission_response.py b/seed/python-sdk/trace/src/seed/submission/types/submission_response.py index 96b1409d958..b7806ce6b89 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/submission_response.py +++ b/seed/python-sdk/trace/src/seed/submission/types/submission_response.py @@ -7,6 +7,8 @@ from ...commons.types.problem_id import ProblemId from ...core.pydantic_utilities import pydantic_v1 from .code_execution_update import CodeExecutionUpdate +from .exception_info import ExceptionInfo +from .terminated_response import TerminatedResponse class SubmissionResponse_ServerInitialized(pydantic_v1.BaseModel): @@ -34,11 +36,8 @@ class Config: smart_union = True -class SubmissionResponse_ServerErrored(pydantic_v1.BaseModel): +class SubmissionResponse_ServerErrored(ExceptionInfo): type: typing.Literal["serverErrored"] = "serverErrored" - exception_type: str = pydantic_v1.Field(alias="exceptionType") - exception_message: str = pydantic_v1.Field(alias="exceptionMessage") - exception_stacktrace: str = pydantic_v1.Field(alias="exceptionStacktrace") class Config: frozen = True @@ -56,12 +55,14 @@ class Config: smart_union = True -class SubmissionResponse_Terminated(pydantic_v1.BaseModel): +class SubmissionResponse_Terminated(TerminatedResponse): type: typing.Literal["terminated"] = "terminated" class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True SubmissionResponse = typing.Union[ diff --git a/seed/python-sdk/trace/src/seed/submission/types/submission_status_for_test_case.py b/seed/python-sdk/trace/src/seed/submission/types/submission_status_for_test_case.py index 78531f86c76..3d7b4944b30 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/submission_status_for_test_case.py +++ b/seed/python-sdk/trace/src/seed/submission/types/submission_status_for_test_case.py @@ -6,18 +6,18 @@ from ...core.pydantic_utilities import pydantic_v1 from .test_case_grade import TestCaseGrade -from .test_case_result import TestCaseResult from .test_case_result_with_stdout import TestCaseResultWithStdout +from .traced_test_case import TracedTestCase -class SubmissionStatusForTestCase_Graded(pydantic_v1.BaseModel): +class SubmissionStatusForTestCase_Graded(TestCaseResultWithStdout): type: typing.Literal["graded"] = "graded" - result: TestCaseResult - stdout: str class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True class SubmissionStatusForTestCase_GradedV2(pydantic_v1.BaseModel): @@ -29,10 +29,8 @@ class Config: smart_union = True -class SubmissionStatusForTestCase_Traced(pydantic_v1.BaseModel): +class SubmissionStatusForTestCase_Traced(TracedTestCase): type: typing.Literal["traced"] = "traced" - result: TestCaseResultWithStdout - trace_responses_size: int = pydantic_v1.Field(alias="traceResponsesSize") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/submission_status_v_2.py b/seed/python-sdk/trace/src/seed/submission/types/submission_status_v_2.py index ddaf60ee226..e6f0cc01ee9 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/submission_status_v_2.py +++ b/seed/python-sdk/trace/src/seed/submission/types/submission_status_v_2.py @@ -4,19 +4,12 @@ import typing -from ...commons.types.problem_id import ProblemId -from ...core.pydantic_utilities import pydantic_v1 -from ...v_2.problem.types.problem_info_v_2 import ProblemInfoV2 -from .test_submission_update import TestSubmissionUpdate -from .workspace_submission_update import WorkspaceSubmissionUpdate +from .test_submission_status_v_2 import TestSubmissionStatusV2 +from .workspace_submission_status_v_2 import WorkspaceSubmissionStatusV2 -class SubmissionStatusV2_Test(pydantic_v1.BaseModel): +class SubmissionStatusV2_Test(TestSubmissionStatusV2): type: typing.Literal["test"] = "test" - updates: typing.List[TestSubmissionUpdate] - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - problem_version: int = pydantic_v1.Field(alias="problemVersion") - problem_info: ProblemInfoV2 = pydantic_v1.Field(alias="problemInfo") class Config: frozen = True @@ -25,13 +18,14 @@ class Config: populate_by_name = True -class SubmissionStatusV2_Workspace(pydantic_v1.BaseModel): +class SubmissionStatusV2_Workspace(WorkspaceSubmissionStatusV2): type: typing.Literal["workspace"] = "workspace" - updates: typing.List[WorkspaceSubmissionUpdate] class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True SubmissionStatusV2 = typing.Union[SubmissionStatusV2_Test, SubmissionStatusV2_Workspace] diff --git a/seed/python-sdk/trace/src/seed/submission/types/submission_type_state.py b/seed/python-sdk/trace/src/seed/submission/types/submission_type_state.py index f3a40b036a0..400b23eebd9 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/submission_type_state.py +++ b/seed/python-sdk/trace/src/seed/submission/types/submission_type_state.py @@ -4,19 +4,12 @@ import typing -from ...commons.types.problem_id import ProblemId -from ...commons.types.test_case import TestCase -from ...core.pydantic_utilities import pydantic_v1 -from .test_submission_status import TestSubmissionStatus -from .workspace_submission_status import WorkspaceSubmissionStatus +from .test_submission_state import TestSubmissionState +from .workspace_submission_state import WorkspaceSubmissionState -class SubmissionTypeState_Test(pydantic_v1.BaseModel): +class SubmissionTypeState_Test(TestSubmissionState): type: typing.Literal["test"] = "test" - problem_id: ProblemId = pydantic_v1.Field(alias="problemId") - default_test_cases: typing.List[TestCase] = pydantic_v1.Field(alias="defaultTestCases") - custom_test_cases: typing.List[TestCase] = pydantic_v1.Field(alias="customTestCases") - status: TestSubmissionStatus class Config: frozen = True @@ -25,13 +18,14 @@ class Config: populate_by_name = True -class SubmissionTypeState_Workspace(pydantic_v1.BaseModel): +class SubmissionTypeState_Workspace(WorkspaceSubmissionState): type: typing.Literal["workspace"] = "workspace" - status: WorkspaceSubmissionStatus class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True SubmissionTypeState = typing.Union[SubmissionTypeState_Test, SubmissionTypeState_Workspace] diff --git a/seed/python-sdk/trace/src/seed/submission/types/test_case_grade.py b/seed/python-sdk/trace/src/seed/submission/types/test_case_grade.py index e19ab224820..6605cb7212d 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/test_case_grade.py +++ b/seed/python-sdk/trace/src/seed/submission/types/test_case_grade.py @@ -4,26 +4,22 @@ import typing -from ...commons.types.variable_value import VariableValue -from ...core.pydantic_utilities import pydantic_v1 -from .exception_v_2 import ExceptionV2 +from .test_case_hidden_grade import TestCaseHiddenGrade +from .test_case_non_hidden_grade import TestCaseNonHiddenGrade -class TestCaseGrade_Hidden(pydantic_v1.BaseModel): +class TestCaseGrade_Hidden(TestCaseHiddenGrade): type: typing.Literal["hidden"] = "hidden" - passed: bool class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class TestCaseGrade_NonHidden(pydantic_v1.BaseModel): +class TestCaseGrade_NonHidden(TestCaseNonHiddenGrade): type: typing.Literal["nonHidden"] = "nonHidden" - passed: bool - actual_result: typing.Optional[VariableValue] = pydantic_v1.Field(alias="actualResult") - exception: typing.Optional[ExceptionV2] - stdout: str class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/test_submission_update_info.py b/seed/python-sdk/trace/src/seed/submission/types/test_submission_update_info.py index 8976264ef6c..9692fc6bf73 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/test_submission_update_info.py +++ b/seed/python-sdk/trace/src/seed/submission/types/test_submission_update_info.py @@ -5,10 +5,10 @@ import typing from ...core.pydantic_utilities import pydantic_v1 -from ...v_2.problem.types.test_case_id import TestCaseId from .error_info import ErrorInfo +from .graded_test_case_update import GradedTestCaseUpdate +from .recorded_test_case_update import RecordedTestCaseUpdate from .running_submission_state import RunningSubmissionState -from .test_case_grade import TestCaseGrade class TestSubmissionUpdateInfo_Running(pydantic_v1.BaseModel): @@ -37,10 +37,8 @@ class Config: smart_union = True -class TestSubmissionUpdateInfo_GradedTestCase(pydantic_v1.BaseModel): +class TestSubmissionUpdateInfo_GradedTestCase(GradedTestCaseUpdate): type: typing.Literal["gradedTestCase"] = "gradedTestCase" - test_case_id: TestCaseId = pydantic_v1.Field(alias="testCaseId") - grade: TestCaseGrade class Config: frozen = True @@ -49,10 +47,8 @@ class Config: populate_by_name = True -class TestSubmissionUpdateInfo_RecordedTestCase(pydantic_v1.BaseModel): +class TestSubmissionUpdateInfo_RecordedTestCase(RecordedTestCaseUpdate): type: typing.Literal["recordedTestCase"] = "recordedTestCase" - test_case_id: TestCaseId = pydantic_v1.Field(alias="testCaseId") - trace_responses_size: int = pydantic_v1.Field(alias="traceResponsesSize") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/workspace_submission_status.py b/seed/python-sdk/trace/src/seed/submission/types/workspace_submission_status.py index 03d3bcbb3c4..1cc0f609992 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/workspace_submission_status.py +++ b/seed/python-sdk/trace/src/seed/submission/types/workspace_submission_status.py @@ -6,9 +6,8 @@ from ...core.pydantic_utilities import pydantic_v1 from .error_info import ErrorInfo -from .exception_info import ExceptionInfo -from .exception_v_2 import ExceptionV2 from .running_submission_state import RunningSubmissionState +from .workspace_run_details import WorkspaceRunDetails class WorkspaceSubmissionStatus_Stopped(pydantic_v1.BaseModel): @@ -37,11 +36,8 @@ class Config: smart_union = True -class WorkspaceSubmissionStatus_Ran(pydantic_v1.BaseModel): +class WorkspaceSubmissionStatus_Ran(WorkspaceRunDetails): type: typing.Literal["ran"] = "ran" - exception_v_2: typing.Optional[ExceptionV2] = pydantic_v1.Field(alias="exceptionV2") - exception: typing.Optional[ExceptionInfo] - stdout: str class Config: frozen = True @@ -50,11 +46,8 @@ class Config: populate_by_name = True -class WorkspaceSubmissionStatus_Traced(pydantic_v1.BaseModel): +class WorkspaceSubmissionStatus_Traced(WorkspaceRunDetails): type: typing.Literal["traced"] = "traced" - exception_v_2: typing.Optional[ExceptionV2] = pydantic_v1.Field(alias="exceptionV2") - exception: typing.Optional[ExceptionInfo] - stdout: str class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/submission/types/workspace_submission_update_info.py b/seed/python-sdk/trace/src/seed/submission/types/workspace_submission_update_info.py index 317c3c219d9..2719caebd65 100644 --- a/seed/python-sdk/trace/src/seed/submission/types/workspace_submission_update_info.py +++ b/seed/python-sdk/trace/src/seed/submission/types/workspace_submission_update_info.py @@ -6,9 +6,9 @@ from ...core.pydantic_utilities import pydantic_v1 from .error_info import ErrorInfo -from .exception_info import ExceptionInfo -from .exception_v_2 import ExceptionV2 from .running_submission_state import RunningSubmissionState +from .workspace_run_details import WorkspaceRunDetails +from .workspace_traced_update import WorkspaceTracedUpdate class WorkspaceSubmissionUpdateInfo_Running(pydantic_v1.BaseModel): @@ -20,11 +20,8 @@ class Config: smart_union = True -class WorkspaceSubmissionUpdateInfo_Ran(pydantic_v1.BaseModel): +class WorkspaceSubmissionUpdateInfo_Ran(WorkspaceRunDetails): type: typing.Literal["ran"] = "ran" - exception_v_2: typing.Optional[ExceptionV2] = pydantic_v1.Field(alias="exceptionV2") - exception: typing.Optional[ExceptionInfo] - stdout: str class Config: frozen = True @@ -49,9 +46,8 @@ class Config: smart_union = True -class WorkspaceSubmissionUpdateInfo_TracedV2(pydantic_v1.BaseModel): +class WorkspaceSubmissionUpdateInfo_TracedV2(WorkspaceTracedUpdate): type: typing.Literal["tracedV2"] = "tracedV2" - trace_responses_size: int = pydantic_v1.Field(alias="traceResponsesSize") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/v_2/problem/types/assert_correctness_check.py b/seed/python-sdk/trace/src/seed/v_2/problem/types/assert_correctness_check.py index dd05a81a5ef..9ebdb63477b 100644 --- a/seed/python-sdk/trace/src/seed/v_2/problem/types/assert_correctness_check.py +++ b/seed/python-sdk/trace/src/seed/v_2/problem/types/assert_correctness_check.py @@ -4,15 +4,12 @@ import typing -from ....core.pydantic_utilities import pydantic_v1 -from .function_implementation_for_multiple_languages import FunctionImplementationForMultipleLanguages -from .parameter import Parameter -from .parameter_id import ParameterId +from .deep_equality_correctness_check import DeepEqualityCorrectnessCheck +from .void_function_definition_that_takes_actual_result import VoidFunctionDefinitionThatTakesActualResult -class AssertCorrectnessCheck_DeepEquality(pydantic_v1.BaseModel): +class AssertCorrectnessCheck_DeepEquality(DeepEqualityCorrectnessCheck): type: typing.Literal["deepEquality"] = "deepEquality" - expected_value_parameter_id: ParameterId = pydantic_v1.Field(alias="expectedValueParameterId") class Config: frozen = True @@ -21,10 +18,8 @@ class Config: populate_by_name = True -class AssertCorrectnessCheck_Custom(pydantic_v1.BaseModel): +class AssertCorrectnessCheck_Custom(VoidFunctionDefinitionThatTakesActualResult): type: typing.Literal["custom"] = "custom" - additional_parameters: typing.List[Parameter] = pydantic_v1.Field(alias="additionalParameters") - code: FunctionImplementationForMultipleLanguages class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/v_2/problem/types/custom_files.py b/seed/python-sdk/trace/src/seed/v_2/problem/types/custom_files.py index 75845553193..ac7024b3955 100644 --- a/seed/python-sdk/trace/src/seed/v_2/problem/types/custom_files.py +++ b/seed/python-sdk/trace/src/seed/v_2/problem/types/custom_files.py @@ -6,18 +6,13 @@ from ....commons.types.language import Language from ....core.pydantic_utilities import pydantic_v1 -from .basic_test_case_template import BasicTestCaseTemplate +from .basic_custom_files import BasicCustomFiles from .file_info_v_2 import FileInfoV2 from .files import Files -from .non_void_function_signature import NonVoidFunctionSignature -class CustomFiles_Basic(pydantic_v1.BaseModel): +class CustomFiles_Basic(BasicCustomFiles): type: typing.Literal["basic"] = "basic" - method_name: str = pydantic_v1.Field(alias="methodName") - signature: NonVoidFunctionSignature - additional_files: typing.Dict[Language, Files] = pydantic_v1.Field(alias="additionalFiles") - basic_test_case_template: BasicTestCaseTemplate = pydantic_v1.Field(alias="basicTestCaseTemplate") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/v_2/problem/types/function_signature.py b/seed/python-sdk/trace/src/seed/v_2/problem/types/function_signature.py index 20759eba308..8c74dcc76a1 100644 --- a/seed/python-sdk/trace/src/seed/v_2/problem/types/function_signature.py +++ b/seed/python-sdk/trace/src/seed/v_2/problem/types/function_signature.py @@ -4,24 +4,23 @@ import typing -from ....commons.types.variable_type import VariableType -from ....core.pydantic_utilities import pydantic_v1 -from .parameter import Parameter +from .non_void_function_signature import NonVoidFunctionSignature +from .void_function_signature import VoidFunctionSignature +from .void_function_signature_that_takes_actual_result import VoidFunctionSignatureThatTakesActualResult -class FunctionSignature_Void(pydantic_v1.BaseModel): +class FunctionSignature_Void(VoidFunctionSignature): type: typing.Literal["void"] = "void" - parameters: typing.List[Parameter] class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class FunctionSignature_NonVoid(pydantic_v1.BaseModel): +class FunctionSignature_NonVoid(NonVoidFunctionSignature): type: typing.Literal["nonVoid"] = "nonVoid" - parameters: typing.List[Parameter] - return_type: VariableType = pydantic_v1.Field(alias="returnType") class Config: frozen = True @@ -30,10 +29,8 @@ class Config: populate_by_name = True -class FunctionSignature_VoidThatTakesActualResult(pydantic_v1.BaseModel): +class FunctionSignature_VoidThatTakesActualResult(VoidFunctionSignatureThatTakesActualResult): type: typing.Literal["voidThatTakesActualResult"] = "voidThatTakesActualResult" - parameters: typing.List[Parameter] - actual_result_type: VariableType = pydantic_v1.Field(alias="actualResultType") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/v_2/problem/types/test_case_function.py b/seed/python-sdk/trace/src/seed/v_2/problem/types/test_case_function.py index 75e2a98e9a8..f40bbe8ed89 100644 --- a/seed/python-sdk/trace/src/seed/v_2/problem/types/test_case_function.py +++ b/seed/python-sdk/trace/src/seed/v_2/problem/types/test_case_function.py @@ -4,17 +4,12 @@ import typing -from ....core.pydantic_utilities import pydantic_v1 -from .assert_correctness_check import AssertCorrectnessCheck -from .function_implementation_for_multiple_languages import FunctionImplementationForMultipleLanguages -from .non_void_function_definition import NonVoidFunctionDefinition -from .parameter import Parameter +from .test_case_with_actual_result_implementation import TestCaseWithActualResultImplementation +from .void_function_definition import VoidFunctionDefinition -class TestCaseFunction_WithActualResult(pydantic_v1.BaseModel): +class TestCaseFunction_WithActualResult(TestCaseWithActualResultImplementation): type: typing.Literal["withActualResult"] = "withActualResult" - get_actual_result: NonVoidFunctionDefinition = pydantic_v1.Field(alias="getActualResult") - assert_correctness_check: AssertCorrectnessCheck = pydantic_v1.Field(alias="assertCorrectnessCheck") class Config: frozen = True @@ -23,14 +18,14 @@ class Config: populate_by_name = True -class TestCaseFunction_Custom(pydantic_v1.BaseModel): +class TestCaseFunction_Custom(VoidFunctionDefinition): type: typing.Literal["custom"] = "custom" - parameters: typing.List[Parameter] - code: FunctionImplementationForMultipleLanguages class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True TestCaseFunction = typing.Union[TestCaseFunction_WithActualResult, TestCaseFunction_Custom] diff --git a/seed/python-sdk/trace/src/seed/v_2/problem/types/test_case_implementation_reference.py b/seed/python-sdk/trace/src/seed/v_2/problem/types/test_case_implementation_reference.py index 35bf76c80b6..a55a8cd0def 100644 --- a/seed/python-sdk/trace/src/seed/v_2/problem/types/test_case_implementation_reference.py +++ b/seed/python-sdk/trace/src/seed/v_2/problem/types/test_case_implementation_reference.py @@ -5,8 +5,7 @@ import typing from ....core.pydantic_utilities import pydantic_v1 -from .test_case_function import TestCaseFunction -from .test_case_implementation_description import TestCaseImplementationDescription +from .test_case_implementation import TestCaseImplementation from .test_case_template_id import TestCaseTemplateId @@ -19,14 +18,14 @@ class Config: smart_union = True -class TestCaseImplementationReference_Implementation(pydantic_v1.BaseModel): +class TestCaseImplementationReference_Implementation(TestCaseImplementation): type: typing.Literal["implementation"] = "implementation" - description: TestCaseImplementationDescription - function: TestCaseFunction class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True TestCaseImplementationReference = typing.Union[ diff --git a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/assert_correctness_check.py b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/assert_correctness_check.py index defdad5d825..9ebdb63477b 100644 --- a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/assert_correctness_check.py +++ b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/assert_correctness_check.py @@ -4,15 +4,12 @@ import typing -from .....core.pydantic_utilities import pydantic_v1 -from .function_implementation_for_multiple_languages import FunctionImplementationForMultipleLanguages -from .parameter import Parameter -from .parameter_id import ParameterId +from .deep_equality_correctness_check import DeepEqualityCorrectnessCheck +from .void_function_definition_that_takes_actual_result import VoidFunctionDefinitionThatTakesActualResult -class AssertCorrectnessCheck_DeepEquality(pydantic_v1.BaseModel): +class AssertCorrectnessCheck_DeepEquality(DeepEqualityCorrectnessCheck): type: typing.Literal["deepEquality"] = "deepEquality" - expected_value_parameter_id: ParameterId = pydantic_v1.Field(alias="expectedValueParameterId") class Config: frozen = True @@ -21,10 +18,8 @@ class Config: populate_by_name = True -class AssertCorrectnessCheck_Custom(pydantic_v1.BaseModel): +class AssertCorrectnessCheck_Custom(VoidFunctionDefinitionThatTakesActualResult): type: typing.Literal["custom"] = "custom" - additional_parameters: typing.List[Parameter] = pydantic_v1.Field(alias="additionalParameters") - code: FunctionImplementationForMultipleLanguages class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/custom_files.py b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/custom_files.py index 5bd714fea5f..d62e76d8d11 100644 --- a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/custom_files.py +++ b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/custom_files.py @@ -6,18 +6,13 @@ from .....commons.types.language import Language from .....core.pydantic_utilities import pydantic_v1 -from .basic_test_case_template import BasicTestCaseTemplate +from .basic_custom_files import BasicCustomFiles from .file_info_v_2 import FileInfoV2 from .files import Files -from .non_void_function_signature import NonVoidFunctionSignature -class CustomFiles_Basic(pydantic_v1.BaseModel): +class CustomFiles_Basic(BasicCustomFiles): type: typing.Literal["basic"] = "basic" - method_name: str = pydantic_v1.Field(alias="methodName") - signature: NonVoidFunctionSignature - additional_files: typing.Dict[Language, Files] = pydantic_v1.Field(alias="additionalFiles") - basic_test_case_template: BasicTestCaseTemplate = pydantic_v1.Field(alias="basicTestCaseTemplate") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/function_signature.py b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/function_signature.py index a938a541fa0..8c74dcc76a1 100644 --- a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/function_signature.py +++ b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/function_signature.py @@ -4,24 +4,23 @@ import typing -from .....commons.types.variable_type import VariableType -from .....core.pydantic_utilities import pydantic_v1 -from .parameter import Parameter +from .non_void_function_signature import NonVoidFunctionSignature +from .void_function_signature import VoidFunctionSignature +from .void_function_signature_that_takes_actual_result import VoidFunctionSignatureThatTakesActualResult -class FunctionSignature_Void(pydantic_v1.BaseModel): +class FunctionSignature_Void(VoidFunctionSignature): type: typing.Literal["void"] = "void" - parameters: typing.List[Parameter] class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class FunctionSignature_NonVoid(pydantic_v1.BaseModel): +class FunctionSignature_NonVoid(NonVoidFunctionSignature): type: typing.Literal["nonVoid"] = "nonVoid" - parameters: typing.List[Parameter] - return_type: VariableType = pydantic_v1.Field(alias="returnType") class Config: frozen = True @@ -30,10 +29,8 @@ class Config: populate_by_name = True -class FunctionSignature_VoidThatTakesActualResult(pydantic_v1.BaseModel): +class FunctionSignature_VoidThatTakesActualResult(VoidFunctionSignatureThatTakesActualResult): type: typing.Literal["voidThatTakesActualResult"] = "voidThatTakesActualResult" - parameters: typing.List[Parameter] - actual_result_type: VariableType = pydantic_v1.Field(alias="actualResultType") class Config: frozen = True diff --git a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/test_case_function.py b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/test_case_function.py index ed468560674..f40bbe8ed89 100644 --- a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/test_case_function.py +++ b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/test_case_function.py @@ -4,17 +4,12 @@ import typing -from .....core.pydantic_utilities import pydantic_v1 -from .assert_correctness_check import AssertCorrectnessCheck -from .function_implementation_for_multiple_languages import FunctionImplementationForMultipleLanguages -from .non_void_function_definition import NonVoidFunctionDefinition -from .parameter import Parameter +from .test_case_with_actual_result_implementation import TestCaseWithActualResultImplementation +from .void_function_definition import VoidFunctionDefinition -class TestCaseFunction_WithActualResult(pydantic_v1.BaseModel): +class TestCaseFunction_WithActualResult(TestCaseWithActualResultImplementation): type: typing.Literal["withActualResult"] = "withActualResult" - get_actual_result: NonVoidFunctionDefinition = pydantic_v1.Field(alias="getActualResult") - assert_correctness_check: AssertCorrectnessCheck = pydantic_v1.Field(alias="assertCorrectnessCheck") class Config: frozen = True @@ -23,14 +18,14 @@ class Config: populate_by_name = True -class TestCaseFunction_Custom(pydantic_v1.BaseModel): +class TestCaseFunction_Custom(VoidFunctionDefinition): type: typing.Literal["custom"] = "custom" - parameters: typing.List[Parameter] - code: FunctionImplementationForMultipleLanguages class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True TestCaseFunction = typing.Union[TestCaseFunction_WithActualResult, TestCaseFunction_Custom] diff --git a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/test_case_implementation_reference.py b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/test_case_implementation_reference.py index 842fe3ecff7..9aa5ffd3a9c 100644 --- a/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/test_case_implementation_reference.py +++ b/seed/python-sdk/trace/src/seed/v_2/v_3/problem/types/test_case_implementation_reference.py @@ -5,8 +5,7 @@ import typing from .....core.pydantic_utilities import pydantic_v1 -from .test_case_function import TestCaseFunction -from .test_case_implementation_description import TestCaseImplementationDescription +from .test_case_implementation import TestCaseImplementation from .test_case_template_id import TestCaseTemplateId @@ -19,14 +18,14 @@ class Config: smart_union = True -class TestCaseImplementationReference_Implementation(pydantic_v1.BaseModel): +class TestCaseImplementationReference_Implementation(TestCaseImplementation): type: typing.Literal["implementation"] = "implementation" - description: TestCaseImplementationDescription - function: TestCaseFunction class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True TestCaseImplementationReference = typing.Union[ diff --git a/seed/python-sdk/unions/src/seed/types/types/union_with_base_properties.py b/seed/python-sdk/unions/src/seed/types/types/union_with_base_properties.py index 535cfe306ed..6fb71a11741 100644 --- a/seed/python-sdk/unions/src/seed/types/types/union_with_base_properties.py +++ b/seed/python-sdk/unions/src/seed/types/types/union_with_base_properties.py @@ -7,6 +7,7 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import pydantic_v1 +from .foo import Foo class Base(pydantic_v1.BaseModel): @@ -49,9 +50,8 @@ class Config: populate_by_name = True -class UnionWithBaseProperties_Foo(Base): +class UnionWithBaseProperties_Foo(Foo, Base): type: typing.Literal["foo"] = "foo" - name: str class Config: frozen = True diff --git a/seed/python-sdk/unions/src/seed/types/types/union_with_unknown.py b/seed/python-sdk/unions/src/seed/types/types/union_with_unknown.py index be2bb5bf5d1..74bf23c52b9 100644 --- a/seed/python-sdk/unions/src/seed/types/types/union_with_unknown.py +++ b/seed/python-sdk/unions/src/seed/types/types/union_with_unknown.py @@ -5,15 +5,17 @@ import typing from ...core.pydantic_utilities import pydantic_v1 +from .foo import Foo -class UnionWithUnknown_Foo(pydantic_v1.BaseModel): +class UnionWithUnknown_Foo(Foo): type: typing.Literal["foo"] = "foo" - name: str class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True class UnionWithUnknown_Unknown(pydantic_v1.BaseModel): diff --git a/seed/python-sdk/unions/src/seed/types/types/union_without_key.py b/seed/python-sdk/unions/src/seed/types/types/union_without_key.py index f05cdc228ea..45618181d31 100644 --- a/seed/python-sdk/unions/src/seed/types/types/union_without_key.py +++ b/seed/python-sdk/unions/src/seed/types/types/union_without_key.py @@ -4,25 +4,28 @@ import typing -from ...core.pydantic_utilities import pydantic_v1 +from .bar import Bar +from .foo import Foo -class UnionWithoutKey_Foo(pydantic_v1.BaseModel): +class UnionWithoutKey_Foo(Foo): type: typing.Literal["foo"] = "foo" - name: str class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True -class UnionWithoutKey_Bar(pydantic_v1.BaseModel): +class UnionWithoutKey_Bar(Bar): type: typing.Literal["bar"] = "bar" - name: str class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True UnionWithoutKey = typing.Union[UnionWithoutKey_Foo, UnionWithoutKey_Bar] diff --git a/seed/python-sdk/unions/src/seed/union/types/shape.py b/seed/python-sdk/unions/src/seed/union/types/shape.py index 3e94e6b8c33..68fadcb0d36 100644 --- a/seed/python-sdk/unions/src/seed/union/types/shape.py +++ b/seed/python-sdk/unions/src/seed/union/types/shape.py @@ -7,6 +7,8 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import pydantic_v1 +from .circle import Circle +from .square import Square class Base(pydantic_v1.BaseModel): @@ -27,9 +29,8 @@ class Config: json_encoders = {dt.datetime: serialize_datetime} -class Shape_Circle(Base): +class Shape_Circle(Circle, Base): type: typing.Literal["circle"] = "circle" - radius: float class Config: frozen = True @@ -38,9 +39,8 @@ class Config: populate_by_name = True -class Shape_Square(Base): +class Shape_Square(Square, Base): type: typing.Literal["square"] = "square" - length: float class Config: frozen = True diff --git a/seed/python-sdk/websocket/.inputs/config.json b/seed/python-sdk/websocket/.inputs/config.json index 8dc1603681d..bdccb1deaae 100644 --- a/seed/python-sdk/websocket/.inputs/config.json +++ b/seed/python-sdk/websocket/.inputs/config.json @@ -1,24 +1,27 @@ { - "irFilepath": "./ir.json", + "irFilepath": "/fern/ir.json", "output": { "mode": { + "type": "github", "repoUrl": "https://github.com/websocket/fern", "version": "0.0.1", "publishInfo": { + "type": "pypi", "registryUrl": "", "packageName": "fern_websocket", "usernameEnvironmentVariable": "", - "passwordEnvironmentVariable": "", - "type": "pypi" - }, - "type": "github" + "passwordEnvironmentVariable": "" + } }, - "path": "../" + "path": "/fern/output", + "publishingMetadata": null, + "snippetFilepath": "/fern/snippet.json" }, + "publish": null, "workspaceName": "websocket", "organization": "seed", "environment": { - "type": "local" + "_type": "local" }, "dryRun": false, "whitelabel": false,