Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formating to make dependats bot happy. #626

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/lsu/test_dummylsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
)
Expand Down
3 changes: 1 addition & 2 deletions transactron/lib/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
81 changes: 27 additions & 54 deletions transactron/utils/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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]):
Expand Down
6 changes: 2 additions & 4 deletions transactron/utils/amaranth_ext/elaboratables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down
Loading