From 4276308be01ea498d946a79554b4a10b1cf13ccb Mon Sep 17 00:00:00 2001 From: KotlinIsland <65446343+KotlinIsland@users.noreply.github.com> Date: Sun, 16 Apr 2023 09:44:21 +1000 Subject: [PATCH] =?UTF-8?q?(=F0=9F=8E=81)=20update=20black=20to=2023.3.0?= =?UTF-8?q?=20(#15059)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: KotlinIsland --- .pre-commit-config.yaml | 2 +- misc/analyze_cache.py | 2 +- misc/fix_annotate.py | 1 - mypy/api.py | 1 - mypy/checker.py | 2 -- mypy/checkexpr.py | 4 +-- mypy/checkstrformat.py | 1 - mypy/config_parser.py | 2 +- mypy/constraints.py | 3 +-- mypy/dmypy_server.py | 2 -- mypy/fastparse.py | 1 - mypy/ipc.py | 1 - mypy/meet.py | 4 +-- mypy/messages.py | 3 +-- mypy/nodes.py | 1 - mypy/plugins/attrs.py | 1 - mypy/plugins/dataclasses.py | 1 - mypy/plugins/singledispatch.py | 2 -- mypy/report.py | 3 +-- mypy/semanal.py | 2 +- mypy/semanal_typeddict.py | 2 +- mypy/subtypes.py | 2 +- mypy/test/teststubgen.py | 4 +++ mypy/types.py | 7 +++--- mypy/typestate.py | 4 +-- mypy/typevartuples.py | 46 +++++++++++++++++++--------------- mypyc/analysis/dataflow.py | 1 - mypyc/codegen/emitclass.py | 1 - mypyc/ir/ops.py | 1 + mypyc/irbuild/builder.py | 2 -- mypyc/irbuild/function.py | 1 - mypyc/irbuild/prepare.py | 1 - mypyc/irbuild/statement.py | 2 +- mypyc/primitives/int_ops.py | 1 + mypyc/test/test_run.py | 6 ++--- test-requirements.txt | 2 +- 36 files changed, 55 insertions(+), 67 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d794c780ad3b..566e31d77017 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 22.12.0 # must match test-requirements.txt + rev: 23.3.0 # must match test-requirements.txt hooks: - id: black - repo: https://github.com/pycqa/isort diff --git a/misc/analyze_cache.py b/misc/analyze_cache.py index 8b805d8da0bc..45c44139b473 100644 --- a/misc/analyze_cache.py +++ b/misc/analyze_cache.py @@ -62,7 +62,7 @@ def load_json(data_path: str, meta_path: str) -> CacheData: def get_files(root: str) -> Iterable[CacheData]: - for (dirpath, dirnames, filenames) in os.walk(root): + for dirpath, dirnames, filenames in os.walk(root): for filename in filenames: if filename.endswith(".data.json"): meta_filename = filename.replace(".data.json", ".meta.json") diff --git a/misc/fix_annotate.py b/misc/fix_annotate.py index 7fffba8a8507..fc8ac27466d5 100644 --- a/misc/fix_annotate.py +++ b/misc/fix_annotate.py @@ -38,7 +38,6 @@ def foo(self, bar, baz=12): class FixAnnotate(BaseFix): - # This fixer is compatible with the bottom matcher. BM_compatible = True diff --git a/mypy/api.py b/mypy/api.py index 612fd0442276..e2179dba30ca 100644 --- a/mypy/api.py +++ b/mypy/api.py @@ -51,7 +51,6 @@ def _run(main_wrapper: Callable[[TextIO, TextIO], None]) -> tuple[str, str, int]: - stdout = StringIO() stderr = StringIO() diff --git a/mypy/checker.py b/mypy/checker.py index cdf2ab648545..2b865f645330 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -2068,7 +2068,6 @@ def erase_override(t: Type) -> Type: if not is_subtype( original.arg_types[i], erase_override(override.arg_types[i]) ): - arg_type_in_super = original.arg_types[i] if isinstance(node, FuncDef): @@ -2954,7 +2953,6 @@ def check_compatibility_all_supers( and lvalue.kind in (MDEF, None) and len(lvalue_node.info.bases) > 0 # None for Vars defined via self ): - for base in lvalue_node.info.mro[1:]: tnode = base.names.get(lvalue_node.name) if tnode is not None: diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index e8f4a9d086d9..c0c4e18d8f1f 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -170,7 +170,7 @@ # Type of callback user for checking individual function arguments. See # check_args() below for details. ArgChecker: _TypeAlias = Callable[ - [Type, Type, ArgKind, Type, int, int, CallableType, Optional[Type], Context, Context], None, + [Type, Type, ArgKind, Type, int, int, CallableType, Optional[Type], Context, Context], None ] # Maximum nesting level for math union in overloads, setting this to large values @@ -845,7 +845,7 @@ def check_typeddict_call_with_kwargs( # this may give a better error message. ret_type = callee - for (item_name, item_expected_type) in ret_type.items.items(): + for item_name, item_expected_type in ret_type.items.items(): if item_name in kwargs: item_value = kwargs[item_name] self.chk.check_simple_assignment( diff --git a/mypy/checkstrformat.py b/mypy/checkstrformat.py index 3ff4f9ea98b6..701a2d42ebfb 100644 --- a/mypy/checkstrformat.py +++ b/mypy/checkstrformat.py @@ -139,7 +139,6 @@ class ConversionSpecifier: def __init__( self, match: Match[str], start_pos: int = -1, non_standard_format_spec: bool = False ) -> None: - self.whole_seq = match.group() self.start_pos = start_pos diff --git a/mypy/config_parser.py b/mypy/config_parser.py index 190782a3bded..c723f99770c9 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -34,7 +34,7 @@ from mypy.options import PER_MODULE_OPTIONS, Options _CONFIG_VALUE_TYPES: _TypeAlias = Union[ - str, bool, int, float, Dict[str, str], List[str], Tuple[int, int], + str, bool, int, float, Dict[str, str], List[str], Tuple[int, int] ] _INI_PARSER_CALLABLE: _TypeAlias = Callable[[Any], _CONFIG_VALUE_TYPES] diff --git a/mypy/constraints.py b/mypy/constraints.py index c8c3c7933b6e..b145e5b8bd55 100644 --- a/mypy/constraints.py +++ b/mypy/constraints.py @@ -1006,7 +1006,6 @@ def infer_against_overloaded( return infer_constraints(template, item, self.direction) def visit_tuple_type(self, template: TupleType) -> list[Constraint]: - actual = self.actual unpack_index = find_unpack_in_list(template.items) is_varlength_tuple = ( @@ -1065,7 +1064,7 @@ def visit_typeddict_type(self, template: TypedDictType) -> list[Constraint]: res: list[Constraint] = [] # NOTE: Non-matching keys are ignored. Compatibility is checked # elsewhere so this shouldn't be unsafe. - for (item_name, template_item_type, actual_item_type) in template.zip(actual): + for item_name, template_item_type, actual_item_type in template.zip(actual): res.extend(infer_constraints(template_item_type, actual_item_type, self.direction)) return res elif isinstance(actual, AnyType): diff --git a/mypy/dmypy_server.py b/mypy/dmypy_server.py index 3cc50f4ece36..48e46ac8ba84 100644 --- a/mypy/dmypy_server.py +++ b/mypy/dmypy_server.py @@ -163,7 +163,6 @@ def ignore_suppressed_imports(module: str) -> bool: class Server: - # NOTE: the instance is constructed in the parent process but # serve() is called in the grandchild (by daemonize()). @@ -828,7 +827,6 @@ def update_sources(self, sources: list[BuildSource]) -> None: def update_changed( self, sources: list[BuildSource], remove: list[str], update: list[str] ) -> ChangesAndRemovals: - changed_paths = self.fswatcher.update_changed(remove, update) return self._find_changed(sources, changed_paths) diff --git a/mypy/fastparse.py b/mypy/fastparse.py index 6ff51e25ad5f..9a38d67f30e5 100644 --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -255,7 +255,6 @@ def parse( errors: Errors | None = None, options: Options | None = None, ) -> MypyFile: - """Parse a source file, without doing any semantic analysis. Return the parse tree. If errors is not provided, raise ParseError diff --git a/mypy/ipc.py b/mypy/ipc.py index f07616df0fd0..21ef61918de5 100644 --- a/mypy/ipc.py +++ b/mypy/ipc.py @@ -169,7 +169,6 @@ def __exit__( class IPCServer(IPCBase): - BUFFER_SIZE: Final = 2**16 def __init__(self, name: str, timeout: float | None = None) -> None: diff --git a/mypy/meet.py b/mypy/meet.py index 3214b4b43975..6ace7e993eec 100644 --- a/mypy/meet.py +++ b/mypy/meet.py @@ -828,13 +828,13 @@ def visit_tuple_type(self, t: TupleType) -> ProperType: def visit_typeddict_type(self, t: TypedDictType) -> ProperType: if isinstance(self.s, TypedDictType): - for (name, l, r) in self.s.zip(t): + for name, l, r in self.s.zip(t): if not is_equivalent(l, r) or (name in t.required_keys) != ( name in self.s.required_keys ): return self.default(self.s) item_list: list[tuple[str, Type]] = [] - for (item_name, s_item_type, t_item_type) in self.s.zipall(t): + for item_name, s_item_type, t_item_type in self.s.zipall(t): if s_item_type is not None: item_list.append((item_name, s_item_type)) else: diff --git a/mypy/messages.py b/mypy/messages.py index 9a91761558af..bbeb763e2797 100644 --- a/mypy/messages.py +++ b/mypy/messages.py @@ -2276,7 +2276,6 @@ def format_callable_args( arg_strings = [] for arg_name, arg_type, arg_kind in zip(arg_names, arg_types, arg_kinds): if arg_kind == ARG_POS and arg_name is None or verbosity == 0 and arg_kind.is_positional(): - arg_strings.append(format(arg_type)) else: constructor = ARG_CONSTRUCTOR_NAMES[arg_kind] @@ -2383,7 +2382,7 @@ def format_literal_value(typ: LiteralType) -> str: if not typ.is_anonymous(): return format(typ.fallback) items = [] - for (item_name, item_type) in typ.items.items(): + for item_name, item_type in typ.items.items(): modifier = "" if item_name in typ.required_keys else "?" items.append(f"{item_name!r}{modifier}: {format(item_type)}") s = f"TypedDict({{{', '.join(items)}}})" diff --git a/mypy/nodes.py b/mypy/nodes.py index 8365e508f8e0..83d8d319f725 100644 --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -3326,7 +3326,6 @@ def deserialize(cls, data: JsonDict) -> TypeInfo: class FakeInfo(TypeInfo): - __slots__ = ("msg",) # types.py defines a single instance of this class, called types.NOT_READY. diff --git a/mypy/plugins/attrs.py b/mypy/plugins/attrs.py index 4a43c2a16d52..80c2ff3d3325 100644 --- a/mypy/plugins/attrs.py +++ b/mypy/plugins/attrs.py @@ -529,7 +529,6 @@ def _cleanup_decorator(stmt: Decorator, attr_map: dict[str, Attribute]) -> None: and isinstance(func_decorator.expr, NameExpr) and func_decorator.expr.name in attr_map ): - if func_decorator.name == "default": attr_map[func_decorator.expr.name].has_default = True diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py index 9fa32a108b74..a577784217aa 100644 --- a/mypy/plugins/dataclasses.py +++ b/mypy/plugins/dataclasses.py @@ -220,7 +220,6 @@ def transform(self) -> bool: and ("__init__" not in info.names or info.names["__init__"].plugin_generated) and attributes ): - with state.strict_optional_set(self._api.options.strict_optional): args = [ attr.to_argument(info) diff --git a/mypy/plugins/singledispatch.py b/mypy/plugins/singledispatch.py index cd6a3a9fa1cc..ecfad83bde93 100644 --- a/mypy/plugins/singledispatch.py +++ b/mypy/plugins/singledispatch.py @@ -99,7 +99,6 @@ def create_singledispatch_function_callback(ctx: FunctionContext) -> Type: """Called for functools.singledispatch""" func_type = get_proper_type(get_first_arg(ctx.arg_types)) if isinstance(func_type, CallableType): - if len(func_type.arg_kinds) < 1: fail( ctx, "Singledispatch function requires at least one argument", func_type.definition @@ -176,7 +175,6 @@ def register_function( fallback_dispatch_type = fallback.arg_types[0] if not is_subtype(dispatch_type, fallback_dispatch_type): - fail( ctx, "Dispatch type {} must be subtype of fallback function first argument {}".format( diff --git a/mypy/report.py b/mypy/report.py index 2edd0957254e..81d49baf50da 100644 --- a/mypy/report.py +++ b/mypy/report.py @@ -44,7 +44,7 @@ ) ReporterClasses: _TypeAlias = Dict[ - str, Tuple[Callable[["Reports", str], "AbstractReporter"], bool], + str, Tuple[Callable[["Reports", str], "AbstractReporter"], bool] ] reporter_classes: Final[ReporterClasses] = {} @@ -860,7 +860,6 @@ def on_file( type_map: dict[Expression, Type], options: Options, ) -> None: - try: path = os.path.relpath(tree.path) except ValueError: diff --git a/mypy/semanal.py b/mypy/semanal.py index 84573790fd68..547bf4863edd 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -510,6 +510,7 @@ def prepare_typing_namespace(self, file_node: MypyFile, aliases: dict[str, str]) They will be replaced with real aliases when corresponding targets are ready. """ + # This is all pretty unfortunate. typeshed now has a # sys.version_info check for OrderedDict, and we shouldn't # take it out, because it is correct and a typechecker should @@ -4422,7 +4423,6 @@ def process__slots__(self, s: AssignmentStmt) -> None: and s.lvalues[0].name == "__slots__" and s.lvalues[0].kind == MDEF ): - # We understand `__slots__` defined as string, tuple, list, set, and dict: if not isinstance(s.rvalue, (StrExpr, ListExpr, TupleExpr, SetExpr, DictExpr)): # For example, `__slots__` can be defined as a variable, diff --git a/mypy/semanal_typeddict.py b/mypy/semanal_typeddict.py index acb93edb7d2d..04e0c85d5b68 100644 --- a/mypy/semanal_typeddict.py +++ b/mypy/semanal_typeddict.py @@ -469,7 +469,7 @@ def parse_typeddict_fields_with_types( seen_keys = set() items: list[str] = [] types: list[Type] = [] - for (field_name_expr, field_type_expr) in dict_items: + for field_name_expr, field_type_expr in dict_items: if isinstance(field_name_expr, StrExpr): key = field_name_expr.value items.append(key) diff --git a/mypy/subtypes.py b/mypy/subtypes.py index 7ffa2ac68eef..29ad86e5d99f 100644 --- a/mypy/subtypes.py +++ b/mypy/subtypes.py @@ -1034,7 +1034,7 @@ def f(self) -> A: ... if not members_right.issubset(members_left): return False assuming = right.type.assuming_proper if proper_subtype else right.type.assuming - for (l, r) in reversed(assuming): + for l, r in reversed(assuming): if l == left and r == right: return True with pop_on_exit(assuming, left, right): diff --git a/mypy/test/teststubgen.py b/mypy/test/teststubgen.py index 47b664a46d72..b21e06c0896a 100644 --- a/mypy/test/teststubgen.py +++ b/mypy/test/teststubgen.py @@ -1061,6 +1061,7 @@ def test(self, arg0: str = "") -> None: def test_generate_c_function_other_module_arg(self) -> None: """Test that if argument references type from other module, module will be imported.""" + # Provide different type in python spec than in docstring to make sure, that docstring # information is used. def test(arg0: str) -> None: @@ -1087,6 +1088,7 @@ def test_generate_c_function_same_module(self) -> None: """Test that if annotation references type from same module but using full path, no module will be imported, and type specification will be striped to local reference. """ + # Provide different type in python spec than in docstring to make sure, that docstring # information is used. def test(arg0: str) -> None: @@ -1136,6 +1138,7 @@ def test_generate_c_function_same_module_nested(self) -> None: """Test that if annotation references type from same module but using full path, no module will be imported, and type specification will be stripped to local reference. """ + # Provide different type in python spec than in docstring to make sure, that docstring # information is used. def test(arg0: str) -> None: @@ -1162,6 +1165,7 @@ def test_generate_c_function_same_module_compound(self) -> None: """Test that if annotation references type from same module but using full path, no module will be imported, and type specification will be stripped to local reference. """ + # Provide different type in python spec than in docstring to make sure, that docstring # information is used. def test(arg0: str) -> None: diff --git a/mypy/types.py b/mypy/types.py index 994eb290fff3..e78209be058f 100644 --- a/mypy/types.py +++ b/mypy/types.py @@ -505,7 +505,6 @@ def is_meta_var(self) -> bool: class TypeVarLikeType(ProperType): - __slots__ = ("name", "fullname", "id", "upper_bound") name: str # Name (may be qualified) @@ -2406,17 +2405,17 @@ def names_are_wider_than(self, other: TypedDictType) -> bool: def zip(self, right: TypedDictType) -> Iterable[tuple[str, Type, Type]]: left = self - for (item_name, left_item_type) in left.items.items(): + for item_name, left_item_type in left.items.items(): right_item_type = right.items.get(item_name) if right_item_type is not None: yield (item_name, left_item_type, right_item_type) def zipall(self, right: TypedDictType) -> Iterable[tuple[str, Type | None, Type | None]]: left = self - for (item_name, left_item_type) in left.items.items(): + for item_name, left_item_type in left.items.items(): right_item_type = right.items.get(item_name) yield (item_name, left_item_type, right_item_type) - for (item_name, right_item_type) in right.items.items(): + for item_name, right_item_type in right.items.items(): if item_name in left.items: continue yield (item_name, None, right_item_type) diff --git a/mypy/typestate.py b/mypy/typestate.py index 82864d200c8a..9f65481e5e94 100644 --- a/mypy/typestate.py +++ b/mypy/typestate.py @@ -112,7 +112,7 @@ def __init__(self) -> None: self.infer_unions = False def is_assumed_subtype(self, left: Type, right: Type) -> bool: - for (l, r) in reversed(self._assuming): + for l, r in reversed(self._assuming): if get_proper_type(l) == get_proper_type(left) and get_proper_type( r ) == get_proper_type(right): @@ -120,7 +120,7 @@ def is_assumed_subtype(self, left: Type, right: Type) -> bool: return False def is_assumed_proper_subtype(self, left: Type, right: Type) -> bool: - for (l, r) in reversed(self._assuming_proper): + for l, r in reversed(self._assuming_proper): if get_proper_type(l) == get_proper_type(left) and get_proper_type( r ) == get_proper_type(right): diff --git a/mypy/typevartuples.py b/mypy/typevartuples.py index 29b85dae72eb..cb7650ebb57d 100644 --- a/mypy/typevartuples.py +++ b/mypy/typevartuples.py @@ -52,14 +52,17 @@ def split_with_mapped_and_template( template: tuple[Type, ...], template_prefix_len: int, template_suffix_len: int, -) -> tuple[ - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], -] | None: +) -> ( + tuple[ + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + ] + | None +): split_result = fully_split_with_mapped_and_template( mapped, mapped_prefix_len, @@ -101,18 +104,21 @@ def fully_split_with_mapped_and_template( template: tuple[Type, ...], template_prefix_len: int, template_suffix_len: int, -) -> tuple[ - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], - tuple[Type, ...], -] | None: +) -> ( + tuple[ + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + tuple[Type, ...], + ] + | None +): if mapped_prefix_len is not None: assert mapped_suffix_len is not None mapped_prefix, mapped_middle, mapped_suffix = split_with_prefix_and_suffix( diff --git a/mypyc/analysis/dataflow.py b/mypyc/analysis/dataflow.py index 877fdaf77884..5136dc9f9abb 100644 --- a/mypyc/analysis/dataflow.py +++ b/mypyc/analysis/dataflow.py @@ -89,7 +89,6 @@ def get_cfg(blocks: list[BasicBlock]) -> CFG: pred_map: dict[BasicBlock, list[BasicBlock]] = {} exits = set() for block in blocks: - assert not any( isinstance(op, ControlOp) for op in block.ops[:-1] ), "Control-flow ops must be at the end of blocks" diff --git a/mypyc/codegen/emitclass.py b/mypyc/codegen/emitclass.py index bf1f152f1bb1..6a272d1aee2b 100644 --- a/mypyc/codegen/emitclass.py +++ b/mypyc/codegen/emitclass.py @@ -1017,7 +1017,6 @@ def generate_readonly_getter( def generate_property_setter( cl: ClassIR, attr: str, arg_type: RType, func_ir: FuncIR, emitter: Emitter ) -> None: - emitter.emit_line("static int") emitter.emit_line( "{}({} *self, PyObject *value, void *closure)".format( diff --git a/mypyc/ir/ops.py b/mypyc/ir/ops.py index adf24de235ff..0ab25aec8e8c 100644 --- a/mypyc/ir/ops.py +++ b/mypyc/ir/ops.py @@ -1549,6 +1549,7 @@ def visit_keep_alive(self, op: KeepAlive) -> T: # TODO: Should the following definition live somewhere else? + # We do a three-pass deserialization scheme in order to resolve name # references. # 1. Create an empty ClassIR for each class in an SCC. diff --git a/mypyc/irbuild/builder.py b/mypyc/irbuild/builder.py index 14f614f57dd6..8bdc626bc9c5 100644 --- a/mypyc/irbuild/builder.py +++ b/mypyc/irbuild/builder.py @@ -756,7 +756,6 @@ def process_iterator_tuple_assignment_helper( def process_iterator_tuple_assignment( self, target: AssignmentTargetTuple, rvalue_reg: Value, line: int ) -> None: - iterator = self.call_c(iter_op, [rvalue_reg], line) # This may be the whole lvalue list if there is no starred value @@ -1041,7 +1040,6 @@ def is_module_member_expr(self, expr: MemberExpr) -> bool: def call_refexpr_with_args( self, expr: CallExpr, callee: RefExpr, arg_values: list[Value] ) -> Value: - # Handle data-driven special-cased primitive call ops. if callee.fullname and expr.arg_kinds == [ARG_POS] * len(arg_values): fullname = get_call_target_fullname(callee) diff --git a/mypyc/irbuild/function.py b/mypyc/irbuild/function.py index ba2e4d2ba10b..dd962d9184f5 100644 --- a/mypyc/irbuild/function.py +++ b/mypyc/irbuild/function.py @@ -435,7 +435,6 @@ def handle_ext_method(builder: IRBuilder, cdef: ClassDef, fdef: FuncDef) -> None class_ir.method_decls[name].sig, base.method_decls[name].sig ) ): - # TODO: Support contravariant subtyping in the input argument for # property setters. Need to make a special glue method for handling this, # similar to gen_glue_property. diff --git a/mypyc/irbuild/prepare.py b/mypyc/irbuild/prepare.py index b3d10887ce21..e82e9fd3ff76 100644 --- a/mypyc/irbuild/prepare.py +++ b/mypyc/irbuild/prepare.py @@ -465,7 +465,6 @@ def prepare_init_method(cdef: ClassDef, ir: ClassIR, module_name: str, mapper: M def prepare_non_ext_class_def( path: str, module_name: str, cdef: ClassDef, errors: Errors, mapper: Mapper ) -> None: - ir = mapper.type_to_ir[cdef.info] info = cdef.info diff --git a/mypyc/irbuild/statement.py b/mypyc/irbuild/statement.py index 6592e593ae4d..c7eace87a17c 100644 --- a/mypyc/irbuild/statement.py +++ b/mypyc/irbuild/statement.py @@ -169,7 +169,7 @@ def transform_assignment_stmt(builder: IRBuilder, stmt: AssignmentStmt) -> None: temp = Register(rvalue_reg.type) builder.assign(temp, rvalue_reg, stmt.line) temps.append(temp) - for (left, temp) in zip(first_lvalue.items, temps): + for left, temp in zip(first_lvalue.items, temps): assignment_target = builder.get_assignment_target(left) builder.assign(assignment_target, temp, stmt.line) builder.flush_keep_alives() diff --git a/mypyc/primitives/int_ops.py b/mypyc/primitives/int_ops.py index 13dca720eba2..eff4b4ffd8ab 100644 --- a/mypyc/primitives/int_ops.py +++ b/mypyc/primitives/int_ops.py @@ -161,6 +161,7 @@ def int_unary_op(name: str, c_function_name: str) -> CFunctionDescription: # Primitives related to integer comparison operations: + # Description for building int comparison ops # # Fields: diff --git a/mypyc/test/test_run.py b/mypyc/test/test_run.py index 9598b9865f1e..8d6dd90d770d 100644 --- a/mypyc/test/test_run.py +++ b/mypyc/test/test_run.py @@ -142,9 +142,9 @@ class TestRun(MypycDataSuite): def run_case(self, testcase: DataDrivenTestCase) -> None: # setup.py wants to be run from the root directory of the package, which we accommodate # by chdiring into tmp/ - with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase), ( - chdir_manager("tmp") - ): + with use_custom_builtins( + os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase + ), chdir_manager("tmp"): self.run_case_inner(testcase) def run_case_inner(self, testcase: DataDrivenTestCase) -> None: diff --git a/test-requirements.txt b/test-requirements.txt index a7394e6d1472..8d0866eeb20c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ -r mypy-requirements.txt -r build-requirements.txt attrs>=18.0 -black==22.12.0 # must match version in .pre-commit-config.yaml +black==23.3.0 # must match version in .pre-commit-config.yaml filelock>=3.3.0 flake8==5.0.4 # must match version in .pre-commit-config.yaml flake8-bugbear==22.12.6 # must match version in .pre-commit-config.yaml