Clarify safety_level get/set index mismatch is intentional (#173)#175
Open
beaufour wants to merge 1 commit into
Open
Clarify safety_level get/set index mismatch is intentional (#173)#175beaufour wants to merge 1 commit into
beaufour wants to merge 1 commit into
Conversation
getSafetyLevel() returns Flickr's raw 0-indexed value (0=safe, 1=moderate, 2=restricted) from getInfo/search, while setSafetyLevel expects a 1-indexed value (1=safe, 2=moderate, 3=restricted). This is a long-standing asymmetry in the Flickr API itself, not a bug in this library. PR #174 shipped a docstring wrongly claiming the two scales match. Correct the getSafetyLevel() docstring to document the real 0-indexed scale, note the mismatch is intentional (we mirror Flickr rather than normalise), and show the +1 conversion for round-tripping into setSafetyLevel. Add a matching note at the safety_level converter. Verified against the Flickr Foundation's own flickr-photos-api parser and a recorded getInfo API response (safety_level="0" -> safe). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Summary
Fixes the misleading
Photo.getSafetyLevel()docstring shipped in #174 / 0.8.1.getSafetyLevel()returns Flickr's raw 0-indexed value fromgetInfo/search(0=safe,1=moderate,2=restricted), butflickr.photos.setSafetyLevelexpects a 1-indexed value (1=safe,2=moderate,3=restricted). The old docstring wrongly claimed the two scales matched, so following its own example would set the wrong safety level (reported in #173).This is a long-standing asymmetry in the Flickr API itself, not a bug in this library — we intentionally pass both values through unchanged rather than normalise them. This PR makes that explicit.
Changes (docs only, no behaviour change)
getSafetyLevel()docstring: document the real 0-indexed scale, state the mismatch withsetSafetyLevelis by design, and show the+1conversion for round-tripping.safety_levelconverter so readers of the raw attribute see the same caveat.Verification
Confirmed the 0-indexed
getInfoscale against independent sources:setSafetyLeveldocs — 1-indexed setter.flickr-photos-apiparse_safety_level()— mapsgetInfo0/1/2→ safe/moderate/restricted.getInforesponse in that repo returningsafety_level="0"for a safe photo.Existing
test/test_photos.pypasses (38 passed).🤖 Generated with Claude Code