codegen-2 2.11.0__tar.gz → 2.11.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: codegen-2
3
- Version: 2.11.0
3
+ Version: 2.11.1
4
4
  Summary: Meta-programming
5
5
  License: MIT
6
6
  Author: Binh Vu
@@ -164,10 +164,10 @@ class ExprAwait(Expr):
164
164
  expr: Expr
165
165
 
166
166
  def to_python(self):
167
- return f"await {self.expr.to_python()}"
167
+ return f"(await {self.expr.to_python()})"
168
168
 
169
169
  def to_typescript(self):
170
- return f"await {self.expr.to_typescript()}"
170
+ return f"(await {self.expr.to_typescript()})"
171
171
 
172
172
 
173
173
  @dataclass
@@ -239,7 +239,11 @@ class SingleExprStatement(Statement):
239
239
  expr: Expr
240
240
 
241
241
  def to_python(self):
242
- return self.expr.to_python()
242
+ stmt = self.expr.to_python()
243
+ if stmt[0] == "(" and stmt[-1] == ")":
244
+ # remove parentheses if they are not needed
245
+ stmt = stmt[1:-1]
246
+ return stmt
243
247
 
244
248
  def to_typescript(self):
245
249
  return self.expr.to_typescript()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "codegen-2"
3
- version = "2.11.0"
3
+ version = "2.11.1"
4
4
  description = "Meta-programming"
5
5
  authors = ["Binh Vu <binh@toan2.com>"]
6
6
  license = "MIT"
File without changes
File without changes