-
Notifications
You must be signed in to change notification settings - Fork 445
feat: make ResourceReference hashable #1668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
3890990 to
a7310ee
Compare
Closes tableau#1666 This allows `ResourceReference` to be used as a key in dicts, as well as added to sets by making it hashable. Also adds a `to_reference` method, while leaving the the `as_reference` static method in place untouched.
a7310ee to
c39ba83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds type safety improvements and a new to_reference() method to model classes. The changes include:
- Adding type hints to
ResourceReferenceclass methods and properties - Implementing
__hash__()method forResourceReferenceto make it hashable - Adding
to_reference()instance methods toUserItem,GroupItem, andGroupSetItemthat convert instances toResourceReferenceobjects - Adding null safety checks in the permissions request factory to validate grantee IDs
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tableauserverclient/models/reference_item.py | Added type hints and __hash__() method to ResourceReference class |
| tableauserverclient/models/user_item.py | Added to_reference() method with null check for converting UserItem to ResourceReference |
| tableauserverclient/models/group_item.py | Added to_reference() method with null check for converting GroupItem to ResourceReference |
| tableauserverclient/models/groupset_item.py | Added to_reference() method with null check for converting GroupSetItem to ResourceReference |
| tableauserverclient/server/request_factory.py | Added validation to ensure grantee has an ID before adding to XML element |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3ca1445 to
9e697e4
Compare
Closes #1666
This allows
ResourceReferenceto be used as a key in dicts, as well as added to sets by making it hashable. Also adds ato_referencemethod, while leaving the theas_referencestatic method in place untouched.