jaclang 0.7.8__py3-none-any.whl → 0.7.9__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/passes/main/type_check_pass.py +19 -1
- jaclang/compiler/passes/tool/tests/test_unparse_validate.py +1 -1
- jaclang/langserve/engine.py +17 -8
- jaclang/langserve/server.py +12 -17
- jaclang/py.typed +0 -0
- {jaclang-0.7.8.dist-info → jaclang-0.7.9.dist-info}/METADATA +1 -1
- {jaclang-0.7.8.dist-info → jaclang-0.7.9.dist-info}/RECORD +10 -9
- {jaclang-0.7.8.dist-info → jaclang-0.7.9.dist-info}/WHEEL +0 -0
- {jaclang-0.7.8.dist-info → jaclang-0.7.9.dist-info}/entry_points.txt +0 -0
jaclang/compiler/absyntree.py
CHANGED
|
@@ -676,7 +676,7 @@ class Module(AstDocNode):
|
|
|
676
676
|
if self.doc:
|
|
677
677
|
new_kid.append(self.doc)
|
|
678
678
|
new_kid.extend(self.body)
|
|
679
|
-
self.set_kids(nodes=new_kid)
|
|
679
|
+
self.set_kids(nodes=new_kid if len(new_kid) else [EmptyToken()])
|
|
680
680
|
return res
|
|
681
681
|
|
|
682
682
|
def unparse(self) -> str:
|
|
@@ -8,6 +8,7 @@ import os
|
|
|
8
8
|
import pathlib
|
|
9
9
|
import sys
|
|
10
10
|
|
|
11
|
+
# import jaclang
|
|
11
12
|
import jaclang.compiler.absyntree as ast
|
|
12
13
|
import jaclang.compiler.passes.utils.mypy_ast_build as myab
|
|
13
14
|
from jaclang.compiler.constant import Constants as Con
|
|
@@ -93,12 +94,29 @@ class JacTypeCheckPass(Pass):
|
|
|
93
94
|
mypy_graph[module.name] = st
|
|
94
95
|
new_modules.append(st)
|
|
95
96
|
|
|
97
|
+
# def get_stub(mod: str) -> myab.BuildSource:
|
|
98
|
+
# """Get stub file path."""
|
|
99
|
+
# return myab.BuildSource(
|
|
100
|
+
# path=str(
|
|
101
|
+
# pathlib.Path(os.path.dirname(jaclang.__file__)).parent
|
|
102
|
+
# / "stubs"
|
|
103
|
+
# / "jaclang"
|
|
104
|
+
# / "plugin"
|
|
105
|
+
# / f"{mod}.pyi"
|
|
106
|
+
# ),
|
|
107
|
+
# module=f"jaclang.plugin.{mod}",
|
|
108
|
+
# )
|
|
109
|
+
|
|
96
110
|
graph = myab.load_graph(
|
|
97
111
|
[
|
|
98
112
|
myab.BuildSource(
|
|
99
113
|
path=str(self.__path / "typeshed" / "stdlib" / "builtins.pyi"),
|
|
100
114
|
module="builtins",
|
|
101
|
-
)
|
|
115
|
+
),
|
|
116
|
+
# get_stub("default"),
|
|
117
|
+
# get_stub("feature"),
|
|
118
|
+
# get_stub("spec"),
|
|
119
|
+
# get_stub("builtin"),
|
|
102
120
|
],
|
|
103
121
|
manager,
|
|
104
122
|
old_graph=mypy_graph,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import ast as ast3
|
|
4
4
|
from difflib import unified_diff
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
from jaclang.compiler.compile import jac_file_to_pass, jac_str_to_pass
|
|
8
8
|
from jaclang.compiler.passes.main import PyastGenPass
|
|
9
9
|
from jaclang.compiler.passes.main.schedules import py_code_gen as without_format
|
jaclang/langserve/engine.py
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import asyncio
|
|
5
6
|
import logging
|
|
7
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
6
8
|
from enum import IntEnum
|
|
7
9
|
from typing import Optional
|
|
8
10
|
|
|
@@ -126,8 +128,9 @@ class JacLangServer(LanguageServer):
|
|
|
126
128
|
"""Initialize workspace."""
|
|
127
129
|
super().__init__("jac-lsp", "v0.1")
|
|
128
130
|
self.modules: dict[str, ModuleInfo] = {}
|
|
131
|
+
self.executor = ThreadPoolExecutor()
|
|
129
132
|
|
|
130
|
-
def push_diagnostics(self, file_path: str) -> None:
|
|
133
|
+
async def push_diagnostics(self, file_path: str) -> None:
|
|
131
134
|
"""Push diagnostics for a file."""
|
|
132
135
|
if file_path in self.modules:
|
|
133
136
|
self.publish_diagnostics(
|
|
@@ -230,17 +233,23 @@ class JacLangServer(LanguageServer):
|
|
|
230
233
|
self.update_modules(file_path, build, ALev.TYPE)
|
|
231
234
|
return len(self.modules[file_path].errors) == 0
|
|
232
235
|
|
|
233
|
-
def analyze_and_publish(self, uri: str, level: int = 2) -> None:
|
|
236
|
+
async def analyze_and_publish(self, uri: str, level: int = 2) -> None:
|
|
234
237
|
"""Analyze and publish diagnostics."""
|
|
235
238
|
self.log_py(f"Analyzing {uri}...")
|
|
236
|
-
success =
|
|
237
|
-
|
|
239
|
+
success = await asyncio.get_event_loop().run_in_executor(
|
|
240
|
+
self.executor, self.quick_check, uri
|
|
241
|
+
)
|
|
242
|
+
await self.push_diagnostics(uri)
|
|
238
243
|
if success and level > 0:
|
|
239
|
-
success =
|
|
240
|
-
|
|
244
|
+
success = await asyncio.get_event_loop().run_in_executor(
|
|
245
|
+
self.executor, self.deep_check, uri
|
|
246
|
+
)
|
|
247
|
+
await self.push_diagnostics(uri)
|
|
241
248
|
if level > 1:
|
|
242
|
-
|
|
243
|
-
|
|
249
|
+
await asyncio.get_event_loop().run_in_executor(
|
|
250
|
+
self.executor, self.type_check, uri
|
|
251
|
+
)
|
|
252
|
+
await self.push_diagnostics(uri)
|
|
244
253
|
|
|
245
254
|
def get_completion(
|
|
246
255
|
self, file_path: str, position: lspt.Position
|
jaclang/langserve/server.py
CHANGED
|
@@ -18,21 +18,24 @@ server = JacLangServer()
|
|
|
18
18
|
|
|
19
19
|
@server.feature(lspt.TEXT_DOCUMENT_DID_OPEN)
|
|
20
20
|
@server.feature(lspt.TEXT_DOCUMENT_DID_SAVE)
|
|
21
|
-
def did_open(ls: JacLangServer, params: lspt.DidOpenTextDocumentParams) -> None:
|
|
21
|
+
async def did_open(ls: JacLangServer, params: lspt.DidOpenTextDocumentParams) -> None:
|
|
22
22
|
"""Check syntax on change."""
|
|
23
|
-
ls.analyze_and_publish(params.text_document.uri)
|
|
24
|
-
# token_params = lspt.SemanticTokensParams(
|
|
25
|
-
# text_document=lspt.TextDocumentIdentifier(uri=params.text_document.uri)
|
|
26
|
-
# )
|
|
27
|
-
# tokens = semantic_tokens_full(ls, token_params)
|
|
28
|
-
# ls.send_notification("textDocument/publishSemanticTokens", tokens)
|
|
23
|
+
await ls.analyze_and_publish(params.text_document.uri)
|
|
29
24
|
|
|
30
25
|
|
|
31
26
|
@server.feature(lspt.TEXT_DOCUMENT_DID_CHANGE)
|
|
32
|
-
@debounce(0.
|
|
27
|
+
@debounce(0.3)
|
|
33
28
|
async def did_change(ls: JacLangServer, params: lspt.DidOpenTextDocumentParams) -> None:
|
|
34
29
|
"""Check syntax on change."""
|
|
35
|
-
ls.analyze_and_publish(params.text_document.uri, level=
|
|
30
|
+
await ls.analyze_and_publish(params.text_document.uri, level=1)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@server.feature(lspt.TEXT_DOCUMENT_FORMATTING)
|
|
34
|
+
def formatting(
|
|
35
|
+
ls: JacLangServer, params: lspt.DocumentFormattingParams
|
|
36
|
+
) -> list[lspt.TextEdit]:
|
|
37
|
+
"""Format the given document."""
|
|
38
|
+
return ls.formatted_jac(params.text_document.uri)
|
|
36
39
|
|
|
37
40
|
|
|
38
41
|
@server.feature(
|
|
@@ -86,14 +89,6 @@ def completion(ls: JacLangServer, params: lspt.CompletionParams) -> lspt.Complet
|
|
|
86
89
|
return ls.get_completion(params.text_document.uri, params.position)
|
|
87
90
|
|
|
88
91
|
|
|
89
|
-
@server.feature(lspt.TEXT_DOCUMENT_FORMATTING)
|
|
90
|
-
def formatting(
|
|
91
|
-
ls: JacLangServer, params: lspt.DocumentFormattingParams
|
|
92
|
-
) -> list[lspt.TextEdit]:
|
|
93
|
-
"""Format the given document."""
|
|
94
|
-
return ls.formatted_jac(params.text_document.uri)
|
|
95
|
-
|
|
96
|
-
|
|
97
92
|
@server.feature(lspt.TEXT_DOCUMENT_HOVER, lspt.HoverOptions(work_done_progress=True))
|
|
98
93
|
def hover(
|
|
99
94
|
ls: JacLangServer, params: lspt.TextDocumentPositionParams
|
jaclang/py.typed
ADDED
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jaclang
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.9
|
|
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
|
|
@@ -6,7 +6,7 @@ jaclang/cli/cli.py,sha256=8CbN_oqMhZ71AJhgA9J0Q551GMO3ey273dgaFPckLyI,13582
|
|
|
6
6
|
jaclang/cli/cmdreg.py,sha256=u0jAd6A8czt7tBgPBBKBhYAG4By1FrjEGaTU2XFKeYs,8372
|
|
7
7
|
jaclang/compiler/.gitignore,sha256=n1k2_xXTorp9PY8hhYM4psHircn-NMaFx95bSgDKopo,10
|
|
8
8
|
jaclang/compiler/__init__.py,sha256=P8h-q53h-MTK8Wmvpb7sP5R6Ojz94Y2F9nqMwIUt0d4,3064
|
|
9
|
-
jaclang/compiler/absyntree.py,sha256=
|
|
9
|
+
jaclang/compiler/absyntree.py,sha256=Xwkd3sxRmjWobNZEO-UNDmDfSC0wA0ihN-FSRXrZ-1Q,134545
|
|
10
10
|
jaclang/compiler/codeloc.py,sha256=YhJcHjhMCOT6mV1qLehwriuFgW0H2-ntq68k_r8yBs4,2800
|
|
11
11
|
jaclang/compiler/compile.py,sha256=0d8p4i2LXg2RCu1XfWx_Jq_dx7pK2Zn2VIj-apvX_nI,3389
|
|
12
12
|
jaclang/compiler/constant.py,sha256=n4KaEkvnb9-KVJJVvxiWimhjbrOiknBvLHAVDBFbF7Y,8991
|
|
@@ -62,7 +62,7 @@ jaclang/compiler/passes/main/tests/test_sub_node_pass.py,sha256=I8m2SM2Z-OJkRG3C
|
|
|
62
62
|
jaclang/compiler/passes/main/tests/test_sym_tab_build_pass.py,sha256=85mUM6mYYLCrQ9AivBIbreG7CgdsJH2zrNOqdcpnwBo,730
|
|
63
63
|
jaclang/compiler/passes/main/tests/test_type_check_pass.py,sha256=v2_KmcyX1_fOpReRKM0mUnlFXKVPRvFCMR3Mw9ftytI,2265
|
|
64
64
|
jaclang/compiler/passes/main/tests/test_typeinfo_pass.py,sha256=ehC0_giLg7NwB7fR10nW5Te8mZ76qmUFxkK1bEjtmrw,129
|
|
65
|
-
jaclang/compiler/passes/main/type_check_pass.py,sha256=
|
|
65
|
+
jaclang/compiler/passes/main/type_check_pass.py,sha256=TyVC3jmuxMvG8Fo4TbceMnRSgZxX98m65cfMh10C5O8,4073
|
|
66
66
|
jaclang/compiler/passes/tool/__init__.py,sha256=xekCOXysHIcthWm8NRmQoA1Ah1XV8vFbkfeHphJtUdc,223
|
|
67
67
|
jaclang/compiler/passes/tool/fuse_comments_pass.py,sha256=N9a84qArNuTXX1iaXsBzqcufx6A3zYq2p-1ieH6FmHc,3133
|
|
68
68
|
jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=yqq2OOSs2tlDKUnPe0GS3NAZh8F5fquA5ZTYw44QX08,87356
|
|
@@ -100,7 +100,7 @@ jaclang/compiler/passes/tool/tests/fixtures/simple_walk.jac,sha256=6jwYKXxJ1B4Vf
|
|
|
100
100
|
jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac,sha256=6jwYKXxJ1B4VfYDFlQhStN3_QX7dDXzC2gI6U9-KhZM,806
|
|
101
101
|
jaclang/compiler/passes/tool/tests/test_fuse_comments_pass.py,sha256=ZeWHsm7VIyyS8KKpoB2SdlHM4jF22fMfSrfTfxt2MQw,398
|
|
102
102
|
jaclang/compiler/passes/tool/tests/test_jac_format_pass.py,sha256=AKGBEz02bS9REJuryZlPvY2avE_XWqKV8sRrnh5hu2g,6101
|
|
103
|
-
jaclang/compiler/passes/tool/tests/test_unparse_validate.py,sha256=
|
|
103
|
+
jaclang/compiler/passes/tool/tests/test_unparse_validate.py,sha256=HtaIGwLoY2yz1T3nkI9SFjMEnY_st7cnUcz6hmguR6I,2728
|
|
104
104
|
jaclang/compiler/passes/transform.py,sha256=GEHK3zFWrEjbAQ3mIl3D59jBuIrA8DRbw9t_IlUqg3M,2297
|
|
105
105
|
jaclang/compiler/passes/utils/__init__.py,sha256=UsI5rUopTUiStAzup4kbPwIwrnC5ofCrqWBCBbM2-k4,35
|
|
106
106
|
jaclang/compiler/passes/utils/mypy_ast_build.py,sha256=aPvvdGSwbOGHYiK5kY665bqtfjj7s2YfTONV4EuLai8,26162
|
|
@@ -126,8 +126,8 @@ jaclang/core/memory.py,sha256=7QukfL6wDBXrdpRn01yu4RMNkmIMNqFiKrI0zfpGSy4,2947
|
|
|
126
126
|
jaclang/core/test.py,sha256=HRCl3cf0uPTe58Kcx_sBUb6ow8J53rnmpFOhA7g9oAA,2851
|
|
127
127
|
jaclang/core/utils.py,sha256=uzEsRSuNSMMo7dlvCozGv0TnpUmHEjGNzUTZt1Df2gQ,7741
|
|
128
128
|
jaclang/langserve/__init__.py,sha256=3qbnivBBcLZCfmDYRMIeKkG08Lx7XQsJJg-qG8TU8yc,51
|
|
129
|
-
jaclang/langserve/engine.py,sha256=
|
|
130
|
-
jaclang/langserve/server.py,sha256=
|
|
129
|
+
jaclang/langserve/engine.py,sha256=ntvJB2silUagQZFLOahyXqh0Ef7E3uiMsE14PzunFOU,16708
|
|
130
|
+
jaclang/langserve/server.py,sha256=4WrJXEVYWEcTjXlNoRx0patf34tjPXENKg35ofSYhtI,4121
|
|
131
131
|
jaclang/langserve/tests/__init__.py,sha256=iDM47k6c3vahaWhwxpbkdEOshbmX-Zl5x669VONjS2I,23
|
|
132
132
|
jaclang/langserve/tests/defaults.py,sha256=8UWHuCHY-WatPcWFhyX9-4KLuJgODTlLNj0wNnKomIM,7608
|
|
133
133
|
jaclang/langserve/tests/fixtures/base_module_structure.jac,sha256=gtU3Uq0gsJy6G8Dg4IWiL-YSk_LVFAYK4mVEPt5rGpE,515
|
|
@@ -161,6 +161,7 @@ jaclang/plugin/tests/fixtures/simple_node_connection.jac,sha256=KdbpACWtnj92TqQq
|
|
|
161
161
|
jaclang/plugin/tests/fixtures/simple_persistent.jac,sha256=o0TZTOJEZjFW8A2IGY8ICBZEBZzHhqha0xQFFBK_DSI,624
|
|
162
162
|
jaclang/plugin/tests/test_features.py,sha256=p0N5inZn92Cj0eqslmDR0-q6pVG8hkcQfA6CuQcfP3Y,2352
|
|
163
163
|
jaclang/plugin/tests/test_jaseci.py,sha256=XcVL-FOZMTsjJEZqCa-rcYyEPl1dxdFFu9vhvm8kUaI,7956
|
|
164
|
+
jaclang/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
164
165
|
jaclang/settings.py,sha256=7rKy_kQkWjciwBoWHoJVYrK0nxLwaG54FFvFLOGGggk,3375
|
|
165
166
|
jaclang/tests/fixtures/abc.jac,sha256=AWzRxTBjvQwoLSOakjn0kKXWqKvDaUYGc1zmBk1Nd5c,1770
|
|
166
167
|
jaclang/tests/fixtures/access_checker.jac,sha256=6Inm14cZsyMfezFRs2zfnQEZSE_JRxVvytcZbox7BNw,375
|
|
@@ -1477,7 +1478,7 @@ jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjW
|
|
|
1477
1478
|
jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD,sha256=XS4fBVrPI7kaNZ56Ggl2RGa76jySWLqTzcrUpZIQTVM,418
|
|
1478
1479
|
jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
1479
1480
|
jaclang/vendor/typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451
|
|
1480
|
-
jaclang-0.7.
|
|
1481
|
-
jaclang-0.7.
|
|
1482
|
-
jaclang-0.7.
|
|
1483
|
-
jaclang-0.7.
|
|
1481
|
+
jaclang-0.7.9.dist-info/METADATA,sha256=uil9KBvccbzWC-m1gQEOrUjkRXcGBRyIctKEbLvQgGY,4807
|
|
1482
|
+
jaclang-0.7.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
1483
|
+
jaclang-0.7.9.dist-info/entry_points.txt,sha256=8sMi4Tvi9f8tQDN2QAXsSA2icO27zQ4GgEdph6bNEZM,49
|
|
1484
|
+
jaclang-0.7.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|