Motivation
When I wanted to understand better https://github.com/bitcoin/bitcoin/pull/19145/files#diff-4bebbd3b112dc222ea7e75ef051838ceffcee63b9e9234a98a4cc7251d34451b test, I noticed that navigation in PyCharm/VS Code did not work for nodes
variable. I think this is frustrating, especially for newcomers.
Summary
- This PR modifies Python 3.5 type comments to Python 3.6+ types and adds a proper type for
nodes
instance attribute. - This PR does not change behavior.
- This PR is intentionally very small, if the concept is accepted, a follow-up PRs can be more ambitious.
End result
- Open
test/functional/feature_abortnode.py
- Move your caret to:
self.nodes[0].generate[caret here](3)
- Use “Go to definition” [F12] should work now.
I have tested this on PyCharm (Windows, Ubuntu) and VS Code (Windows, Ubuntu).
Note: Some TestNode
methods (e.g. self.nodes[0].getblock(...)
) use __call__
mechanism and navigation does not work for them even with this PR.