Add ContextTempOverride as context manager, support __enter__/__exit__ dunders
- Discover ContextTempOverride by probing Context.temp_override() return value - Add __enter__ and __exit__ to _USEFUL_DUNDERS set - Fix __enter__ return type to Self, __exit__ params to standard CM signature - Add Self import to bpy.types generator when used in type annotations - Remove ContextTempOverride from undefined type map (now a real class) Remaining conformance issue: context.copy() returns dict[str, object] which loses specific types when unpacked with **kwargs into temp_override params. This is an inherent limitation of the copy() -> dict pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -553,6 +553,8 @@ def generate_types_stub(
|
||||
typing_imports = ["Generic", "TypeVar"]
|
||||
if "Literal[" in all_type_strs:
|
||||
typing_imports.append("Literal")
|
||||
if re.search(r"\bSelf\b", all_type_strs):
|
||||
typing_imports.append("Self")
|
||||
|
||||
abc_imports = ["Iterator"]
|
||||
if "Callable" in all_type_strs:
|
||||
|
||||
Reference in New Issue
Block a user