Skip to content

Commit f427d23

Browse files
pre-commit-ci[bot]BobTheBuidler
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 20e25aa commit f427d23

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mypyc/irbuild/constant_fold.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ def constant_fold_expr(builder: IRBuilder, expr: Expression) -> ConstantValue |
8181
elif isinstance(expr, DictExpr):
8282
# NOTE: the builder can't simply use a dict constant like it can with other constants, since dicts are mutable.
8383
# TODO: make the builder load the dict 'constant' by calling copy on a prebuilt constant template instead of building from scratch each time
84-
folded = {
85-
constant_fold_expr(key): constant_fold_expr(value)
86-
for key, value in expr.items
87-
}
88-
if len(folded) == len(expr.items) and None not in folded.keys() and None not in folded.values():
84+
folded = {constant_fold_expr(key): constant_fold_expr(value) for key, value in expr.items}
85+
if (
86+
len(folded) == len(expr.items)
87+
and None not in folded.keys()
88+
and None not in folded.values()
89+
):
8990
return folded
90-
91+
9192
# TODO use a placeholder instead of None so we can include None in folded tuples/dicts
9293
return None
9394

0 commit comments

Comments
 (0)