Closed bzoracler closed 11 months ago
Upgraded status as it looks like it's a release blocker (https://qa.debian.org/excuses.php?package=mypy)
Thanks! This looks good as is, so I'll go ahead and merge it. I'll make sure to publish a release by EOD.
Closes #305
This is an experimental PR to use a standalone imitation of
mypy.visitor.TraverserVisitor
, allowing reversion of the recent pinning of mypy to <1.7.The visitor module
traverser.py
is produced from generated code (not handwritten) onmypy==1.7.0
. The style (including explicit re-export of the nodes,@functools.singledispatch
, nothing underTYPE_CHECKING
blocks even though the imports aren't used at runtime) is deliberate to allow the visitor to be compiled by mypyc if you wish (which has a lot of quirks, and is not fully compatible with standard Python in my experience).The visitor has a different API (
visitor.accept(node)
, notnode.accept(visitor)
) because mypynode
s can'taccept
visitors that are not subclassed from mypy's own visitors (mypyc fails type incompatibilities at runtime), and you can't subclassmypy.traverser.TraverserVisitor
with themypy==1.7.0
change.Setting this as a draft PR - feel free to merge, change, and/or discard as appropriate.