Skip to content

Commit 68b3633

Browse files
committed
Merge branch 'dict-literals' of https://github.com/BobTheBuidler/mypy into dict-literals
2 parents 6bbb9cf + bd42865 commit 68b3633

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mypyc/irbuild/expression.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,13 +1025,18 @@ def dict_literal_values(
10251025
If all keys and values are deeply immutable and constant (including nested dicts as values),
10261026
return the Python dict value. Otherwise, return None.
10271027
"""
1028-
def constant_fold_expr_or_tuple(builder: IRBuilder, expr: Expression) -> ConstantValueTuple | None:
1028+
1029+
def constant_fold_expr_or_tuple(
1030+
builder: IRBuilder, expr: Expression
1031+
) -> ConstantValueTuple | None:
10291032
value = constant_fold_expr(builder, expr)
10301033
if value is not None:
10311034
return value
10321035
if not isinstance(expr, TupleExpr):
10331036
return None
1034-
folded = tuple(const for const in map(constant_fold_expr_or_tuple, expr.items) if const is not None)
1037+
folded = tuple(
1038+
const for const in map(constant_fold_expr_or_tuple, expr.items) if const is not None
1039+
)
10351040
return folded if len(folded) == len(expr.items) else None
10361041

10371042
result = {}

0 commit comments

Comments
 (0)