Skip to content

Commit 86cdb1f

Browse files
committed
Implement deduplication for WATcloud URI
1 parent 410a21a commit 86cdb1f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def run_agent():
1616
logging.info("Extracting WATcloud URIs")
1717
watcloud_uris = list(
1818
# sorting to ensure consistent order for testing
19-
sorted(flatten([get_watcloud_uris(repo.working_dir) for repo in repos]))
19+
sorted(set(flatten([get_watcloud_uris(repo.working_dir) for repo in repos])))
2020
)
2121

2222
logging.info(f"Found {len(watcloud_uris)} WATcloud URIs:")

src/watcloud_uri.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ def __repr__(self) -> str:
4747
def __lt__(self, other):
4848
return self.sha256 < other.sha256
4949

50+
def __eq__(self, other):
51+
return self.sha256 == other.sha256
52+
53+
def __hash__(self):
54+
return hash(self.sha256)
55+
5056
if __name__ == "__main__":
5157
# Example usage
5258
uri = WATcloudURI("watcloud://v1/sha256:906f98c1d660a70a6b36ad14c559a9468fe7712312beba1d24650cc379a62360?name=cloud-light.avif")

0 commit comments

Comments
 (0)