-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
address comments left by @creatorrr on #986 (feat(agents-api): Config…
…ure routes );
- Loading branch information
1 parent
77903ef
commit eed8827
Showing
12 changed files
with
0 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
agents-api/agents_api/activities/task_steps/cozo_query_step.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +0,0 @@ | ||
from typing import Any | ||
|
||
from beartype import beartype | ||
from temporalio import activity | ||
|
||
from ... import models | ||
from ...env import testing | ||
|
||
|
||
@beartype | ||
async def cozo_query_step( | ||
query_name: str, | ||
values: dict[str, Any], | ||
) -> Any: | ||
(module_name, name) = query_name.split(".") | ||
|
||
module = getattr(models, module_name) | ||
query = getattr(module, name) | ||
return query(**values) | ||
|
||
|
||
# Note: This is here just for clarity. We could have just imported cozo_query_step directly | ||
# They do the same thing, so we dont need to mock the cozo_query_step function | ||
mock_cozo_query_step = cozo_query_step | ||
|
||
cozo_query_step = activity.defn(name="cozo_query_step")( | ||
cozo_query_step if not testing else mock_cozo_query_step | ||
) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +0,0 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""This module provides utility functions for interacting with the Cozo API client, including data mutation processes.""" | ||
|
||
from types import SimpleNamespace | ||
from uuid import UUID | ||
|
||
from beartype import beartype | ||
from pycozo import Client | ||
|
||
# Define a mock client for testing purposes, simulating Cozo API client behavior. | ||
_fake_client: SimpleNamespace = SimpleNamespace() | ||
# Lambda function to process and mutate data dictionaries using the Cozo client's internal method. This is a workaround to access protected member functions for testing. | ||
_fake_client._process_mutate_data_dict = lambda data: ( | ||
Client._process_mutate_data_dict(_fake_client, data) | ||
) | ||
|
||
# Public interface to process and mutate data using the Cozo client. It wraps the client's internal processing method for external use. | ||
cozo_process_mutate_data = _fake_client._process_mutate_data = lambda data: ( | ||
Client._process_mutate_data(_fake_client, data) | ||
) | ||
|
||
|
||
@beartype | ||
def uuid_int_list_to_uuid(data: list[int]) -> UUID: | ||
return UUID(bytes=b"".join([i.to_bytes(1, "big") for i in data])) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters