mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 14:13:55 -06:00
Merge branch 'tests-for-um3networkplugin' into cloud-output-device
This commit is contained in:
commit
2d7588903c
1 changed files with 15 additions and 28 deletions
|
@ -4,53 +4,40 @@
|
||||||
|
|
||||||
## Base model that maps kwargs to instance attributes.
|
## Base model that maps kwargs to instance attributes.
|
||||||
class BaseModel:
|
class BaseModel:
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs) -> None:
|
||||||
self.__dict__.update(kwargs)
|
self.__dict__.update(kwargs)
|
||||||
self.validate()
|
self.validate()
|
||||||
|
|
||||||
def validate(self):
|
def validate(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
## Class representing a material that was fetched from the cluster API.
|
## Class representing a material that was fetched from the cluster API.
|
||||||
class ClusterMaterial(BaseModel):
|
class ClusterMaterial(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, guid = str, version = str, **kwargs) -> None:
|
||||||
self.guid = None # type: str
|
self.guid = guid # type: str
|
||||||
self.material = None # type: str
|
self.version = version # type: int
|
||||||
self.brand = None # type: str
|
|
||||||
self.version = None # type: int
|
|
||||||
self.color = None # type: str
|
|
||||||
self.density = None # type: str
|
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self) -> None:
|
||||||
if not self.guid:
|
if not self.guid:
|
||||||
raise ValueError("guid is required on ClusterMaterial")
|
raise ValueError("guid is required on ClusterMaterial")
|
||||||
|
if not self.version:
|
||||||
|
raise ValueError("version is required on ClusterMaterial")
|
||||||
|
|
||||||
|
|
||||||
## Class representing a local material that was fetched from the container registry.
|
## Class representing a local material that was fetched from the container registry.
|
||||||
class LocalMaterial(BaseModel):
|
class LocalMaterial(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, GUID = str, id = str, version = str, **kwargs) -> None:
|
||||||
self.GUID = None # type: str
|
self.GUID = GUID # type: str
|
||||||
self.id = None # type: str
|
self.id = id # type: str
|
||||||
self.type = None # type: str
|
self.version = version # type: int
|
||||||
self.status = None # type: str
|
|
||||||
self.base_file = None # type: str
|
|
||||||
self.setting_version = None # type: int
|
|
||||||
self.version = None # type: int
|
|
||||||
self.brand = None # type: str
|
|
||||||
self.material = None # type: str
|
|
||||||
self.color_name = None # type: str
|
|
||||||
self.color_code = None # type: str
|
|
||||||
self.description = None # type: str
|
|
||||||
self.adhesion_info = None # type: str
|
|
||||||
self.approximate_diameter = None # type: str
|
|
||||||
self.definition = None # type: str
|
|
||||||
self.compatible = None # type: bool
|
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self) -> None:
|
||||||
if not self.GUID:
|
if not self.GUID:
|
||||||
raise ValueError("guid is required on LocalMaterial")
|
raise ValueError("guid is required on LocalMaterial")
|
||||||
|
if not self.version:
|
||||||
|
raise ValueError("version is required on LocalMaterial")
|
||||||
if not self.id:
|
if not self.id:
|
||||||
raise ValueError("id is required on LocalMaterial")
|
raise ValueError("id is required on LocalMaterial")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue