Skip to content

Commit

Permalink
[MINOR]: Address PR Commments
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Nov 26, 2024
1 parent a10b66e commit 34277b9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
11 changes: 8 additions & 3 deletions jac-cloud/jac_cloud/tests/simple_graph.jac
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,6 @@ walker get_custom_object {
has object_id: str;

can enter1 with `root entry {
import:py from jac_cloud.core.architype {BaseAnchor}
try {
report &(self.object_id);
} except Exception as e {
Expand All @@ -772,7 +771,6 @@ walker update_custom_object {
has object_id: str;

can enter1 with `root entry {
import:py from jac_cloud.core.architype {BaseAnchor}
savable_object = &(self.object_id);
savable_object.parent.child.json["c"] = 3;
savable_object.parent.child.arr.append(3);
Expand All @@ -795,6 +793,13 @@ walker delete_custom_object {

can enter1 with `root entry {
import:py from jac_cloud.core.architype {BaseAnchor}
Jac.destroy(BaseAnchor.ref(self.object_id));
Jac.destroy(&(self.object_id));

# This is similar to
#
# Jac.destroy(BaseAnchor.ref(self.object_id));
#
# The only difference is BaseAnchor.ref doesn't
# load the actual object and just use it as reference
}
}
6 changes: 3 additions & 3 deletions jac-cloud/jac_cloud/tests/test_simple_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,19 +560,19 @@ def trigger_upload_file(self) -> None:
"single": {
"name": "simple_graph.jac",
"content_type": "application/octet-stream",
"size": 17536,
"size": 17624,
}
},
"multiple": [
{
"name": "simple_graph.jac",
"content_type": "application/octet-stream",
"size": 17536,
"size": 17624,
},
{
"name": "simple_graph.jac",
"content_type": "application/octet-stream",
"size": 17536,
"size": 17624,
},
],
"singleOptional": None,
Expand Down
15 changes: 5 additions & 10 deletions jac/jaclang/plugin/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,6 @@ def create_cmd() -> None:
return plugin_manager.hook.create_cmd()


class JacCallable:
"""Jac Callable Executions."""

@staticmethod
def get_object(id: str) -> Architype | None:
"""Get object given id."""
return plugin_manager.hook.get_object_func()(id=id)


class JacFeature(
JacClassReferences,
JacAccessValidation,
Expand All @@ -255,7 +246,6 @@ class JacFeature(
JacWalker,
JacBuiltin,
JacCmd,
JacCallable,
):
"""Jac Feature."""

Expand All @@ -274,6 +264,11 @@ def reset_graph(root: Optional[Root] = None) -> int:
"""Purge current or target graph."""
return plugin_manager.hook.reset_graph(root=root)

@staticmethod
def get_object(id: str) -> Architype | None:
"""Get object given id."""
return plugin_manager.hook.get_object_func()(id=id)

@staticmethod
def get_object_func() -> Callable[[str], Architype | None]:
"""Get object given id."""
Expand Down

0 comments on commit 34277b9

Please sign in to comment.