Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f56ecb0c0 |
@@ -332,7 +332,7 @@ class AutomationContext:
|
||||
def attach_error_to_objects(
|
||||
self,
|
||||
category: str,
|
||||
objects: Union[Base, List[Base]],
|
||||
object_ids: Union[str, List[str]],
|
||||
message: Optional[str] = None,
|
||||
metadata: Optional[Dict[str, Any]] = None,
|
||||
visual_overrides: Optional[Dict[str, Any]] = None,
|
||||
@@ -351,7 +351,7 @@ class AutomationContext:
|
||||
self.attach_result_to_objects(
|
||||
ObjectResultLevel.ERROR,
|
||||
category,
|
||||
objects,
|
||||
object_ids,
|
||||
message,
|
||||
metadata,
|
||||
visual_overrides,
|
||||
@@ -360,7 +360,7 @@ class AutomationContext:
|
||||
def attach_warning_to_objects(
|
||||
self,
|
||||
category: str,
|
||||
objects: Union[Base, List[Base]],
|
||||
object_ids: Union[str, List[str]],
|
||||
message: Optional[str] = None,
|
||||
metadata: Optional[Dict[str, Any]] = None,
|
||||
visual_overrides: Optional[Dict[str, Any]] = None,
|
||||
@@ -369,7 +369,7 @@ class AutomationContext:
|
||||
self.attach_result_to_objects(
|
||||
ObjectResultLevel.WARNING,
|
||||
category,
|
||||
objects,
|
||||
object_ids,
|
||||
message,
|
||||
metadata,
|
||||
visual_overrides,
|
||||
@@ -378,7 +378,7 @@ class AutomationContext:
|
||||
def attach_success_to_objects(
|
||||
self,
|
||||
category: str,
|
||||
objects: Union[Base, List[Base]],
|
||||
object_ids: Union[str, List[str]],
|
||||
message: Optional[str] = None,
|
||||
metadata: Optional[Dict[str, Any]] = None,
|
||||
visual_overrides: Optional[Dict[str, Any]] = None,
|
||||
@@ -387,7 +387,7 @@ class AutomationContext:
|
||||
self.attach_result_to_objects(
|
||||
ObjectResultLevel.SUCCESS,
|
||||
category,
|
||||
objects,
|
||||
object_ids,
|
||||
message,
|
||||
metadata,
|
||||
visual_overrides,
|
||||
@@ -396,7 +396,7 @@ class AutomationContext:
|
||||
def attach_info_to_objects(
|
||||
self,
|
||||
category: str,
|
||||
objects: Union[Base, List[Base]],
|
||||
object_ids: Union[str, List[str]],
|
||||
message: Optional[str] = None,
|
||||
metadata: Optional[Dict[str, Any]] = None,
|
||||
visual_overrides: Optional[Dict[str, Any]] = None,
|
||||
@@ -405,7 +405,7 @@ class AutomationContext:
|
||||
self.attach_result_to_objects(
|
||||
ObjectResultLevel.INFO,
|
||||
category,
|
||||
objects,
|
||||
object_ids,
|
||||
message,
|
||||
metadata,
|
||||
visual_overrides,
|
||||
@@ -415,22 +415,19 @@ class AutomationContext:
|
||||
self,
|
||||
level: ObjectResultLevel,
|
||||
category: str,
|
||||
objects: Union[Base, List[Base]],
|
||||
object_ids: Union[str, List[str]],
|
||||
message: Optional[str] = None,
|
||||
metadata: Optional[Dict[str, Any]] = None,
|
||||
visual_overrides: Optional[Dict[str, Any]] = None,
|
||||
) -> None:
|
||||
if isinstance(objects, list):
|
||||
if len(objects) < 1:
|
||||
if isinstance(object_ids, list):
|
||||
if len(object_ids) < 1:
|
||||
raise ValueError(
|
||||
f"Need atleast one object_id to report a(n) {level.value.upper()}"
|
||||
)
|
||||
id_list = [o.id for o in objects]
|
||||
application_ids = [o.applicationId for o in objects]
|
||||
id_list = object_ids
|
||||
else:
|
||||
id_list = [objects.id]
|
||||
application_ids = [objects.applicationId]
|
||||
metadata["applicationIds"] = application_ids
|
||||
id_list = [object_ids]
|
||||
print(
|
||||
f"Created new {level.value.upper()}"
|
||||
f" category: {category} caused by: {message}"
|
||||
|
||||
@@ -49,9 +49,8 @@ class Mesh(
|
||||
|
||||
if len(self.vertices) % 3 != 0:
|
||||
raise ValueError(
|
||||
f"Invalid vertices list: length ({
|
||||
len(self.vertices)
|
||||
}) must be a multiple of 3"
|
||||
f"Invalid vertices list: length {len(self.vertices)} "
|
||||
f"must be a multiple of 3"
|
||||
)
|
||||
return len(self.vertices) // 3
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ def automate_function(
|
||||
raise ValueError("Cannot operate on objects without their id's.")
|
||||
automation_context.attach_error_to_objects(
|
||||
"Forbidden speckle_type",
|
||||
version_root_object,
|
||||
version_root_object.id,
|
||||
"This project should not contain the type: "
|
||||
f"{function_inputs.forbidden_speckle_type}",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user