Refactor filename processing optimization#1242
Merged
AndreyNikiforov merged 14 commits intoicloud-photos-downloader:masterfrom Sep 2, 2025
Merged
Conversation
Update compile_tzlc.py to perform case insensitive comparison when checking if timezone/locale compatibility test outputs match expected content. This makes the compatibility tests more robust by handling variations in capitalization that may occur across different systems. Before: content not in expected_content (case sensitive) After: content.lower() not in [c.lower() for c in expected_content] (case insensitive) This prevents false negatives when version strings have different capitalization (e.g., "Version:1.32.0" vs "version:1.32.0"). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…omposition - Add string utility functions in src/foundation/string_utils.py - Add predicate composition utilities in src/foundation/predicates.py - Refactor lp_filename_concatinator to use functional composition - Update authentication functions to use strip and strip_and_lower utilities - Improve parse_mfa_provider with functional lookup pattern instead of if/elif chain - Fix cross-platform path issues in issue icloud-photos-downloader#1220 test - Separate pure transformations from I/O operations for better testability All tests pass (201 passed, 3 skipped) with strict mypy validation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove empty else blocks that Pylance flagged as statically false conditions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Refactor folder structure checks using compose(eq("none"), lower)
- Update password input handling with strip and strip_and_lower utilities
- Improve file extension checks with compose(endswith(...), lower)
- Enhance XMP sidecar logic with functional predicates
- Add tuple support to endswith utility for multiple extensions
- Replace imperative string checks with point-free composition
All 201 tests pass with strict mypy validation maintained.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
… composition - Add replace_extension utility for filename transformations - Refactor lp_filename_* functions to use functional composition patterns - Extract pure validation functions from I/O operations in authentication - Consolidate duplicate string utilities and improve import organization - Separate side-effectful operations from pure business logic - Enhance testability through functional decomposition All tests pass, strict mypy validation successful, and code follows point-free style patterns throughout high-priority areas. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace mock_lp_filename_generator with real lp_filename_concatinator function - Replace simple_lp_filename_generator with lp_filename_original (identical functionality) - Eliminate code duplication while maintaining identical behavior - Tests continue to pass with the real functions instead of duplicated logic Both simple_lp_filename_generator and lp_filename_original had identical logic: just replace any file extension with .MOV for live photo handling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ssion Add centralized connection error handling at the HTTP session level to provide consistent error messages and behavior for all iCloud API requests. Key changes: - Add PyiCloudConnectionErrorException for standardized connection errors - Implement handle_connection_error decorator to catch ConnectionError, TimeoutError, Timeout, and NewConnectionError - Apply wrapper at PyiCloudSession.request() level for universal coverage - Update core_single_run error handling to include new exception type - Remove redundant connection error handling block in base.py Testing: - Add comprehensive integration test suite with real HTTP server - Test all four connection exception types with mocking and real network conditions - Update existing authentication tests to work with new session-level handling - All 61 tests pass with new 7 integration tests added 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…sers Replace generic "Invalid email/password combination." with actual exception messages to provide better diagnostic information to users. Changes: - Use actual exception message instead of hardcoded generic message - Apply to both logger output and WebUI error display - Preserve original exception handling flow and error chaining Benefits: - Users see specific errors like "Invalid authentication token" or "Failed to initiate srp authentication" instead of generic message - Better troubleshooting with actionable error information - Maintains security as original messages are already user-safe 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…d parameters • Create filename_policies.py with create_filename_builder() factory using partial_2_1 • Replace 12 instances of duplicated filename building code with single function • Remove None optionality from file_match_policy and filename_cleaner parameters • Eliminate redundant parameters from download_media function • Fix parameter order bugs in delete function calls • Update test assertions to match new function signatures Performance improvements: - Pre-configured filename builders eliminate repeated parameter passing - No runtime None checks in hot paths with required parameters - Better type safety with guaranteed non-None values - Reduced function complexity by removing defensive programming branches 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
• Add explicit desired_item_type parameter to make function intent clearer • Move photo parameter to last position for better partial application • Replace reverse logic inference with direct desired type logic • Update function calls to pass explicit AssetItemType.IMAGE/MOVIE values Benefits: - Clearer function signature expressing "skip message for desired type" - No more reverse logic assumptions in implementation - Better parameter ordering for functional composition - More explicit and maintainable code 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
• Change socket bind from ("", 0) to ("localhost", 0) in test helper
• Addresses security scanner warning about binding to all interfaces
• No functional change - test still finds available port correctly
• Follows security best practice of explicit interface binding
This fixes a false positive security warning while maintaining the same
test functionality for finding available ports.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
…handling - Use tempfile.gettempdir() instead of hardcoded '/tmp/' paths - Ensures test compatibility across Windows, macOS, and Linux platforms - Fixes FileNotFoundError on Windows systems 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Upgrade pytest-cov from 5.0.0 to 6.2.1 for Python 3.13 and coverage 7.x compatibility - Remove coveralls==3.3.1 dependency as it's unused and conflicts with coverage 7.x - Eliminates Python 3.13 deprecation warning: "co_lnotab is deprecated, use co_lines instead" - Project uses local coverage reports only, no external coverage service integration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
52e1fcd
into
icloud-photos-downloader:master
773 of 774 checks passed
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.