Skip to content

Conversation

@jorwoods
Copy link
Contributor

Closes #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.

@jorwoods jorwoods force-pushed the jorwoods/hashing_reference branch from 3890990 to a7310ee Compare October 17, 2025 20:28
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.
@jorwoods jorwoods force-pushed the jorwoods/hashing_reference branch from a7310ee to c39ba83 Compare October 17, 2025 20:41
@jacalata jacalata requested a review from Copilot October 29, 2025 04:36
Copy link

Copilot AI left a 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 ResourceReference class methods and properties
  • Implementing __hash__() method for ResourceReference to make it hashable
  • Adding to_reference() instance methods to UserItem, GroupItem, and GroupSetItem that convert instances to ResourceReference objects
  • 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.

@jorwoods jorwoods force-pushed the jorwoods/hashing_reference branch from 3ca1445 to 9e697e4 Compare October 29, 2025 13:47
@jorwoods
Copy link
Contributor Author

@bcantoni @jacalata I don't have access to fossa to see what the issue is with the license compliance check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make ReferenceItem hashable

1 participant