Skip to content

Commit

Permalink
chore: generate
Browse files Browse the repository at this point in the history
  • Loading branch information
grutt committed Jul 18, 2024
1 parent 41c89c9 commit d29a713
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions hatchet_sdk/clients/rest/models/worker_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,28 @@


from __future__ import annotations

import json
import pprint
import re # noqa: F401
import json
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta
from typing import Optional, Set
from typing_extensions import Self

from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta


class WorkerLabel(BaseModel):
"""
WorkerLabel
""" # noqa: E501
""" # noqa: E501

metadata: APIResourceMeta
key: StrictStr = Field(description="The key of the label.")
value: Optional[StrictStr] = Field(default=None, description="The value of the label.")
value: Optional[StrictStr] = Field(
default=None, description="The value of the label."
)
__properties: ClassVar[List[str]] = ["metadata", "key", "value"]

model_config = ConfigDict(
Expand All @@ -38,7 +43,6 @@ class WorkerLabel(BaseModel):
protected_namespaces=(),
)


def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
Expand All @@ -63,8 +67,7 @@ def to_dict(self) -> Dict[str, Any]:
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])

_dict = self.model_dump(
by_alias=True,
Expand All @@ -73,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]:
)
# override the default output from pydantic by calling `to_dict()` of metadata
if self.metadata:
_dict['metadata'] = self.metadata.to_dict()
_dict["metadata"] = self.metadata.to_dict()
return _dict

@classmethod
Expand All @@ -85,11 +88,15 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({
"metadata": APIResourceMeta.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None,
"key": obj.get("key"),
"value": obj.get("value")
})
_obj = cls.model_validate(
{
"metadata": (
APIResourceMeta.from_dict(obj["metadata"])
if obj.get("metadata") is not None
else None
),
"key": obj.get("key"),
"value": obj.get("value"),
}
)
return _obj


0 comments on commit d29a713

Please sign in to comment.