Skip to content

Commit 317f9ed

Browse files
committed
Minor style fix in scripts/cython_godot_extension_class_preprocessor/__init__.py
1 parent ad831f7 commit 317f9ed

File tree

1 file changed

+3
-6
lines changed
  • scripts/cython_godot_extension_class_preprocessor

1 file changed

+3
-6
lines changed

scripts/cython_godot_extension_class_preprocessor/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ class extension's methods in a json format (used as input by the template to gen
2323
2424
The drawback is Cython doesn't provide a public API to plug into it compilation pipeline so
2525
we have no guarantee this will not break in the future (but this part Cython is very central
26-
so it's highly inlikely to change).
26+
so it's highly unlikely to change).
2727
"""
2828

2929
from typing import Optional
3030
from dataclasses import dataclass
3131
from Cython.Compiler.ParseTreeTransforms import NormalizeTree
3232
from Cython.Compiler.Visitor import CythonTransform
3333
import Cython.Compiler.Pipeline
34-
from Cython.Compiler.Pipeline import dumptree
3534
from Cython.Compiler.Errors import error
3635
from Cython.Compiler.PyrexTypes import CIntType
3736
from Cython.Compiler import Nodes, ExprNodes
@@ -43,14 +42,12 @@ class extension's methods in a json format (used as input by the template to gen
4342

4443

4544
def patch_cython_pipeline():
46-
4745
global _pipeline_patched
4846
assert not _pipeline_patched # Sanity check to avoid double patching
4947

5048
vanilla_create_pipeline = Cython.Compiler.Pipeline.create_pipeline
5149

5250
def godot_python_patched_create_pipeline(context, mode, exclude_classes=()):
53-
5451
stages = vanilla_create_pipeline(context, mode, exclude_classes)
5552
index = next(i + 1 for i, x in enumerate(stages) if isinstance(x, NormalizeTree))
5653
stages.insert(index, GodotExtensionClassAttributes(context))
@@ -183,7 +180,7 @@ def visit_CClassDefNode(self, node):
183180
error(arg.key.pos, f"unknown param `{arg.key.value}`")
184181
return node
185182
if not isinstance(arg.value, ExprNodes.UnicodeNode):
186-
error(arg.value.pos, f"param `parent` must be a unicode literal")
183+
error(arg.value.pos, "param `parent` must be a unicode literal")
187184
return node
188185
parent_class_name = arg.value.value
189186

@@ -302,7 +299,7 @@ def _extract_method_spec(method_node) -> MethodSpec:
302299
isinstance(arg_node.declarator, Nodes.CNameDeclaratorNode)
303300
and arg_node.declarator.name == ""
304301
):
305-
error(arg_node.pos, f"type required")
302+
error(arg_node.pos, "type required")
306303
return
307304
if isinstance(arg_node.declarator, Nodes.CPtrDeclaratorNode):
308305
arg_type_name = f"{arg_node.base_type.name}*"

0 commit comments

Comments
 (0)