Repository navigation
Follow TYPE_CHECKING imports and __init__ constructors in DeclaredReceiverTyping, and close partial/sync callbacks in threaded_absence - #643
Merged
Conversation
…eiverTyping and close partial/sync callbacks in threaded_absence
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.
Summary
Two high-leverage capabilities from Toad bench feedback:
DeclaredReceiverTyping(class_index.py,declared_receivers.py):if TYPE_CHECKING:import aliases onCompactModuleClassHeader.type_checking_import_aliases(kept separate from runtimeimport_aliases) and resolves annotations / type aliases throughannotation_aliases_by_module(runtime aliases still win on overlap). Unlocksapp_node.py'sif TYPE_CHECKING: from toad.app import ToadAppfor every subclass (ToadNode,AppScoped).self.<attr> = SomeClass(...)assignments in__init__(CompactIndexedClass.init_attribute_calls,_compact_init_attribute_calls), rejecting attributes that are annotated, reassigned to another expression, or calling a local parameter/variable shadowing a module symbol. Resolved throughDeclaredReceiverTyping.called_reference(handling both scanned classes and installed stub classes, failing closed on unannotated functions).threaded_absence(refactors/threaded_absence.py):functools.partial(fn, *args, **kwargs)binding the target parameter (positionally, or by keyword whenpartial(...)is passed directly as a call argument) extracts and rewrites the bound argument directly in place (Held<Family>(...)/Absent<Family>()/<Family>.from_optional(...)) for both sync and async functions/methods.push_screen(..., self.picked_bus),AnimationClock(self._schedule_animation), Qt.connect(self._slot)) adapt cleanly at the callback boundary vialambda <p>: <ref>(<Family>.from_optional(<p>))(or<p>=Nonewhen defaulted), while still refusing.disconnect(...)/removal consumers andasync defcallbacks (where a sync lambda would breakinspect.iscoroutinefunction).Verification
tests/test_declared_receivers.py,tests/test_threaded_absence.py,tests/test_receiver_binding.py,tests/test_receiver_field_bindings.py,tests/test_foreign_absence_branch.py) + 72test_repository_*guards ondesktop.