Mypy cleanup#933
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR focuses on cleaning up type hints and addressing mypy warnings throughout the Scalene codebase. The changes improve type safety and code quality by adding proper type annotations, assertions, and modernizing certain patterns.
Key changes include:
- Adding type annotations and assertions for better type safety
- Replacing
OrderedDictwithDictwhere ordering is not required - Modernizing code patterns (e.g., simplifying if-else logic)
- Adding proper inheritance relationships and type ignores for mypy compatibility
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scalene/scalene_profiler.py | Adds noqa comment, assertion for null check, improves function signature, changes list to tuple |
| scalene/scalene_preload.py | Replaces print with warnings.warn for better error handling |
| scalene/scalene_neuron.py | Simplifies boolean return logic |
| scalene/scalene_magics.py | Adds type ignore comments for IPython magic decorators |
| scalene/scalene_leak_analysis.py | Replaces OrderedDict with Dict in type hints |
| scalene/scalene_json.py | Replaces OrderedDict with Dict and adds explicit type annotation |
| scalene/scalene_apple_gpu.py | Adds proper inheritance, type annotations, and type ignore comments |
| ruff.toml | Adds B028 to ignored lint rules |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
No description provided.