Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "fix stubs" script to correct typing and import statements #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mike-reilly-bg
Copy link

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
mreilly92@gmail.com

…ll some issues where it tries to make functions from commented lines, should be minor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant