fix: lint errors (UP007, UP045, UP006 & UP035) #754
Merged
bhimrazy merged 9 commits intoLightning-AI:mainfrom Jan 7, 2026
Merged
fix: lint errors (UP007, UP045, UP006 & UP035) #754bhimrazy merged 9 commits intoLightning-AI:mainfrom
bhimrazy merged 9 commits intoLightning-AI:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #754 +/- ##
===================================
Coverage 80% 80%
===================================
Files 52 52
Lines 7366 7371 +5
===================================
+ Hits 5907 5912 +5
Misses 1459 1459 🚀 New features to boost your workflow:
|
tchaton
approved these changes
Jan 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes type annotations across the codebase to comply with PEP 604 by converting from the older Optional[X] and Union[X, Y] syntax to the newer X | None and X | Y syntax. It also removes the corresponding pyupgrade lint rule ignores (UP007, UP045, UP006, UP035) from pyproject.toml.
Key Changes:
- Converted all
Optional[X]annotations toX | None - Converted most
Union[X, Y]annotations toX | Y - Removed unused imports of
Optionaland someUnionfrom typing - Updated
pyproject.tomlto remove UP007 and UP045 from lint ignore list - Used string quotes for forward references involving
Queuefrom multiprocessing to avoid circular import issues
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/streaming/test_dataset.py | Converted Optional to PEP 604 syntax in test fixtures |
| src/litdata/utilities/subsample.py | Updated type annotations for function parameters |
| src/litdata/utilities/parquet.py | Converted Union and Optional annotations across multiple classes |
| src/litdata/utilities/hf_dataset.py | Modernized function signatures with PEP 604 syntax |
| src/litdata/utilities/env.py | Updated Callable and Optional annotations, imported Callable from collections.abc |
| src/litdata/utilities/encryption.py | Converted Union annotations in state management methods |
| src/litdata/utilities/dataset_utilities.py | Updated Optional/Union annotations and moved Callable import |
| src/litdata/utilities/broadcast.py | Modernized HTTP client type annotations |
| src/litdata/utilities/base.py | Updated abstract base class type annotations |
| src/litdata/streaming/writer.py | Converted type annotations and used quoted "Queue" for forward reference |
| src/litdata/streaming/serializers.py | Updated serializer method signatures |
| src/litdata/streaming/sampler.py | Converted Iterator and Union annotations |
| src/litdata/streaming/resolver.py | Updated Dir-related type annotations (incomplete - see comments) |
| src/litdata/streaming/reader.py | Modernized reader class annotations |
| src/litdata/streaming/parallel.py | Updated dataset wrapper annotations |
| src/litdata/streaming/item_loader.py | Converted loader type annotations with quoted Queue reference |
| src/litdata/streaming/fs_provider.py | Updated filesystem provider signatures |
| src/litdata/streaming/downloader.py | Modernized downloader class annotations |
| src/litdata/streaming/dataset.py | Updated streaming dataset parameters (incomplete - see comments) |
| src/litdata/streaming/dataloader.py | Converted dataloader type annotations |
| src/litdata/streaming/config.py | Updated config class method signatures |
| src/litdata/streaming/combined.py | Modernized combined dataset annotations |
| src/litdata/streaming/client.py | Updated S3/R2 client type annotations |
| src/litdata/streaming/cache.py | Converted cache class annotations with quoted Queue |
| src/litdata/raw/indexer.py | Updated indexer abstract methods |
| src/litdata/raw/dataset.py | Modernized raw dataset type annotations |
| src/litdata/processing/utilities.py | Updated utility function signatures |
| src/litdata/processing/functions.py | Converted processing function annotations (incomplete - see comments) |
| src/litdata/processing/data_processor.py | Updated data processor type annotations |
| src/litdata/imports.py | Modernized requirement cache annotations |
| src/litdata/helpers.py | Updated helper function signatures |
| pyproject.toml | Removed UP007, UP045, UP006, UP035 from lint ignore list |
| examples/multi_modal/loop.py | Converted callback type annotations |
| examples/multi_modal/dataloader.py | Updated dataset class signatures |
| benchmarks/litdata/optimize_imagenet.py | Modernized resize_size annotation |
| .github/benchmark/benchmark.py | Updated benchmark configuration annotations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rs_sequentially function
…set and resolver modules
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.
Before submitting
What does this PR do?
This PR addresses lint errors across the codebase by:
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in GitHub issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃