Add typing_extensions.Override to SpikeDetection callback#21664
Open
mattiagaggi wants to merge 2 commits intoLightning-AI:masterfrom
Open
Add typing_extensions.Override to SpikeDetection callback#21664mattiagaggi wants to merge 2 commits intoLightning-AI:masterfrom
mattiagaggi wants to merge 2 commits intoLightning-AI:masterfrom
Conversation
Add the missing @OverRide decorator to the single remaining file: src/lightning/pytorch/callbacks/spike.py. The SpikeDetection.on_train_batch_end method overrides Callback.on_train_batch_end but lacks @OverRide. Import override from typing_extensions and add the decorator. The rest of the codebase (888 uses across 120 files) was already migrated via a series of PRs (Lightning-AI#18911, Lightning-AI#18934, Lightning-AI#19065, Lightning-AI#19090, etc.). The typing_extensions version requirement (>4.5.0) already supports override.
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
deependujha
approved these changes
Apr 29, 2026
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #21664 +/- ##
=========================================
- Coverage 87% 79% -8%
=========================================
Files 270 267 -3
Lines 23973 23916 -57
=========================================
- Hits 20748 18806 -1942
- Misses 3225 5110 +1885 |
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
Add
@overridedecorator fromtyping_extensionsto theSpikeDetection.on_train_batch_endmethod, improving type safety and making it explicit that this method overrides the parent class implementation.Changes
overridefromtyping_extensions@overridedecorator toSpikeDetection.on_train_batch_endTesting
python -m pytest tests/tests_pytorch/callbacks/test_spike.py— existing tests passmypy src/lightning/pytorch/callbacks/spike.py— type check passesCloses #18695
📚 Documentation preview 📚: https://pytorch-lightning--21664.org.readthedocs.build/en/21664/