Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pathable/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,17 @@ def _clone_with_parts(
accessor=self.accessor,
)

def _identity_key(self) -> tuple[str, tuple[K, ...], int]:
return (self.separator, self.parts, id(self.accessor))

def __hash__(self) -> int:
return hash(self._identity_key())

def __eq__(self, other: Any) -> bool:
if not isinstance(other, AccessorPath):
return NotImplemented
return self._identity_key() == other._identity_key()

def __rtruediv__(self: TAccessorPath, key: Hashable) -> TAccessorPath:
try:
return self._from_parts(
Expand Down
Loading