Skip to content
Snippets Groups Projects
Commit 05bbd20a authored by Krzysztof Mochocki's avatar Krzysztof Mochocki
Browse files

Add support for legacy operations access

parent 09feac2e
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,17 @@ class Operation(PreconfiguredBaseModel):
"""conversion name of operation from CamelCase to snake_case"""
return re.sub(r"(?<!^)(?=[A-Z])", "_", cls.get_class_name()).lower()
def __getitem__(self, key: str | int) -> Any:
if isinstance(key, int):
match (key):
case 0:
return self.get_name()
case 1:
return self
case _:
raise ValueError("out of bound")
return super().__getitem__(key)
class VirtualOperation(Operation):
"""Base class for all virtual operations"""
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment