In docs/source/tutorial.ipynb
the type hint for the self.stack attribute of class TypingCollector is wrong and should read
class TypingCollector(cst.CSTVisitor):
def __init__(self):
# stack for storing the canonical name of the current function
self.stack: List[str] = []
...
instead of
class TypingCollector(cst.CSTVisitor):
def __init__(self):
# stack for storing the canonical name of the current function
self.stack: List[Tuple[str, ...]] = [] # wrong type hint
...
because the only assignment to self.stack in the example is
...
self.stack.append(node.name.value)
...
and node.name.value is a str, not a Tuple.
The error will also be flagged by pyright or mypy.
The same applys to class TypingTransformer in the same file.
In
docs/source/tutorial.ipynbthe type hint for the
self.stackattribute ofclass TypingCollectoris wrong and should readinstead of
because the only assignment to
self.stackin the example is... self.stack.append(node.name.value) ...and
node.name.valueis astr, not aTuple.The error will also be flagged by pyright or mypy.
The same applys to
class TypingTransformerin the same file.