From ab599bcef6b3129ab0eeca38487d30cba0f384d1 Mon Sep 17 00:00:00 2001 From: Mark Koch Date: Wed, 22 Nov 2023 10:25:07 +0000 Subject: [PATCH] Rename types to gtypes --- guppy/ast_util.py | 4 ++-- guppy/cfg/builder.py | 2 +- guppy/checker/cfg_checker.py | 2 +- guppy/checker/core.py | 2 +- guppy/checker/expr_checker.py | 2 +- guppy/checker/func_checker.py | 2 +- guppy/checker/stmt_checker.py | 2 +- guppy/compiler/cfg_compiler.py | 2 +- guppy/compiler/core.py | 2 +- guppy/compiler/expr_compiler.py | 2 +- guppy/compiler/func_compiler.py | 2 +- guppy/compiler/stmt_compiler.py | 2 +- guppy/custom.py | 2 +- guppy/declared.py | 2 +- guppy/decorator.py | 2 +- guppy/error.py | 2 +- guppy/{types.py => gtypes.py} | 0 guppy/hugr/hugr.py | 2 +- guppy/module.py | 2 +- guppy/nodes.py | 2 +- guppy/prelude/_internal.py | 2 +- guppy/prelude/builtins.py | 2 +- tests/hugr/test_dummy_nodes.py | 2 +- tests/hugr/test_ports.py | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) rename guppy/{types.py => gtypes.py} (100%) diff --git a/guppy/ast_util.py b/guppy/ast_util.py index cbd78448..8c4be4f7 100644 --- a/guppy/ast_util.py +++ b/guppy/ast_util.py @@ -2,7 +2,7 @@ from typing import Any, TypeVar, Generic, Union, Optional, TYPE_CHECKING if TYPE_CHECKING: - from guppy.types import GuppyType + from guppy.gtypes import GuppyType AstNode = Union[ ast.AST, @@ -179,7 +179,7 @@ def with_type(ty: "GuppyType", node: A) -> A: def get_type_opt(node: AstNode) -> Optional["GuppyType"]: """Tries to retrieve a type annotation from an AST node.""" - from guppy.types import GuppyType + from guppy.gtypes import GuppyType try: ty = getattr(node, "type") diff --git a/guppy/cfg/builder.py b/guppy/cfg/builder.py index 9428f700..7285a613 100644 --- a/guppy/cfg/builder.py +++ b/guppy/cfg/builder.py @@ -7,7 +7,7 @@ from guppy.cfg.cfg import CFG from guppy.checker.core import Globals from guppy.error import GuppyError, InternalGuppyError -from guppy.types import NoneType +from guppy.gtypes import NoneType from guppy.nodes import NestedFunctionDef # In order to build expressions, need an endless stream of unique temporary variables diff --git a/guppy/checker/cfg_checker.py b/guppy/checker/cfg_checker.py index 2085f8c1..1fbb0521 100644 --- a/guppy/checker/cfg_checker.py +++ b/guppy/checker/cfg_checker.py @@ -11,7 +11,7 @@ from guppy.checker.expr_checker import ExprSynthesizer, to_bool from guppy.checker.stmt_checker import StmtChecker from guppy.error import GuppyError -from guppy.types import GuppyType +from guppy.gtypes import GuppyType VarRow = Sequence[Variable] diff --git a/guppy/checker/core.py b/guppy/checker/core.py index d64ab3de..9bab6375 100644 --- a/guppy/checker/core.py +++ b/guppy/checker/core.py @@ -4,7 +4,7 @@ from typing import NamedTuple, Optional, Union from guppy.ast_util import AstNode -from guppy.types import ( +from guppy.gtypes import ( GuppyType, FunctionType, TupleType, diff --git a/guppy/checker/expr_checker.py b/guppy/checker/expr_checker.py index 17a7c591..747d32c0 100644 --- a/guppy/checker/expr_checker.py +++ b/guppy/checker/expr_checker.py @@ -4,7 +4,7 @@ from guppy.ast_util import AstVisitor, with_loc, AstNode, with_type, get_type_opt from guppy.checker.core import Context, CallableVariable, Globals from guppy.error import GuppyError, GuppyTypeError, InternalGuppyError -from guppy.types import GuppyType, TupleType, FunctionType, BoolType +from guppy.gtypes import GuppyType, TupleType, FunctionType, BoolType from guppy.nodes import LocalName, GlobalName, LocalCall # Mapping from unary AST op to dunder method and display name diff --git a/guppy/checker/func_checker.py b/guppy/checker/func_checker.py index 290c6add..87b22b8f 100644 --- a/guppy/checker/func_checker.py +++ b/guppy/checker/func_checker.py @@ -8,7 +8,7 @@ from guppy.checker.cfg_checker import check_cfg, CheckedCFG from guppy.checker.expr_checker import synthesize_call, check_call from guppy.error import GuppyError -from guppy.types import FunctionType, type_from_ast, NoneType, GuppyType +from guppy.gtypes import FunctionType, type_from_ast, NoneType, GuppyType from guppy.nodes import GlobalCall, CheckedNestedFunctionDef, NestedFunctionDef diff --git a/guppy/checker/stmt_checker.py b/guppy/checker/stmt_checker.py index 8b9dc77f..5b12dc58 100644 --- a/guppy/checker/stmt_checker.py +++ b/guppy/checker/stmt_checker.py @@ -6,7 +6,7 @@ from guppy.checker.core import Variable, Context from guppy.checker.expr_checker import ExprSynthesizer, ExprChecker from guppy.error import GuppyError, GuppyTypeError, InternalGuppyError -from guppy.types import GuppyType, TupleType, type_from_ast, NoneType +from guppy.gtypes import GuppyType, TupleType, type_from_ast, NoneType from guppy.nodes import NestedFunctionDef diff --git a/guppy/compiler/cfg_compiler.py b/guppy/compiler/cfg_compiler.py index fa9277b3..d18c21b9 100644 --- a/guppy/compiler/cfg_compiler.py +++ b/guppy/compiler/cfg_compiler.py @@ -12,7 +12,7 @@ ) from guppy.compiler.expr_compiler import ExprCompiler from guppy.compiler.stmt_compiler import StmtCompiler -from guppy.types import TupleType, SumType, type_to_row +from guppy.gtypes import TupleType, SumType, type_to_row from guppy.hugr.hugr import Hugr, Node, CFNode, OutPortV diff --git a/guppy/compiler/core.py b/guppy/compiler/core.py index 093ee0f6..2b6a4fb2 100644 --- a/guppy/compiler/core.py +++ b/guppy/compiler/core.py @@ -4,7 +4,7 @@ from guppy.ast_util import AstNode from guppy.checker.core import Variable, CallableVariable -from guppy.types import FunctionType +from guppy.gtypes import FunctionType from guppy.hugr.hugr import OutPortV, DFContainingNode, Hugr diff --git a/guppy/compiler/expr_compiler.py b/guppy/compiler/expr_compiler.py index 75017cbc..5fdc378b 100644 --- a/guppy/compiler/expr_compiler.py +++ b/guppy/compiler/expr_compiler.py @@ -4,7 +4,7 @@ from guppy.ast_util import AstVisitor, get_type from guppy.compiler.core import CompilerBase, DFContainer, CompiledFunction from guppy.error import InternalGuppyError -from guppy.types import FunctionType, type_to_row, BoolType +from guppy.gtypes import FunctionType, type_to_row, BoolType from guppy.hugr import ops, val from guppy.hugr.hugr import OutPortV from guppy.nodes import LocalName, GlobalName, GlobalCall, LocalCall diff --git a/guppy/compiler/func_compiler.py b/guppy/compiler/func_compiler.py index 60c7f526..ab066839 100644 --- a/guppy/compiler/func_compiler.py +++ b/guppy/compiler/func_compiler.py @@ -9,7 +9,7 @@ DFContainer, PortVariable, ) -from guppy.types import type_to_row, FunctionType +from guppy.gtypes import type_to_row, FunctionType from guppy.hugr.hugr import Hugr, OutPortV, DFContainingVNode from guppy.nodes import CheckedNestedFunctionDef diff --git a/guppy/compiler/stmt_compiler.py b/guppy/compiler/stmt_compiler.py index a8d9c5c8..db656b6f 100644 --- a/guppy/compiler/stmt_compiler.py +++ b/guppy/compiler/stmt_compiler.py @@ -12,7 +12,7 @@ ) from guppy.compiler.expr_compiler import ExprCompiler from guppy.error import InternalGuppyError -from guppy.types import TupleType +from guppy.gtypes import TupleType from guppy.hugr.hugr import Hugr, OutPortV from guppy.nodes import CheckedNestedFunctionDef diff --git a/guppy/custom.py b/guppy/custom.py index bb548e4e..acfd7341 100644 --- a/guppy/custom.py +++ b/guppy/custom.py @@ -14,7 +14,7 @@ UnknownFunctionType, GuppyTypeError, ) -from guppy.types import GuppyType, FunctionType, type_to_row, TupleType +from guppy.gtypes import GuppyType, FunctionType, type_to_row, TupleType from guppy.hugr import ops from guppy.hugr.hugr import OutPortV, Hugr, Node, DFContainingVNode from guppy.nodes import GlobalCall diff --git a/guppy/declared.py b/guppy/declared.py index 854e3823..91b5283e 100644 --- a/guppy/declared.py +++ b/guppy/declared.py @@ -8,7 +8,7 @@ from guppy.checker.func_checker import check_signature from guppy.compiler.core import CompiledFunction, DFContainer, CompiledGlobals from guppy.error import GuppyError -from guppy.types import type_to_row, GuppyType +from guppy.gtypes import type_to_row, GuppyType from guppy.hugr.hugr import VNode, Hugr, Node, OutPortV from guppy.nodes import GlobalCall diff --git a/guppy/decorator.py b/guppy/decorator.py index 67948cec..493ddcb2 100644 --- a/guppy/decorator.py +++ b/guppy/decorator.py @@ -12,7 +12,7 @@ DefaultCallCompiler, ) from guppy.error import GuppyError, pretty_errors -from guppy.types import GuppyType +from guppy.gtypes import GuppyType from guppy.hugr import tys, ops from guppy.hugr.hugr import Hugr from guppy.module import GuppyModule, PyFunc, parse_py_func diff --git a/guppy/error.py b/guppy/error.py index 550429f0..b0ace141 100644 --- a/guppy/error.py +++ b/guppy/error.py @@ -6,7 +6,7 @@ from typing import Optional, Any, Sequence, Callable, TypeVar, cast from guppy.ast_util import AstNode, get_line_offset, get_file, get_source -from guppy.types import GuppyType, FunctionType +from guppy.gtypes import GuppyType, FunctionType from guppy.hugr.hugr import OutPortV, Node diff --git a/guppy/types.py b/guppy/gtypes.py similarity index 100% rename from guppy/types.py rename to guppy/gtypes.py diff --git a/guppy/hugr/hugr.py b/guppy/hugr/hugr.py index 69d2fa84..511fe702 100644 --- a/guppy/hugr/hugr.py +++ b/guppy/hugr/hugr.py @@ -8,7 +8,7 @@ import guppy.hugr.ops as ops import guppy.hugr.raw as raw -from guppy.types import ( +from guppy.gtypes import ( GuppyType, TupleType, FunctionType, diff --git a/guppy/module.py b/guppy/module.py index fb29bb6d..e07a15ac 100644 --- a/guppy/module.py +++ b/guppy/module.py @@ -13,7 +13,7 @@ from guppy.custom import CustomFunction from guppy.declared import DeclaredFunction from guppy.error import GuppyError, pretty_errors -from guppy.types import GuppyType +from guppy.gtypes import GuppyType from guppy.hugr.hugr import Hugr PyFunc = Callable[..., Any] diff --git a/guppy/nodes.py b/guppy/nodes.py index 919caf82..dfd02349 100644 --- a/guppy/nodes.py +++ b/guppy/nodes.py @@ -3,7 +3,7 @@ import ast from typing import TYPE_CHECKING, Any, Mapping -from guppy.types import FunctionType +from guppy.gtypes import FunctionType if TYPE_CHECKING: from guppy.cfg.cfg import CFG diff --git a/guppy/prelude/_internal.py b/guppy/prelude/_internal.py index a3693de6..3fbb406f 100644 --- a/guppy/prelude/_internal.py +++ b/guppy/prelude/_internal.py @@ -13,7 +13,7 @@ CustomCallCompiler, ) from guppy.error import GuppyTypeError, GuppyError -from guppy.types import GuppyType, FunctionType, BoolType +from guppy.gtypes import GuppyType, FunctionType, BoolType from guppy.hugr import ops, tys, val from guppy.hugr.hugr import OutPortV from guppy.nodes import GlobalCall diff --git a/guppy/prelude/builtins.py b/guppy/prelude/builtins.py index a47ca48c..25dfc741 100644 --- a/guppy/prelude/builtins.py +++ b/guppy/prelude/builtins.py @@ -4,7 +4,7 @@ from guppy.custom import NoopCompiler, DefaultCallChecker from guppy.decorator import guppy -from guppy.types import BoolType +from guppy.gtypes import BoolType from guppy.hugr import tys, ops from guppy.module import GuppyModule from guppy.prelude._internal import ( diff --git a/tests/hugr/test_dummy_nodes.py b/tests/hugr/test_dummy_nodes.py index 73b7ee2d..e1efaab9 100644 --- a/tests/hugr/test_dummy_nodes.py +++ b/tests/hugr/test_dummy_nodes.py @@ -1,4 +1,4 @@ -from guppy.types import FunctionType, BoolType, TupleType +from guppy.gtypes import FunctionType, BoolType, TupleType from guppy.hugr import ops from guppy.hugr.hugr import Hugr diff --git a/tests/hugr/test_ports.py b/tests/hugr/test_ports.py index dd9fd7a0..77e07ef4 100644 --- a/tests/hugr/test_ports.py +++ b/tests/hugr/test_ports.py @@ -1,7 +1,7 @@ import pytest from guppy.error import UndefinedPort, InternalGuppyError -from guppy.types import BoolType +from guppy.gtypes import BoolType def test_undefined_port():