fix: ZFSPath, Dataset hash

This commit is contained in:
timeshifter
2022-01-05 13:37:57 +01:00
parent 07d4946432
commit 66371ff899
+6
View File
@@ -215,6 +215,9 @@ class ZFSPath:
and self._snapshot_name == other._snapshot_name and self._snapshot_name == other._snapshot_name
) )
def __hash__(self):
return str(self).__hash__()
@classmethod @classmethod
def from_string(cls, string: str) -> ZFSPath: def from_string(cls, string: str) -> ZFSPath:
"""Take a string from the `zfs` cli, return a ZFSPath object.""" """Take a string from the `zfs` cli, return a ZFSPath object."""
@@ -691,6 +694,9 @@ class Dataset:
def __eq__(self, other: Dataset): def __eq__(self, other: Dataset):
return self._path == other._path return self._path == other._path
def __hash__(self):
return self._path.__hash__()
@classmethod @classmethod
def from_string(cls, qualified_name: str) -> Dataset: def from_string(cls, qualified_name: str) -> Dataset:
return cls(ZFSPath.from_string(qualified_name)) return cls(ZFSPath.from_string(qualified_name))