| 
									
										
										
										
											2023-05-04 00:58:06 -07:00
										 |  |  | from typing import Any, Dict, List, Type, TypeVar, Union | 
					
						
							| 
									
										
										
										
											2022-04-27 12:14:58 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | import attr | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-11 17:26:20 -07:00
										 |  |  | from ..models.cache_metadata import CacheMetadata | 
					
						
							| 
									
										
										
										
											2023-05-04 00:58:06 -07:00
										 |  |  | from ..models.connection import Connection | 
					
						
							| 
									
										
										
										
											2022-06-11 17:26:20 -07:00
										 |  |  | from ..models.environment import Environment | 
					
						
							| 
									
										
										
										
											2022-04-27 12:14:58 -07:00
										 |  |  | from ..models.file_system_metadata import FileSystemMetadata | 
					
						
							|  |  |  | from ..types import UNSET, Unset | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-28 14:29:16 -08:00
										 |  |  | IT = TypeVar("IT", bound="Metadata") | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-27 12:14:58 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | @attr.s(auto_attribs=True) | 
					
						
							|  |  |  | class Metadata: | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  |     """Metadata about our currently running server.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     This is mostly used for internal purposes and debugging."""  # noqa: E501
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     cache: Union[Unset, CacheMetadata] = UNSET | 
					
						
							|  |  |  |     environment: Union[Unset, Environment] = UNSET | 
					
						
							|  |  |  |     fs: Union[Unset, FileSystemMetadata] = UNSET | 
					
						
							|  |  |  |     git_hash: Union[Unset, str] = UNSET | 
					
						
							|  |  |  |     pubsub: Union[Unset, Connection] = UNSET | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def to_dict(self) -> Dict[str, Any]: | 
					
						
							|  |  |  |         if not isinstance(self.cache, Unset): | 
					
						
							|  |  |  |             cache = self.cache | 
					
						
							|  |  |  |         if not isinstance(self.environment, Unset): | 
					
						
							|  |  |  |             environment = self.environment | 
					
						
							|  |  |  |         if not isinstance(self.fs, Unset): | 
					
						
							|  |  |  |             fs = self.fs | 
					
						
							|  |  |  |         git_hash = self.git_hash | 
					
						
							|  |  |  |         if not isinstance(self.pubsub, Unset): | 
					
						
							|  |  |  |             pubsub = self.pubsub | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         field_dict: Dict[str, Any] = {} | 
					
						
							|  |  |  |         field_dict.update(self.additional_properties) | 
					
						
							|  |  |  |         field_dict.update({}) | 
					
						
							|  |  |  |         if cache is not UNSET: | 
					
						
							| 
									
										
										
										
											2023-11-28 13:13:13 -08:00
										 |  |  |             field_dict["cache"] = cache.to_dict() | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  |         if environment is not UNSET: | 
					
						
							|  |  |  |             field_dict["environment"] = environment | 
					
						
							|  |  |  |         if fs is not UNSET: | 
					
						
							| 
									
										
										
										
											2023-11-28 13:13:13 -08:00
										 |  |  |             field_dict["fs"] = fs.to_dict() | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  |         if git_hash is not UNSET: | 
					
						
							|  |  |  |             field_dict["git_hash"] = git_hash | 
					
						
							|  |  |  |         if pubsub is not UNSET: | 
					
						
							| 
									
										
										
										
											2023-11-28 13:13:13 -08:00
										 |  |  |             field_dict["pubsub"] = pubsub.to_dict() | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return field_dict | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @classmethod | 
					
						
							| 
									
										
										
										
											2023-11-28 14:29:16 -08:00
										 |  |  |     def from_dict(cls: Type[IT], src_dict: Dict[str, Any]) -> IT: | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  |         d = src_dict.copy() | 
					
						
							|  |  |  |         _cache = d.pop("cache", UNSET) | 
					
						
							|  |  |  |         cache: Union[Unset, CacheMetadata] | 
					
						
							|  |  |  |         if isinstance(_cache, Unset): | 
					
						
							|  |  |  |             cache = UNSET | 
					
						
							| 
									
										
										
										
											2023-11-28 15:17:44 -08:00
										 |  |  |         if _cache is None: | 
					
						
							|  |  |  |             cache = UNSET | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2023-11-28 15:17:44 -08:00
										 |  |  |             cache = CacheMetadata.from_dict(_cache) | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         _environment = d.pop("environment", UNSET) | 
					
						
							|  |  |  |         environment: Union[Unset, Environment] | 
					
						
							|  |  |  |         if isinstance(_environment, Unset): | 
					
						
							|  |  |  |             environment = UNSET | 
					
						
							| 
									
										
										
										
											2023-11-28 15:17:44 -08:00
										 |  |  |         if _environment is None: | 
					
						
							|  |  |  |             environment = UNSET | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2023-11-28 15:17:44 -08:00
										 |  |  |             environment = _environment | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         _fs = d.pop("fs", UNSET) | 
					
						
							|  |  |  |         fs: Union[Unset, FileSystemMetadata] | 
					
						
							|  |  |  |         if isinstance(_fs, Unset): | 
					
						
							|  |  |  |             fs = UNSET | 
					
						
							| 
									
										
										
										
											2023-11-28 15:17:44 -08:00
										 |  |  |         if _fs is None: | 
					
						
							|  |  |  |             fs = UNSET | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2023-11-28 15:17:44 -08:00
										 |  |  |             fs = FileSystemMetadata.from_dict(_fs) | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         git_hash = d.pop("git_hash", UNSET) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         _pubsub = d.pop("pubsub", UNSET) | 
					
						
							|  |  |  |         pubsub: Union[Unset, Connection] | 
					
						
							|  |  |  |         if isinstance(_pubsub, Unset): | 
					
						
							|  |  |  |             pubsub = UNSET | 
					
						
							| 
									
										
										
										
											2023-11-28 15:17:44 -08:00
										 |  |  |         if _pubsub is None: | 
					
						
							|  |  |  |             pubsub = UNSET | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2023-11-28 15:17:44 -08:00
										 |  |  |             pubsub = Connection.from_dict(_pubsub) | 
					
						
							| 
									
										
										
										
											2023-11-27 16:01:20 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         metadata = cls( | 
					
						
							|  |  |  |             cache=cache, | 
					
						
							|  |  |  |             environment=environment, | 
					
						
							|  |  |  |             fs=fs, | 
					
						
							|  |  |  |             git_hash=git_hash, | 
					
						
							|  |  |  |             pubsub=pubsub, | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         metadata.additional_properties = d | 
					
						
							|  |  |  |         return metadata | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @property | 
					
						
							|  |  |  |     def additional_keys(self) -> List[str]: | 
					
						
							|  |  |  |         return list(self.additional_properties.keys()) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def __getitem__(self, key: str) -> Any: | 
					
						
							|  |  |  |         return self.additional_properties[key] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def __setitem__(self, key: str, value: Any) -> None: | 
					
						
							|  |  |  |         self.additional_properties[key] = value | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def __delitem__(self, key: str) -> None: | 
					
						
							|  |  |  |         del self.additional_properties[key] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def __contains__(self, key: str) -> bool: | 
					
						
							|  |  |  |         return key in self.additional_properties |