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

Supporting MyPy static analizer #12

Open
HamzaHajeir opened this issue Sep 30, 2021 · 2 comments
Open

Supporting MyPy static analizer #12

HamzaHajeir opened this issue Sep 30, 2021 · 2 comments

Comments

@HamzaHajeir
Copy link

Hi

I'm new to Python really, but as a C++ programmer, I really weight the static typing.

I heard of MyPy as type checking tool, so I've used it in my simple kinparse-based script.

Before diving into the errors log, I'd really thank you for this great library, if there's a suggestion is to support parts pins (if possible) nlst.parts[0].pins.

Returning to the error log:

LibManager.py:1: error: Skipping analyzing "kinparse": found module but no type hints or library stubs
LibManager.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
LibManager.py:12: error: "list" expects 1 type argument, but 2 given <<< Dismiss this >>>
LibManager.py:69: error: "List[Any]" has no attribute "name"
LibManager.py:87: error: "List[Any]" has no attribute "ref"
LibManager.py:93: error: "List[Any]" has no attribute "name"

Is there a way to help mypy doing it?

Thanks

@devbisme
Copy link
Owner

devbisme commented Oct 1, 2021

I've never used MyPy so I'm not sure what issue it's having other than the fact my code isn't annotated for type checking. kinparse is mostly a syntax table that gets passed to the pyparsing package along with the netlist as a text string. Maybe you could do some minimal type annotation to see if you can get past the errors.

@HamzaHajeir
Copy link
Author

So I think it's in pyparsing's field, not directly to kinparse. Am I correct?

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

No branches or pull requests

2 participants