codegen-2 2.15.5__tar.gz → 2.15.7__tar.gz
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.
- codegen_2-2.15.7/PKG-INFO +15 -0
- {codegen_2-2.15.5 → codegen_2-2.15.7}/codegen/models/ast.py +8 -4
- {codegen_2-2.15.5 → codegen_2-2.15.7}/codegen/models/expr.py +1 -1
- codegen_2-2.15.7/pyproject.toml +20 -0
- codegen_2-2.15.5/LICENSE +0 -21
- codegen_2-2.15.5/PKG-INFO +0 -20
- codegen_2-2.15.5/pyproject.toml +0 -19
- {codegen_2-2.15.5 → codegen_2-2.15.7}/README.md +0 -0
- {codegen_2-2.15.5 → codegen_2-2.15.7}/codegen/__init__.py +0 -0
- {codegen_2-2.15.5 → codegen_2-2.15.7}/codegen/models/__init__.py +0 -0
- {codegen_2-2.15.5 → codegen_2-2.15.7}/codegen/models/program.py +0 -0
- {codegen_2-2.15.5 → codegen_2-2.15.7}/codegen/models/statement.py +0 -0
- {codegen_2-2.15.5 → codegen_2-2.15.7}/codegen/models/types.py +0 -0
- {codegen_2-2.15.5 → codegen_2-2.15.7}/codegen/models/var.py +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: codegen-2
|
|
3
|
+
Version: 2.15.7
|
|
4
|
+
Summary: Meta-programming
|
|
5
|
+
Author: Binh Vu
|
|
6
|
+
Author-email: Binh Vu <binh@toan2.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Requires-Dist: pytest>=8.0.0 ; extra == 'dev'
|
|
9
|
+
Requires-Dist: autoflake>=2.2.1 ; extra == 'dev'
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# codegen
|
|
15
|
+
Meta-programming
|
|
@@ -97,7 +97,7 @@ class AST:
|
|
|
97
97
|
def func(
|
|
98
98
|
self,
|
|
99
99
|
name: str,
|
|
100
|
-
vars: Sequence[DeferredVar | tuple[DeferredVar, Expr]],
|
|
100
|
+
vars: Sequence[Optional[DeferredVar] | tuple[DeferredVar, Expr]],
|
|
101
101
|
return_type: Optional[Expr] = None,
|
|
102
102
|
is_async: bool = False,
|
|
103
103
|
is_static: bool = False,
|
|
@@ -107,6 +107,9 @@ class AST:
|
|
|
107
107
|
"""Define a function. The input variables are deferred vars as they are created for this function (i.e., must not be predefined prior to this function)"""
|
|
108
108
|
grandchild_id = self.next_grandchild_id()
|
|
109
109
|
for vararg in vars:
|
|
110
|
+
if vararg is None:
|
|
111
|
+
continue
|
|
112
|
+
|
|
110
113
|
if isinstance(vararg, tuple):
|
|
111
114
|
var = vararg[0]
|
|
112
115
|
else:
|
|
@@ -127,6 +130,7 @@ class AST:
|
|
|
127
130
|
else var.get_var()
|
|
128
131
|
)
|
|
129
132
|
for var in vars
|
|
133
|
+
if var is not None
|
|
130
134
|
],
|
|
131
135
|
return_type,
|
|
132
136
|
is_async,
|
|
@@ -173,9 +177,9 @@ class AST:
|
|
|
173
177
|
|
|
174
178
|
def for_loop(self, item: DeferredVar, iter: Expr):
|
|
175
179
|
"""When we construct a for-loop, the item (or var) is always declared. We don't allow reassigning the variable in the for-loop."""
|
|
176
|
-
assert (
|
|
177
|
-
|
|
178
|
-
)
|
|
180
|
+
assert isinstance(item, DeferredVar) and item.has_not_been_created(), (
|
|
181
|
+
"The item must be a new variable"
|
|
182
|
+
)
|
|
179
183
|
var = self.prog.create_var(
|
|
180
184
|
item.name, item.key, self.next_grandchild_id(), item.force_name
|
|
181
185
|
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "codegen-2"
|
|
3
|
+
version = "2.15.7"
|
|
4
|
+
description = "Meta-programming"
|
|
5
|
+
authors = [{ name = "Binh Vu", email = "binh@toan2.com" }]
|
|
6
|
+
license = { text = "MIT" }
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = []
|
|
10
|
+
|
|
11
|
+
[project.optional-dependencies]
|
|
12
|
+
dev = ["pytest>=8.0.0", "autoflake>=2.2.1"]
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["uv-build"]
|
|
16
|
+
build-backend = "uv_build"
|
|
17
|
+
|
|
18
|
+
[tool.uv.build-backend]
|
|
19
|
+
module-name = "codegen"
|
|
20
|
+
module-root = ""
|
codegen_2-2.15.5/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Binh Vu
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
codegen_2-2.15.5/PKG-INFO
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: codegen-2
|
|
3
|
-
Version: 2.15.5
|
|
4
|
-
Summary: Meta-programming
|
|
5
|
-
License: MIT
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Author: Binh Vu
|
|
8
|
-
Author-email: binh@toan2.com
|
|
9
|
-
Requires-Python: >=3.11,<4.0
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
|
|
18
|
-
# codegen
|
|
19
|
-
Meta-programming
|
|
20
|
-
|
codegen_2-2.15.5/pyproject.toml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
[tool.poetry]
|
|
2
|
-
name = "codegen-2"
|
|
3
|
-
version = "2.15.5"
|
|
4
|
-
description = "Meta-programming"
|
|
5
|
-
authors = ["Binh Vu <binh@toan2.com>"]
|
|
6
|
-
license = "MIT"
|
|
7
|
-
readme = "README.md"
|
|
8
|
-
packages = [{ include = "codegen" }]
|
|
9
|
-
|
|
10
|
-
[tool.poetry.dependencies]
|
|
11
|
-
python = "^3.11"
|
|
12
|
-
|
|
13
|
-
[tool.poetry.group.dev.dependencies]
|
|
14
|
-
pytest = "^8.0.0"
|
|
15
|
-
autoflake = "^2.2.1"
|
|
16
|
-
|
|
17
|
-
[build-system]
|
|
18
|
-
requires = ["poetry-core"]
|
|
19
|
-
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|