| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
When no overload matches a call, the TypeError now appends a diagnosis of
the first argument that fails to match the nearest overload (the one with
the most leading convertible arguments), e.g.:
Argument mismatch: argument 3 ('asynchronous') expected bool, got str.
Keyword arguments whose values cannot convert to the matching parameter
are diagnosed too. The line is appended after the overloads hint so
consumers that extract the hint from its marker onwards keep it.
Drops the duplicated type-name helper in favor of the existing runtime one, and tightens the new comments.
Keeps the Jaro-Winkler scoring from this branch in ClassBase while retaining Util.LevenshteinDistance, which MethodBinder's unexpected-kwarg suggestion (QuantConnect#144) still uses. Also moves the DiagnoseClosestOverloadMismatch block inside the bind-failure try so master compiles again: QuantConnect#144 wrapped the message construction (including the candidates declaration) in try/catch after QuantConnect#145 had added the mismatch diagnosis below it, leaving 'candidates' out of scope at its use site.
| Back | FazBrowse Home | New Git URL |
What does this implement/fix? Explain your changes.
When a call cannot be matched to any overload, the bind-failure TypeError now pinpoints the first argument that fails to match the nearest overload (the candidate with the most leading convertible arguments), so the caller doesn't have to diff the hinted signatures by eye.
Before:
After (last line is new):
TypeError: No method matches given arguments for market_order: (<class 'QuantConnect.Symbol'>, <class 'int'>, <class 'str'>). The following overloads are available: market_order(symbol: Symbol, quantity: float, asynchronous: bool = False, tag: str = "", order_properties: IOrderProperties = None) market_order(symbol: Symbol, quantity: int, asynchronous: bool = False, tag: str = "", order_properties: IOrderProperties = None) Argument mismatch: argument 3 ('asynchronous') expected bool, got str.Keyword arguments whose values cannot convert to the parameter they name are diagnosed too (Argument mismatch: keyword argument 'tag' expected str, got int.).
Details:
Does this close any currently open issues?
Part of the pythonnet overload/attribute error-surface improvements (QuantConnect/Agents#305, improvement 1: show the nearest overload with the first mismatching parameter highlighted).
Any other comments?
The fleet's most common failure shape motivating this is a positional string tag landing in the asynchronous: bool slot of the order methods, e.g. self.market_order(symbol, -quantity, "exit signal").
Checklist
Check all those that are applicable and complete.