This PR is part of a larger effort to make the test_framework API more intuitive. See #9876 for background.
Several testcases use a wildcard import from test_framework.script. That’s not ideal as it pollutes the namespace with all of the names defined in test_framework.script, including anything that script.py has imported itself.
This PR adds an __all__ module variable to script.py which indexes all of the names that should commonly be required by individual test cases. That makes the wildcard import a well-defined API and test cases can wildcard import without worrying about importing unexpected names. If a test case needs to import something from script.py which isn’t included in __all__, it can explicitly import it.
I’ve not included hash160() or CScriptOp() in __all__ because hash160() is a helper function which I think should be defined elsewhere (ideally in the same module as sha256(), ripemd160() and hash256()), and CScriptOp should not commonly be required by testcases (the only place it’s currently used is in GetP2PKHScript() in p2p-segwit.py, which arguably should be pulled up into the script.py module).