Repository navigation
fix(parsers): import UniversalConcept for annotations in C# and MATLAB mappings - #432
Merged
HananKavitzAmat merged 1 commit intoOct 6, 2026
Conversation
…B mappings csharp.py and matlab.py annotate method parameters with the string "UniversalConcept" but only import the name inside function bodies, so ruff reports nine F821 undefined-name errors and mypy reports nine name-defined errors for the two modules. Add a TYPE_CHECKING-only import, the same pattern mappings/base.py already uses. Nothing changes at runtime. Refs chunkhound#349
HananKavitzAmat
self-requested a review
October 6, 2026 08:40
Collaborator
|
Looks Good to me. Merging! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
ruff check chunkhound(the lint step in CONTRIBUTING) reports nineF821 undefined-nameerrors, all forUniversalConceptinparsers/mappings/csharp.pyandparsers/mappings/matlab.py. Both modules use the name in quoted parameter annotations but only import it inside function bodies, so linters and mypy cannot resolve it. These are the only non-cosmetic items in the baseline described in #349, and they make the lint step harder to use because a contributor cannot tell new violations from existing ones.This is option 1 from #349 ("just the F821"), which @HananKavitzAmat asked to start with. It does not touch the cosmetic violations or CI.
Change
Add a
TYPE_CHECKING-only import ofUniversalConceptto both modules, the same patternparsers/mappings/base.pyalready uses. The import never runs at runtime, so behaviour is unchanged and no import cycle is introduced.Verification (Windows 11, Python 3.14, native extension built locally)
ruff check chunkhound --select F821mypy chunkhoundruff format --checkon both filespytest tests/test_smoke.py: 14 passed.pytest tests/test_csharp_mapping.py tests/test_parser_mappings_import.py: 42 passed.pytest tests/: 4980 passed, 128 skipped. The remaining failures on my machine are not related to these files: thetests/sitetests error because I did not build the site, one symlink test needs a Windows privilege my account lacks, and several MCP stdio startup tests hit their 5 s timeouts. I re-ran those on unmodifiedmainand they fail or flake the same way there.Refs #349