Skip to content

Commit ba9b3eb

Browse files
committed
[mypyc] Fix lint errors in imported mypyc code
1 parent 43461c1 commit ba9b3eb

File tree

8 files changed

+18
-21
lines changed

8 files changed

+18
-21
lines changed

mypyc/__init__.py

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

mypyc/emit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Utilities for emitting C code."""
22

33
from collections import OrderedDict
4-
from typing import List, Set, Dict, Optional, List, Callable, Union
4+
from typing import List, Set, Dict, Optional, Callable, Union
55

66
from mypyc.common import (
77
REG_PREFIX, ATTR_PREFIX, STATIC_PREFIX, TYPE_PREFIX, NATIVE_PREFIX,

mypyc/emitmodule.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from mypyc.uninit import insert_uninit_checks
2323
from mypyc.refcount import insert_ref_count_opcodes
2424
from mypyc.exceptions import insert_exception_handling
25-
from mypyc.emit import EmitterContext, Emitter, HeaderDeclaration
2625
from mypyc.namegen import exported_name
2726

2827

mypyc/genops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def f(x: int) -> int:
6565
bool_rprimitive, list_rprimitive, is_list_rprimitive, dict_rprimitive, set_rprimitive,
6666
str_rprimitive, tuple_rprimitive, none_rprimitive, is_none_rprimitive, object_rprimitive,
6767
exc_rtuple,
68-
PrimitiveOp, ControlOp, LoadErrorValue, OpDescription, RegisterOp,
68+
PrimitiveOp, ControlOp, OpDescription, RegisterOp,
6969
is_object_rprimitive, LiteralsMap, FuncSignature, VTableAttr, VTableMethod, VTableEntries,
7070
NAMESPACE_TYPE, RaiseStandardError, LoadErrorValue, NO_TRACEBACK_LINE_NO, FuncDecl,
7171
FUNC_NORMAL, FUNC_STATICMETHOD, FUNC_CLASSMETHOD,
@@ -4502,10 +4502,10 @@ def op_arg_type(self, desc: OpDescription, n: int) -> RType:
45024502
@overload
45034503
def accept(self, node: Expression) -> Value: ...
45044504

4505-
@overload
4505+
@overload # noqa
45064506
def accept(self, node: Statement) -> None: ...
45074507

4508-
def accept(self, node: Union[Statement, Expression]) -> Optional[Value]:
4508+
def accept(self, node: Union[Statement, Expression]) -> Optional[Value]: # noqa
45094509
with self.catch_errors(node.line):
45104510
if isinstance(node, Expression):
45114511
try:

mypyc/ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def add(self, reg: 'Value', name: str) -> None:
440440

441441
def add_local(self, symbol: SymbolNode, typ: RType, is_arg: bool = False) -> 'Register':
442442
assert isinstance(symbol, SymbolNode)
443-
reg = Register(typ, symbol.line, is_arg = is_arg)
443+
reg = Register(typ, symbol.line, is_arg=is_arg)
444444
self.symtable[symbol] = AssignmentTargetRegister(reg)
445445
self.add(reg, symbol.name())
446446
return reg

mypyc/ops_exc.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@
1414
arg_types=[object_rprimitive],
1515
result_type=bool_rprimitive,
1616
error_kind=ERR_FALSE,
17-
format_str = 'raise_exception({args[0]}); {dest} = 0',
17+
format_str='raise_exception({args[0]}); {dest} = 0',
1818
emit=simple_emit('CPy_Raise({args[0]}); {dest} = 0;'))
1919

2020
set_stop_iteration_value = custom_op(
2121
arg_types=[object_rprimitive],
2222
result_type=bool_rprimitive,
2323
error_kind=ERR_FALSE,
24-
format_str = 'set_stop_iteration_value({args[0]}); {dest} = 0',
24+
format_str='set_stop_iteration_value({args[0]}); {dest} = 0',
2525
emit=simple_emit('CPyGen_SetStopIterationValue({args[0]}); {dest} = 0;'))
2626

2727
raise_exception_with_tb_op = custom_op(
2828
arg_types=[object_rprimitive, object_rprimitive, object_rprimitive],
2929
result_type=bool_rprimitive,
3030
error_kind=ERR_FALSE,
31-
format_str = 'raise_exception_with_tb({args[0]}, {args[1]}, {args[2]}); {dest} = 0',
31+
format_str='raise_exception_with_tb({args[0]}, {args[1]}, {args[2]}); {dest} = 0',
3232
emit=simple_emit('CPyErr_SetObjectAndTraceback({args[0]}, {args[1]}, {args[2]}); {dest} = 0;'))
3333

3434
reraise_exception_op = custom_op(
3535
arg_types=[],
3636
result_type=bool_rprimitive,
3737
error_kind=ERR_FALSE,
38-
format_str = 'reraise_exc; {dest} = 0',
38+
format_str='reraise_exc; {dest} = 0',
3939
emit=simple_emit('CPy_Reraise(); {dest} = 0;'))
4040

4141
no_err_occurred_op = custom_op(
4242
arg_types=[],
4343
result_type=bool_rprimitive,
4444
error_kind=ERR_FALSE,
45-
format_str = '{dest} = no_err_occurred',
45+
format_str='{dest} = no_err_occurred',
4646
emit=simple_emit('{dest} = (PyErr_Occurred() == NULL);'))
4747

4848
assert_err_occured_op = custom_op(
@@ -56,7 +56,7 @@
5656
arg_types=[],
5757
result_type=bool_rprimitive,
5858
error_kind=ERR_FALSE,
59-
format_str = '{dest} = keep_propagating',
59+
format_str='{dest} = keep_propagating',
6060
emit=simple_emit('{dest} = 0;'))
6161

6262
# Catches a propagating exception and makes it the "currently
@@ -67,7 +67,7 @@
6767
arg_types=[],
6868
result_type=exc_rtuple,
6969
error_kind=ERR_NEVER,
70-
format_str = '{dest} = error_catch',
70+
format_str='{dest} = error_catch',
7171
emit=simple_emit('CPy_CatchError(&{dest}.f0, &{dest}.f1, &{dest}.f2);'))
7272

7373
# Restore an old "currently handled exception" returned from
@@ -76,28 +76,28 @@
7676
arg_types=[exc_rtuple],
7777
result_type=void_rtype,
7878
error_kind=ERR_NEVER,
79-
format_str = 'restore_exc_info {args[0]}',
79+
format_str='restore_exc_info {args[0]}',
8080
emit=simple_emit('CPy_RestoreExcInfo({args[0]}.f0, {args[0]}.f1, {args[0]}.f2);'))
8181

8282
# Checks whether the exception currently being handled matches a particular type.
8383
exc_matches_op = custom_op(
8484
arg_types=[object_rprimitive],
8585
result_type=bool_rprimitive,
8686
error_kind=ERR_NEVER,
87-
format_str = '{dest} = exc_matches {args[0]}',
87+
format_str='{dest} = exc_matches {args[0]}',
8888
emit=simple_emit('{dest} = CPy_ExceptionMatches({args[0]});'))
8989

9090
# Get the value of the exception currently being handled.
9191
get_exc_value_op = custom_op(
9292
arg_types=[],
9393
result_type=object_rprimitive,
9494
error_kind=ERR_NEVER,
95-
format_str = '{dest} = get_exc_value',
95+
format_str='{dest} = get_exc_value',
9696
emit=simple_emit('{dest} = CPy_GetExcValue();'))
9797

9898
get_exc_info_op = custom_op(
9999
arg_types=[],
100100
result_type=exc_rtuple,
101101
error_kind=ERR_NEVER,
102-
format_str = '{dest} = get_exc_info',
102+
format_str='{dest} = get_exc_info',
103103
emit=simple_emit('CPy_GetExcInfo(&{dest}.f0, &{dest}.f1, &{dest}.f2);'))

mypyc/ops_misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
from mypyc.ops_primitive import (
1010
name_ref_op, simple_emit, binary_op, unary_op, func_op, method_op, custom_op,
11-
simple_emit, negative_int_emit,
11+
negative_int_emit,
1212
call_emit, name_emit, call_negative_bool_emit, call_negative_magic_emit,
1313
)
1414

@@ -304,7 +304,7 @@
304304
format_str='{dest} = py_calc_metaclass({comma_args})',
305305
emit=simple_emit(
306306
'{dest} = (PyObject*) _PyType_CalculateMetaclass((PyTypeObject *){args[0]}, {args[1]});'),
307-
is_borrowed = True
307+
is_borrowed=True
308308
)
309309

310310
py_delattr_op = func_op(

mypyc/refcount.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
analyze_live_regs,
2525
analyze_borrowed_arguments,
2626
cleanup_cfg,
27-
analyze_must_defined_regs,
2827
AnalysisDict
2928
)
3029
from mypyc.ops import (

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy