From b848fa4e59c07fb0a7d03506009a247acaa44af5 Mon Sep 17 00:00:00 2001 From: Lekcyjna <309016@uwr.edu.pl> Date: Sun, 24 Mar 2024 18:21:53 +0100 Subject: [PATCH] Fix formating to make dependats bot happy. --- test/lsu/test_dummylsu.py | 6 +- transactron/lib/transformers.py | 3 +- transactron/utils/_typing.py | 81 +++++++------------ .../utils/amaranth_ext/elaboratables.py | 6 +- 4 files changed, 33 insertions(+), 63 deletions(-) diff --git a/test/lsu/test_dummylsu.py b/test/lsu/test_dummylsu.py index 4211720a6..776f0e2cd 100644 --- a/test/lsu/test_dummylsu.py +++ b/test/lsu/test_dummylsu.py @@ -173,9 +173,9 @@ def generate_instr(self, max_reg_val, max_imm_val): self.exception_queue.append( { "rob_id": rob_id, - "cause": ExceptionCause.LOAD_ADDRESS_MISALIGNED - if misaligned - else ExceptionCause.LOAD_ACCESS_FAULT, + "cause": ( + ExceptionCause.LOAD_ADDRESS_MISALIGNED if misaligned else ExceptionCause.LOAD_ACCESS_FAULT + ), "pc": 0, } ) diff --git a/transactron/lib/transformers.py b/transactron/lib/transformers.py index f874cea2c..5e9b1a6b0 100644 --- a/transactron/lib/transformers.py +++ b/transactron/lib/transformers.py @@ -60,8 +60,7 @@ def use(self, m: ModuleLike): class Unifier(Transformer, Protocol): method: Method - def __init__(self, targets: list[Method]): - ... + def __init__(self, targets: list[Method]): ... class MethodMap(Elaboratable, Transformer): diff --git a/transactron/utils/_typing.py b/transactron/utils/_typing.py index 32497c7d5..e8e3152b9 100644 --- a/transactron/utils/_typing.py +++ b/transactron/utils/_typing.py @@ -86,17 +86,13 @@ # Protocols for Amaranth classes class _ModuleBuilderDomainsLike(Protocol): - def __getattr__(self, name: str) -> "_ModuleBuilderDomain": - ... + def __getattr__(self, name: str) -> "_ModuleBuilderDomain": ... - def __getitem__(self, name: str) -> "_ModuleBuilderDomain": - ... + def __getitem__(self, name: str) -> "_ModuleBuilderDomain": ... - def __setattr__(self, name: str, value: "_ModuleBuilderDomain") -> None: - ... + def __setattr__(self, name: str, value: "_ModuleBuilderDomain") -> None: ... - def __setitem__(self, name: str, value: "_ModuleBuilderDomain") -> None: - ... + def __setitem__(self, name: str, value: "_ModuleBuilderDomain") -> None: ... _T_ModuleBuilderDomains = TypeVar("_T_ModuleBuilderDomains", bound=_ModuleBuilderDomainsLike) @@ -127,80 +123,59 @@ def Default(self) -> AbstractContextManager[None]: # noqa: N802 def FSM( # noqa: N802 self, reset: Optional[str] = ..., domain: str = ..., name: str = ... - ) -> AbstractContextManager["amaranth.hdl._dsl.FSM"]: - ... + ) -> AbstractContextManager["amaranth.hdl._dsl.FSM"]: ... def State(self, name: str) -> AbstractContextManager[None]: # noqa: N802 ... @property - def next(self) -> NoReturn: - ... + def next(self) -> NoReturn: ... @next.setter - def next(self, name: str) -> None: - ... + def next(self, name: str) -> None: ... class AbstractSignatureMembers(Protocol): - def flip(self) -> "AbstractSignatureMembers": - ... + def flip(self) -> "AbstractSignatureMembers": ... - def __eq__(self, other) -> bool: - ... + def __eq__(self, other) -> bool: ... - def __contains__(self, name: str) -> bool: - ... + def __contains__(self, name: str) -> bool: ... - def __getitem__(self, name: str) -> Member: - ... + def __getitem__(self, name: str) -> Member: ... - def __setitem__(self, name: str, member: Member) -> NoReturn: - ... + def __setitem__(self, name: str, member: Member) -> NoReturn: ... - def __delitem__(self, name: str) -> NoReturn: - ... + def __delitem__(self, name: str) -> NoReturn: ... - def __iter__(self) -> Iterator[str]: - ... + def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: - ... + def __len__(self) -> int: ... - def flatten(self, *, path: tuple[str | int, ...] = ...) -> Iterator[tuple[tuple[str | int, ...], Member]]: - ... + def flatten(self, *, path: tuple[str | int, ...] = ...) -> Iterator[tuple[tuple[str | int, ...], Member]]: ... - def create(self, *, path: tuple[str | int, ...] = ..., src_loc_at: int = ...) -> dict[str, Any]: - ... + def create(self, *, path: tuple[str | int, ...] = ..., src_loc_at: int = ...) -> dict[str, Any]: ... - def __repr__(self) -> str: - ... + def __repr__(self) -> str: ... class AbstractSignature(Protocol): - def flip(self) -> "AbstractSignature": - ... + def flip(self) -> "AbstractSignature": ... @property - def members(self) -> AbstractSignatureMembers: - ... + def members(self) -> AbstractSignatureMembers: ... - def __eq__(self, other) -> bool: - ... + def __eq__(self, other) -> bool: ... - def flatten(self, obj) -> Iterator[tuple[tuple[str | int, ...], Flow, ValueLike]]: - ... + def flatten(self, obj) -> Iterator[tuple[tuple[str | int, ...], Flow, ValueLike]]: ... - def is_compliant(self, obj, *, reasons: Optional[list[str]] = ..., path: tuple[str, ...] = ...) -> bool: - ... + def is_compliant(self, obj, *, reasons: Optional[list[str]] = ..., path: tuple[str, ...] = ...) -> bool: ... def create( self, *, path: tuple[str | int, ...] = ..., src_loc_at: int = ... - ) -> "AbstractInterface[AbstractSignature]": - ... + ) -> "AbstractInterface[AbstractSignature]": ... - def __repr__(self) -> str: - ... + def __repr__(self) -> str: ... _T_AbstractSignature = TypeVar("_T_AbstractSignature", bound=AbstractSignature) @@ -211,14 +186,12 @@ class AbstractInterface(Protocol, Generic[_T_AbstractSignature]): class HasElaborate(Protocol): - def elaborate(self, platform) -> "HasElaborate": - ... + def elaborate(self, platform) -> "HasElaborate": ... @runtime_checkable class HasDebugSignals(Protocol): - def debug_signals(self) -> SignalBundle: - ... + def debug_signals(self) -> SignalBundle: ... def type_self_kwargs_as(as_func: Callable[Concatenate[Any, P], Any]): diff --git a/transactron/utils/amaranth_ext/elaboratables.py b/transactron/utils/amaranth_ext/elaboratables.py index 3af4ded98..b0ddbae35 100644 --- a/transactron/utils/amaranth_ext/elaboratables.py +++ b/transactron/utils/amaranth_ext/elaboratables.py @@ -59,13 +59,11 @@ def case(n: Optional[int] = None): @overload -def OneHotSwitchDynamic(m: ModuleLike, test: Value, *, default: Literal[True]) -> Iterable[Optional[int]]: - ... +def OneHotSwitchDynamic(m: ModuleLike, test: Value, *, default: Literal[True]) -> Iterable[Optional[int]]: ... @overload -def OneHotSwitchDynamic(m: ModuleLike, test: Value, *, default: Literal[False] = False) -> Iterable[int]: - ... +def OneHotSwitchDynamic(m: ModuleLike, test: Value, *, default: Literal[False] = False) -> Iterable[int]: ... def OneHotSwitchDynamic(m: ModuleLike, test: Value, *, default: bool = False) -> Iterable[Optional[int]]: