Open
Conversation
- Replace `str | None` with `Optional[str]` - Replace `dict[str, Any]` with `Dict[str, Any]` - Replace `dict[str, Any] | None` with `Optional[Dict[str, Any]]` - Add `Dict` and `Optional` imports from typing module This resolves the TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' error that occurred when running with Python 3.8.
- Change requires-python from >=3.13 to >=3.8 to match CI workflow - Update ruff target-version from py311 to py38 - Ignore ruff rules UP006, UP007, UP035, UP045 that enforce Python 3.10+ syntax - These changes ensure consistency between CI tests (3.8 & 3.12) and project config This resolves the ruff linting failures while maintaining Python 3.8 compatibility.
- Add Dict import from typing module - Replace dict[str, Any] with Dict[str, Any] in method signatures: - display_file_preview() at line 165 - create_statistics_table() at line 190 This resolves the TypeError: 'type' object is not subscriptable error during test collection on Python 3.8.
Updated type hints in 14 files to use Python 3.8 compatible syntax: - src/main.py - src/modules/backup_manager.py - src/modules/duplicate_detector.py - src/modules/enhanced_exif_extractor.py - src/modules/enhanced_video_extractor.py - src/modules/exif_extractor.py - src/modules/file_renamer.py - src/modules/folder_organizer.py - src/modules/geolocation.py - src/modules/image_processor.py - src/modules/session_detector.py - src/modules/statistics_generator.py - src/modules/xmp_analyzer.py - src/utils/camera_slugger.py Changes made: - Replaced dict[X, Y] with Dict[X, Y] - Replaced list[X] with List[X] - Replaced set[X] with Set[X] - Replaced tuple[X, ...] with Tuple[X, ...] - Replaced X | Y with Union[X, Y] - Replaced X | None with Optional[X] - Added necessary typing imports to all files This completes the Python 3.8 compatibility fixes across the entire project.
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.
str | NonewithOptional[str]dict[str, Any]withDict[str, Any]dict[str, Any] | NonewithOptional[Dict[str, Any]]DictandOptionalimports from typing moduleThis resolves the TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' error that occurred when running with Python 3.8.