Skip to content

Commit

Permalink
Implement deduplication for WATcloud URI
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-z committed Jun 30, 2024
1 parent 410a21a commit 86cdb1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def run_agent():
logging.info("Extracting WATcloud URIs")
watcloud_uris = list(
# sorting to ensure consistent order for testing
sorted(flatten([get_watcloud_uris(repo.working_dir) for repo in repos]))
sorted(set(flatten([get_watcloud_uris(repo.working_dir) for repo in repos])))
)

logging.info(f"Found {len(watcloud_uris)} WATcloud URIs:")
Expand Down
6 changes: 6 additions & 0 deletions src/watcloud_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def __repr__(self) -> str:
def __lt__(self, other):
return self.sha256 < other.sha256

def __eq__(self, other):
return self.sha256 == other.sha256

def __hash__(self):
return hash(self.sha256)

if __name__ == "__main__":
# Example usage
uri = WATcloudURI("watcloud://v1/sha256:906f98c1d660a70a6b36ad14c559a9468fe7712312beba1d24650cc379a62360?name=cloud-light.avif")
Expand Down

0 comments on commit 86cdb1f

Please sign in to comment.