Repository navigation
Import the class of another module that TypedDict extra_items names - #5219
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
d50be4f to
57e70d8
Compare
Merging this PR will improve performance by 36.04%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
extra_items wrote the bare class name of its data type, which the module import pass never visited. In modular output a class of another module was then undefined, or the class of the same name in the module was named instead (a.Bar for b.Bar). The import pass now visits the data types of backend settings beside those of fields and validator rules, so extra_items names the class through its import (b.Bar with from . import b), as field types do. Fixes: #5031
57e70d8 to
22fa43a
Compare
Breaking Change AnalysisResult: No breaking changes detected Reasoning: This PR fixes a bug in modular output that only shows up when TypedDict extra_items names a class in another module. Before the fix, extra_items used the bare class name. That name was undefined in modules that did not import the class, and in one case it pointed to a different class with the same name in the current module instead of the class the schema references. Now the referenced module is imported and extra_items uses the qualified name, such as b.Bar, the same way field types are imported. The code changes add an internal hook, _setting_data_types, on the base and TypedDict models, and a private helper, _data_types_beside_fields, which the import and name-collection passes use. The pass declaration now also reads IMPORT_ALIASES. The rest of the PR is documentation and new tests. No CLI options, public Python API, default values, templates, supported Python versions or error handling change. The generated output changes only where the old output was invalid or did not match the schema, so this is a bug fix and not a breaking change. This analysis was produced by the release draft workflow |
Fixes: #5031
Summary by CodeRabbit
TypedDictdefinitions soextra_itemsreferences resolve correctly when their types are defined in other modules or use finalized class names.