From e29ad3a2c43ce86510c5d8528c0e00d1a2b3090e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 19:26:11 +0000 Subject: [PATCH] 05a67e5ad4cacba01036a19db36b541ce52f8c46 --- .openapi-generator/FILES | 7 - .openapi-generator/VERSION | 2 +- README.md | 5 +- docs/AnnotationRequest.md | 3 +- docs/AnnotationReturn.md | 3 +- neurostore_sdk/__init__.py | 3 - neurostore_sdk/models/__init__.py | 3 - neurostore_sdk/models/annotation_request.py | 173 +++++++--------- neurostore_sdk/models/annotation_return.py | 216 +++++++++++--------- 9 files changed, 190 insertions(+), 225 deletions(-) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 141f5e1..f892bdd 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -22,12 +22,9 @@ docs/AnnotationCommon.md docs/AnnotationExport.md docs/AnnotationList.md docs/AnnotationRequest.md -docs/AnnotationRequestOneOf.md docs/AnnotationRequestRelationships.md docs/AnnotationRequestRelationshipsNotes.md docs/AnnotationReturn.md -docs/AnnotationReturnOneOf.md -docs/AnnotationReturnOneOf1.md docs/AnnotationReturnRelationships.md docs/AnnotationReturnRelationshipsNotes.md docs/AnnotationsApi.md @@ -129,12 +126,9 @@ neurostore_sdk/models/annotation_common.py neurostore_sdk/models/annotation_export.py neurostore_sdk/models/annotation_list.py neurostore_sdk/models/annotation_request.py -neurostore_sdk/models/annotation_request_one_of.py neurostore_sdk/models/annotation_request_relationships.py neurostore_sdk/models/annotation_request_relationships_notes.py neurostore_sdk/models/annotation_return.py -neurostore_sdk/models/annotation_return_one_of.py -neurostore_sdk/models/annotation_return_one_of1.py neurostore_sdk/models/annotation_return_relationships.py neurostore_sdk/models/annotation_return_relationships_notes.py neurostore_sdk/models/clone.py @@ -200,5 +194,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_point_relationships_values.py tox.ini diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index cd802a1..757e674 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -6.6.0 \ No newline at end of file +7.0.0-SNAPSHOT \ No newline at end of file diff --git a/README.md b/README.md index a716a6f..7553321 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 1.0 - Package version: 0.0.1 -- Build package: org.openapitools.codegen.languages.PythonNextgenClientCodegen +- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://github.com/jdkent](https://github.com/jdkent) ## Requirements. @@ -188,12 +188,9 @@ Class | Method | HTTP request | Description - [AnnotationExport](docs/AnnotationExport.md) - [AnnotationList](docs/AnnotationList.md) - [AnnotationRequest](docs/AnnotationRequest.md) - - [AnnotationRequestOneOf](docs/AnnotationRequestOneOf.md) - [AnnotationRequestRelationships](docs/AnnotationRequestRelationships.md) - [AnnotationRequestRelationshipsNotes](docs/AnnotationRequestRelationshipsNotes.md) - [AnnotationReturn](docs/AnnotationReturn.md) - - [AnnotationReturnOneOf](docs/AnnotationReturnOneOf.md) - - [AnnotationReturnOneOf1](docs/AnnotationReturnOneOf1.md) - [AnnotationReturnRelationships](docs/AnnotationReturnRelationships.md) - [AnnotationReturnRelationshipsNotes](docs/AnnotationReturnRelationshipsNotes.md) - [Clone](docs/Clone.md) diff --git a/docs/AnnotationRequest.md b/docs/AnnotationRequest.md index 6e9b24c..9649789 100644 --- a/docs/AnnotationRequest.md +++ b/docs/AnnotationRequest.md @@ -4,10 +4,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**metadata** | **object** | object describing metadata about the annotation, such as software used or descriptions of the keys used in the annotation. | [optional] -**annotation_csv** | **str** | annotation object expressed as a CSV | **name** | **str** | Descriptive name for the annotation. | [optional] **description** | **str** | Long form description of the annotation. | [optional] +**metadata** | **object** | object describing metadata about the annotation, such as software used or descriptions of the keys used in the annotation. | [optional] **note_keys** | **object** | The keys (columns) in the annotation and the key's respective data type (such as an integer or string). | [optional] **notes** | [**AnnotationRequestRelationshipsNotes**](AnnotationRequestRelationshipsNotes.md) | | [optional] **id** | **str** | short UUID specifying the location of this resource | [optional] diff --git a/docs/AnnotationReturn.md b/docs/AnnotationReturn.md index 96564f7..9ff4713 100644 --- a/docs/AnnotationReturn.md +++ b/docs/AnnotationReturn.md @@ -4,10 +4,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**metadata** | **object** | object describing metadata about the annotation, such as software used or descriptions of the keys used in the annotation. | [optional] -**annotation_csv** | **str** | annotation object expressed as a CSV | **name** | **str** | Descriptive name for the annotation. | [optional] **description** | **str** | Long form description of the annotation. | [optional] +**metadata** | **object** | object describing metadata about the annotation, such as software used or descriptions of the keys used in the annotation. | [optional] **note_keys** | **object** | The keys (columns) in the annotation and the key's respective data type (such as an integer or string). | [optional] **created_at** | **datetime** | time the resource was created on the database | [optional] [readonly] **updated_at** | **str** | when was the resource last modified/updated. | [optional] [readonly] diff --git a/neurostore_sdk/__init__.py b/neurostore_sdk/__init__.py index 9d90193..2841711 100644 --- a/neurostore_sdk/__init__.py +++ b/neurostore_sdk/__init__.py @@ -58,12 +58,9 @@ from neurostore_sdk.models.annotation_export import AnnotationExport from neurostore_sdk.models.annotation_list import AnnotationList from neurostore_sdk.models.annotation_request import AnnotationRequest -from neurostore_sdk.models.annotation_request_one_of import AnnotationRequestOneOf from neurostore_sdk.models.annotation_request_relationships import AnnotationRequestRelationships from neurostore_sdk.models.annotation_request_relationships_notes import AnnotationRequestRelationshipsNotes from neurostore_sdk.models.annotation_return import AnnotationReturn -from neurostore_sdk.models.annotation_return_one_of import AnnotationReturnOneOf -from neurostore_sdk.models.annotation_return_one_of1 import AnnotationReturnOneOf1 from neurostore_sdk.models.annotation_return_relationships import AnnotationReturnRelationships from neurostore_sdk.models.annotation_return_relationships_notes import AnnotationReturnRelationshipsNotes from neurostore_sdk.models.clone import Clone diff --git a/neurostore_sdk/models/__init__.py b/neurostore_sdk/models/__init__.py index 82c0946..bfdfd23 100644 --- a/neurostore_sdk/models/__init__.py +++ b/neurostore_sdk/models/__init__.py @@ -33,12 +33,9 @@ from neurostore_sdk.models.annotation_export import AnnotationExport from neurostore_sdk.models.annotation_list import AnnotationList from neurostore_sdk.models.annotation_request import AnnotationRequest -from neurostore_sdk.models.annotation_request_one_of import AnnotationRequestOneOf from neurostore_sdk.models.annotation_request_relationships import AnnotationRequestRelationships from neurostore_sdk.models.annotation_request_relationships_notes import AnnotationRequestRelationshipsNotes from neurostore_sdk.models.annotation_return import AnnotationReturn -from neurostore_sdk.models.annotation_return_one_of import AnnotationReturnOneOf -from neurostore_sdk.models.annotation_return_one_of1 import AnnotationReturnOneOf1 from neurostore_sdk.models.annotation_return_relationships import AnnotationReturnRelationships from neurostore_sdk.models.annotation_return_relationships_notes import AnnotationReturnRelationshipsNotes from neurostore_sdk.models.clone import Clone diff --git a/neurostore_sdk/models/annotation_request.py b/neurostore_sdk/models/annotation_request.py index 4b9d1d5..1f1fadc 100644 --- a/neurostore_sdk/models/annotation_request.py +++ b/neurostore_sdk/models/annotation_request.py @@ -14,125 +14,96 @@ from __future__ import annotations -from inspect import getfullargspec -import json import pprint import re # noqa: F401 +import json -from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator -from neurostore_sdk.models.annotation_request_one_of import AnnotationRequestOneOf -from neurostore_sdk.models.annotation_return_one_of import AnnotationReturnOneOf -from typing import Any, List -from pydantic import StrictStr, Field -ANNOTATIONREQUEST_ONE_OF_SCHEMAS = ["AnnotationRequestOneOf", "AnnotationReturnOneOf"] +from typing import Any, Dict, Optional +from pydantic import BaseModel, Field, StrictBool, StrictStr, constr +from neurostore_sdk.models.annotation_request_relationships_notes import AnnotationRequestRelationshipsNotes class AnnotationRequest(BaseModel): """ AnnotationRequest """ - # data type: AnnotationReturnOneOf - oneof_schema_1_validator: Optional[AnnotationReturnOneOf] = None - # data type: AnnotationRequestOneOf - oneof_schema_2_validator: Optional[AnnotationRequestOneOf] = None - actual_instance: Any - one_of_schemas: List[str] = Field(ANNOTATIONREQUEST_ONE_OF_SCHEMAS, const=True) + name: Optional[StrictStr] = Field(None, description="Descriptive name for the annotation.") + description: Optional[StrictStr] = Field(None, description="Long form description of the annotation.") + metadata: Optional[Dict[str, Any]] = Field(None, description="object describing metadata about the annotation, such as software used or descriptions of the keys used in the annotation.") + note_keys: Optional[Dict[str, Any]] = Field(None, description="The keys (columns) in the annotation and the key's respective data type (such as an integer or string).") + notes: Optional[AnnotationRequestRelationshipsNotes] = None + id: Optional[constr(strict=True, max_length=12, min_length=12)] = Field(None, description="short UUID specifying the location of this resource") + public: Optional[StrictBool] = Field(True, description="whether the resource is listed in public searches or not") + studyset: Optional[StrictStr] = None + __properties = ["name", "description", "metadata", "note_keys", "notes", "id", "public", "studyset"] class Config: + """Pydantic configuration""" + allow_population_by_field_name = True validate_assignment = True - def __init__(self, *args, **kwargs): - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator('actual_instance') - def actual_instance_must_validate_oneof(cls, v): - instance = AnnotationRequest.construct() - error_messages = [] - match = 0 - # validate data type: AnnotationReturnOneOf - if not isinstance(v, AnnotationReturnOneOf): - error_messages.append(f"Error! Input type `{type(v)}` is not `AnnotationReturnOneOf`") - else: - match += 1 - # validate data type: AnnotationRequestOneOf - if not isinstance(v, AnnotationRequestOneOf): - error_messages.append(f"Error! Input type `{type(v)}` is not `AnnotationRequestOneOf`") - else: - match += 1 - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in AnnotationRequest with oneOf schemas: AnnotationRequestOneOf, AnnotationReturnOneOf. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when setting `actual_instance` in AnnotationRequest with oneOf schemas: AnnotationRequestOneOf, AnnotationReturnOneOf. Details: " + ", ".join(error_messages)) - else: - return v + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) - @classmethod - def from_dict(cls, obj: dict) -> AnnotationRequest: - return cls.from_json(json.dumps(obj)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) @classmethod def from_json(cls, json_str: str) -> AnnotationRequest: - """Returns the object represented by the json string""" - instance = AnnotationRequest.construct() - error_messages = [] - match = 0 - - # deserialize data into AnnotationReturnOneOf - try: - instance.actual_instance = AnnotationReturnOneOf.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into AnnotationRequestOneOf - try: - instance.actual_instance = AnnotationRequestOneOf.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into AnnotationRequest with oneOf schemas: AnnotationRequestOneOf, AnnotationReturnOneOf. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when deserializing the JSON string into AnnotationRequest with oneOf schemas: AnnotationRequestOneOf, AnnotationReturnOneOf. Details: " + ", ".join(error_messages)) - else: - return instance + """Create an instance of AnnotationRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of notes + if self.notes: + _dict['notes'] = self.notes.to_dict() + # set to None if name (nullable) is None + # and __fields_set__ contains the field + if self.name is None and "name" in self.__fields_set__: + _dict['name'] = None + + # set to None if description (nullable) is None + # and __fields_set__ contains the field + if self.description is None and "description" in self.__fields_set__: + _dict['description'] = None + + # set to None if metadata (nullable) is None + # and __fields_set__ contains the field + if self.metadata is None and "metadata" in self.__fields_set__: + _dict['metadata'] = None + + # set to None if note_keys (nullable) is None + # and __fields_set__ contains the field + if self.note_keys is None and "note_keys" in self.__fields_set__: + _dict['note_keys'] = None + + return _dict - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: + @classmethod + def from_dict(cls, obj: dict) -> AnnotationRequest: + """Create an instance of AnnotationRequest from a dict""" + if obj is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + if not isinstance(obj, dict): + return AnnotationRequest.parse_obj(obj) + + _obj = AnnotationRequest.parse_obj({ + "name": obj.get("name"), + "description": obj.get("description"), + "metadata": obj.get("metadata"), + "note_keys": obj.get("note_keys"), + "notes": AnnotationRequestRelationshipsNotes.from_dict(obj.get("notes")) if obj.get("notes") is not None else None, + "id": obj.get("id"), + "public": obj.get("public") if obj.get("public") is not None else True, + "studyset": obj.get("studyset") + }) + return _obj diff --git a/neurostore_sdk/models/annotation_return.py b/neurostore_sdk/models/annotation_return.py index 2641201..b924eaf 100644 --- a/neurostore_sdk/models/annotation_return.py +++ b/neurostore_sdk/models/annotation_return.py @@ -14,125 +14,137 @@ from __future__ import annotations -from inspect import getfullargspec -import json import pprint import re # noqa: F401 +import json -from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator -from neurostore_sdk.models.annotation_return_one_of import AnnotationReturnOneOf -from neurostore_sdk.models.annotation_return_one_of1 import AnnotationReturnOneOf1 -from typing import Any, List -from pydantic import StrictStr, Field - -ANNOTATIONRETURN_ONE_OF_SCHEMAS = ["AnnotationReturnOneOf", "AnnotationReturnOneOf1"] +from datetime import datetime +from typing import Any, Dict, Optional +from pydantic import BaseModel, Field, StrictBool, StrictStr, constr +from neurostore_sdk.models.annotation_return_relationships_notes import AnnotationReturnRelationshipsNotes class AnnotationReturn(BaseModel): """ AnnotationReturn """ - # data type: AnnotationReturnOneOf - oneof_schema_1_validator: Optional[AnnotationReturnOneOf] = None - # data type: AnnotationReturnOneOf1 - oneof_schema_2_validator: Optional[AnnotationReturnOneOf1] = None - actual_instance: Any - one_of_schemas: List[str] = Field(ANNOTATIONRETURN_ONE_OF_SCHEMAS, const=True) + name: Optional[StrictStr] = Field(None, description="Descriptive name for the annotation.") + description: Optional[StrictStr] = Field(None, description="Long form description of the annotation.") + metadata: Optional[Dict[str, Any]] = Field(None, description="object describing metadata about the annotation, such as software used or descriptions of the keys used in the annotation.") + note_keys: Optional[Dict[str, Any]] = Field(None, description="The keys (columns) in the annotation and the key's respective data type (such as an integer or string).") + created_at: Optional[datetime] = Field(None, description="time the resource was created on the database") + updated_at: Optional[StrictStr] = Field(None, description="when was the resource last modified/updated.") + id: Optional[constr(strict=True, max_length=12, min_length=12)] = Field(None, description="short UUID specifying the location of this resource") + public: Optional[StrictBool] = Field(True, description="whether the resource is listed in public searches or not") + user: Optional[StrictStr] = Field(None, description="who owns the resource") + source: Optional[StrictStr] = None + source_id: Optional[StrictStr] = None + source_updated_at: Optional[StrictStr] = None + notes: Optional[AnnotationReturnRelationshipsNotes] = None + studyset: Optional[StrictStr] = None + __properties = ["name", "description", "metadata", "note_keys", "created_at", "updated_at", "id", "public", "user", "source", "source_id", "source_updated_at", "notes", "studyset"] class Config: + """Pydantic configuration""" + allow_population_by_field_name = True validate_assignment = True - def __init__(self, *args, **kwargs): - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator('actual_instance') - def actual_instance_must_validate_oneof(cls, v): - instance = AnnotationReturn.construct() - error_messages = [] - match = 0 - # validate data type: AnnotationReturnOneOf - if not isinstance(v, AnnotationReturnOneOf): - error_messages.append(f"Error! Input type `{type(v)}` is not `AnnotationReturnOneOf`") - else: - match += 1 - # validate data type: AnnotationReturnOneOf1 - if not isinstance(v, AnnotationReturnOneOf1): - error_messages.append(f"Error! Input type `{type(v)}` is not `AnnotationReturnOneOf1`") - else: - match += 1 - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in AnnotationReturn with oneOf schemas: AnnotationReturnOneOf, AnnotationReturnOneOf1. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when setting `actual_instance` in AnnotationReturn with oneOf schemas: AnnotationReturnOneOf, AnnotationReturnOneOf1. Details: " + ", ".join(error_messages)) - else: - return v + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) - @classmethod - def from_dict(cls, obj: dict) -> AnnotationReturn: - return cls.from_json(json.dumps(obj)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) @classmethod def from_json(cls, json_str: str) -> AnnotationReturn: - """Returns the object represented by the json string""" - instance = AnnotationReturn.construct() - error_messages = [] - match = 0 - - # deserialize data into AnnotationReturnOneOf - try: - instance.actual_instance = AnnotationReturnOneOf.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into AnnotationReturnOneOf1 - try: - instance.actual_instance = AnnotationReturnOneOf1.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into AnnotationReturn with oneOf schemas: AnnotationReturnOneOf, AnnotationReturnOneOf1. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when deserializing the JSON string into AnnotationReturn with oneOf schemas: AnnotationReturnOneOf, AnnotationReturnOneOf1. Details: " + ", ".join(error_messages)) - else: - return instance + """Create an instance of AnnotationReturn from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + "created_at", + "updated_at", + "user", + "source_updated_at", + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of notes + if self.notes: + _dict['notes'] = self.notes.to_dict() + # set to None if name (nullable) is None + # and __fields_set__ contains the field + if self.name is None and "name" in self.__fields_set__: + _dict['name'] = None + + # set to None if description (nullable) is None + # and __fields_set__ contains the field + if self.description is None and "description" in self.__fields_set__: + _dict['description'] = None + + # set to None if metadata (nullable) is None + # and __fields_set__ contains the field + if self.metadata is None and "metadata" in self.__fields_set__: + _dict['metadata'] = None + + # set to None if note_keys (nullable) is None + # and __fields_set__ contains the field + if self.note_keys is None and "note_keys" in self.__fields_set__: + _dict['note_keys'] = None + + # set to None if updated_at (nullable) is None + # and __fields_set__ contains the field + if self.updated_at is None and "updated_at" in self.__fields_set__: + _dict['updated_at'] = None + + # set to None if user (nullable) is None + # and __fields_set__ contains the field + if self.user is None and "user" in self.__fields_set__: + _dict['user'] = None + + # set to None if source (nullable) is None + # and __fields_set__ contains the field + if self.source is None and "source" in self.__fields_set__: + _dict['source'] = None + + # set to None if source_id (nullable) is None + # and __fields_set__ contains the field + if self.source_id is None and "source_id" in self.__fields_set__: + _dict['source_id'] = None + + # set to None if source_updated_at (nullable) is None + # and __fields_set__ contains the field + if self.source_updated_at is None and "source_updated_at" in self.__fields_set__: + _dict['source_updated_at'] = None + + return _dict - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: + @classmethod + def from_dict(cls, obj: dict) -> AnnotationReturn: + """Create an instance of AnnotationReturn from a dict""" + if obj is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + if not isinstance(obj, dict): + return AnnotationReturn.parse_obj(obj) + + _obj = AnnotationReturn.parse_obj({ + "name": obj.get("name"), + "description": obj.get("description"), + "metadata": obj.get("metadata"), + "note_keys": obj.get("note_keys"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "id": obj.get("id"), + "public": obj.get("public") if obj.get("public") is not None else True, + "user": obj.get("user"), + "source": obj.get("source"), + "source_id": obj.get("source_id"), + "source_updated_at": obj.get("source_updated_at"), + "notes": AnnotationReturnRelationshipsNotes.from_dict(obj.get("notes")) if obj.get("notes") is not None else None, + "studyset": obj.get("studyset") + }) + return _obj