Added "fix stubs" script to correct typing and import statements #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a script that fixes shortcommings in the existing iron-stubs output, as of 7/5/2023.
Right now, iron-stubs gets types right in the comments it adds, but not the code. It also produces
stubs that have a lot of type errors, and no import statements.
To fix this, this script will re-write the functions and classes with correct syntax.
It will also go through every type in every function, property, and class, and look
for it in all the other stubs files in the same root. If it finds the class in another stub file,
it will add an import statement at the top of the file. Note that it will use the first class
definition it finds, so if names are not unique and you want to limit the stubs folders it looks through,
remove the unwanted stubs folders. In my case, all the external references were from System
If it does not find a class's inherited class in the current file, another stubs file, or
the builtin types, it will omit that inherited class from the revised code.
This code is not super well written (sorry) (...or commented), but as of now it creates stub files that are
100% warning- and error-free.
Compared to the current repo, I rebuilt my System stubs like this to get the latest datatypes:
C:'Program Files''IronPython 2.7'\ipy.exe -m ironstubs make mscorlib --path="C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
How to use this script:
Put this script in the root of the stubs directory.
You will be prompted for the name of the Stubs folder that you want to clean up.
Path syntax is currently handled for Windows (i.e. ), but can be easily fixed for linux
written by Mike Reilly
[email protected]