codegen-2 2.15.1__tar.gz → 2.15.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegen-2
3
- Version: 2.15.1
3
+ Version: 2.15.3
4
4
  Summary: Meta-programming
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -96,7 +96,7 @@ class DefFuncStatement(Statement):
96
96
  comment: str = ""
97
97
 
98
98
  def to_python(self):
99
- sig = f"def {self.name}({', '.join([arg[0].to_python() + " = " + arg[1].to_python() if isinstance(arg, tuple) else arg.to_python() for arg in self.args])})"
99
+ sig = f"def {self.name}({', '.join([arg[0].to_python() + ' = ' + arg[1].to_python() if isinstance(arg, tuple) else arg.to_python() for arg in self.args])})"
100
100
  if self.return_type is not None:
101
101
  sig += f" -> {self.return_type.to_python()}"
102
102
  if self.is_async:
@@ -130,7 +130,7 @@ class DefFuncStatement(Statement):
130
130
 
131
131
  sig = (
132
132
  keyword
133
- + f"{self.name}({', '.join([arg[0].to_typescript() + " = " + arg[1].to_typescript() if isinstance(arg, tuple) else arg.to_typescript() for arg in self.args])})"
133
+ + f"{self.name}({', '.join([arg[0].to_typescript() + ' = ' + arg[1].to_typescript() if isinstance(arg, tuple) else arg.to_typescript() for arg in self.args])})"
134
134
  )
135
135
  if self.return_type is not None:
136
136
  sig += f": {self.return_type.to_typescript()}"
@@ -342,6 +342,9 @@ class IfStatement(Statement):
342
342
  def to_python(self):
343
343
  return f"if {self.cond.to_python()}:"
344
344
 
345
+ def to_typescript(self):
346
+ return f"if ({self.cond.to_typescript()})"
347
+
345
348
 
346
349
  @dataclass
347
350
  class TryStatement(Statement):
@@ -364,6 +367,9 @@ class ElseStatement(Statement):
364
367
  def to_python(self):
365
368
  return "else:"
366
369
 
370
+ def to_typescript(self):
371
+ return "else"
372
+
367
373
 
368
374
  @dataclass
369
375
  class Comment(Statement):
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "codegen-2"
3
- version = "2.15.1"
3
+ version = "2.15.3"
4
4
  description = "Meta-programming"
5
5
  authors = ["Binh Vu <binh@toan2.com>"]
6
6
  license = "MIT"
File without changes
File without changes