From 99c6380e451af74023aa9070b2a6422e08f32e6c Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 16 Dec 2022 02:03:18 -0800 Subject: [PATCH] import dataclasses instead of dataclass --- src/bigint_presentation_code/compiler_ir.py | 26 ++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/bigint_presentation_code/compiler_ir.py b/src/bigint_presentation_code/compiler_ir.py index 2d19492..9e4d13d 100644 --- a/src/bigint_presentation_code/compiler_ir.py +++ b/src/bigint_presentation_code/compiler_ir.py @@ -1,5 +1,6 @@ from contextlib import contextmanager import enum +import dataclasses from abc import ABCMeta, abstractmethod from enum import Enum, unique from functools import lru_cache, total_ordering @@ -9,7 +10,6 @@ from typing import (AbstractSet, Any, Callable, Generic, Iterable, Iterator, from weakref import WeakValueDictionary as _WeakVDict from cached_property import cached_property -from dataclasses import dataclass from nmutil import plain_data # type: ignore from bigint_presentation_code.type_util import (Literal, Self, assert_never, @@ -210,7 +210,7 @@ class OpStage(Enum): assert OpStage.Early < OpStage.Late, "early must be less than late" -@dataclass(frozen=True, unsafe_hash=True, repr=False) +@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False) @final class ProgramPoint(Interned): op_index: int @@ -269,7 +269,7 @@ class ProgramPoint(Interned): return f"" -@dataclass(frozen=True, unsafe_hash=True, repr=False) +@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False) @final class ProgramRange(Sequence[ProgramPoint], Interned): start: ProgramPoint @@ -321,7 +321,7 @@ class ProgramRange(Sequence[ProgramPoint], Interned): return f"" -@dataclass(frozen=True, unsafe_hash=True, repr=False) +@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False) @final class SSAValSubReg(Interned): ssa_val: "SSAVal" @@ -550,7 +550,7 @@ class BaseTy(Enum): return "BaseTy." + self._name_ -@dataclass(frozen=True, unsafe_hash=True, repr=False) +@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False) @final class Ty(Interned): base_ty: BaseTy @@ -688,7 +688,7 @@ class LocSubKind(Enum): return "LocSubKind." + self._name_ -@dataclass(frozen=True, unsafe_hash=True) +@dataclasses.dataclass(frozen=True, unsafe_hash=True) @final class GenericTy(Interned): base_ty: BaseTy @@ -714,7 +714,7 @@ class GenericTy(Interned): return ty.reg_len == 1 -@dataclass(frozen=True, unsafe_hash=True) +@dataclasses.dataclass(frozen=True, unsafe_hash=True) @final class Loc(Interned): kind: LocKind @@ -930,7 +930,7 @@ class LocSet(OFSet[Loc], Interned): return only_loc -@dataclass(frozen=True, unsafe_hash=True) +@dataclasses.dataclass(frozen=True, unsafe_hash=True) @final class GenericOperandDesc(Interned): """generic Op operand descriptor""" @@ -1043,7 +1043,7 @@ class GenericOperandDesc(Interned): spread_index=idx, write_stage=self.write_stage) -@dataclass(frozen=True, unsafe_hash=True) +@dataclasses.dataclass(frozen=True, unsafe_hash=True) @final class OperandDesc(Interned): """Op operand descriptor""" @@ -1112,7 +1112,7 @@ OD_VL = GenericOperandDesc( sub_kinds=[LocSubKind.VL_MAXVL]) -@dataclass(frozen=True, unsafe_hash=True) +@dataclasses.dataclass(frozen=True, unsafe_hash=True) @final class GenericOpProperties(Interned): demo_asm: str @@ -1894,7 +1894,7 @@ class OpKind(Enum): _GEN_ASMS[FuncArgR3] = lambda: OpKind.__funcargr3_gen_asm -@dataclass(frozen=True, unsafe_hash=True, repr=False) +@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False) class SSAValOrUse(Interned): op: "Op" operand_idx: int @@ -1957,7 +1957,7 @@ class SSAValOrUse(Interned): return self.__class__(op=self.op, operand_idx=self.unspread_start_idx) -@dataclass(frozen=True, unsafe_hash=True, repr=False) +@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False) @final class SSAVal(SSAValOrUse): __slots__ = () @@ -2008,7 +2008,7 @@ class SSAVal(SSAValOrUse): return tuple(SSAValSubReg(self, i) for i in range(self.ty.reg_len)) -@dataclass(frozen=True, unsafe_hash=True, repr=False) +@dataclasses.dataclass(frozen=True, unsafe_hash=True, repr=False) @final class SSAUse(SSAValOrUse): __slots__ = () -- 2.30.2