@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
@ -26,13 +26,17 @@ class Metadata:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
cache: Union[Unset, CacheMetadata] = UNSET
|
||||
if not isinstance(self.cache, Unset):
|
||||
cache = self.cache
|
||||
environment: Union[Unset, Environment] = UNSET
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment
|
||||
fs: Union[Unset, FileSystemMetadata] = UNSET
|
||||
if not isinstance(self.fs, Unset):
|
||||
fs = self.fs
|
||||
git_hash = self.git_hash
|
||||
pubsub: Union[Unset, Connection] = UNSET
|
||||
if not isinstance(self.pubsub, Unset):
|
||||
pubsub = self.pubsub
|
||||
|
||||
@ -40,15 +44,18 @@ class Metadata:
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if cache is not UNSET:
|
||||
field_dict["cache"] = cache.to_dict()
|
||||
_cache: CacheMetadata = cast(CacheMetadata, cache)
|
||||
field_dict["cache"] = _cache.to_dict()
|
||||
if environment is not UNSET:
|
||||
field_dict["environment"] = environment
|
||||
if fs is not UNSET:
|
||||
field_dict["fs"] = fs.to_dict()
|
||||
_fs: FileSystemMetadata = cast(FileSystemMetadata, fs)
|
||||
field_dict["fs"] = _fs.to_dict()
|
||||
if git_hash is not UNSET:
|
||||
field_dict["git_hash"] = git_hash
|
||||
if pubsub is not UNSET:
|
||||
field_dict["pubsub"] = pubsub.to_dict()
|
||||
_pubsub: Connection = cast(Connection, pubsub)
|
||||
field_dict["pubsub"] = _pubsub.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
|
Reference in New Issue
Block a user