Skip to content

Commit

Permalink
Remove data field
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielguarisa committed Oct 18, 2024
1 parent c7471ba commit a35d264
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "retrack"
version = "2.9.1a3"
version = "2.10.0a1"
description = "A business rules engine"
authors = ["Gabriel Guarisa <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion retrack/nodes/dynamic/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def run(self, **kwargs) -> typing.Dict[str, typing.Any]:

def generate_input_nodes(self):
input_nodes = []
for component in rule_instance.components_registry.data.values():
for component in rule_instance.components_registry.memory.values():
input_nodes.extend(component.generate_input_nodes())
return input_nodes

Expand Down
2 changes: 1 addition & 1 deletion retrack/utils/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def validate_data(data: dict) -> dict:
def validate_with_validators(
graph_data: dict, edges: dict, validator_registry: Registry
):
for validator_name, validator in validator_registry.data.items():
for validator_name, validator in validator_registry.memory.items():
if not validator.validate(graph_data=graph_data, edges=edges):
raise ValueError(f"Invalid graph data: {validator_name}")

Expand Down
10 changes: 0 additions & 10 deletions retrack/utils/registry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import typing
import warnings


class Registry:
Expand Down Expand Up @@ -33,15 +32,6 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any:

return self._memory.get(key, default)

@property
def data(self) -> typing.Dict[str, typing.Any]:
"""Return the registry memory."""
warnings.warn(
"The 'data' property is deprecated, use 'memory' instead.",
DeprecationWarning,
)
return self._memory

@property
def keys(self) -> typing.List[str]:
"""Return the registry keys."""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

def test_create_registry():
registry = Registry()
assert registry.data == {}
assert registry.memory == {}


def test_register_model():
registry = Registry()
registry.register("test", "example")
assert registry.data == {"test": "example"}
assert registry.memory == {"test": "example"}


def test_get_model():
Expand Down

0 comments on commit a35d264

Please sign in to comment.