Skip to content

Commit 16357d3

Browse files
JohnRichard4096Copilot
andcommitted
Update: __init__ and README
Co-authored-by: Copilot <copilot@github.com>
1 parent e995c50 commit 16357d3

6 files changed

Lines changed: 77 additions & 13 deletions

File tree

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
1-
# AmritaSense
2-
Next-Gen Graph workflow engine.
3-
41
<center>
2+
<img src="./docs/public/Amrita.png" alt="Logo" width="200" height="200">
3+
4+
<h1>AmritaSense</h1>
5+
6+
<p>
7+
<a href="https://img.shields.io/pypi/v/amrita-sense">
8+
<img src="https://img.shields.io/pypi/v/amrita-sense?color=blue&style=flat-square" alt="PyPI Version">
9+
</a>
10+
<a href="https://www.python.org/">
11+
<img src="https://img.shields.io/badge/python-3.10+-blue?logo=python&style=flat-square" alt="Python Version">
12+
</a>
13+
<a href="LICENSE">
14+
<img src="https://img.shields.io/github/license/AmritaBot/AmritaSense?style=flat-square" alt="License">
15+
</a>
16+
<a href="https://discord.gg/byAD3sbjjj">
17+
<img src="https://img.shields.io/badge/Discord-Project.Amrita-blue?logo=discord&style=flat-square" alt="Discord">
18+
</a>
19+
<a href="https://qm.qq.com/q/9J23pPZN3a">
20+
<img src="https://img.shields.io/badge/QQ-1006893368-blue?style=flat-square" alt="QQ Group">
21+
</a>
22+
</p>
23+
24+
> ### _"Any is things all you need."_
25+
26+
</center>
527

6-
> ## *"Any is things all you need."*
28+
## Significants
729

8-
</center>
30+
Docs and tests are still in progress...

log.txt

Whitespace-only changes.

src/amrita_sense/__init__.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from .exceptions import (
2+
DependsException,
3+
DependsInjectFailed,
4+
DependsResolveFailed,
5+
InterruptNotice,
6+
NullPointerException,
7+
)
8+
from .instructions import ALIAS, DO, IF, INTERRUPT, NOP, WHILE, Try
9+
from .node import Node, NodeCompose, NodeComposeRendered, NodeType
10+
from .runtime.deps import POINTER_DEPENDS
11+
from .runtime.workflow import WorkflowInterpreter, WorkflowPC
12+
from .types import PointerVector, Stack
13+
14+
__all__ = [
15+
"ALIAS",
16+
"DO",
17+
"IF",
18+
"INTERRUPT",
19+
"NOP",
20+
"POINTER_DEPENDS",
21+
"WHILE",
22+
"DependsException",
23+
"DependsInjectFailed",
24+
"DependsResolveFailed",
25+
"InterruptNotice",
26+
"Node",
27+
"NodeCompose",
28+
"NodeComposeRendered",
29+
"NodeType",
30+
"NullPointerException",
31+
"PointerVector",
32+
"Stack",
33+
"Try",
34+
"WorkflowInterpreter",
35+
"WorkflowPC",
36+
]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .alias import AliasNode
1+
from .alias import ALIAS
22
from .if_clause import IF
33
from .jump import GOTO
44
from .loop.do_while import DO
@@ -7,12 +7,12 @@
77
from .workfl_ctrl import INTERRUPT, NOP
88

99
__all__ = (
10+
"ALIAS",
1011
"DO",
1112
"GOTO",
1213
"IF",
1314
"INTERRUPT",
1415
"NOP",
1516
"WHILE",
16-
"AliasNode",
1717
"Try",
1818
)

src/amrita_sense/node/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
from .core import NodeComposeRendered
1+
from .core import Node as NodeType
2+
from .core import NodeCompose, NodeComposeRendered
23
from .self_compile import SelfCompileInstruction
34
from .wrapper import Node
45

56
__all__ = [
67
"Node",
8+
"NodeCompose",
79
"NodeComposeRendered",
10+
"NodeType",
811
"SelfCompileInstruction",
912
]

src/amrita_sense/runtime/workflow.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from copy import deepcopy
66
from functools import wraps
77
from inspect import iscoroutinefunction
8-
from typing import Any, TypeAlias
8+
from typing import Any, Generic, TypeAlias, TypeVar, cast
99

1010
from amrita_core import SuspendObjectStream, logger
1111
from amrita_core.hook.matcher import DependsFactory, MatcherFactory
@@ -24,21 +24,23 @@
2424
"WorkflowPC::each_node" # When stop at this checkpoint, change address is allowed.
2525
)
2626

27+
io_T = TypeVar("io_T", bound=SuspendObjectStream, covariant=True)
2728

28-
class WorkflowInterpreter:
29+
30+
class WorkflowInterpreter(Generic[io_T]):
2931
_graph: NodeComposeRendered
3032
_pointer: PointerVector
3133
_ava_args: tuple
3234
_ava_kwargs: dict[str, Any]
3335
_exc_ignored: tuple[type[BaseException], ...]
34-
object_io: SuspendObjectStream
36+
object_io: io_T
3537
_ret_addr_stack: Stack[PointerVector]
3638
_jump_marked: bool
3739

3840
def __init__(
3941
self,
4042
node_compose: NodeComposeRendered | SelfCompileInstruction,
41-
object_io: SuspendObjectStream | None = None,
43+
object_io: SuspendObjectStream[Any] | None = None,
4244
*,
4345
exception_ignored: tuple[type[BaseException], ...],
4446
extra_args: tuple,
@@ -52,7 +54,8 @@ def __init__(
5254
self._ava_args = (self, *extra_args)
5355
self._ava_kwargs = deepcopy(extra_kwargs)
5456
self._exc_ignored = (*exception_ignored, InterruptNotice)
55-
self.object_io = object_io or SuspendObjectStream()
57+
object_io = object_io or SuspendObjectStream()
58+
self.object_io = cast(io_T, object_io)
5659
self._ret_addr_stack = addr_stack or Stack()
5760
self._jump_marked = False
5861

0 commit comments

Comments
 (0)