jaclang 0.7.13__py3-none-any.whl → 0.7.15__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 +11 -8
- jaclang/cli/cmdreg.py +9 -12
- jaclang/compiler/__init__.py +0 -2
- jaclang/compiler/absyntree.py +12 -12
- jaclang/compiler/parser.py +4 -0
- jaclang/compiler/passes/ir_pass.py +3 -12
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +4 -5
- jaclang/compiler/passes/main/import_pass.py +5 -2
- jaclang/compiler/passes/main/pyast_gen_pass.py +33 -39
- jaclang/compiler/passes/main/pyast_load_pass.py +1 -0
- jaclang/compiler/passes/main/registry_pass.py +1 -1
- jaclang/compiler/passes/main/tests/test_import_pass.py +5 -1
- jaclang/compiler/passes/tool/fuse_comments_pass.py +14 -2
- jaclang/compiler/passes/tool/jac_formatter_pass.py +23 -28
- jaclang/compiler/passes/transform.py +4 -0
- jaclang/compiler/semtable.py +5 -3
- jaclang/compiler/tests/test_importer.py +3 -0
- jaclang/langserve/engine.py +227 -94
- jaclang/langserve/server.py +6 -10
- jaclang/langserve/tests/fixtures/base_module_structure.jac +1 -1
- jaclang/langserve/tests/fixtures/import_include_statements.jac +1 -1
- jaclang/langserve/tests/test_sem_tokens.py +277 -0
- jaclang/langserve/tests/test_server.py +28 -4
- jaclang/langserve/utils.py +128 -95
- jaclang/plugin/builtin.py +1 -1
- jaclang/plugin/default.py +25 -16
- jaclang/plugin/feature.py +4 -5
- jaclang/plugin/spec.py +2 -2
- jaclang/{core → runtimelib}/architype.py +1 -1
- jaclang/{core → runtimelib}/context.py +4 -1
- jaclang/runtimelib/importer.py +414 -0
- jaclang/runtimelib/machine.py +19 -0
- jaclang/{core → runtimelib}/utils.py +1 -1
- jaclang/tests/fixtures/blankwithentry.jac +3 -0
- jaclang/tests/fixtures/deep/one_lev.jac +3 -3
- jaclang/tests/fixtures/deep/one_lev_dup.jac +2 -3
- jaclang/tests/test_cli.py +1 -1
- jaclang/tests/test_language.py +16 -0
- jaclang/tests/test_man_code.py +17 -0
- jaclang/utils/treeprinter.py +0 -4
- {jaclang-0.7.13.dist-info → jaclang-0.7.15.dist-info}/METADATA +1 -1
- {jaclang-0.7.13.dist-info → jaclang-0.7.15.dist-info}/RECORD +48 -45
- jaclang/core/importer.py +0 -344
- /jaclang/{core → runtimelib}/__init__.py +0 -0
- /jaclang/{core → runtimelib}/constructs.py +0 -0
- /jaclang/{core → runtimelib}/memory.py +0 -0
- /jaclang/{core → runtimelib}/test.py +0 -0
- {jaclang-0.7.13.dist-info → jaclang-0.7.15.dist-info}/WHEEL +0 -0
- {jaclang-0.7.13.dist-info → jaclang-0.7.15.dist-info}/entry_points.txt +0 -0
|
@@ -2,30 +2,30 @@ 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=
|
|
6
|
-
jaclang/cli/cmdreg.py,sha256=
|
|
5
|
+
jaclang/cli/cli.py,sha256=MVWy7AWBWzLx8Uc98_tw81YNQdGjmKl_y4bz7gp6jv0,14072
|
|
6
|
+
jaclang/cli/cmdreg.py,sha256=5mhzLJnpHfc0Z22qKQgcEOICgBaC95G9gSJZ-R7GqvU,8282
|
|
7
7
|
jaclang/compiler/.gitignore,sha256=n1k2_xXTorp9PY8hhYM4psHircn-NMaFx95bSgDKopo,10
|
|
8
|
-
jaclang/compiler/__init__.py,sha256=
|
|
9
|
-
jaclang/compiler/absyntree.py,sha256=
|
|
8
|
+
jaclang/compiler/__init__.py,sha256=bQE2z6wyuMqhPI31QYEBq__2fSrAtcKThjBRkTSwnPA,3038
|
|
9
|
+
jaclang/compiler/absyntree.py,sha256=fjNGlj0gqUMJhxy6jbbC2J-NlrrZPaRICcRgbYIqiJs,134966
|
|
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
|
|
13
13
|
jaclang/compiler/jac.lark,sha256=Vu14pEa9HObGQCHCGFhIdq__yA3W0-cKAX53NZc--xM,17204
|
|
14
|
-
jaclang/compiler/parser.py,sha256=
|
|
14
|
+
jaclang/compiler/parser.py,sha256=T7ntURGUAEtOi7nTRSBER5Nkh7SxeNxoerYmnFFsAFc,140448
|
|
15
15
|
jaclang/compiler/passes/__init__.py,sha256=0Tw0d130ZjzA05jVcny9cf5NfLjlaM70PKqFnY4zqn4,69
|
|
16
|
-
jaclang/compiler/passes/ir_pass.py,sha256=
|
|
16
|
+
jaclang/compiler/passes/ir_pass.py,sha256=KMlrp2aLcUjoHw55p-h8d1Fg5w71GBj7mMqRoBjkAlc,5553
|
|
17
17
|
jaclang/compiler/passes/main/__init__.py,sha256=YSWVNkgnJKF32LpJwX__FwvYrpTSoxFqvnw410WrhkA,947
|
|
18
18
|
jaclang/compiler/passes/main/access_modifier_pass.py,sha256=fvmvU_V72Zby8fiBnVESinAYFII5qJWKYXtmn4JAChA,5140
|
|
19
19
|
jaclang/compiler/passes/main/def_impl_match_pass.py,sha256=yAkwLQm2NBJycJVSmG88Shq0r2GSxTH8goINDfGIHek,4583
|
|
20
20
|
jaclang/compiler/passes/main/def_use_pass.py,sha256=68Uts_v-R-9mzBXC9EfXpcBEQwqnVcpL2JD0sri88AY,9674
|
|
21
|
-
jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256
|
|
22
|
-
jaclang/compiler/passes/main/import_pass.py,sha256=
|
|
23
|
-
jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=
|
|
24
|
-
jaclang/compiler/passes/main/pyast_load_pass.py,sha256=
|
|
21
|
+
jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256=0zuBLMDj-EYzBfWVqJNoM3nXfh4NvI8F22xIYGkSZ8s,18166
|
|
22
|
+
jaclang/compiler/passes/main/import_pass.py,sha256=fFMbJCcF_JXm6olmRHzr2Xi31y46opBFKSKL6tPC_zU,10982
|
|
23
|
+
jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=HJWsF_aEArFCz7G0sZHRQ2vlym5WLotBGRxCfQHfKVQ,152061
|
|
24
|
+
jaclang/compiler/passes/main/pyast_load_pass.py,sha256=NzMwqYLbKLQha8McmTM3HT5ytk_e8xQVMHgIPbzYQd4,93266
|
|
25
25
|
jaclang/compiler/passes/main/pybc_gen_pass.py,sha256=CjA9AqyMO3Pv_b5Hh0YI6JmCqIru2ASonO6rhrkau-M,1336
|
|
26
26
|
jaclang/compiler/passes/main/pyjac_ast_link_pass.py,sha256=dnx_MvrVIks9hpUbiF2m3ao_xrfCwPajPJec7Bis_bA,8338
|
|
27
27
|
jaclang/compiler/passes/main/pyout_pass.py,sha256=QWVB-AyVBha3OespP89LMuslRsdG2niZErwtnRPiURM,3191
|
|
28
|
-
jaclang/compiler/passes/main/registry_pass.py,sha256=
|
|
28
|
+
jaclang/compiler/passes/main/registry_pass.py,sha256=1KdkX1WA5PSeBjPL2mhjox9GEk8iMWJlexg-gpF4_x8,4579
|
|
29
29
|
jaclang/compiler/passes/main/schedules.py,sha256=cu3-AIckvbKGe3C-DbtDwwAdvnX25CdDP6j9QLps9Kg,1298
|
|
30
30
|
jaclang/compiler/passes/main/sub_node_tab_pass.py,sha256=25HEJGBbDlJibyW5MV4ShXQ2vmzG3LDreknV-u2nQjk,1184
|
|
31
31
|
jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=_EYyPOS2_CMgO2znCJck3NLgg6kx7lfiQGhY3Fy9JnI,34689
|
|
@@ -53,7 +53,7 @@ jaclang/compiler/passes/main/tests/fixtures/registry.jac,sha256=1G6amtU1zIFCgq09
|
|
|
53
53
|
jaclang/compiler/passes/main/tests/fixtures/type_info.jac,sha256=64Im2L-R3YF8DEuTt29QE6mJI5PnFe3PiwcDLKa8gOE,661
|
|
54
54
|
jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py,sha256=zWF2l93RjyG0AWyDXdXsMlPWYOhX46d699YqvIETRGY,1836
|
|
55
55
|
jaclang/compiler/passes/main/tests/test_def_use_pass.py,sha256=0ieyoeiDSK2m3dmVN00oJK2TdJhxWwxA1lnxT95wz0A,843
|
|
56
|
-
jaclang/compiler/passes/main/tests/test_import_pass.py,sha256=
|
|
56
|
+
jaclang/compiler/passes/main/tests/test_import_pass.py,sha256=jLdes0wofyz79mESsGuj1ingjOv-nBsI1YqEezxqYC8,2838
|
|
57
57
|
jaclang/compiler/passes/main/tests/test_pyast_build_pass.py,sha256=LIT4TP-nhtftRtY5rNySRQlim-dWMSlkfUvkhZTk4pc,1383
|
|
58
58
|
jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py,sha256=6ZpLNYxblzBg6bmWSA0fikNM7nEAR9b9F18LJaO5buM,4679
|
|
59
59
|
jaclang/compiler/passes/main/tests/test_pybc_gen_pass.py,sha256=If8PE4exN5g9o1NRElNC0XdfIwJAp7M7f69rzmYRYUQ,655
|
|
@@ -64,8 +64,8 @@ jaclang/compiler/passes/main/tests/test_type_check_pass.py,sha256=v2_KmcyX1_fOpR
|
|
|
64
64
|
jaclang/compiler/passes/main/tests/test_typeinfo_pass.py,sha256=ehC0_giLg7NwB7fR10nW5Te8mZ76qmUFxkK1bEjtmrw,129
|
|
65
65
|
jaclang/compiler/passes/main/type_check_pass.py,sha256=oPXSlTkxPge8H5fvKpFt80V_5ft5It56wLftG7HjS2Y,3458
|
|
66
66
|
jaclang/compiler/passes/tool/__init__.py,sha256=xekCOXysHIcthWm8NRmQoA1Ah1XV8vFbkfeHphJtUdc,223
|
|
67
|
-
jaclang/compiler/passes/tool/fuse_comments_pass.py,sha256=
|
|
68
|
-
jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=
|
|
67
|
+
jaclang/compiler/passes/tool/fuse_comments_pass.py,sha256=CSnuWy4gZfTcWKe0Q7LBikBgWe1zJr0QmNUkgrZ7B38,3657
|
|
68
|
+
jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=tI9crvlxvU-a0K3uF3F8uRMQZYb2VpUN7mgy0TzPW-g,87106
|
|
69
69
|
jaclang/compiler/passes/tool/schedules.py,sha256=kmbsCazAMizGAdQuZpFky5BPlYlMXqNw7wOUzdi_wBo,432
|
|
70
70
|
jaclang/compiler/passes/tool/tests/__init__.py,sha256=AeOaZjA1rf6VAr0JqIit6jlcmOzW7pxGr4U1fOwgK_Y,24
|
|
71
71
|
jaclang/compiler/passes/tool/tests/fixtures/corelib.jac,sha256=fNJJWnT_MiyYuN0exec1JTAkh4VKkAcEPFtFYLw3JKk,12712
|
|
@@ -101,10 +101,10 @@ jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac,sha256=6jwYKXxJ1
|
|
|
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
103
|
jaclang/compiler/passes/tool/tests/test_unparse_validate.py,sha256=rySW9ppDvnOqgF_B6kC4qRvXwfGErs6rOGXl4iULw-U,2674
|
|
104
|
-
jaclang/compiler/passes/transform.py,sha256=
|
|
104
|
+
jaclang/compiler/passes/transform.py,sha256=h84ZfyctT_hKVvGtFeO87vqN6p50DqJh94Dk827Alw8,2394
|
|
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
|
|
107
|
-
jaclang/compiler/semtable.py,sha256=
|
|
107
|
+
jaclang/compiler/semtable.py,sha256=S7AJbuOGzjcBkgh2Cipz6bVqNTw2HvMvxcB7NlLnhRw,4212
|
|
108
108
|
jaclang/compiler/symtable.py,sha256=oYdYS1PUnNCGPPZsZZOduiDtTYyLVd6tXWAoUyCupUc,9275
|
|
109
109
|
jaclang/compiler/tests/__init__.py,sha256=qiXa5UNRBanGOcplFKTT9a_9GEyiv7goq1OzuCjDCFE,27
|
|
110
110
|
jaclang/compiler/tests/fixtures/__init__.py,sha256=udQ0T6rajpW_nMiYKJNckqP8izZ-pH3P4PNTJEln2NU,36
|
|
@@ -115,22 +115,14 @@ jaclang/compiler/tests/fixtures/kwesc.jac,sha256=OXxVL_fwiFuvYO1YX1RHa2hpETSpb0Q
|
|
|
115
115
|
jaclang/compiler/tests/fixtures/mod_doc_test.jac,sha256=aFZpjn7V5lvCHp0lPoGXtdkcY3CK8_-SKeZGruutv4Y,35
|
|
116
116
|
jaclang/compiler/tests/fixtures/staticcheck.jac,sha256=t849--dTkSSjCJX1OiMV-lgao_hIDSKwKVs-aS6IwK8,342
|
|
117
117
|
jaclang/compiler/tests/fixtures/stuff.jac,sha256=qOq6WOwhlprMmJpiqQudgqnr4qTd9uhulQSDGQ3o6sY,82
|
|
118
|
-
jaclang/compiler/tests/test_importer.py,sha256=
|
|
118
|
+
jaclang/compiler/tests/test_importer.py,sha256=OehpSN7_s0mbwJWz3OwRyxkSqBXAumiftzskQGzbEAc,1949
|
|
119
119
|
jaclang/compiler/tests/test_parser.py,sha256=Sj9Kz1FghESaPpyx_kEvScs4xvz-vgEdH8yyQJ0iB7M,4820
|
|
120
|
-
jaclang/core/__init__.py,sha256=jDDYBCV82qPhmcDVk3NIvHbhng0ebSrXD3xrojg0-eo,34
|
|
121
|
-
jaclang/core/architype.py,sha256=qBH0W-ALxmK6DALc4_S7gx-3R7C_6o-PGKb3f4RbWbE,16781
|
|
122
|
-
jaclang/core/constructs.py,sha256=ogWc95DEZxQWoxqsfbRrcmt9ldGDqW7zQVu3DWuIAKs,848
|
|
123
|
-
jaclang/core/context.py,sha256=AxGsra9EqokVdOhwIxR9RuAcnm0HmobUnMBezUBY1_s,4774
|
|
124
|
-
jaclang/core/importer.py,sha256=Rj7OzuwSAn-ig5pdFhqgjb5H5KyC8YFcur4VAyk1qLI,12712
|
|
125
|
-
jaclang/core/memory.py,sha256=7QukfL6wDBXrdpRn01yu4RMNkmIMNqFiKrI0zfpGSy4,2947
|
|
126
|
-
jaclang/core/test.py,sha256=HRCl3cf0uPTe58Kcx_sBUb6ow8J53rnmpFOhA7g9oAA,2851
|
|
127
|
-
jaclang/core/utils.py,sha256=uzEsRSuNSMMo7dlvCozGv0TnpUmHEjGNzUTZt1Df2gQ,7741
|
|
128
120
|
jaclang/langserve/__init__.py,sha256=3qbnivBBcLZCfmDYRMIeKkG08Lx7XQsJJg-qG8TU8yc,51
|
|
129
|
-
jaclang/langserve/engine.py,sha256
|
|
130
|
-
jaclang/langserve/server.py,sha256=
|
|
121
|
+
jaclang/langserve/engine.py,sha256=-RnqaUA6HsJVpYSTiJQeL6I7EbpAaHCyknarr1jTLBs,25363
|
|
122
|
+
jaclang/langserve/server.py,sha256=ay9DlsZY1JKPBWlPLKV7uFoeNerzLdhGcj1CzNr3k-o,4791
|
|
131
123
|
jaclang/langserve/tests/__init__.py,sha256=iDM47k6c3vahaWhwxpbkdEOshbmX-Zl5x669VONjS2I,23
|
|
132
124
|
jaclang/langserve/tests/defaults.py,sha256=8UWHuCHY-WatPcWFhyX9-4KLuJgODTlLNj0wNnKomIM,7608
|
|
133
|
-
jaclang/langserve/tests/fixtures/base_module_structure.jac,sha256=
|
|
125
|
+
jaclang/langserve/tests/fixtures/base_module_structure.jac,sha256=1cwJIhkm_6OJoUTOGOpiUpU2V2axhcidz_hQcHWFrkk,1010
|
|
134
126
|
jaclang/langserve/tests/fixtures/circle.jac,sha256=AWzRxTBjvQwoLSOakjn0kKXWqKvDaUYGc1zmBk1Nd5c,1770
|
|
135
127
|
jaclang/langserve/tests/fixtures/circle_err.jac,sha256=T22UiWpKJy6IhS-y0DrrZJMz95-8SAZnRAQUmT_kxO4,1732
|
|
136
128
|
jaclang/langserve/tests/fixtures/circle_pure.impl.jac,sha256=rsXatY9a-wZONRPJ6VOuw7Bj9R_CrJO_TEwAVXj1PjU,702
|
|
@@ -139,7 +131,7 @@ jaclang/langserve/tests/fixtures/circle_pure.test.jac,sha256=QiOAUZ5xXPKDx_QQRCZ
|
|
|
139
131
|
jaclang/langserve/tests/fixtures/circle_pure_err.impl.jac,sha256=rsXatY9a-wZONRPJ6VOuw7Bj9R_CrJO_TEwAVXj1PjU,702
|
|
140
132
|
jaclang/langserve/tests/fixtures/circle_pure_err.jac,sha256=jQ5QX0G5khGACoY82CM-6LcOX57w4e29tHVicE2eMgw,608
|
|
141
133
|
jaclang/langserve/tests/fixtures/hello.jac,sha256=iRMKtYVCw1zLvjOQbj3q__3Manj1Di1YeDTNMEvYtBc,36
|
|
142
|
-
jaclang/langserve/tests/fixtures/import_include_statements.jac,sha256=
|
|
134
|
+
jaclang/langserve/tests/fixtures/import_include_statements.jac,sha256=C7aW24QodYRHB0czqvpEZwR4A60ktYa4pGNWNXisL7s,300
|
|
143
135
|
jaclang/langserve/tests/fixtures/py_import.py,sha256=BvNimsRmsbJWd-JNM31oJpl52bYvSdfQ6Np3DJNt7d0,320
|
|
144
136
|
jaclang/langserve/tests/pylsp_jsonrpc/__init__.py,sha256=bDWxRjmELPCVGy243_0kNrG7PttyZsv_eZ9JTKQrU1E,105
|
|
145
137
|
jaclang/langserve/tests/pylsp_jsonrpc/dispatchers.py,sha256=zEZWu6C2_n4lPoA8H8OO67746P93VhbYaXZMdtrD8Z0,1038
|
|
@@ -147,13 +139,14 @@ jaclang/langserve/tests/pylsp_jsonrpc/endpoint.py,sha256=TxDpWUd-8AGJwdRQN_iiCXY
|
|
|
147
139
|
jaclang/langserve/tests/pylsp_jsonrpc/exceptions.py,sha256=NGHeFQawZcjoLUcgDmY3bF7BqZR83g7TmdKyzCmRaKM,2836
|
|
148
140
|
jaclang/langserve/tests/pylsp_jsonrpc/streams.py,sha256=R80_FvICIkrbdGmNtlemWYaxrr7-XldPgLaASnyv0W8,3332
|
|
149
141
|
jaclang/langserve/tests/session.py,sha256=3pIRoQjZnsnUWIYnO2SpK7c1PAiHMCFrrStNK2tawRM,9572
|
|
150
|
-
jaclang/langserve/tests/
|
|
151
|
-
jaclang/langserve/
|
|
142
|
+
jaclang/langserve/tests/test_sem_tokens.py,sha256=zWoczkMfBBS9o9caeru359GmFfAksqaF3IWK4nl0uFw,9886
|
|
143
|
+
jaclang/langserve/tests/test_server.py,sha256=3Tq_pH4KNA4UXCMLCs2RjqRN7j-oZTJ9yz8_viBB4eY,12159
|
|
144
|
+
jaclang/langserve/utils.py,sha256=sZJkgZcuid6uO0eSgDmNVvJp63OBlpBHEyWfW5g5OfQ,20138
|
|
152
145
|
jaclang/plugin/__init__.py,sha256=5t2krHKt_44PrCTGojzxEimxpNHYVQcn89jAiCSXE_k,165
|
|
153
|
-
jaclang/plugin/builtin.py,sha256=
|
|
154
|
-
jaclang/plugin/default.py,sha256=
|
|
155
|
-
jaclang/plugin/feature.py,sha256=
|
|
156
|
-
jaclang/plugin/spec.py,sha256=
|
|
146
|
+
jaclang/plugin/builtin.py,sha256=zAypgY6GemiCmbFUyhj9g_0qNyQFLnDPHGlZ0BuA3RE,1194
|
|
147
|
+
jaclang/plugin/default.py,sha256=mEwDG7MYvuG-ddk7S_gMSy7Ojg2l0PUqJWr2yb5vr38,24060
|
|
148
|
+
jaclang/plugin/feature.py,sha256=dWMDgR5VjPXz60ypuqenmuRgKvbVP2tREU93arnDPRA,9813
|
|
149
|
+
jaclang/plugin/spec.py,sha256=SirNgIlzsGo4CMtRcwb36dMArDKEQapKmQNAmZjWdxU,8915
|
|
157
150
|
jaclang/plugin/tests/__init__.py,sha256=rn_tNG8jCHWwBc_rx4yFkGc4N1GISb7aPuTFVRTvrTk,38
|
|
158
151
|
jaclang/plugin/tests/fixtures/impl_match.jac,sha256=WEhcA1GlovusITEFO2bOjYYqiiULyYGKhM17uK2GqnI,91
|
|
159
152
|
jaclang/plugin/tests/fixtures/impl_match_impl.jac,sha256=k1385r7Hdlq6mUKxEHa3VOKJUIWH08hYg2kErhbYwFM,31
|
|
@@ -162,6 +155,15 @@ jaclang/plugin/tests/fixtures/simple_persistent.jac,sha256=o0TZTOJEZjFW8A2IGY8IC
|
|
|
162
155
|
jaclang/plugin/tests/test_features.py,sha256=p0N5inZn92Cj0eqslmDR0-q6pVG8hkcQfA6CuQcfP3Y,2352
|
|
163
156
|
jaclang/plugin/tests/test_jaseci.py,sha256=XcVL-FOZMTsjJEZqCa-rcYyEPl1dxdFFu9vhvm8kUaI,7956
|
|
164
157
|
jaclang/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
158
|
+
jaclang/runtimelib/__init__.py,sha256=jDDYBCV82qPhmcDVk3NIvHbhng0ebSrXD3xrojg0-eo,34
|
|
159
|
+
jaclang/runtimelib/architype.py,sha256=UPcwYNkFQaewPrywTIYUT0DWm7I_V0kmFfQ8LamvZdY,16787
|
|
160
|
+
jaclang/runtimelib/constructs.py,sha256=ogWc95DEZxQWoxqsfbRrcmt9ldGDqW7zQVu3DWuIAKs,848
|
|
161
|
+
jaclang/runtimelib/context.py,sha256=EohVnWpidtQJf2i_KEIZobIC_QfgzHdfZ3SyurJzEY0,4916
|
|
162
|
+
jaclang/runtimelib/importer.py,sha256=0Ckc0IQE24A5uj9BbEKdJPRcSw_HwSk5eib8S4NJGIY,16225
|
|
163
|
+
jaclang/runtimelib/machine.py,sha256=X8QBBoVspXzg0yfgI3xeHFms_ztvj0Bx8XLSzWJooto,576
|
|
164
|
+
jaclang/runtimelib/memory.py,sha256=7QukfL6wDBXrdpRn01yu4RMNkmIMNqFiKrI0zfpGSy4,2947
|
|
165
|
+
jaclang/runtimelib/test.py,sha256=HRCl3cf0uPTe58Kcx_sBUb6ow8J53rnmpFOhA7g9oAA,2851
|
|
166
|
+
jaclang/runtimelib/utils.py,sha256=yXaHevMzs8nLqW6xuQHHL-3zW75yzDXhdGT0ZLUDU_o,7747
|
|
165
167
|
jaclang/settings.py,sha256=woT2v-xh3Mh_haOoefQlRddOYDkalwGGlQJVSvBkmAc,3404
|
|
166
168
|
jaclang/tests/fixtures/abc.jac,sha256=AWzRxTBjvQwoLSOakjn0kKXWqKvDaUYGc1zmBk1Nd5c,1770
|
|
167
169
|
jaclang/tests/fixtures/access_checker.jac,sha256=6Inm14cZsyMfezFRs2zfnQEZSE_JRxVvytcZbox7BNw,375
|
|
@@ -170,6 +172,7 @@ jaclang/tests/fixtures/aott_raise.jac,sha256=ufKMVC21NJw3zSSJ_8uCoG_IR9pJf8WfGp8
|
|
|
170
172
|
jaclang/tests/fixtures/arithmetic_bug.jac,sha256=iiO3ZwTi7R1U6-flV4tGbxDHXsw8GnaLEzVNGTPdMUA,135
|
|
171
173
|
jaclang/tests/fixtures/assign_compr.jac,sha256=rnoujdtpjNbem4IdtBfxPahSUXl-gxNv4JFNEuUs5iM,286
|
|
172
174
|
jaclang/tests/fixtures/assign_compr_dup.jac,sha256=rnoujdtpjNbem4IdtBfxPahSUXl-gxNv4JFNEuUs5iM,286
|
|
175
|
+
jaclang/tests/fixtures/blankwithentry.jac,sha256=lnMDDKyKnldsUIx1AVCIHt47KY3gR2CZYhox8663sLM,53
|
|
173
176
|
jaclang/tests/fixtures/builtin_dotgen.jac,sha256=HsAHVyN7HxhbICqe4GXV51cJlMe68WMleMmx9KeR8fU,1759
|
|
174
177
|
jaclang/tests/fixtures/byllmissue.jac,sha256=A7V7nk0oqt0uR246sJ8DKBxMERn1cvHvE98pxJRVoRU,152
|
|
175
178
|
jaclang/tests/fixtures/chandra_bugs.jac,sha256=vcBjZ4P7S1PPUs-_0Stt779pus95RJTMs1x_-m0w7yY,282
|
|
@@ -179,8 +182,8 @@ jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac,sha256=omdlOBM0cuUAHhmx
|
|
|
179
182
|
jaclang/tests/fixtures/deep/deeper/deep_outer_import2.jac,sha256=YlAclVAukzVeCNbXZU6iTl8Rj1uXpUJ1WR7Ei2vhbqc,252
|
|
180
183
|
jaclang/tests/fixtures/deep/deeper/snd_lev.jac,sha256=SRp6Ic-MAgjcbYc090TwiFYsoVoJB4sLTA-Y5JPMpp8,82
|
|
181
184
|
jaclang/tests/fixtures/deep/mycode.jac,sha256=XP6RdZP90ftdhe5vidttgZhjDcsO4S8rbaVC0cG-e0U,47
|
|
182
|
-
jaclang/tests/fixtures/deep/one_lev.jac,sha256=
|
|
183
|
-
jaclang/tests/fixtures/deep/one_lev_dup.jac,sha256=
|
|
185
|
+
jaclang/tests/fixtures/deep/one_lev.jac,sha256=EtevkN6ZhO4tl_kZ_r7nWCYh44RPKh9Eo2nPSuqCfWA,234
|
|
186
|
+
jaclang/tests/fixtures/deep/one_lev_dup.jac,sha256=fwe14Xd1dliw_FJrqWXEpqFMEYHkU0nHOd2vFFoV0ng,120
|
|
184
187
|
jaclang/tests/fixtures/deep/one_lev_dup_py.py,sha256=G2k46o37mPhPSskYw7bYdbdq8r0xXVpNbGPWu2_os14,117
|
|
185
188
|
jaclang/tests/fixtures/deep_convert.jac,sha256=AWmLuqhM8GlOZ5rP2THREzpIpL9v3L9sZWyx07nkeDE,71
|
|
186
189
|
jaclang/tests/fixtures/deep_convo.py,sha256=sxU9RYsFIDlsbgNIQv6FBNgQHYEQ0Dwvx1f_qWvfZxE,96
|
|
@@ -243,9 +246,9 @@ jaclang/tests/fixtures/type_info.jac,sha256=4Cw31ef5gny6IS0kLzgeSO-7ArEH1HgFFFip
|
|
|
243
246
|
jaclang/tests/fixtures/walker_override.jac,sha256=Ok58ZAgxuV6aECNxYrjbbyAWSiqIbnly3N3O6cD563o,271
|
|
244
247
|
jaclang/tests/fixtures/with_context.jac,sha256=cDA_4YWe5UVmQRgcpktzkZ_zsswQpV_T2Otf_rFnPy8,466
|
|
245
248
|
jaclang/tests/test_bugs.py,sha256=tBPsIlSPqZDIz4QaScNRT-WdGIdJ0uU-aRBWq1XUZ6o,555
|
|
246
|
-
jaclang/tests/test_cli.py,sha256=
|
|
247
|
-
jaclang/tests/test_language.py,sha256=
|
|
248
|
-
jaclang/tests/test_man_code.py,sha256=
|
|
249
|
+
jaclang/tests/test_cli.py,sha256=Ea3IIbbqMcscJHtN7JLrMwsl7LPxEavw2xeuS9vwmek,8649
|
|
250
|
+
jaclang/tests/test_language.py,sha256=iws_4UKePGgUXAcE4gd7gSxQbd7NzR8G8ja6N5Wsutc,35276
|
|
251
|
+
jaclang/tests/test_man_code.py,sha256=ZdNarlZVfT_-8Jv3FjLplHw76tsvkCuISyfX3M4qxPg,5027
|
|
249
252
|
jaclang/tests/test_reference.py,sha256=FoZQS-U9teiag8mAmX5X6ak4fuCOv00mvOyqJ44Zkc8,3379
|
|
250
253
|
jaclang/tests/test_settings.py,sha256=TIX5uiu8H9IpZN2__uFiclcdCpBpPpcAwtlEHyFC4kk,1999
|
|
251
254
|
jaclang/utils/__init__.py,sha256=86LQ_LDyWV-JFkYBpeVHpLaVxkqwFDP60XpWXOFZIQk,46
|
|
@@ -255,7 +258,7 @@ jaclang/utils/log.py,sha256=G8Y_DnETgTh9xzvlW5gh9zqJ1ap4YY_MDTwIMu5Uc0Y,262
|
|
|
255
258
|
jaclang/utils/test.py,sha256=l2CrsC0umDn0YKukuAO4oWxjOeeP5QK0LgHxjxCjxkY,5743
|
|
256
259
|
jaclang/utils/tests/__init__.py,sha256=8uwVqMsc6cxBAM1DuHLuNuTnzLXqOqM-WRa4ixOMF6w,23
|
|
257
260
|
jaclang/utils/tests/test_lang_tools.py,sha256=hFQzkzdmJIhP99xqjR5z7bqkefMLmE6kwldXYrfK--E,4831
|
|
258
|
-
jaclang/utils/treeprinter.py,sha256=
|
|
261
|
+
jaclang/utils/treeprinter.py,sha256=0Sm-rOldGSkF3FUzuzU-sp7qgFclhCZ5tNxm32W_FAI,12430
|
|
259
262
|
jaclang/vendor/__init__.py,sha256=tEcp2kl3hMvF2d6X6WlJSAGuAMYOVCKCstXuPMQSR4Q,265
|
|
260
263
|
jaclang/vendor/attr/__init__.py,sha256=WlXJN6ICB0Y_HZ0lmuTUgia0kuSdn2p67d4N6cYxNZM,3307
|
|
261
264
|
jaclang/vendor/attr/__init__.pyi,sha256=u08EujYHy_rSyebNn-I9Xv2S_cXmtA9xWGc0cBsyl18,16976
|
|
@@ -1478,7 +1481,7 @@ jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjW
|
|
|
1478
1481
|
jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD,sha256=XS4fBVrPI7kaNZ56Ggl2RGa76jySWLqTzcrUpZIQTVM,418
|
|
1479
1482
|
jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
1480
1483
|
jaclang/vendor/typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451
|
|
1481
|
-
jaclang-0.7.
|
|
1482
|
-
jaclang-0.7.
|
|
1483
|
-
jaclang-0.7.
|
|
1484
|
-
jaclang-0.7.
|
|
1484
|
+
jaclang-0.7.15.dist-info/METADATA,sha256=I81V6-hfvkZ9T4VV6ZpaF2NmQO7bVmB4vDJuf_sT5cQ,4822
|
|
1485
|
+
jaclang-0.7.15.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
1486
|
+
jaclang-0.7.15.dist-info/entry_points.txt,sha256=8sMi4Tvi9f8tQDN2QAXsSA2icO27zQ4GgEdph6bNEZM,49
|
|
1487
|
+
jaclang-0.7.15.dist-info/RECORD,,
|
jaclang/core/importer.py
DELETED
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
"""Special Imports for Jac Code."""
|
|
2
|
-
|
|
3
|
-
import importlib
|
|
4
|
-
import marshal
|
|
5
|
-
import os
|
|
6
|
-
import sys
|
|
7
|
-
import types
|
|
8
|
-
from os import getcwd, path
|
|
9
|
-
from typing import Optional, Union
|
|
10
|
-
|
|
11
|
-
from jaclang.compiler.absyntree import Module
|
|
12
|
-
from jaclang.compiler.compile import compile_jac
|
|
13
|
-
from jaclang.compiler.constant import Constants as Con
|
|
14
|
-
from jaclang.core.utils import sys_path_context
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def handle_directory(
|
|
18
|
-
module_name: str, full_mod_path: str, mod_bundle: Optional[Module]
|
|
19
|
-
) -> types.ModuleType:
|
|
20
|
-
"""Import from a directory that potentially contains multiple Jac modules."""
|
|
21
|
-
module = types.ModuleType(module_name)
|
|
22
|
-
module.__name__ = module_name
|
|
23
|
-
module.__path__ = [full_mod_path]
|
|
24
|
-
module.__file__ = None
|
|
25
|
-
module.__dict__["__jac_mod_bundle__"] = mod_bundle
|
|
26
|
-
if module_name not in sys.modules:
|
|
27
|
-
sys.modules[module_name] = module
|
|
28
|
-
return module
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def process_items(
|
|
32
|
-
module: types.ModuleType,
|
|
33
|
-
items: dict[str, Union[str, Optional[str]]],
|
|
34
|
-
caller_dir: str,
|
|
35
|
-
lang: Optional[str],
|
|
36
|
-
mod_bundle: Optional[Module] = None,
|
|
37
|
-
cachable: bool = True,
|
|
38
|
-
) -> list:
|
|
39
|
-
"""Process items within a module by handling renaming and potentially loading missing attributes."""
|
|
40
|
-
unique_loaded_items = []
|
|
41
|
-
|
|
42
|
-
def handle_item_loading(item: str, alias: Union[str, Optional[str]]) -> None:
|
|
43
|
-
if item:
|
|
44
|
-
unique_loaded_items.append(item)
|
|
45
|
-
setattr(module, name, item)
|
|
46
|
-
if alias and alias != name and not isinstance(alias, bool):
|
|
47
|
-
setattr(module, alias, item)
|
|
48
|
-
|
|
49
|
-
for name, alias in items.items():
|
|
50
|
-
try:
|
|
51
|
-
item = getattr(module, name)
|
|
52
|
-
handle_item_loading(item, alias)
|
|
53
|
-
except AttributeError:
|
|
54
|
-
if lang == "jac":
|
|
55
|
-
jac_file_path = (
|
|
56
|
-
os.path.join(module.__path__[0], f"{name}.jac")
|
|
57
|
-
if hasattr(module, "__path__")
|
|
58
|
-
else module.__file__
|
|
59
|
-
)
|
|
60
|
-
if jac_file_path and os.path.isfile(jac_file_path):
|
|
61
|
-
item = load_jac_file(
|
|
62
|
-
module=module,
|
|
63
|
-
name=name,
|
|
64
|
-
jac_file_path=jac_file_path,
|
|
65
|
-
mod_bundle=mod_bundle,
|
|
66
|
-
cachable=cachable,
|
|
67
|
-
caller_dir=caller_dir,
|
|
68
|
-
)
|
|
69
|
-
handle_item_loading(item, alias)
|
|
70
|
-
elif jac_file_path and os.path.isdir(jac_file_path[:-4]):
|
|
71
|
-
item = handle_directory(name, jac_file_path[:-4], mod_bundle)
|
|
72
|
-
handle_item_loading(item, alias)
|
|
73
|
-
else:
|
|
74
|
-
if hasattr(module, "__path__"):
|
|
75
|
-
full_module_name = f"{module.__name__}.{name}"
|
|
76
|
-
item = importlib.import_module(full_module_name)
|
|
77
|
-
handle_item_loading(item, alias)
|
|
78
|
-
return unique_loaded_items
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def load_jac_file(
|
|
82
|
-
module: types.ModuleType,
|
|
83
|
-
name: str,
|
|
84
|
-
jac_file_path: str,
|
|
85
|
-
mod_bundle: Optional[Module],
|
|
86
|
-
cachable: bool,
|
|
87
|
-
caller_dir: str,
|
|
88
|
-
) -> Optional[types.ModuleType]:
|
|
89
|
-
"""Load a single .jac file into the specified module component."""
|
|
90
|
-
try:
|
|
91
|
-
package_name = (
|
|
92
|
-
f"{module.__name__}.{name}"
|
|
93
|
-
if hasattr(module, "__path__")
|
|
94
|
-
else module.__name__
|
|
95
|
-
)
|
|
96
|
-
new_module = sys.modules.get(
|
|
97
|
-
package_name,
|
|
98
|
-
create_jac_py_module(mod_bundle, name, module.__name__, jac_file_path),
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
codeobj = get_codeobj(
|
|
102
|
-
full_target=jac_file_path,
|
|
103
|
-
module_name=name,
|
|
104
|
-
mod_bundle=mod_bundle,
|
|
105
|
-
cachable=cachable,
|
|
106
|
-
caller_dir=caller_dir,
|
|
107
|
-
)
|
|
108
|
-
if not codeobj:
|
|
109
|
-
raise ImportError(f"No bytecode found for {jac_file_path}")
|
|
110
|
-
|
|
111
|
-
exec(codeobj, new_module.__dict__)
|
|
112
|
-
return getattr(new_module, name, new_module)
|
|
113
|
-
except ImportError as e:
|
|
114
|
-
print(
|
|
115
|
-
f"Failed to load {name} from {jac_file_path} in {module.__name__}: {str(e)}"
|
|
116
|
-
)
|
|
117
|
-
return None
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
def get_codeobj(
|
|
121
|
-
full_target: str,
|
|
122
|
-
module_name: str,
|
|
123
|
-
mod_bundle: Optional[Module],
|
|
124
|
-
cachable: bool,
|
|
125
|
-
caller_dir: str,
|
|
126
|
-
) -> Optional[types.CodeType]:
|
|
127
|
-
"""Execcutes the code for a given module."""
|
|
128
|
-
if mod_bundle:
|
|
129
|
-
codeobj = mod_bundle.mod_deps[full_target].gen.py_bytecode
|
|
130
|
-
return marshal.loads(codeobj) if isinstance(codeobj, bytes) else None
|
|
131
|
-
gen_dir = os.path.join(caller_dir, Con.JAC_GEN_DIR)
|
|
132
|
-
pyc_file_path = os.path.join(gen_dir, module_name + ".jbc")
|
|
133
|
-
if cachable and os.path.exists(pyc_file_path):
|
|
134
|
-
with open(pyc_file_path, "rb") as f:
|
|
135
|
-
return marshal.load(f)
|
|
136
|
-
|
|
137
|
-
result = compile_jac(full_target, cache_result=cachable)
|
|
138
|
-
if result.errors_had or not result.ir.gen.py_bytecode:
|
|
139
|
-
for e in result.errors_had:
|
|
140
|
-
print(e)
|
|
141
|
-
return None
|
|
142
|
-
if result.ir.gen.py_bytecode is not None:
|
|
143
|
-
return marshal.loads(result.ir.gen.py_bytecode)
|
|
144
|
-
else:
|
|
145
|
-
return None
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
def jac_importer(
|
|
149
|
-
target: str,
|
|
150
|
-
base_path: str,
|
|
151
|
-
absorb: bool = False,
|
|
152
|
-
cachable: bool = True,
|
|
153
|
-
mdl_alias: Optional[str] = None,
|
|
154
|
-
override_name: Optional[str] = None,
|
|
155
|
-
mod_bundle: Optional[Module | str] = None,
|
|
156
|
-
lng: Optional[str] = "jac",
|
|
157
|
-
items: Optional[dict[str, Union[str, Optional[str]]]] = None,
|
|
158
|
-
) -> tuple[types.ModuleType, ...]:
|
|
159
|
-
"""Core Import Process."""
|
|
160
|
-
unique_loaded_items = []
|
|
161
|
-
dir_path, file_name = path.split(path.join(*(target.split("."))))
|
|
162
|
-
module_name = path.splitext(file_name)[0]
|
|
163
|
-
package_path = dir_path.replace(path.sep, ".")
|
|
164
|
-
if (
|
|
165
|
-
not override_name
|
|
166
|
-
and package_path
|
|
167
|
-
and f"{package_path}.{module_name}" in sys.modules
|
|
168
|
-
):
|
|
169
|
-
module = sys.modules[f"{package_path}.{module_name}"]
|
|
170
|
-
elif not override_name and not package_path and module_name in sys.modules:
|
|
171
|
-
module = sys.modules[module_name]
|
|
172
|
-
else:
|
|
173
|
-
module = None
|
|
174
|
-
valid_mod_bundle = (
|
|
175
|
-
sys.modules[mod_bundle].__jac_mod_bundle__
|
|
176
|
-
if isinstance(mod_bundle, str)
|
|
177
|
-
and mod_bundle in sys.modules
|
|
178
|
-
and "__jac_mod_bundle__" in sys.modules[mod_bundle].__dict__
|
|
179
|
-
else None
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
caller_dir = get_caller_dir(target, base_path, dir_path)
|
|
183
|
-
full_target = path.normpath(path.join(caller_dir, file_name))
|
|
184
|
-
if not module:
|
|
185
|
-
if os.path.isdir(full_target):
|
|
186
|
-
module = handle_directory(module_name, full_target, valid_mod_bundle)
|
|
187
|
-
else:
|
|
188
|
-
full_target += ".jac" if lng == "jac" else ".py"
|
|
189
|
-
module_name = path.splitext(file_name)[0]
|
|
190
|
-
package_path = dir_path.replace(path.sep, ".")
|
|
191
|
-
|
|
192
|
-
if lng == "py":
|
|
193
|
-
module, *unique_loaded_items = py_import(
|
|
194
|
-
target=target,
|
|
195
|
-
items=items,
|
|
196
|
-
absorb=absorb,
|
|
197
|
-
mdl_alias=mdl_alias,
|
|
198
|
-
caller_dir=caller_dir,
|
|
199
|
-
)
|
|
200
|
-
else:
|
|
201
|
-
module_name = override_name if override_name else module_name
|
|
202
|
-
module = create_jac_py_module(
|
|
203
|
-
valid_mod_bundle,
|
|
204
|
-
module_name,
|
|
205
|
-
package_path,
|
|
206
|
-
full_target,
|
|
207
|
-
)
|
|
208
|
-
codeobj = get_codeobj(
|
|
209
|
-
full_target,
|
|
210
|
-
module_name,
|
|
211
|
-
valid_mod_bundle,
|
|
212
|
-
cachable,
|
|
213
|
-
caller_dir=caller_dir,
|
|
214
|
-
)
|
|
215
|
-
try:
|
|
216
|
-
if not codeobj:
|
|
217
|
-
raise ImportError(f"No bytecode found for {full_target}")
|
|
218
|
-
with sys_path_context(caller_dir):
|
|
219
|
-
exec(codeobj, module.__dict__)
|
|
220
|
-
except Exception as e:
|
|
221
|
-
raise ImportError(f"Error importing {full_target}: {str(e)}")
|
|
222
|
-
unique_loaded_items = (
|
|
223
|
-
process_items(
|
|
224
|
-
module=module,
|
|
225
|
-
items=items,
|
|
226
|
-
caller_dir=caller_dir,
|
|
227
|
-
mod_bundle=valid_mod_bundle,
|
|
228
|
-
cachable=cachable,
|
|
229
|
-
lang=lng,
|
|
230
|
-
)
|
|
231
|
-
if items
|
|
232
|
-
else []
|
|
233
|
-
)
|
|
234
|
-
return (module,) if absorb or not items else tuple(unique_loaded_items)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
def create_jac_py_module(
|
|
238
|
-
mod_bundle: Optional[Module],
|
|
239
|
-
module_name: str,
|
|
240
|
-
package_path: str,
|
|
241
|
-
full_target: str,
|
|
242
|
-
) -> types.ModuleType:
|
|
243
|
-
"""Create a module."""
|
|
244
|
-
module = types.ModuleType(module_name)
|
|
245
|
-
module.__file__ = full_target
|
|
246
|
-
module.__name__ = module_name
|
|
247
|
-
module.__dict__["__jac_mod_bundle__"] = mod_bundle
|
|
248
|
-
if package_path:
|
|
249
|
-
parts = package_path.split(".")
|
|
250
|
-
base_path = full_target.split(package_path.replace(".", path.sep))[0]
|
|
251
|
-
for i in range(len(parts)):
|
|
252
|
-
package_name = ".".join(parts[: i + 1])
|
|
253
|
-
if package_name not in sys.modules:
|
|
254
|
-
full_mod_path = path.join(
|
|
255
|
-
base_path, package_name.replace(".", path.sep)
|
|
256
|
-
)
|
|
257
|
-
handle_directory(
|
|
258
|
-
module_name=package_name,
|
|
259
|
-
full_mod_path=full_mod_path,
|
|
260
|
-
mod_bundle=mod_bundle,
|
|
261
|
-
)
|
|
262
|
-
|
|
263
|
-
setattr(sys.modules[package_path], module_name, module)
|
|
264
|
-
sys.modules[f"{package_path}.{module_name}"] = module
|
|
265
|
-
sys.modules[module_name] = module
|
|
266
|
-
return module
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
def get_caller_dir(target: str, base_path: str, dir_path: str) -> str:
|
|
270
|
-
"""Get the directory of the caller."""
|
|
271
|
-
caller_dir = base_path if path.isdir(base_path) else path.dirname(base_path)
|
|
272
|
-
caller_dir = caller_dir if caller_dir else getcwd()
|
|
273
|
-
chomp_target = target
|
|
274
|
-
if chomp_target.startswith("."):
|
|
275
|
-
chomp_target = chomp_target[1:]
|
|
276
|
-
while chomp_target.startswith("."):
|
|
277
|
-
caller_dir = path.dirname(caller_dir)
|
|
278
|
-
chomp_target = chomp_target[1:]
|
|
279
|
-
caller_dir = path.join(caller_dir, dir_path)
|
|
280
|
-
return caller_dir
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
def py_import(
|
|
284
|
-
target: str,
|
|
285
|
-
caller_dir: str,
|
|
286
|
-
items: Optional[dict[str, Union[str, Optional[str]]]] = None,
|
|
287
|
-
absorb: bool = False,
|
|
288
|
-
mdl_alias: Optional[str] = None,
|
|
289
|
-
) -> tuple[types.ModuleType, ...]:
|
|
290
|
-
"""Import a Python module."""
|
|
291
|
-
try:
|
|
292
|
-
loaded_items: list = []
|
|
293
|
-
if target.startswith("."):
|
|
294
|
-
target = target.lstrip(".")
|
|
295
|
-
full_target = path.normpath(path.join(caller_dir, target))
|
|
296
|
-
spec = importlib.util.spec_from_file_location(target, full_target + ".py")
|
|
297
|
-
if spec and spec.loader:
|
|
298
|
-
imported_module = importlib.util.module_from_spec(spec)
|
|
299
|
-
sys.modules[spec.name] = imported_module
|
|
300
|
-
spec.loader.exec_module(imported_module)
|
|
301
|
-
else:
|
|
302
|
-
raise ImportError(f"Cannot find module {target} at {full_target}")
|
|
303
|
-
else:
|
|
304
|
-
imported_module = importlib.import_module(name=target)
|
|
305
|
-
main_module = __import__("__main__")
|
|
306
|
-
if absorb:
|
|
307
|
-
for name in dir(imported_module):
|
|
308
|
-
if not name.startswith("_"):
|
|
309
|
-
setattr(main_module, name, getattr(imported_module, name))
|
|
310
|
-
|
|
311
|
-
elif items:
|
|
312
|
-
for name, alias in items.items():
|
|
313
|
-
if isinstance(alias, bool):
|
|
314
|
-
alias = name
|
|
315
|
-
try:
|
|
316
|
-
item = getattr(imported_module, name)
|
|
317
|
-
if item not in loaded_items:
|
|
318
|
-
setattr(
|
|
319
|
-
main_module, alias if isinstance(alias, str) else name, item
|
|
320
|
-
)
|
|
321
|
-
loaded_items.append(item)
|
|
322
|
-
except AttributeError as e:
|
|
323
|
-
if hasattr(imported_module, "__path__"):
|
|
324
|
-
item = importlib.import_module(f"{target}.{name}")
|
|
325
|
-
if item not in loaded_items:
|
|
326
|
-
setattr(
|
|
327
|
-
main_module,
|
|
328
|
-
alias if isinstance(alias, str) else name,
|
|
329
|
-
item,
|
|
330
|
-
)
|
|
331
|
-
loaded_items.append(item)
|
|
332
|
-
else:
|
|
333
|
-
raise e
|
|
334
|
-
|
|
335
|
-
else:
|
|
336
|
-
setattr(
|
|
337
|
-
__import__("__main__"),
|
|
338
|
-
mdl_alias if isinstance(mdl_alias, str) else target,
|
|
339
|
-
imported_module,
|
|
340
|
-
)
|
|
341
|
-
return (imported_module, *loaded_items)
|
|
342
|
-
|
|
343
|
-
except ImportError as e:
|
|
344
|
-
raise e
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|