pybind: pos validation and class attribute constants for S2CellId bindings#625
Open
deustis wants to merge 2 commits into
Open
pybind: pos validation and class attribute constants for S2CellId bindings#625deustis wants to merge 2 commits into
deustis wants to merge 2 commits into
Conversation
- Add S2CellId::kMaxPosition constant (2^61 - 1) to s2cell_id.h and add C++ unit test verifying valid/overflow behavior - Validate pos argument in from_face_pos_level; expose MAX_POSITION as a Python class attribute; add Python test for pos out of range - Switch constants to cls.attr() pattern; update README to document this style - Fix BUILD: add @abseil-cpp//absl/strings dep to s2cell_id_bindings
Contributor
Author
|
@jmr, couple of fast follow improvements here to be able to validate the position attribute, and I also found a way to use python class attributes for constants as you had suggested previously. |
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
S2CellId::kMaxPositionconstant (2^61 - 1) tos2cell_id.hwith a C++ unit test verifying valid and overflow behaviorposargument inS2CellId.from_face_pos_levelPython binding; exposeMAX_POSITIONas a Python class attributecls.attr()pattern for uniform style regardless of whether constants come fromstatic constexprmembers or enum values; document in README@abseil-cpp//absl/stringsdep tos2cell_id_bindings