jaclang 0.7.19__py3-none-any.whl → 0.7.20__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jaclang might be problematic. Click here for more details.
- jaclang/compiler/absyntree.py +1 -1
- jaclang/compiler/parser.py +1 -1
- jaclang/compiler/passes/main/__init__.py +1 -1
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +50 -13
- jaclang/compiler/passes/main/import_pass.py +27 -0
- jaclang/compiler/passes/main/sym_tab_build_pass.py +0 -18
- jaclang/compiler/passes/main/tests/fixtures/mod_type_assign.jac +7 -0
- jaclang/compiler/passes/main/tests/test_type_check_pass.py +1 -1
- jaclang/compiler/passes/main/tests/test_typeinfo_pass.py +23 -1
- jaclang/compiler/passes/tool/jac_formatter_pass.py +10 -0
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/line_spacing.jac +3 -1
- jaclang/compiler/semtable.py +4 -4
- jaclang/compiler/symtable.py +5 -0
- jaclang/langserve/engine.py +64 -6
- jaclang/langserve/tests/test_server.py +1 -1
- jaclang/langserve/utils.py +0 -113
- jaclang/plugin/tests/test_jaseci.py +23 -4
- jaclang/runtimelib/importer.py +2 -0
- jaclang/runtimelib/memory.py +1 -1
- jaclang/stubs/jaclang/__init__.pyi +5 -0
- jaclang/stubs/jaclang/cli/__init__.pyi +0 -0
- jaclang/stubs/jaclang/cli/cli.pyi +58 -0
- jaclang/stubs/jaclang/cli/cmdreg.pyi +32 -0
- jaclang/stubs/jaclang/compiler/__init__.pyi +6 -0
- jaclang/stubs/jaclang/compiler/absyntree.pyi +1248 -0
- jaclang/stubs/jaclang/compiler/codeloc.pyi +45 -0
- jaclang/stubs/jaclang/compiler/compile.pyi +29 -0
- jaclang/stubs/jaclang/compiler/constant.pyi +287 -0
- jaclang/stubs/jaclang/compiler/generated/__init__.pyi +0 -0
- jaclang/stubs/jaclang/compiler/generated/jac_parser.pyi +898 -0
- jaclang/stubs/jaclang/compiler/parser.pyi +266 -0
- jaclang/stubs/jaclang/compiler/passes/__init__.pyi +3 -0
- jaclang/stubs/jaclang/compiler/passes/ir_pass.pyi +40 -0
- jaclang/stubs/jaclang/compiler/passes/main/__init__.pyi +27 -0
- jaclang/stubs/jaclang/compiler/passes/main/access_modifier_pass.pyi +23 -0
- jaclang/stubs/jaclang/compiler/passes/main/def_impl_match_pass.pyi +12 -0
- jaclang/stubs/jaclang/compiler/passes/main/def_use_pass.pyi +31 -0
- jaclang/stubs/jaclang/compiler/passes/main/fuse_typeinfo_pass.pyi +66 -0
- jaclang/stubs/jaclang/compiler/passes/main/import_pass.pyi +34 -0
- jaclang/stubs/jaclang/compiler/passes/main/pyast_gen_pass.pyi +178 -0
- jaclang/stubs/jaclang/compiler/passes/main/pyast_load_pass.pyi +135 -0
- jaclang/stubs/jaclang/compiler/passes/main/pybc_gen_pass.pyi +6 -0
- jaclang/stubs/jaclang/compiler/passes/main/pyjac_ast_link_pass.pyi +22 -0
- jaclang/stubs/jaclang/compiler/passes/main/pyout_pass.pyi +9 -0
- jaclang/stubs/jaclang/compiler/passes/main/registry_pass.pyi +15 -0
- jaclang/stubs/jaclang/compiler/passes/main/schedules.pyi +19 -0
- jaclang/stubs/jaclang/compiler/passes/main/sub_node_tab_pass.pyi +6 -0
- jaclang/stubs/jaclang/compiler/passes/main/sym_tab_build_pass.pyi +147 -0
- jaclang/stubs/jaclang/compiler/passes/main/type_check_pass.pyi +11 -0
- jaclang/stubs/jaclang/compiler/passes/tool/__init__.pyi +4 -0
- jaclang/stubs/jaclang/compiler/passes/tool/fuse_comments_pass.pyi +12 -0
- jaclang/stubs/jaclang/compiler/passes/tool/jac_formatter_pass.pyi +134 -0
- jaclang/stubs/jaclang/compiler/passes/tool/schedules.pyi +11 -0
- jaclang/stubs/jaclang/compiler/passes/transform.pyi +28 -0
- jaclang/stubs/jaclang/compiler/passes/utils/__init__.pyi +0 -0
- jaclang/stubs/jaclang/compiler/passes/utils/mypy_ast_build.pyi +151 -0
- jaclang/stubs/jaclang/compiler/semtable.pyi +35 -0
- jaclang/stubs/jaclang/compiler/symtable.pyi +65 -0
- jaclang/stubs/jaclang/langserve/__init__.pyi +0 -0
- jaclang/stubs/jaclang/langserve/engine.pyi +73 -0
- jaclang/stubs/jaclang/langserve/sem_manager.pyi +89 -0
- jaclang/stubs/jaclang/langserve/server.pyi +38 -0
- jaclang/stubs/jaclang/langserve/utils.pyi +55 -0
- jaclang/stubs/jaclang/plugin/__init__.pyi +3 -0
- jaclang/stubs/jaclang/plugin/builtin.pyi +12 -0
- jaclang/stubs/jaclang/plugin/default.pyi +202 -0
- jaclang/stubs/jaclang/plugin/feature.pyi +176 -0
- jaclang/stubs/jaclang/plugin/spec.pyi +181 -0
- jaclang/stubs/jaclang/runtimelib/__init__.pyi +0 -0
- jaclang/stubs/jaclang/runtimelib/architype.pyi +133 -0
- jaclang/stubs/jaclang/runtimelib/constructs.pyi +41 -0
- jaclang/stubs/jaclang/runtimelib/context.pyi +48 -0
- jaclang/stubs/jaclang/runtimelib/importer.pyi +104 -0
- jaclang/stubs/jaclang/runtimelib/machine.pyi +6 -0
- jaclang/stubs/jaclang/runtimelib/memory.pyi +26 -0
- jaclang/stubs/jaclang/runtimelib/utils.pyi +35 -0
- jaclang/stubs/jaclang/settings.pyi +35 -0
- jaclang/stubs/jaclang/utils/__init__.pyi +0 -0
- jaclang/stubs/jaclang/utils/helpers.pyi +18 -0
- jaclang/stubs/jaclang/utils/lang_tools.pyi +43 -0
- jaclang/stubs/jaclang/utils/log.pyi +3 -0
- jaclang/stubs/jaclang/utils/treeprinter.pyi +47 -0
- jaclang/tests/fixtures/builtins_test.jac +16 -0
- jaclang/tests/fixtures/match_multi_ex.jac +12 -0
- jaclang/tests/test_cli.py +29 -2
- jaclang/tests/test_language.py +10 -0
- jaclang/utils/treeprinter.py +1 -1
- {jaclang-0.7.19.dist-info → jaclang-0.7.20.dist-info}/METADATA +1 -1
- {jaclang-0.7.19.dist-info → jaclang-0.7.20.dist-info}/RECORD +91 -25
- {jaclang-0.7.19.dist-info → jaclang-0.7.20.dist-info}/WHEEL +0 -0
- {jaclang-0.7.19.dist-info → jaclang-0.7.20.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import types
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from jaclang.compiler.constant import EdgeDir as EdgeDir
|
|
4
|
+
from jaclang.runtimelib.utils import (
|
|
5
|
+
collect_node_connections as collect_node_connections,
|
|
6
|
+
)
|
|
7
|
+
from typing import Any, Callable
|
|
8
|
+
from uuid import UUID
|
|
9
|
+
|
|
10
|
+
@dataclass(eq=False)
|
|
11
|
+
class Anchor:
|
|
12
|
+
def spawn_call(self, walk: WalkerArchitype) -> WalkerArchitype: ...
|
|
13
|
+
def __init__(self, obj, id=...) -> None: ...
|
|
14
|
+
|
|
15
|
+
@dataclass(eq=False)
|
|
16
|
+
class NodeAnchor(Anchor):
|
|
17
|
+
obj: NodeArchitype
|
|
18
|
+
edges: list[EdgeArchitype] = ...
|
|
19
|
+
edge_ids: list[UUID] = ...
|
|
20
|
+
persistent: bool = ...
|
|
21
|
+
def populate_edges(self) -> None: ...
|
|
22
|
+
def connect_node(self, nd: NodeArchitype, edg: EdgeArchitype) -> NodeArchitype: ...
|
|
23
|
+
def get_edges(
|
|
24
|
+
self,
|
|
25
|
+
dir: EdgeDir,
|
|
26
|
+
filter_func: Callable[[list[EdgeArchitype]], list[EdgeArchitype]] | None,
|
|
27
|
+
target_obj: list[NodeArchitype] | None,
|
|
28
|
+
) -> list[EdgeArchitype]: ...
|
|
29
|
+
def edges_to_nodes(
|
|
30
|
+
self,
|
|
31
|
+
dir: EdgeDir,
|
|
32
|
+
filter_func: Callable[[list[EdgeArchitype]], list[EdgeArchitype]] | None,
|
|
33
|
+
target_obj: list[NodeArchitype] | None,
|
|
34
|
+
) -> list[NodeArchitype]: ...
|
|
35
|
+
def gen_dot(self, dot_file: str | None = None) -> str: ...
|
|
36
|
+
def __init__(
|
|
37
|
+
self, obj, id=..., edges=..., edge_ids=..., persistent=...
|
|
38
|
+
) -> None: ...
|
|
39
|
+
|
|
40
|
+
@dataclass(eq=False)
|
|
41
|
+
class EdgeAnchor(Anchor):
|
|
42
|
+
obj: EdgeArchitype
|
|
43
|
+
source: NodeArchitype | None = ...
|
|
44
|
+
target: NodeArchitype | None = ...
|
|
45
|
+
source_id: UUID | None = ...
|
|
46
|
+
target_id: UUID | None = ...
|
|
47
|
+
is_undirected: bool = ...
|
|
48
|
+
persistent: bool = ...
|
|
49
|
+
def attach(
|
|
50
|
+
self, src: NodeArchitype, trg: NodeArchitype, is_undirected: bool = False
|
|
51
|
+
) -> EdgeAnchor: ...
|
|
52
|
+
def detach(
|
|
53
|
+
self, src: NodeArchitype, trg: NodeArchitype, is_undirected: bool = False
|
|
54
|
+
) -> None: ...
|
|
55
|
+
def spawn_call(self, walk: WalkerArchitype) -> WalkerArchitype: ...
|
|
56
|
+
def __init__(
|
|
57
|
+
self,
|
|
58
|
+
obj,
|
|
59
|
+
id=...,
|
|
60
|
+
source=...,
|
|
61
|
+
target=...,
|
|
62
|
+
source_id=...,
|
|
63
|
+
target_id=...,
|
|
64
|
+
is_undirected=...,
|
|
65
|
+
persistent=...,
|
|
66
|
+
) -> None: ...
|
|
67
|
+
|
|
68
|
+
@dataclass(eq=False)
|
|
69
|
+
class WalkerAnchor(Anchor):
|
|
70
|
+
obj: WalkerArchitype
|
|
71
|
+
path: list[Architype] = ...
|
|
72
|
+
next: list[Architype] = ...
|
|
73
|
+
ignores: list[Architype] = ...
|
|
74
|
+
disengaged: bool = ...
|
|
75
|
+
def visit_node(
|
|
76
|
+
self,
|
|
77
|
+
nds: (
|
|
78
|
+
list[NodeArchitype | EdgeArchitype]
|
|
79
|
+
| list[NodeArchitype]
|
|
80
|
+
| list[EdgeArchitype]
|
|
81
|
+
| NodeArchitype
|
|
82
|
+
| EdgeArchitype
|
|
83
|
+
),
|
|
84
|
+
) -> bool: ...
|
|
85
|
+
def ignore_node(
|
|
86
|
+
self,
|
|
87
|
+
nds: (
|
|
88
|
+
list[NodeArchitype | EdgeArchitype]
|
|
89
|
+
| list[NodeArchitype]
|
|
90
|
+
| list[EdgeArchitype]
|
|
91
|
+
| NodeArchitype
|
|
92
|
+
| EdgeArchitype
|
|
93
|
+
),
|
|
94
|
+
) -> bool: ...
|
|
95
|
+
def disengage_now(self) -> None: ...
|
|
96
|
+
def spawn_call(self, nd: Architype) -> WalkerArchitype: ...
|
|
97
|
+
def __init__(
|
|
98
|
+
self, obj, id=..., path=..., next=..., ignores=..., disengaged=...
|
|
99
|
+
) -> None: ...
|
|
100
|
+
|
|
101
|
+
class Architype:
|
|
102
|
+
def __init__(self) -> None: ...
|
|
103
|
+
def __hash__(self) -> int: ...
|
|
104
|
+
def __eq__(self, other: object) -> bool: ...
|
|
105
|
+
|
|
106
|
+
class NodeArchitype(Architype):
|
|
107
|
+
def __init__(self) -> None: ...
|
|
108
|
+
def save(self) -> None: ...
|
|
109
|
+
|
|
110
|
+
class EdgeArchitype(Architype):
|
|
111
|
+
persistent: bool
|
|
112
|
+
def __init__(self) -> None: ...
|
|
113
|
+
def save(self) -> None: ...
|
|
114
|
+
def populate_nodes(self) -> None: ...
|
|
115
|
+
|
|
116
|
+
class WalkerArchitype(Architype):
|
|
117
|
+
def __init__(self) -> None: ...
|
|
118
|
+
|
|
119
|
+
class GenericEdge(EdgeArchitype): ...
|
|
120
|
+
|
|
121
|
+
class Root(NodeArchitype):
|
|
122
|
+
reachable_nodes: list[NodeArchitype]
|
|
123
|
+
connections: set[tuple[NodeArchitype, NodeArchitype, EdgeArchitype]]
|
|
124
|
+
def __init__(self) -> None: ...
|
|
125
|
+
def reset(self) -> None: ...
|
|
126
|
+
|
|
127
|
+
@dataclass(eq=False)
|
|
128
|
+
class DSFunc:
|
|
129
|
+
name: str
|
|
130
|
+
trigger: type | types.UnionType | tuple[type | types.UnionType, ...] | None
|
|
131
|
+
func: Callable[[Any, Any], Any] | None = ...
|
|
132
|
+
def resolve(self, cls: type) -> None: ...
|
|
133
|
+
def __init__(self, name, trigger, func=...) -> None: ...
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from .architype import (
|
|
2
|
+
Anchor as Anchor,
|
|
3
|
+
Architype as Architype,
|
|
4
|
+
DSFunc as DSFunc,
|
|
5
|
+
EdgeAnchor as EdgeAnchor,
|
|
6
|
+
EdgeArchitype as EdgeArchitype,
|
|
7
|
+
GenericEdge as GenericEdge,
|
|
8
|
+
NodeAnchor as NodeAnchor,
|
|
9
|
+
NodeArchitype as NodeArchitype,
|
|
10
|
+
Root as Root,
|
|
11
|
+
WalkerAnchor as WalkerAnchor,
|
|
12
|
+
WalkerArchitype as WalkerArchitype,
|
|
13
|
+
)
|
|
14
|
+
from .context import ExecutionContext as ExecutionContext, exec_context as exec_context
|
|
15
|
+
from .memory import Memory as Memory, ShelveStorage as ShelveStorage
|
|
16
|
+
from .test import (
|
|
17
|
+
JacTestCheck as JacTestCheck,
|
|
18
|
+
JacTestResult as JacTestResult,
|
|
19
|
+
JacTextTestRunner as JacTextTestRunner,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"Anchor",
|
|
24
|
+
"NodeAnchor",
|
|
25
|
+
"EdgeAnchor",
|
|
26
|
+
"WalkerAnchor",
|
|
27
|
+
"Architype",
|
|
28
|
+
"NodeArchitype",
|
|
29
|
+
"EdgeArchitype",
|
|
30
|
+
"WalkerArchitype",
|
|
31
|
+
"GenericEdge",
|
|
32
|
+
"Root",
|
|
33
|
+
"DSFunc",
|
|
34
|
+
"Memory",
|
|
35
|
+
"ShelveStorage",
|
|
36
|
+
"ExecutionContext",
|
|
37
|
+
"exec_context",
|
|
38
|
+
"JacTestResult",
|
|
39
|
+
"JacTextTestRunner",
|
|
40
|
+
"JacTestCheck",
|
|
41
|
+
]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from .architype import Architype as Architype, Root as Root
|
|
3
|
+
from .machine import JacMachine as JacMachine
|
|
4
|
+
from .memory import Memory as Memory, ShelveStorage as ShelveStorage
|
|
5
|
+
from _typeshed import Incomplete
|
|
6
|
+
from contextvars import ContextVar
|
|
7
|
+
from typing import Callable
|
|
8
|
+
from uuid import UUID
|
|
9
|
+
|
|
10
|
+
class ExecutionContext:
|
|
11
|
+
mem: Memory | None
|
|
12
|
+
root: Root | None
|
|
13
|
+
jac_machine: Incomplete
|
|
14
|
+
def __init__(self) -> None: ...
|
|
15
|
+
def init_memory(self, base_path: str = "", session: str = "") -> None: ...
|
|
16
|
+
def get_root(self) -> Root: ...
|
|
17
|
+
def get_obj(self, obj_id: UUID) -> Architype | None: ...
|
|
18
|
+
def save_obj(self, item: Architype, persistent: bool) -> None: ...
|
|
19
|
+
def reset(self) -> None: ...
|
|
20
|
+
|
|
21
|
+
exec_context: ContextVar[ExecutionContext | None]
|
|
22
|
+
|
|
23
|
+
class JacTestResult(unittest.TextTestResult):
|
|
24
|
+
failures_count: Incomplete
|
|
25
|
+
max_failures: Incomplete
|
|
26
|
+
def __init__(
|
|
27
|
+
self, stream, descriptions, verbosity: int, max_failures: int | None = None
|
|
28
|
+
) -> None: ...
|
|
29
|
+
def addFailure(self, test, err) -> None: ...
|
|
30
|
+
shouldStop: bool
|
|
31
|
+
def stop(self) -> None: ...
|
|
32
|
+
|
|
33
|
+
class JacTextTestRunner(unittest.TextTestRunner):
|
|
34
|
+
max_failures: Incomplete
|
|
35
|
+
def __init__(self, max_failures: int | None = None, **kwargs) -> None: ...
|
|
36
|
+
|
|
37
|
+
class JacTestCheck:
|
|
38
|
+
test_case: Incomplete
|
|
39
|
+
test_suite: Incomplete
|
|
40
|
+
breaker: bool
|
|
41
|
+
failcount: int
|
|
42
|
+
@staticmethod
|
|
43
|
+
def reset() -> None: ...
|
|
44
|
+
@staticmethod
|
|
45
|
+
def run_test(xit: bool, maxfail: int | None, verbose: bool) -> None: ...
|
|
46
|
+
@staticmethod
|
|
47
|
+
def add_test(test_fun: Callable) -> None: ...
|
|
48
|
+
def __getattr__(self, name: str) -> object: ...
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import types
|
|
2
|
+
from _typeshed import Incomplete
|
|
3
|
+
from jaclang.compiler.absyntree import Module as Module
|
|
4
|
+
from jaclang.compiler.compile import compile_jac as compile_jac
|
|
5
|
+
from jaclang.runtimelib.machine import JacMachine as JacMachine
|
|
6
|
+
from jaclang.runtimelib.utils import sys_path_context as sys_path_context
|
|
7
|
+
from jaclang.utils.log import logging as logging
|
|
8
|
+
|
|
9
|
+
logger: Incomplete
|
|
10
|
+
|
|
11
|
+
class ImportPathSpec:
|
|
12
|
+
target: Incomplete
|
|
13
|
+
base_path: Incomplete
|
|
14
|
+
absorb: Incomplete
|
|
15
|
+
cachable: Incomplete
|
|
16
|
+
mdl_alias: Incomplete
|
|
17
|
+
override_name: Incomplete
|
|
18
|
+
mod_bundle: Incomplete
|
|
19
|
+
language: Incomplete
|
|
20
|
+
items: Incomplete
|
|
21
|
+
module_name: Incomplete
|
|
22
|
+
package_path: Incomplete
|
|
23
|
+
caller_dir: Incomplete
|
|
24
|
+
full_target: Incomplete
|
|
25
|
+
def __init__(
|
|
26
|
+
self,
|
|
27
|
+
target: str,
|
|
28
|
+
base_path: str,
|
|
29
|
+
absorb: bool,
|
|
30
|
+
cachable: bool,
|
|
31
|
+
mdl_alias: str | None,
|
|
32
|
+
override_name: str | None,
|
|
33
|
+
mod_bundle: Module | str | None,
|
|
34
|
+
lng: str | None,
|
|
35
|
+
items: dict[str, str | str | None] | None,
|
|
36
|
+
) -> None: ...
|
|
37
|
+
def get_caller_dir(self) -> str: ...
|
|
38
|
+
|
|
39
|
+
class ImportReturn:
|
|
40
|
+
ret_mod: Incomplete
|
|
41
|
+
ret_items: Incomplete
|
|
42
|
+
importer: Incomplete
|
|
43
|
+
def __init__(
|
|
44
|
+
self,
|
|
45
|
+
ret_mod: types.ModuleType,
|
|
46
|
+
ret_items: list[types.ModuleType],
|
|
47
|
+
importer: Importer,
|
|
48
|
+
) -> None: ...
|
|
49
|
+
def process_items(
|
|
50
|
+
self,
|
|
51
|
+
module: types.ModuleType,
|
|
52
|
+
items: dict[str, str | str | None],
|
|
53
|
+
caller_dir: str,
|
|
54
|
+
lang: str | None,
|
|
55
|
+
mod_bundle: Module | None = None,
|
|
56
|
+
cachable: bool = True,
|
|
57
|
+
) -> None: ...
|
|
58
|
+
def load_jac_mod_as_item(
|
|
59
|
+
self,
|
|
60
|
+
module: types.ModuleType,
|
|
61
|
+
name: str,
|
|
62
|
+
jac_file_path: str,
|
|
63
|
+
mod_bundle: Module | None,
|
|
64
|
+
cachable: bool,
|
|
65
|
+
caller_dir: str,
|
|
66
|
+
) -> types.ModuleType | None: ...
|
|
67
|
+
|
|
68
|
+
class Importer:
|
|
69
|
+
jac_machine: Incomplete
|
|
70
|
+
result: Incomplete
|
|
71
|
+
def __init__(self, jac_machine: JacMachine) -> None: ...
|
|
72
|
+
def run_import(self, spec: ImportPathSpec) -> ImportReturn: ...
|
|
73
|
+
def update_sys(self, module: types.ModuleType, spec: ImportPathSpec) -> None: ...
|
|
74
|
+
def get_codeobj(
|
|
75
|
+
self,
|
|
76
|
+
full_target: str,
|
|
77
|
+
module_name: str,
|
|
78
|
+
mod_bundle: Module | None,
|
|
79
|
+
cachable: bool,
|
|
80
|
+
caller_dir: str,
|
|
81
|
+
) -> types.CodeType | None: ...
|
|
82
|
+
|
|
83
|
+
class PythonImporter(Importer):
|
|
84
|
+
jac_machine: Incomplete
|
|
85
|
+
def __init__(self, jac_machine: JacMachine) -> None: ...
|
|
86
|
+
result: Incomplete
|
|
87
|
+
def run_import(self, spec: ImportPathSpec) -> ImportReturn: ...
|
|
88
|
+
|
|
89
|
+
class JacImporter(Importer):
|
|
90
|
+
jac_machine: Incomplete
|
|
91
|
+
def __init__(self, jac_machine: JacMachine) -> None: ...
|
|
92
|
+
def get_sys_mod_name(self, full_target: str) -> str: ...
|
|
93
|
+
def handle_directory(
|
|
94
|
+
self, module_name: str, full_mod_path: str, mod_bundle: Module | str | None
|
|
95
|
+
) -> types.ModuleType: ...
|
|
96
|
+
def create_jac_py_module(
|
|
97
|
+
self,
|
|
98
|
+
mod_bundle: Module | str | None,
|
|
99
|
+
module_name: str,
|
|
100
|
+
package_path: str,
|
|
101
|
+
full_target: str,
|
|
102
|
+
) -> types.ModuleType: ...
|
|
103
|
+
result: Incomplete
|
|
104
|
+
def run_import(self, spec: ImportPathSpec) -> ImportReturn: ...
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import shelve
|
|
2
|
+
from .architype import Architype as Architype
|
|
3
|
+
from _typeshed import Incomplete
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
class Memory:
|
|
7
|
+
mem: dict[UUID, Architype]
|
|
8
|
+
save_obj_list: dict[UUID, Architype]
|
|
9
|
+
def __init__(self) -> None: ...
|
|
10
|
+
def get_obj(self, obj_id: UUID) -> Architype | None: ...
|
|
11
|
+
def get_obj_from_store(self, obj_id: UUID) -> Architype | None: ...
|
|
12
|
+
def has_obj(self, obj_id: UUID) -> bool: ...
|
|
13
|
+
def has_obj_in_store(self, obj_id: UUID) -> bool: ...
|
|
14
|
+
def save_obj(self, item: Architype, persistent: bool) -> None: ...
|
|
15
|
+
def commit(self) -> None: ...
|
|
16
|
+
def close(self) -> None: ...
|
|
17
|
+
|
|
18
|
+
class ShelveStorage(Memory):
|
|
19
|
+
storage: shelve.Shelf | None
|
|
20
|
+
def __init__(self, session: str = "") -> None: ...
|
|
21
|
+
def get_obj_from_store(self, obj_id: UUID) -> Architype | None: ...
|
|
22
|
+
def has_obj_in_store(self, obj_id: UUID | str) -> bool: ...
|
|
23
|
+
def commit(self) -> None: ...
|
|
24
|
+
session: Incomplete
|
|
25
|
+
def connect(self, session: str) -> None: ...
|
|
26
|
+
def close(self) -> None: ...
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import ast as ast3
|
|
2
|
+
import jaclang.compiler.absyntree as ast
|
|
3
|
+
from jaclang.compiler.semtable import SemScope as SemScope
|
|
4
|
+
from jaclang.runtimelib.constructs import (
|
|
5
|
+
NodeAnchor as NodeAnchor,
|
|
6
|
+
NodeArchitype as NodeArchitype,
|
|
7
|
+
)
|
|
8
|
+
from typing import Callable, Iterator
|
|
9
|
+
|
|
10
|
+
def sys_path_context(path: str) -> Iterator[None]: ...
|
|
11
|
+
def collect_node_connections(
|
|
12
|
+
current_node: NodeAnchor, visited_nodes: set, connections: set
|
|
13
|
+
) -> None: ...
|
|
14
|
+
def traverse_graph(
|
|
15
|
+
node: NodeArchitype,
|
|
16
|
+
cur_depth: int,
|
|
17
|
+
depth: int,
|
|
18
|
+
edge_type: list[str],
|
|
19
|
+
traverse: bool,
|
|
20
|
+
connections: list,
|
|
21
|
+
node_depths: dict[NodeArchitype, int],
|
|
22
|
+
visited_nodes: list,
|
|
23
|
+
queue: list,
|
|
24
|
+
bfs: bool,
|
|
25
|
+
dfs: Callable,
|
|
26
|
+
node_limit: int,
|
|
27
|
+
edge_limit: int,
|
|
28
|
+
) -> None: ...
|
|
29
|
+
def get_sem_scope(node: ast.AstNode) -> SemScope: ...
|
|
30
|
+
def extract_type(node: ast.AstNode) -> list[str]: ...
|
|
31
|
+
def extract_params(
|
|
32
|
+
body: ast.FuncCall,
|
|
33
|
+
) -> tuple[
|
|
34
|
+
dict[str, ast.Expr], list[tuple[str, ast3.AST]], list[tuple[str, ast3.AST]]
|
|
35
|
+
]: ...
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
__all__ = ["settings"]
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class Settings:
|
|
8
|
+
fuse_type_info_debug: bool = ...
|
|
9
|
+
filter_sym_builtins: bool = ...
|
|
10
|
+
ast_symbol_info_detailed: bool = ...
|
|
11
|
+
pass_timer: bool = ...
|
|
12
|
+
py_raise: bool = ...
|
|
13
|
+
py_raise_deep: bool = ...
|
|
14
|
+
max_line_length: int = ...
|
|
15
|
+
lsp_debug: bool = ...
|
|
16
|
+
config_file_path = ...
|
|
17
|
+
def __post_init__(self) -> None: ...
|
|
18
|
+
def load_all(self) -> None: ...
|
|
19
|
+
def load_config_file(self) -> None: ...
|
|
20
|
+
def load_env_vars(self) -> None: ...
|
|
21
|
+
def str_to_bool(self, value: str) -> bool: ...
|
|
22
|
+
def convert_type(self, value: str) -> bool | str | int: ...
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
fuse_type_info_debug=...,
|
|
26
|
+
filter_sym_builtins=...,
|
|
27
|
+
ast_symbol_info_detailed=...,
|
|
28
|
+
pass_timer=...,
|
|
29
|
+
py_raise=...,
|
|
30
|
+
py_raise_deep=...,
|
|
31
|
+
max_line_length=...,
|
|
32
|
+
lsp_debug=...,
|
|
33
|
+
) -> None: ...
|
|
34
|
+
|
|
35
|
+
settings: Incomplete
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import pdb
|
|
2
|
+
from _typeshed import Incomplete
|
|
3
|
+
|
|
4
|
+
def pascal_to_snake(pascal_string: str) -> str: ...
|
|
5
|
+
def heading_to_snake(heading: str) -> str: ...
|
|
6
|
+
def add_line_numbers(s: str) -> str: ...
|
|
7
|
+
def clip_code_section(s: str, target_line: int, line_range: int) -> str: ...
|
|
8
|
+
def get_ast_nodes_as_snake_case() -> list[str]: ...
|
|
9
|
+
def extract_headings(file_path: str) -> dict[str, tuple[int, int]]: ...
|
|
10
|
+
def auto_generate_refs() -> None: ...
|
|
11
|
+
def is_standard_lib_module(module_path: str) -> bool: ...
|
|
12
|
+
|
|
13
|
+
class Jdb(pdb.Pdb):
|
|
14
|
+
prompt: str
|
|
15
|
+
def __init__(self, *args, **kwargs) -> None: ...
|
|
16
|
+
def has_breakpoint(self, bytecode: bytes) -> bool: ...
|
|
17
|
+
|
|
18
|
+
debugger: Incomplete
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import jaclang.compiler.absyntree as ast
|
|
2
|
+
from _typeshed import Incomplete
|
|
3
|
+
from jaclang.compiler.compile import jac_file_to_pass as jac_file_to_pass
|
|
4
|
+
from jaclang.compiler.passes.main.pyast_load_pass import (
|
|
5
|
+
PyastBuildPass as PyastBuildPass,
|
|
6
|
+
)
|
|
7
|
+
from jaclang.compiler.passes.main.schedules import (
|
|
8
|
+
py_code_gen as py_code_gen,
|
|
9
|
+
py_code_gen_typed as py_code_gen_typed,
|
|
10
|
+
type_checker_sched as type_checker_sched,
|
|
11
|
+
)
|
|
12
|
+
from jaclang.compiler.symtable import SymbolTable as SymbolTable
|
|
13
|
+
from jaclang.utils.helpers import (
|
|
14
|
+
auto_generate_refs as auto_generate_refs,
|
|
15
|
+
pascal_to_snake as pascal_to_snake,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
class AstKidInfo:
|
|
19
|
+
name: Incomplete
|
|
20
|
+
typ: Incomplete
|
|
21
|
+
default: Incomplete
|
|
22
|
+
def __init__(self, name: str, typ: str, default: str | None = None) -> None: ...
|
|
23
|
+
|
|
24
|
+
class AstNodeInfo:
|
|
25
|
+
type_map: dict[str, type]
|
|
26
|
+
cls: Incomplete
|
|
27
|
+
def __init__(self, cls: type) -> None: ...
|
|
28
|
+
name: Incomplete
|
|
29
|
+
doc: Incomplete
|
|
30
|
+
class_name_snake: Incomplete
|
|
31
|
+
init_sig: Incomplete
|
|
32
|
+
kids: Incomplete
|
|
33
|
+
def process(self, cls: type[ast.AstNode]) -> None: ...
|
|
34
|
+
|
|
35
|
+
class AstTool:
|
|
36
|
+
ast_classes: Incomplete
|
|
37
|
+
def __init__(self) -> None: ...
|
|
38
|
+
def pass_template(self) -> str: ...
|
|
39
|
+
def py_ast_nodes(self) -> str: ...
|
|
40
|
+
def md_doc(self) -> str: ...
|
|
41
|
+
def ir(self, args: list[str]) -> str: ...
|
|
42
|
+
def automate_ref(self) -> str: ...
|
|
43
|
+
def gen_parser(self) -> str: ...
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import ast as ast3
|
|
2
|
+
from _typeshed import Incomplete
|
|
3
|
+
from jaclang.compiler.absyntree import AstNode as AstNode, SymbolTable as SymbolTable
|
|
4
|
+
from jaclang.settings import settings as settings
|
|
5
|
+
|
|
6
|
+
id_bag: dict
|
|
7
|
+
id_used: int
|
|
8
|
+
CLASS_COLOR_MAP: dict[str, str]
|
|
9
|
+
|
|
10
|
+
def dotgen_ast_tree(root: AstNode, dot_lines: list[str] | None = None) -> str: ...
|
|
11
|
+
def print_ast_tree(
|
|
12
|
+
root: AstNode | ast3.AST,
|
|
13
|
+
marker: str = "+-- ",
|
|
14
|
+
level_markers: list[bool] | None = None,
|
|
15
|
+
output_file: str | None = None,
|
|
16
|
+
max_depth: int | None = None,
|
|
17
|
+
) -> str: ...
|
|
18
|
+
|
|
19
|
+
class SymbolTree:
|
|
20
|
+
kid: Incomplete
|
|
21
|
+
name: Incomplete
|
|
22
|
+
def __init__(
|
|
23
|
+
self,
|
|
24
|
+
node_name: str,
|
|
25
|
+
parent: SymbolTree | None = None,
|
|
26
|
+
children: list[SymbolTree] | None = None,
|
|
27
|
+
) -> None: ...
|
|
28
|
+
@property
|
|
29
|
+
def parent(self) -> SymbolTree | None: ...
|
|
30
|
+
@parent.setter
|
|
31
|
+
def parent(self, parent_node: SymbolTree | None) -> None: ...
|
|
32
|
+
|
|
33
|
+
def print_symtab_tree(
|
|
34
|
+
root: SymbolTable,
|
|
35
|
+
marker: str = "+-- ",
|
|
36
|
+
level_markers: list[bool] | None = None,
|
|
37
|
+
output_file: str | None = None,
|
|
38
|
+
depth: int | None = None,
|
|
39
|
+
) -> str: ...
|
|
40
|
+
def get_symtab_tree_str(
|
|
41
|
+
root: SymbolTree,
|
|
42
|
+
marker: str = "+-- ",
|
|
43
|
+
level_markers: list[bool] | None = None,
|
|
44
|
+
output_file: str | None = None,
|
|
45
|
+
depth: int | None = None,
|
|
46
|
+
) -> str: ...
|
|
47
|
+
def dotgen_symtab_tree(node: SymbolTable) -> str: ...
|
jaclang/tests/test_cli.py
CHANGED
|
@@ -190,6 +190,33 @@ class JacCliTests(TestCase):
|
|
|
190
190
|
r"8\:37 \- 8:44.*ModuleItem - display - abs_path\:.*fixtures/pygame_mock/display.py",
|
|
191
191
|
)
|
|
192
192
|
|
|
193
|
+
def test_builtins_loading(self) -> None:
|
|
194
|
+
"""Testing for print AstTool."""
|
|
195
|
+
from jaclang.settings import settings
|
|
196
|
+
|
|
197
|
+
settings.ast_symbol_info_detailed = True
|
|
198
|
+
captured_output = io.StringIO()
|
|
199
|
+
sys.stdout = captured_output
|
|
200
|
+
|
|
201
|
+
cli.tool("ir", ["ast", f"{self.fixture_abs_path('builtins_test.jac')}"])
|
|
202
|
+
|
|
203
|
+
sys.stdout = sys.__stdout__
|
|
204
|
+
stdout_value = captured_output.getvalue()
|
|
205
|
+
settings.ast_symbol_info_detailed = False
|
|
206
|
+
|
|
207
|
+
self.assertRegex(
|
|
208
|
+
stdout_value,
|
|
209
|
+
r"2\:8 \- 2\:12.*BuiltinType - list - .*SymbolPath: builtins_test.builtins.list",
|
|
210
|
+
)
|
|
211
|
+
self.assertRegex(
|
|
212
|
+
stdout_value,
|
|
213
|
+
r"15\:5 \- 15\:8.*Name - dir - .*SymbolPath: builtins_test.builtins.dir",
|
|
214
|
+
)
|
|
215
|
+
self.assertRegex(
|
|
216
|
+
stdout_value,
|
|
217
|
+
r"13\:12 \- 13\:18.*Name - append - .*SymbolPath: builtins_test.builtins.list.append",
|
|
218
|
+
)
|
|
219
|
+
|
|
193
220
|
def test_ast_dotgen(self) -> None:
|
|
194
221
|
"""Testing for print AstTool."""
|
|
195
222
|
captured_output = io.StringIO()
|
|
@@ -218,8 +245,8 @@ class JacCliTests(TestCase):
|
|
|
218
245
|
sys.stdout = sys.__stdout__
|
|
219
246
|
stdout_value = captured_output.getvalue()
|
|
220
247
|
self.assertEqual(stdout_value.count("type_info.ServerWrapper"), 7)
|
|
221
|
-
self.assertEqual(stdout_value.count("builtins.int"),
|
|
222
|
-
self.assertEqual(stdout_value.count("builtins.str"),
|
|
248
|
+
self.assertEqual(stdout_value.count("builtins.int"), 3)
|
|
249
|
+
self.assertEqual(stdout_value.count("builtins.str"), 10)
|
|
223
250
|
|
|
224
251
|
def test_build_and_run(self) -> None:
|
|
225
252
|
"""Testing for print AstTool."""
|
jaclang/tests/test_language.py
CHANGED
|
@@ -1020,3 +1020,13 @@ class JacLanguageTests(TestCase):
|
|
|
1020
1020
|
self.assertEqual(len(stdout_value[0]), 32)
|
|
1021
1021
|
self.assertEqual("MyNode(value=0)", stdout_value[1])
|
|
1022
1022
|
self.assertEqual("valid: True", stdout_value[2])
|
|
1023
|
+
|
|
1024
|
+
def test_match_multi_ex(self) -> None:
|
|
1025
|
+
"""Test match case with multiple expressions."""
|
|
1026
|
+
captured_output = io.StringIO()
|
|
1027
|
+
sys.stdout = captured_output
|
|
1028
|
+
jac_import("match_multi_ex", base_path=self.fixture_abs_path("./"))
|
|
1029
|
+
sys.stdout = sys.__stdout__
|
|
1030
|
+
stdout_value = captured_output.getvalue().split("\n")
|
|
1031
|
+
self.assertEqual("Ten", stdout_value[0])
|
|
1032
|
+
self.assertEqual("ten", stdout_value[1])
|
jaclang/utils/treeprinter.py
CHANGED
|
@@ -113,7 +113,7 @@ def print_ast_tree(
|
|
|
113
113
|
if node.sym
|
|
114
114
|
else "<No Symbol is associated with this node>"
|
|
115
115
|
)
|
|
116
|
-
out += f" SymbolPath: {symbol}"
|
|
116
|
+
out += f", SymbolPath: {symbol}"
|
|
117
117
|
return out
|
|
118
118
|
elif isinstance(node, Token):
|
|
119
119
|
return f"{node.__class__.__name__} - {node.value}, {access}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jaclang
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.20
|
|
4
4
|
Summary: Jac is a unique and powerful programming language that runs on top of Python, offering an unprecedented level of intelligence and intuitive understanding.
|
|
5
5
|
Home-page: https://jaseci.org
|
|
6
6
|
License: MIT
|