codegen-2 2.6.0__tar.gz → 2.7.1__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.6.0 → codegen_2-2.7.1}/PKG-INFO +1 -1
- {codegen_2-2.6.0 → codegen_2-2.7.1}/codegen/models/expr.py +16 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/pyproject.toml +1 -1
- {codegen_2-2.6.0 → codegen_2-2.7.1}/LICENSE +0 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/README.md +0 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/codegen/__init__.py +0 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/codegen/models/__init__.py +0 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/codegen/models/ast.py +0 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/codegen/models/program.py +0 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/codegen/models/statement.py +0 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/codegen/models/types.py +0 -0
- {codegen_2-2.6.0 → codegen_2-2.7.1}/codegen/models/var.py +0 -0
|
@@ -231,6 +231,19 @@ class ExprDivision(Expr):
|
|
|
231
231
|
return f"{self.left.to_python()} / {self.right.to_python()}"
|
|
232
232
|
|
|
233
233
|
|
|
234
|
+
@dataclass
|
|
235
|
+
class ExprTernary(Expr):
|
|
236
|
+
condition: Expr
|
|
237
|
+
true_expr: Expr
|
|
238
|
+
false_expr: Expr
|
|
239
|
+
|
|
240
|
+
def to_python(self):
|
|
241
|
+
return f"{self.true_expr.to_python()} if {self.condition.to_python()} else {self.false_expr.to_python()}"
|
|
242
|
+
|
|
243
|
+
def to_typescript(self):
|
|
244
|
+
return f"{self.true_expr.to_typescript()} ? {self.condition.to_typescript()} : {self.false_expr.to_typescript()}"
|
|
245
|
+
|
|
246
|
+
|
|
234
247
|
class PredefinedFn:
|
|
235
248
|
@dataclass
|
|
236
249
|
class is_null(Expr):
|
|
@@ -253,6 +266,9 @@ class PredefinedFn:
|
|
|
253
266
|
def to_python(self):
|
|
254
267
|
return f"[{', '.join([item.to_python() for item in self.items])}]"
|
|
255
268
|
|
|
269
|
+
def to_typescript(self):
|
|
270
|
+
return f"[{', '.join([item.to_typescript() for item in self.items])}]"
|
|
271
|
+
|
|
256
272
|
@dataclass
|
|
257
273
|
class dict(Expr):
|
|
258
274
|
items: Sequence[tuple[Expr, Expr]]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|