From 8b46d82c3e130151b0bd43ad92dbfb45adff3e11 Mon Sep 17 00:00:00 2001 From: Seyon Sivarajah Date: Wed, 10 Jan 2024 16:48:05 +0000 Subject: [PATCH] chore: fix newer mypy problems --- guppy/cfg/builder.py | 4 ++-- guppy/checker/expr_checker.py | 2 +- guppy/hugr/hugr.py | 2 +- guppy/hugr/visualise.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/guppy/cfg/builder.py b/guppy/cfg/builder.py index 878437bf..b83b0483 100644 --- a/guppy/cfg/builder.py +++ b/guppy/cfg/builder.py @@ -185,7 +185,7 @@ def visit_FunctionDef( bb.statements.append(new_node) return bb - def generic_visit(self, node: ast.AST, bb: BB, jumps: Jumps) -> BB | None: # type: ignore[override] + def generic_visit(self, node: ast.AST, bb: BB, jumps: Jumps) -> BB | None: # When adding support for new statements, we have to remember to use the # ExprBuilder to transform all included expressions! raise GuppyError("Statement is not supported", node) @@ -365,7 +365,7 @@ def visit_IfExp(self, node: ast.IfExp, bb: BB, true_bb: BB, false_bb: BB) -> Non self.visit(node.body, then_bb, true_bb, false_bb) self.visit(node.orelse, else_bb, true_bb, false_bb) - def generic_visit(self, node: ast.expr, bb: BB, true_bb: BB, false_bb: BB) -> None: # type: ignore[override] + def generic_visit(self, node: ast.expr, bb: BB, true_bb: BB, false_bb: BB) -> None: # We can always fall back to building the node as a regular expression and using # the result as a branch predicate pred, bb = ExprBuilder.build(node, self.cfg, bb) diff --git a/guppy/checker/expr_checker.py b/guppy/checker/expr_checker.py index 9e799399..01c3e383 100644 --- a/guppy/checker/expr_checker.py +++ b/guppy/checker/expr_checker.py @@ -169,7 +169,7 @@ def visit_Call(self, node: ast.Call, ty: GuppyType) -> tuple[ast.expr, Subst]: else: raise GuppyTypeError(f"Expected function type, got `{func_ty}`", node.func) - def generic_visit( # type: ignore[override] + def generic_visit( self, node: ast.expr, ty: GuppyType ) -> tuple[ast.expr, Subst]: # Try to synthesize and then check if we can unify it with the given type diff --git a/guppy/hugr/hugr.py b/guppy/hugr/hugr.py index 980a1c63..fb671bb5 100644 --- a/guppy/hugr/hugr.py +++ b/guppy/hugr/hugr.py @@ -5,7 +5,7 @@ from dataclasses import dataclass, field from typing import Any, Optional -import networkx as nx # type: ignore[import] +import networkx as nx # type: ignore[import-untyped] import guppy.hugr.ops as ops import guppy.hugr.raw as raw diff --git a/guppy/hugr/visualise.py b/guppy/hugr/visualise.py index 450b5293..e3c52cc0 100644 --- a/guppy/hugr/visualise.py +++ b/guppy/hugr/visualise.py @@ -3,7 +3,7 @@ from collections.abc import Iterable from typing import TYPE_CHECKING -import graphviz as gv # type: ignore[import] +import graphviz as gv # type: ignore[import-untyped] from guppy.cfg.analysis import ( DefAssignmentDomain,