Lint and typing cleanup

This commit is contained in:
Alex Mykyta
2022-02-25 23:05:16 -08:00
parent da3ed05492
commit 7a890b56c5
26 changed files with 852 additions and 94 deletions

View File

@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Optional, List
from typing import TYPE_CHECKING, Optional, List, Union
import textwrap
from systemrdl.walker import RDLListener, RDLWalker
@@ -9,7 +9,7 @@ if TYPE_CHECKING:
class Body:
def __init__(self) -> None:
self.children = []
self.children = [] # type: List[Union[str, Body]]
def __str__(self) -> str:
s = '\n'.join((str(x) for x in self.children))
@@ -37,7 +37,7 @@ class ForLoopGenerator:
def __init__(self) -> None:
self._loop_level = 0
self._stack = []
self._stack = [] # type: List[Body]
@property
def current_loop(self) -> Body:
@@ -60,7 +60,7 @@ class ForLoopGenerator:
self.current_loop.children.append(b)
self._loop_level -= 1
def start(self):
def start(self) -> None:
assert not self._stack
b = Body()
self._stack.append(b)