Closed
Add SharedPhotosService and fix review feedback from PR #122#136
Conversation
- Fix docstring to say "Shared Photos" instead of generic "Photos" - Remove duplicate `self._libraries = None` assignment - Remove commented-out code - Initialize `zones = []` before try block to prevent NameError - Raise ICloudPyServiceNotActivatedException on zone fetch failure or empty zones - Add `self._libraries = libraries` caching in libraries property - Add explicit `return self._libraries` in libraries property - Initialize `self._shared_photos = None` in base.py __init__ - Fix condition to check `self._shared_photos` instead of `self._photos` - Add tests for SharedPhotosService
Copilot
AI
changed the title
[WIP] Fix code based on review comments
Add SharedPhotosService with review fixes applied
May 28, 2026
- Add trailing commas to ICloudPyServiceNotActivatedException raises in SharedPhotosService (COM812) - Add trailing comma to PhotoLibrary constructor call in libraries property (COM812) - Move SharedPhotosService and MagicMock imports to top of test file (I001)
Copilot
AI
changed the title
Add SharedPhotosService with review fixes applied
Add SharedPhotosService and fix review feedback from PR #122
May 28, 2026
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.
Implements
SharedPhotosService(a newPhotoLibrarysubclass for shared iCloud photo libraries) and addresses all code review comments from PR #122, plus fixes the resulting ruff lint failures in CI.New:
SharedPhotosService(icloudpy/services/photos.py)PhotosService, targeting the/production/sharedendpoint__init__initializeszones = []before the try block; raisesICloudPyServiceNotActivatedExceptionon fetch failure or empty zones (instead of silently returning with an uninitialisedPhotoLibrary)librariesproperty lazily fetches and cachesself._libraries, withzones = []guard before the try blockself._libraries = Noneassignment and commented-out URLicloudpy/base.pyself._shared_photos = Nonealongsideself._photosin__init__shared_photosproperty with correct lazy-init guard (if not self._shared_photos)Tests (
tests/test_photos.py,tests/__init__.py)SharedPhotosServiceInitializationTestscovering initialization params, zone ID, endpoint structure, libraries caching, and exception handlingICloudPySessionMock.request()to return distinct zone fixtures for/production/shared/zones/listvs./production/private/zones/listLint fixes
COM812) on multi-line calls inSharedPhotosServiceSharedPhotosServiceandMagicMockimports to top-level in test file (I001)