jaclang 0.7.9__py3-none-any.whl → 0.7.10__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/cli/cli.py CHANGED
@@ -243,7 +243,7 @@ def test(
243
243
 
244
244
  jac test => jac test -d .
245
245
  """
246
- Jac.run_test(
246
+ failcount = Jac.run_test(
247
247
  filepath=filepath,
248
248
  filter=filter,
249
249
  xit=xit,
@@ -251,6 +251,8 @@ def test(
251
251
  directory=directory,
252
252
  verbose=verbose,
253
253
  )
254
+ if failcount:
255
+ raise SystemExit(f"Tests failed: {failcount}")
254
256
 
255
257
 
256
258
  @cmd_registry.register
@@ -62,21 +62,35 @@ class ModuleInfo:
62
62
  """Return uri."""
63
63
  return uris.from_fs_path(self.ir.loc.mod_path)
64
64
 
65
- @property
66
- def has_syntax_error(self) -> bool:
67
- """Return if there are syntax errors."""
68
- return len(self.errors) > 0 and self.alev == ALev.QUICK
69
-
70
- def update_with(self, new_info: ModuleInfo, refresh: bool = False) -> None:
65
+ def update_with(
66
+ self,
67
+ build: Pass,
68
+ alev: ALev,
69
+ refresh: bool = False,
70
+ mod_override: Optional[ast.Module] = None,
71
+ ) -> None:
71
72
  """Update module info."""
72
- self.ir = new_info.ir
73
+ target_mod = mod_override if mod_override else build.ir
74
+ if not isinstance(target_mod, ast.Module):
75
+ return
76
+ self.ir = target_mod # if alev > ALev.QUICK else self.ir
73
77
  if refresh:
74
- self.errors = new_info.errors
75
- self.warnings = new_info.warnings
78
+ self.errors = build.errors_had
79
+ self.warnings = build.warnings_had
76
80
  else:
77
- self.errors += [i for i in new_info.errors if i not in self.errors]
78
- self.warnings += [i for i in new_info.warnings if i not in self.warnings]
79
- self.alev = new_info.alev
81
+ self.errors += [
82
+ i
83
+ for i in build.errors_had
84
+ if i not in self.errors
85
+ if i.loc.mod_path == target_mod.loc.mod_path
86
+ ]
87
+ self.warnings += [
88
+ i
89
+ for i in build.warnings_had
90
+ if i not in self.warnings
91
+ if i.loc.mod_path == target_mod.loc.mod_path
92
+ ]
93
+ self.alev = alev
80
94
  self.diagnostics = self.gen_diagnostics()
81
95
  if self.alev == ALev.TYPE:
82
96
  self.sem_tokens = self.gen_sem_tokens()
@@ -158,36 +172,36 @@ class JacLangServer(LanguageServer):
158
172
  if not isinstance(build.ir, ast.Module):
159
173
  self.log_error("Error with module build.")
160
174
  return
161
- new_mod = ModuleInfo(
162
- ir=build.ir,
163
- errors=[
164
- i
165
- for i in build.errors_had
166
- if i.loc.mod_path == uris.to_fs_path(file_path)
167
- ],
168
- warnings=[
169
- i
170
- for i in build.warnings_had
171
- if i.loc.mod_path == uris.to_fs_path(file_path)
172
- ],
173
- alev=alev,
174
- )
175
175
  if file_path in self.modules:
176
- self.modules[file_path].update_with(new_mod, refresh=refresh)
176
+ self.modules[file_path].update_with(build, alev, refresh=refresh)
177
177
  else:
178
- self.modules[file_path] = new_mod
179
- for p in build.ir.mod_deps.keys():
180
- uri = uris.from_fs_path(p)
181
- new_mod = ModuleInfo(
182
- ir=build.ir.mod_deps[p],
183
- errors=[i for i in build.errors_had if i.loc.mod_path == p],
184
- warnings=[i for i in build.warnings_had if i.loc.mod_path == p],
178
+ self.modules[file_path] = ModuleInfo(
179
+ ir=build.ir,
180
+ errors=[
181
+ i
182
+ for i in build.errors_had
183
+ if i.loc.mod_path == uris.to_fs_path(file_path)
184
+ ],
185
+ warnings=[
186
+ i
187
+ for i in build.warnings_had
188
+ if i.loc.mod_path == uris.to_fs_path(file_path)
189
+ ],
185
190
  alev=alev,
186
191
  )
192
+ for p in build.ir.mod_deps.keys():
193
+ uri = uris.from_fs_path(p)
187
194
  if not refresh and uri in self.modules:
188
- self.modules[uri].update_with(new_mod)
195
+ self.modules[uri].update_with(
196
+ build, alev, mod_override=build.ir.mod_deps[p], refresh=refresh
197
+ )
189
198
  else:
190
- self.modules[uri] = new_mod
199
+ self.modules[uri] = ModuleInfo(
200
+ ir=build.ir.mod_deps[p],
201
+ errors=[i for i in build.errors_had if i.loc.mod_path == p],
202
+ warnings=[i for i in build.warnings_had if i.loc.mod_path == p],
203
+ alev=alev,
204
+ )
191
205
  self.modules[uri].parent = (
192
206
  self.modules[file_path] if file_path != uri else None
193
207
  )
@@ -347,7 +361,9 @@ class JacLangServer(LanguageServer):
347
361
 
348
362
  def get_document_symbols(self, file_path: str) -> list[lspt.DocumentSymbol]:
349
363
  """Return document symbols for a file."""
350
- if root_node := self.modules[file_path].ir._sym_tab:
364
+ if file_path in self.modules and (
365
+ root_node := self.modules[file_path].ir._sym_tab
366
+ ):
351
367
  return collect_symbols(root_node)
352
368
  return []
353
369
 
jaclang/plugin/default.py CHANGED
@@ -251,9 +251,10 @@ class JacFeatureDefaults:
251
251
  maxfail: Optional[int],
252
252
  directory: Optional[str],
253
253
  verbose: bool,
254
- ) -> bool:
254
+ ) -> int:
255
255
  """Run the test suite in the specified .jac file."""
256
256
  test_file = False
257
+ ret_count = 0
257
258
  if filepath:
258
259
  if filepath.endswith(".jac"):
259
260
  base, mod_name = os.path.split(filepath)
@@ -262,6 +263,7 @@ class JacFeatureDefaults:
262
263
  JacTestCheck.reset()
263
264
  Jac.jac_import(target=mod_name, base_path=base)
264
265
  JacTestCheck.run_test(xit, maxfail, verbose)
266
+ ret_count = JacTestCheck.failcount
265
267
  else:
266
268
  print("Not a .jac file.")
267
269
  else:
@@ -293,10 +295,11 @@ class JacFeatureDefaults:
293
295
  if JacTestCheck.breaker and (xit or maxfail):
294
296
  break
295
297
  JacTestCheck.breaker = False
298
+ ret_count += JacTestCheck.failcount
296
299
  JacTestCheck.failcount = 0
297
300
  print("No test files found.") if not test_file else None
298
301
 
299
- return True
302
+ return ret_count
300
303
 
301
304
  @staticmethod
302
305
  @hookimpl
jaclang/plugin/feature.py CHANGED
@@ -132,7 +132,7 @@ class JacFeature:
132
132
  maxfail: Optional[int] = None,
133
133
  directory: Optional[str] = None,
134
134
  verbose: bool = False,
135
- ) -> bool:
135
+ ) -> int:
136
136
  """Run the test suite in the specified .jac file."""
137
137
  return pm.hook.run_test(
138
138
  filepath=filepath,
jaclang/plugin/spec.py CHANGED
@@ -121,7 +121,7 @@ class JacFeatureSpec:
121
121
  maxfail: Optional[int],
122
122
  directory: Optional[str],
123
123
  verbose: bool,
124
- ) -> bool:
124
+ ) -> int:
125
125
  """Run the test suite in the specified .jac file."""
126
126
  raise NotImplementedError
127
127
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  import io
4
4
  import sys
5
+ from contextlib import suppress
5
6
 
6
7
  from jaclang.cli import cli
7
8
  from jaclang.utils.test import TestCase
@@ -114,11 +115,12 @@ class JacCliTests(TestCase):
114
115
  sys.stdout = stdio_block
115
116
 
116
117
  # Execute the function
117
- cli.test(
118
- self.fixture_abs_path(
119
- "../../../examples/manual_code/circle_clean_tests.jac"
118
+ with suppress(SystemExit):
119
+ cli.test(
120
+ self.fixture_abs_path(
121
+ "../../../examples/manual_code/circle_clean_tests.jac"
122
+ )
120
123
  )
121
- )
122
124
 
123
125
  sys.stderr = sys.__stderr__
124
126
  sys.stdout = sys.__stdout__
jaclang/utils/helpers.py CHANGED
@@ -108,12 +108,12 @@ def auto_generate_refs() -> None:
108
108
  heading = heading.strip()
109
109
  heading_snakecase = heading_to_snake(heading)
110
110
  content = (
111
- f'## {heading}\n**Grammar Snippet**\n```yaml linenums="{lines[0]}"\n--8<-- '
112
- f'"jaclang/compiler/jac.lark:{lines[0]}:{lines[1]}"\n```\n'
113
- f'**Code Example**\n=== "Jac"\n ```jac linenums="1"\n --8<-- "examples/reference/'
111
+ f'## {heading}\n**Code Example**\n=== "Jac"\n ```jac linenums="1"\n --8<-- "examples/reference/'
114
112
  f'{heading_snakecase}.jac"\n'
115
113
  f' ```\n=== "Python"\n ```python linenums="1"\n --8<-- "examples/reference/'
116
114
  f'{heading_snakecase}.py"\n ```\n'
115
+ f'??? example "Jac Grammar Snippet"\n ```yaml linenums="{lines[0]}"\n --8<-- '
116
+ f'"jaclang/compiler/jac.lark:{lines[0]}:{lines[1]}"\n ```\n'
117
117
  "**Description**\n\n--8<-- "
118
118
  f'"examples/reference/'
119
119
  f'{heading_snakecase}.md"\n'
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaclang
3
- Version: 0.7.9
3
+ Version: 0.7.10
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
7
- Keywords: jac,jaclang,programming-language,machine-learning,artificial-intelligence
7
+ Keywords: jac,jaclang,jaseci,python,programming-language,machine-learning,artificial-intelligence
8
8
  Author: Jason Mars
9
9
  Author-email: jason@jaseci.org
10
10
  Requires-Python: >=3.11.0,<4.0.0
@@ -2,7 +2,7 @@ jaclang/__init__.py,sha256=quKqbhKk5CQ0k798jIXMbeAKzQxD0yhOpQGSvYD6TD8,399
2
2
  jaclang/cli/.gitignore,sha256=NYuons2lzuCpCdefMnztZxeSMgtPVJF6R6zSgVDOV20,27
3
3
  jaclang/cli/__init__.py,sha256=7aaPgYddIAHBvkdv36ngbfwsimMnfGaTDcaHYMg_vf4,23
4
4
  jaclang/cli/cli.md,sha256=4BPJGdcyvs_rXgd_DPEGjkKSGe5ureXXYaQsf-_z_LU,5939
5
- jaclang/cli/cli.py,sha256=8CbN_oqMhZ71AJhgA9J0Q551GMO3ey273dgaFPckLyI,13582
5
+ jaclang/cli/cli.py,sha256=LUu53it5DMotyuhY1f28twR3KTR2inhrYyml9Ga00NI,13667
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
@@ -126,7 +126,7 @@ 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=ntvJB2silUagQZFLOahyXqh0Ef7E3uiMsE14PzunFOU,16708
129
+ jaclang/langserve/engine.py,sha256=9Uyzn00usblkej_dc8J0g8DCZhPxgvbHEgYinyzUV-k,17212
130
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
@@ -151,9 +151,9 @@ jaclang/langserve/tests/test_server.py,sha256=Bmllojot7c40rq0mDMOAiOyowY0-ECh_qA
151
151
  jaclang/langserve/utils.py,sha256=JS_XxDAtqTO4r0wSQjxgGqHwx9xTN_JZpNI1YP-kgbY,9868
152
152
  jaclang/plugin/__init__.py,sha256=5t2krHKt_44PrCTGojzxEimxpNHYVQcn89jAiCSXE_k,165
153
153
  jaclang/plugin/builtin.py,sha256=MEMPUnj_rlwcCNmUkfH5S8iazMnQ6fpp6tls4fh5z7k,1188
154
- jaclang/plugin/default.py,sha256=PBRhDnMChwLbV-Mzuy5Uss1ziRZ3UNCnGfOb1D6fOP4,23533
155
- jaclang/plugin/feature.py,sha256=fhyQRNYOkcXlYn1ObFPqdOHPhtC_lGQfgd7RD2ooLUY,9792
156
- jaclang/plugin/spec.py,sha256=CMu6rzi94eIZaqsFz3NIbN3upJgGneb4FE_7Rly7slE,8893
154
+ jaclang/plugin/default.py,sha256=QF-ITQrpr_8zpX6P7PCuvD0CxPteY_EsEwDZSiUiSEA,23658
155
+ jaclang/plugin/feature.py,sha256=V1-Zis7DwLK1QrL1h89Dk_M45hNe5iyISE37PR_aFKU,9791
156
+ jaclang/plugin/spec.py,sha256=WjqNywrQYR8aSVa47Kx2RqgTFDfvWe2vydNIjxysy5M,8892
157
157
  jaclang/plugin/tests/__init__.py,sha256=rn_tNG8jCHWwBc_rx4yFkGc4N1GISb7aPuTFVRTvrTk,38
158
158
  jaclang/plugin/tests/fixtures/impl_match.jac,sha256=WEhcA1GlovusITEFO2bOjYYqiiULyYGKhM17uK2GqnI,91
159
159
  jaclang/plugin/tests/fixtures/impl_match_impl.jac,sha256=k1385r7Hdlq6mUKxEHa3VOKJUIWH08hYg2kErhbYwFM,31
@@ -245,11 +245,11 @@ jaclang/tests/fixtures/with_context.jac,sha256=cDA_4YWe5UVmQRgcpktzkZ_zsswQpV_T2
245
245
  jaclang/tests/test_bugs.py,sha256=tBPsIlSPqZDIz4QaScNRT-WdGIdJ0uU-aRBWq1XUZ6o,555
246
246
  jaclang/tests/test_cli.py,sha256=tnqdx8W5jTlsDJYR3713EikJqCbcgWEknEwuRHByvWk,8703
247
247
  jaclang/tests/test_language.py,sha256=T0DqM3aFjJ5_0oWqKhEkOyY1eruv-uGRgWkjWWcngXE,34671
248
- jaclang/tests/test_man_code.py,sha256=Kq93zg3hEfiouvpWvmfCgR6lDT5RKDp28k5ZaWe1Xeg,4519
248
+ jaclang/tests/test_man_code.py,sha256=fLaN9TxvaTsiEBcud0VO1KOsv0EjonNnuS-JcRHyji4,4606
249
249
  jaclang/tests/test_reference.py,sha256=FoZQS-U9teiag8mAmX5X6ak4fuCOv00mvOyqJ44Zkc8,3379
250
250
  jaclang/tests/test_settings.py,sha256=TIX5uiu8H9IpZN2__uFiclcdCpBpPpcAwtlEHyFC4kk,1999
251
251
  jaclang/utils/__init__.py,sha256=86LQ_LDyWV-JFkYBpeVHpLaVxkqwFDP60XpWXOFZIQk,46
252
- jaclang/utils/helpers.py,sha256=v-jQ-SDzGLrrLXKxoL1PaCguJqcV-X1UlwjWSL3GNAI,6142
252
+ jaclang/utils/helpers.py,sha256=aPAIj7j_Gqg0DToFj-DEbfea6gIbiBhAEFDtxw-Av4c,6168
253
253
  jaclang/utils/lang_tools.py,sha256=5R-Pe_ylXqWEPXrUGsQ3Vy7rrItf_mbyK19ptFSKiJI,10020
254
254
  jaclang/utils/log.py,sha256=G8Y_DnETgTh9xzvlW5gh9zqJ1ap4YY_MDTwIMu5Uc0Y,262
255
255
  jaclang/utils/test.py,sha256=Ll3H2l8U2OVQGHAkohsryDXIKSJHJseQSrMHS8JQTiw,5414
@@ -1478,7 +1478,7 @@ jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjW
1478
1478
  jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD,sha256=XS4fBVrPI7kaNZ56Ggl2RGa76jySWLqTzcrUpZIQTVM,418
1479
1479
  jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
1480
1480
  jaclang/vendor/typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451
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,,
1481
+ jaclang-0.7.10.dist-info/METADATA,sha256=ZGjbf_LoUyPYl01OoQViBQMvVuO0xsJAFz9IeQSUGXo,4822
1482
+ jaclang-0.7.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1483
+ jaclang-0.7.10.dist-info/entry_points.txt,sha256=8sMi4Tvi9f8tQDN2QAXsSA2icO27zQ4GgEdph6bNEZM,49
1484
+ jaclang-0.7.10.dist-info/RECORD,,