pin_name type annotations
This commit is contained in:
1 parent
9dc58f8c40
commit
aebdf9540d
1 file changed
+2
-2
@@ -50,13 +50,13 @@ class TechLib:
|
||||
assert pin in self.cells[kind][1], f'Unknown pin: {pin} for cell {kind}'
|
||||
return self.cells[kind][1][pin][0]
|
||||
|
||||
def pin_name(self, kind, pos, output=False):
|
||||
def pin_name(self, kind: str, pos: int, output=False) -> str:
|
||||
"""Returns the pin name for a given node kind, list position, and direction."""
|
||||
assert kind in self.cells, f'Unknown cell: {kind}'
|
||||
for name, (ppos, isout) in self.cells[kind][1].items():
|
||||
if isout == output and ppos == pos:
|
||||
return name
|
||||
return None
|
||||
raise ValueError(f'Invalid {"output" if output else "input"} pin position {pos} for cell: {kind}')
|
||||
|
||||
def pin_is_output(self, kind, pin):
|
||||
"""Returns True, if given pin name of a node kind is an output."""
|
||||
|
||||
Reference in new issue
Block a user