Skip to content

Commit 9f31034

Browse files
committed
Lint
1 parent b266529 commit 9f31034

2 files changed

Lines changed: 5 additions & 21 deletions

File tree

mypyc/codegen/emitmodule.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,19 +1195,15 @@ def emit_module_exec_func(
11951195
emitter.emit_line("return -1;")
11961196
emitter.emit_line("}")
11971197

1198-
def emit_init_only_func(
1199-
self, emitter: Emitter, module_name: str, module_prefix: str
1200-
) -> None:
1198+
def emit_init_only_func(self, emitter: Emitter, module_name: str, module_prefix: str) -> None:
12011199
"""Emit CPyInitOnly_* which creates the module object without executing the body.
12021200
12031201
This allows the caller to set up attributes like __file__ and __package__
12041202
before the module body runs. Used for same-group native imports.
12051203
"""
12061204
init_only_name = f"CPyInitOnly_{exported_name(module_name)}"
12071205
init_only_decl = f"PyObject *{init_only_name}(void)"
1208-
emitter.context.declarations[init_only_name] = HeaderDeclaration(
1209-
init_only_decl + ";"
1210-
)
1206+
emitter.context.declarations[init_only_name] = HeaderDeclaration(init_only_decl + ";")
12111207
module_static = self.module_internal_static_name(module_name, emitter)
12121208
emitter.emit_lines(init_only_decl, "{")
12131209
emitter.emit_lines(

mypyc/test/test_statement.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,8 @@ def test_classify_import_from_groups_consecutive_kinds(self) -> None:
118118
)
119119

120120
assert [(bucket.kind, bucket.names, bucket.as_names) for bucket in buckets] == [
121-
(
122-
IMPORT_NATIVE_SUBMODULE,
123-
["native_a", "native_b"],
124-
["native_a", "native_b_alias"],
125-
),
126-
(
127-
IMPORT_NON_NATIVE,
128-
["foreign_a", "foreign_b"],
129-
["foreign_a", "foreign_b_alias"],
130-
),
121+
(IMPORT_NATIVE_SUBMODULE, ["native_a", "native_b"], ["native_a", "native_b_alias"]),
122+
(IMPORT_NON_NATIVE, ["foreign_a", "foreign_b"], ["foreign_a", "foreign_b_alias"]),
131123
]
132124

133125
def test_classify_import_from_treats_missing_name_under_native_parent_as_attr(self) -> None:
@@ -150,11 +142,7 @@ def test_classify_import_from_without_native_parent_never_uses_native_attr(self)
150142
builder = make_builder()
151143

152144
buckets = classify_import_from(
153-
builder,
154-
"pkg",
155-
["attr_name"],
156-
["attr_alias"],
157-
parent_is_native=False,
145+
builder, "pkg", ["attr_name"], ["attr_alias"], parent_is_native=False
158146
)
159147

160148
assert [(bucket.kind, bucket.names, bucket.as_names) for bucket in buckets] == [

0 commit comments

Comments
 (0)