Skip to content

Commit 5471267

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 67ce16a commit 5471267

File tree

18 files changed

+68
-44
lines changed

18 files changed

+68
-44
lines changed

mypyc/analysis/attrdefined.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def foo(self) -> int:
9090
SetMem,
9191
Unreachable,
9292
)
93-
from mypyc.ir.rtypes import RInstance, RInstanceValue
93+
from mypyc.ir.rtypes import RInstance
9494

9595
# If True, print out all always-defined attributes of native classes (to aid
9696
# debugging and testing)

mypyc/codegen/emit.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from mypyc.ir.ops import BasicBlock, Value
2424
from mypyc.ir.rtypes import (
2525
RInstance,
26+
RInstanceValue,
2627
RPrimitive,
2728
RTuple,
2829
RType,
@@ -49,7 +50,7 @@
4950
is_tuple_rprimitive,
5051
is_uint8_rprimitive,
5152
object_rprimitive,
52-
optional_value_type, RInstanceValue,
53+
optional_value_type,
5354
)
5455
from mypyc.namegen import NameGenerator, exported_name
5556
from mypyc.sametype import is_same_type
@@ -1069,7 +1070,9 @@ def emit_box(
10691070
setup_name = f"{name_prefix}_setup"
10701071
py_type_struct = self.type_struct_name(cl)
10711072
temp_dest = self.temp_name()
1072-
self.emit_line(f"{self.ctype_spaced(typ)}*{temp_dest} = ({self.ctype_spaced(typ)}*){setup_name}({py_type_struct});")
1073+
self.emit_line(
1074+
f"{self.ctype_spaced(typ)}*{temp_dest} = ({self.ctype_spaced(typ)}*){setup_name}({py_type_struct});"
1075+
)
10731076
self.emit_line(f"if (unlikely({temp_dest} == NULL))")
10741077
self.emit_line(" CPyError_OutOfMemory();")
10751078
for attr, attr_type in cl.attributes.items():

mypyc/codegen/emitfunc.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,28 @@
7171
)
7272
from mypyc.ir.pprint import generate_names_for_ir
7373
from mypyc.ir.rtypes import (
74-
c_pyssize_t_rprimitive,
74+
PyObject,
7575
RArray,
7676
RInstance,
77+
RInstanceValue,
7778
RStruct,
7879
RTuple,
7980
RType,
81+
c_pyssize_t_rprimitive,
8082
is_int32_rprimitive,
8183
is_int64_rprimitive,
8284
is_int_rprimitive,
8385
is_pointer_rprimitive,
8486
is_tagged,
85-
PyObject,
86-
RInstanceValue,
8787
)
8888

8989

9090
def struct_type(class_ir: ClassIR, emitter: Emitter) -> RStruct:
9191
"""Return the struct type for this instance type."""
92-
python_fields: list[tuple[str, RType]] = [("head", PyObject), ("vtable", c_pyssize_t_rprimitive)]
92+
python_fields: list[tuple[str, RType]] = [
93+
("head", PyObject),
94+
("vtable", c_pyssize_t_rprimitive),
95+
]
9396
class_fields = list(class_ir.attributes.items())
9497
attr_names = [emitter.attr(name) for name, _ in python_fields + class_fields]
9598
attr_types = [rtype for _, rtype in python_fields + class_fields]

mypyc/codegen/emitwrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
is_bool_rprimitive,
3535
is_int_rprimitive,
3636
is_object_rprimitive,
37-
object_rprimitive, RInstanceValue,
37+
object_rprimitive,
3838
)
3939
from mypyc.namegen import NameGenerator
4040

mypyc/ir/class_ir.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from mypyc.common import PROPSET_PREFIX, JsonDict
88
from mypyc.ir.func_ir import FuncDecl, FuncIR, FuncSignature
99
from mypyc.ir.ops import DeserMaps, Value
10-
from mypyc.ir.rtypes import RInstance, RType, deserialize_type, RInstanceValue
10+
from mypyc.ir.rtypes import RInstance, RInstanceValue, RType, deserialize_type
1111
from mypyc.namegen import NameGenerator, exported_name
1212

1313
# Some notes on the vtable layout: Each concrete class has a vtable

mypyc/ir/ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
object_rprimitive,
3636
pointer_rprimitive,
3737
short_int_rprimitive,
38-
void_rtype, RInstanceValue,
38+
void_rtype,
3939
)
4040

4141
if TYPE_CHECKING:

mypyc/ir/rtypes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
from abc import abstractmethod
2626
from typing import TYPE_CHECKING, ClassVar, Final, Generic, TypeVar
27-
2827
from typing_extensions import TypeGuard
2928

3029
from mypyc.common import IS_32_BIT_PLATFORM, PLATFORM_SIZE, JsonDict, short_name

mypyc/irbuild/builder.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from contextlib import contextmanager
1717
from typing import Any, Callable, Final, Iterator, Sequence, Union
18-
1918
from typing_extensions import overload
2019

2120
from mypy.build import Graph
@@ -109,7 +108,7 @@
109108
is_tuple_rprimitive,
110109
none_rprimitive,
111110
object_rprimitive,
112-
str_rprimitive, RInstanceValue,
111+
str_rprimitive,
113112
)
114113
from mypyc.irbuild.context import FuncInfo, ImplicitClass
115114
from mypyc.irbuild.ll_builder import LowLevelIRBuilder

mypyc/irbuild/classdef.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
from __future__ import annotations
44

5+
import typing_extensions
56
from abc import abstractmethod
67
from typing import Callable, Final
78

8-
import typing_extensions
9-
109
from mypy.nodes import (
1110
TYPE_VAR_TUPLE_KIND,
1211
AssignmentStmt,
@@ -64,12 +63,7 @@
6463
handle_non_ext_method,
6564
load_type,
6665
)
67-
from mypyc.irbuild.util import (
68-
dataclass_type,
69-
get_func_def,
70-
is_constant,
71-
is_dataclass_decorator,
72-
)
66+
from mypyc.irbuild.util import dataclass_type, get_func_def, is_constant, is_dataclass_decorator
7367
from mypyc.primitives.dict_ops import dict_new_op, dict_set_item_op
7468
from mypyc.primitives.generic_ops import (
7569
iter_op,

mypyc/irbuild/function.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@
5454
Unreachable,
5555
Value,
5656
)
57-
from mypyc.ir.rtypes import (
58-
bool_rprimitive,
59-
dict_rprimitive,
60-
int_rprimitive,
61-
object_rprimitive,
62-
)
57+
from mypyc.ir.rtypes import bool_rprimitive, dict_rprimitive, int_rprimitive, object_rprimitive
6358
from mypyc.irbuild.builder import IRBuilder, SymbolTarget, gen_arg_defaults
6459
from mypyc.irbuild.callable_class import (
6560
add_call_to_callable_class,
@@ -91,7 +86,6 @@
9186
from mypyc.primitives.registry import builtin_names
9287
from mypyc.sametype import is_same_method_signature, is_same_type
9388

94-
9589
# Top-level transform functions
9690

9791

0 commit comments

Comments
 (0)