Suggest nested type names verbatim and filter attribute hints by member usage#140
Merged
jhonabreul merged 2 commits intoJul 14, 2026
Merged
Conversation
…er usage A missing-attribute hint could suggest the exact name that just failed: accessing OptionPriceModels.quant_lib() produced "has no attribute 'quant_lib'. Did you mean: 'quant_lib'?", because the suggestion list snake-cased nested type names while ClassManager only registers nested types under their original PascalCase name. Nested types are now suggested under their original name, and suggestions are filtered by how the closest match is used from Python: a miss that best matches a method or nested type (a possible constructor call) only suggests callables, while one that best matches a field or property only suggests data members.
Martin-Molinero
approved these changes
Jul 14, 2026
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.
Problem
An algorithm accessing
OptionPriceModels.quant_lib()got:The hint suggested the exact name that just failed.
QuantLibis a nested static class ofOptionPriceModelsin Lean, and nested types are exposed to Python only under their original PascalCase name (ClassManagerregisters no snake_case alias for them). The suggestion builder, however, snake-cased every member name — including nested types — so it offered a name that can never resolve.Changes
GetCandidateMemberNameskeeps nested type names verbatim, so the hint above now readsDid you mean: 'QuantLib'?, pointing at the accessible name.Tests
Python.Test.SuggestionTestfixture with a nested class (Calculator), methods (Calculate,CalculationResults) and a property (CalculationResult) with deliberately similar names.tests/test_class.pycovering: nested-type miss suggests the PascalCase name (and not the snake-cased one), method-like miss suggests callables only, property-like miss suggests data members only.--runtime netcore): 457 passed, 23 skipped. Embed testTestGetMisspelledDynamicObjectPropertySuggestsSimilarMemberspasses.