jaclang 0.5.17__py3-none-any.whl → 0.5.18__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/settings.py ADDED
@@ -0,0 +1,95 @@
1
+ """Main settings of Jac lang."""
2
+
3
+ import configparser
4
+ import os
5
+ from dataclasses import dataclass, fields
6
+
7
+
8
+ @dataclass
9
+ class Settings:
10
+ """Main settings of Jac lang."""
11
+
12
+ fuse_type_info_debug: bool = False
13
+ jac_proc_debug: bool = False
14
+
15
+ def __post_init__(self) -> None:
16
+ """Initialize settings."""
17
+ home_dir = os.path.expanduser("~")
18
+ config_dir = os.path.join(home_dir, ".jaclang")
19
+ self.config_file_path = os.path.join(config_dir, "config.ini")
20
+ os.makedirs(config_dir, exist_ok=True)
21
+ if not os.path.exists(self.config_file_path):
22
+ with open(self.config_file_path, "w") as f:
23
+ f.write("[settings]\n")
24
+ self.load_all()
25
+
26
+ def load_all(self) -> None:
27
+ """Load settings from all available sources."""
28
+ self.load_config_file()
29
+ self.load_env_vars()
30
+
31
+ def load_config_file(self) -> None:
32
+ """Load settings from a configuration file."""
33
+ config_parser = configparser.ConfigParser()
34
+ config_parser.read(self.config_file_path)
35
+ if "settings" in config_parser:
36
+ for key in config_parser["settings"]:
37
+ if key in [f.name for f in fields(self)]:
38
+ setattr(
39
+ self, key, self.convert_type(config_parser["settings"][key])
40
+ )
41
+
42
+ def load_env_vars(self) -> None:
43
+ """Override settings from environment variables if available."""
44
+ for key in [f.name for f in fields(self)]:
45
+ env_value = os.getenv("JACLANG_" + key.upper())
46
+ if env_value is not None:
47
+ setattr(self, key, self.convert_type(env_value))
48
+
49
+ # def load_command_line_arguments(self):
50
+ # """Override settings from command-line arguments if provided."""
51
+ # parser = argparse.ArgumentParser()
52
+ # parser.add_argument(
53
+ # "--debug",
54
+ # type=self.str_to_bool,
55
+ # nargs="?",
56
+ # const=True,
57
+ # default=self.config["debug"],
58
+ # )
59
+ # parser.add_argument("--port", type=int, default=self.config["port"])
60
+ # parser.add_argument("--host", default=self.config["host"])
61
+ # args = parser.parse_args()
62
+
63
+ def str_to_bool(self, value: str) -> bool:
64
+ """Convert string to boolean."""
65
+ return value.lower() in ("yes", "y", "true", "t", "1")
66
+
67
+ def convert_type(self, value: str) -> bool | str | int:
68
+ """Convert string values from the config to the appropriate type."""
69
+ if value.isdigit():
70
+ return int(value)
71
+ if value.lower() in (
72
+ "true",
73
+ "false",
74
+ "t",
75
+ "f",
76
+ "yes",
77
+ "no",
78
+ "y",
79
+ "n",
80
+ "1",
81
+ "0",
82
+ ):
83
+ return self.str_to_bool(value)
84
+ return value
85
+
86
+ def __str__(self) -> str:
87
+ """Return string representation of the settings."""
88
+ return "\n".join(
89
+ [f"{field.name}: {getattr(self, field.name)}" for field in fields(self)]
90
+ )
91
+
92
+
93
+ settings = Settings()
94
+
95
+ __all__ = ["settings"]
@@ -3637,11 +3637,10 @@ class TypeChecker(NodeVisitor[None], CheckerPluginInterface):
3637
3637
  if (
3638
3638
  lv.node.final_unset_in_class
3639
3639
  and not lv.node.final_set_in_init
3640
- and not self.is_stub
3641
- and # It is OK to skip initializer in stub files.
3640
+ and not self.is_stub # It is OK to skip initializer in stub files.
3642
3641
  # Avoid extra error messages, if there is no type in Final[...],
3643
3642
  # then we already reported the error about missing r.h.s.
3644
- isinstance(s, AssignmentStmt)
3643
+ and isinstance(s, AssignmentStmt)
3645
3644
  and s.type is not None
3646
3645
  ):
3647
3646
  self.msg.final_without_value(s)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaclang
3
- Version: 0.5.17
3
+ Version: 0.5.18
4
4
  Home-page: https://github.com/Jaseci-Labs/jaclang
5
5
  Author: Jason Mars
6
6
  Author-email: jason@jaseci.org
@@ -1,34 +1,35 @@
1
- jaclang/__init__.py,sha256=8y03wUXOs-_OI-SQfXzmQBUPHkwKyEM2zGDQvnWMS_k,693
1
+ jaclang/__init__.py,sha256=vTvt9LIz5RNKrLRueH3gUM3KTAjsqoanHQ_Pn9m4i9g,675
2
+ jaclang/settings.py,sha256=qu17a7AenlX1vUnZTHWnaKvwqwKQxWiYueWjLr6MWKY,3162
2
3
  jaclang/cli/__init__.py,sha256=7aaPgYddIAHBvkdv36ngbfwsimMnfGaTDcaHYMg_vf4,23
3
4
  jaclang/cli/cli.py,sha256=_z3PmgTvLS_zkFe-BC7uvmKKJ2ZQqDhQAQpAAlebZOg,10687
4
5
  jaclang/cli/cmdreg.py,sha256=bn2UdOkNbE-4zfbomO2j8rTtkXhsltH4jE5rKqA5HbY,7862
5
6
  jaclang/compiler/__init__.py,sha256=X_n8G4KrjWePCGNC1Leo3d1is4MBer4xCHc0A4983-g,2937
6
- jaclang/compiler/absyntree.py,sha256=5t2uQQ2VT8oZtNh4TtX-MucF4E9SouXsqOLjx2D7En8,126823
7
+ jaclang/compiler/absyntree.py,sha256=quVRgeMZl0AcZ5It5qwKOudLFl7MqOzHcHiERIjUBEo,126927
7
8
  jaclang/compiler/codeloc.py,sha256=KMwf5OMQu3_uDjIdH7ta2piacUtXNPgUV1t8OuLjpzE,2828
8
9
  jaclang/compiler/compile.py,sha256=fS6Uvor93EavESKrwadqp7bstcpMRRACvBkqbr4En04,2682
9
10
  jaclang/compiler/constant.py,sha256=C8nOgWLAg-fRg8Qax_jRcYp6jGyWSSA1gwzk9Zdy7HE,6534
10
- jaclang/compiler/jac.lark,sha256=9gIcsRelDZJ9SwLpUe_51t2Z-gnryrkUlD7jC1DYsZg,16971
11
- jaclang/compiler/parser.py,sha256=6wyZ4SwNw_FbLHKYQI8-b2HwnnGkZtGYgxPW5ikvgxU,135889
11
+ jaclang/compiler/jac.lark,sha256=Xz6xlZ2-YVzshh6WJPh35AU8QispGy1zebr1htclf_Y,16995
12
+ jaclang/compiler/parser.py,sha256=kwA6qJXxaZOnhkmNuXav03CH57RJXdohY-bw-jsjDWo,136544
12
13
  jaclang/compiler/symtable.py,sha256=SRYSwZtLHXLIOkE9CfdWDkkwx0vDLXvMeYiFfh6-wP4,5769
13
- jaclang/compiler/workspace.py,sha256=-DgORhJaFuQK7IiOmfa5-ZlJpfmU4dWgd4YzBY2CL10,7521
14
+ jaclang/compiler/workspace.py,sha256=8r7vNhIKgct2eE7sXaSrfy3NzrE9V2rhnaIXDEArgc8,7381
14
15
  jaclang/compiler/generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- jaclang/compiler/generated/jac_parser.py,sha256=C-1IJkOgviXlOidX__O4QHuqGl1fZPkHkvxtorqz36E,331798
16
+ jaclang/compiler/generated/jac_parser.py,sha256=wwJA422L2G8eor8eqgv04pshhDxsLnYyi5MAE4lDKQE,334286
16
17
  jaclang/compiler/passes/__init__.py,sha256=0Tw0d130ZjzA05jVcny9cf5NfLjlaM70PKqFnY4zqn4,69
17
- jaclang/compiler/passes/ir_pass.py,sha256=Gwcuh3vkSpzozgQdh78GgH7tjkIouuGLmmi2Klyoctk,5490
18
+ jaclang/compiler/passes/ir_pass.py,sha256=gh1Zd8ouu79FoxerW1sMxktmfeC9gHyp4H_MoAviYP8,5504
18
19
  jaclang/compiler/passes/transform.py,sha256=6t-bbX_s615i7_naOIBjT4wvAkvLFM4niRHYyF4my8A,2086
19
20
  jaclang/compiler/passes/main/__init__.py,sha256=jT0AZ3-Cp4VIoJUdUAfwEdjgB0mtMRaqMIw4cjlrLvs,905
20
21
  jaclang/compiler/passes/main/def_impl_match_pass.py,sha256=_KgAVVzMAatigKDp1vAnhyY2GcWf0rRoD8MkfYg-POU,3297
21
22
  jaclang/compiler/passes/main/def_use_pass.py,sha256=d2REmfme2HjUj8avDcXUuPbv3yKfvYHqpL49sxniLhQ,8576
22
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256=xYvcKkL_eiqFVA6FJjad-TftEDlaj-PhPCN9cRRfbiM,15943
23
- jaclang/compiler/passes/main/import_pass.py,sha256=upWEsB3598-JZJ_j1d29i2hgkSEMMeYB8aIhfHdXtuo,6381
24
- jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=JjMfdRLMoPgyszgzBahHmvxSyjJLJhJ927MqvHPe-zQ,136758
25
- jaclang/compiler/passes/main/pyast_load_pass.py,sha256=TrXz30UhGztWKUY03eoc6hwr---_fDEZUqcDKRdn1rg,87041
23
+ jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256=9WrF78r4cNWnDqofx225b9cUZafTi3HwCffXINmgoZ0,15968
24
+ jaclang/compiler/passes/main/import_pass.py,sha256=EgMoPDpDNucbh7s4WRkMEfOdEtXM6dtsN0Qorwh489A,6384
25
+ jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=q1GM4zXA-33MsqMlvJhGa8z1ydcGA9hMRHVZle9O_aU,138177
26
+ jaclang/compiler/passes/main/pyast_load_pass.py,sha256=WXq7Ahaev2ZIsPtmXnPgHn6sIGOpRJaAMHtNrJUSHRU,87133
26
27
  jaclang/compiler/passes/main/pybc_gen_pass.py,sha256=CjA9AqyMO3Pv_b5Hh0YI6JmCqIru2ASonO6rhrkau-M,1336
27
28
  jaclang/compiler/passes/main/pyout_pass.py,sha256=jw-ApCvVyAqynBFCArPQ20wq2ou0s7lTCGqcUyxrJWI,3018
28
29
  jaclang/compiler/passes/main/registry_pass.py,sha256=VEaQKNNZZjRhgMf809X1HpytNzV2W9HyViB2SwQvxNI,4421
29
30
  jaclang/compiler/passes/main/schedules.py,sha256=Tn_jr6Lunm3t5tAluxvE493qfa4lF2kgIQPN0J42TEE,1048
30
31
  jaclang/compiler/passes/main/sub_node_tab_pass.py,sha256=fGgK0CBWsuD6BS4BsLwXPl1b5UC2N2YEOGa6jNMu8N8,1332
31
- jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=8rJ-0iZF2MM9KeKSWbmdSWu7w2lwLrJuVjxCpJZTpeI,40986
32
+ jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=xLlcsntcVHVZ7YEyp1Jh_tKw93dQP2uqK5D5JFQtOyI,41678
32
33
  jaclang/compiler/passes/main/type_check_pass.py,sha256=-f41Ukr3B1w4rkQdZ2xJy6nozymgnVKjJ8E1fn7qJmI,3339
33
34
  jaclang/compiler/passes/main/tests/__init__.py,sha256=UBAATLUEH3yuBN4LYKnXXV79kokRc4XB-rX12qfu0ds,28
34
35
  jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py,sha256=QDsvTEpJt3AuS3GRwfq-1mezRCpx7rwEEyg1AbusaBs,1374
@@ -44,7 +45,7 @@ jaclang/compiler/passes/main/tests/test_type_check_pass.py,sha256=bzrVcsBZra2HkQ
44
45
  jaclang/compiler/passes/main/tests/test_typeinfo_pass.py,sha256=ehC0_giLg7NwB7fR10nW5Te8mZ76qmUFxkK1bEjtmrw,129
45
46
  jaclang/compiler/passes/tool/__init__.py,sha256=xekCOXysHIcthWm8NRmQoA1Ah1XV8vFbkfeHphJtUdc,223
46
47
  jaclang/compiler/passes/tool/fuse_comments_pass.py,sha256=N9a84qArNuTXX1iaXsBzqcufx6A3zYq2p-1ieH6FmHc,3133
47
- jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=8xk3YttnCpNzApOoEZ73G77zq9W3sCxBUQwulD7N5QE,83233
48
+ jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=PKG6jvJeqzPj3loytwymYwTXT-Dhq5opLmfFKXvwj30,83271
48
49
  jaclang/compiler/passes/tool/schedules.py,sha256=kmbsCazAMizGAdQuZpFky5BPlYlMXqNw7wOUzdi_wBo,432
49
50
  jaclang/compiler/passes/tool/tests/__init__.py,sha256=AeOaZjA1rf6VAr0JqIit6jlcmOzW7pxGr4U1fOwgK_Y,24
50
51
  jaclang/compiler/passes/tool/tests/test_fuse_comments_pass.py,sha256=ZeWHsm7VIyyS8KKpoB2SdlHM4jF22fMfSrfTfxt2MQw,398
@@ -62,12 +63,12 @@ jaclang/core/__init__.py,sha256=jDDYBCV82qPhmcDVk3NIvHbhng0ebSrXD3xrojg0-eo,34
62
63
  jaclang/core/aott.py,sha256=_CdK1l37BK5ZCfA7NjOouH-xveWWbsBCRFz24dvsQZA,7716
63
64
  jaclang/core/construct.py,sha256=_mYHEbUPY3Dn0rcl21eJXLqAGYH_0_C-x1K9HDa2RKk,13633
64
65
  jaclang/core/importer.py,sha256=8aNHfUOx_Pw6Knox__n3Gq8uub0pWWmXWsW3kGPFv8k,5437
65
- jaclang/core/llms.py,sha256=J05Tt4TdGG6empbTG08r6ucltD0EvYHHjJuvuvnfOC8,1097
66
+ jaclang/core/llms.py,sha256=bs0EoQcIZc_45HSxDHSEwUgyw-YhawfX4kQYM16UNnk,4139
66
67
  jaclang/core/registry.py,sha256=4uuXahPN4SMVEWwJ6Gjm5LM14rePMGoyjQtSbDQmQZs,4178
67
68
  jaclang/core/utils.py,sha256=Li35s4HuDreuNpsE1blv8RL0okK9wXFUqoF-XVgS6ro,7374
68
69
  jaclang/plugin/__init__.py,sha256=qLbQ2KjwyTvlV50Q7JTIznyIzuGDPjuwM_ZJjdk-avo,182
69
70
  jaclang/plugin/builtin.py,sha256=D1R4GGNHX96P-wZnGm9OI4dMeCJvuXuHkCw2Cl5vaAU,1201
70
- jaclang/plugin/default.py,sha256=4MIn20suzZisydo1ayWdGIYqaC5DIJIuHAHZ16ZzAMc,23339
71
+ jaclang/plugin/default.py,sha256=o6sDfuahxK-MzLSXTJ5rfui1xXiK_g6s_6O54FpC7zs,23654
71
72
  jaclang/plugin/feature.py,sha256=mkU1YwlTTvTuZ4FpsLQZCUr3mQtlp5ICAuvEft2K5QA,8782
72
73
  jaclang/plugin/spec.py,sha256=AiJ-YJ1UiDNO7qjwdc9vK4aua2LYR7GprpVLze0O7to,7806
73
74
  jaclang/plugin/tests/__init__.py,sha256=rn_tNG8jCHWwBc_rx4yFkGc4N1GISb7aPuTFVRTvrTk,38
@@ -131,7 +132,7 @@ jaclang/vendor/mypy/argmap.py,sha256=ooUmGfkZT6z4Yj-PryvPe9Krqe3G2OiY489kNM6IRGU
131
132
  jaclang/vendor/mypy/binder.py,sha256=vfQVroYb6kQgNN-iggcOkg1Xo90RSYv7mhE9eJ3dAsU,21450
132
133
  jaclang/vendor/mypy/bogus_type.py,sha256=w3GrsWoj5FKbfEUsc87OVFO812HC9BvnWnSaV2T4u1c,816
133
134
  jaclang/vendor/mypy/build.py,sha256=ATEhNPCqiGOxDrKJm7Qs5EuQh7hn8yTZXsJ0lM-gGf4,147004
134
- jaclang/vendor/mypy/checker.py,sha256=gIzKUJUAsYfAK96pYIF0YliJ-FhpZjQC2mp6M_f4AQw,386426
135
+ jaclang/vendor/mypy/checker.py,sha256=5BV__Wp1hCAp79cAXdlA6vNn_QX_kzwfK-F2KaP1Qx8,386406
135
136
  jaclang/vendor/mypy/checkexpr.py,sha256=Ei9TMj81pPVKPlFq77LM6DZbcS7diBE-_k9WEBPk1PU,295068
136
137
  jaclang/vendor/mypy/checkmember.py,sha256=eYZ4BvDAuvHIaPKV6C5N79Hl1ysJHFeI15DmjE77Ol8,54473
137
138
  jaclang/vendor/mypy/checkpattern.py,sha256=v8rcpeYl7vcp0WUvwAKVNEKgwkOzGYXpw_LWEJjimz0,34074
@@ -409,8 +410,8 @@ jaclang/vendor/pluggy/_manager.py,sha256=fcYU7VER0CplRym4jAJ7RCFYl6cfDSeVM589YHH
409
410
  jaclang/vendor/pluggy/_result.py,sha256=wXDoVy68bOaOrBzQ0bWFb3HTbpqhvdQMgYwaZvfzxfA,3239
410
411
  jaclang/vendor/pluggy/_tracing.py,sha256=kSBr25F_rNklV2QhLD6h1jx6Z1kcKDRbuYvF5jv35pU,2089
411
412
  jaclang/vendor/pluggy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
412
- jaclang-0.5.17.dist-info/METADATA,sha256=JnyKetUjw7-SsU1GatRcjbLNbtdq7Imd-wifReDU62w,153
413
- jaclang-0.5.17.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
414
- jaclang-0.5.17.dist-info/entry_points.txt,sha256=Z-snS3MDBdV1Z4znXDZTenyyndovaNjqRkDW1t2kYSs,50
415
- jaclang-0.5.17.dist-info/top_level.txt,sha256=ZOAoLpE67ozkUJd-v3C59wBNXiteRD8IWPbsYB3M08g,8
416
- jaclang-0.5.17.dist-info/RECORD,,
413
+ jaclang-0.5.18.dist-info/METADATA,sha256=NTG7UE-l9XL9qa5ezDByBq7fSgiPYU9ffU6ZMLR5JEg,153
414
+ jaclang-0.5.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
415
+ jaclang-0.5.18.dist-info/entry_points.txt,sha256=Z-snS3MDBdV1Z4znXDZTenyyndovaNjqRkDW1t2kYSs,50
416
+ jaclang-0.5.18.dist-info/top_level.txt,sha256=ZOAoLpE67ozkUJd-v3C59wBNXiteRD8IWPbsYB3M08g,8
417
+ jaclang-0.5.18.dist-info/RECORD,,