|
59 | 59 | BasicBlock, |
60 | 60 | Call, |
61 | 61 | ComparisonOp, |
62 | | - InitStatic, |
63 | 62 | Integer, |
64 | 63 | LoadAddress, |
65 | 64 | LoadLiteral, |
66 | | - LoadStatic, |
67 | 65 | PrimitiveDescription, |
68 | 66 | RaiseStandardError, |
69 | 67 | Register, |
|
103 | 101 | ) |
104 | 102 | from mypyc.irbuild.specialize import apply_function_specialization, apply_method_specialization |
105 | 103 | from mypyc.primitives.bytes_ops import bytes_slice_op |
106 | | -from mypyc.primitives.dict_ops import dict_get_item_op, dict_new_op, dict_set_item_op, dict_template_copy_op, exact_dict_set_item_op |
| 104 | +from mypyc.primitives.dict_ops import ( |
| 105 | + dict_get_item_op, |
| 106 | + dict_new_op, |
| 107 | + dict_template_copy_op, |
| 108 | + exact_dict_set_item_op, |
| 109 | +) |
107 | 110 | from mypyc.primitives.generic_ops import iter_op, name_op |
108 | 111 | from mypyc.primitives.list_ops import list_append_op, list_extend_op, list_slice_op |
109 | 112 | from mypyc.primitives.misc_ops import ellipsis_op, get_module_dict_op, new_slice_op, type_op |
@@ -1012,7 +1015,9 @@ def _visit_tuple_display(builder: IRBuilder, expr: TupleExpr) -> Value: |
1012 | 1015 | return builder.primitive_op(list_tuple_op, [val_as_list], expr.line) |
1013 | 1016 |
|
1014 | 1017 |
|
1015 | | -def dict_literal_values(builder: IRBuilder, items: Sequence[tuple[Expression | None, Expression]], line: int) -> "dict | None": |
| 1018 | +def dict_literal_values( |
| 1019 | + builder: IRBuilder, items: Sequence[tuple[Expression | None, Expression]], line: int |
| 1020 | +) -> dict | None: |
1016 | 1021 | """Try to extract a constant dict from a dict literal, recursively staticizing nested dicts. |
1017 | 1022 |
|
1018 | 1023 | If all keys and values are deeply immutable and constant (including nested dicts as values), |
@@ -1043,6 +1048,7 @@ def dict_literal_values(builder: IRBuilder, items: Sequence[tuple[Expression | N |
1043 | 1048 |
|
1044 | 1049 | return result or None |
1045 | 1050 |
|
| 1051 | + |
1046 | 1052 | def transform_dict_expr(builder: IRBuilder, expr: DictExpr) -> Value: |
1047 | 1053 | """First accepts all keys and values, then makes a dict out of them. |
1048 | 1054 |
|
|
0 commit comments