summaryrefslogtreecommitdiff
path: root/lib/ansible/galaxy/dependency_resolution/dataclasses.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/galaxy/dependency_resolution/dataclasses.py')
-rw-r--r--lib/ansible/galaxy/dependency_resolution/dataclasses.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ansible/galaxy/dependency_resolution/dataclasses.py b/lib/ansible/galaxy/dependency_resolution/dataclasses.py
index 0a3f8429a4..46b4e2fffc 100644
--- a/lib/ansible/galaxy/dependency_resolution/dataclasses.py
+++ b/lib/ansible/galaxy/dependency_resolution/dataclasses.py
@@ -167,6 +167,7 @@ def _is_concrete_artifact_pointer(tested_str):
class _ComputedReqKindsMixin:
+ UNIQUE_ATTRS = ('fqcn', 'ver', 'src', 'type')
def __init__(self, *args, **kwargs):
if not self.may_have_offline_galaxy_info:
@@ -181,6 +182,12 @@ class _ComputedReqKindsMixin:
self.ver
)
+ def __hash__(self):
+ return hash(tuple(getattr(self, attr) for attr in _ComputedReqKindsMixin.UNIQUE_ATTRS))
+
+ def __eq__(self, candidate):
+ return hash(self) == hash(candidate)
+
@classmethod
def from_dir_path_as_unknown( # type: ignore[misc]
cls, # type: t.Type[Collection]