Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
GrayHat12 committed Jun 23, 2024
1 parent 0646ee8 commit 94be7fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/pymhash/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ class ImageHash:

def __str__(self) -> str: ...

def __hash__(self) -> int: ...
def __hash__(self) -> int: ...

@property
def hashes(self) -> List[OrientationHash]: ...
1 change: 1 addition & 0 deletions src/hash/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::orientation::OrientationHash;
#[pyclass]
#[derive(Clone)]
pub struct ImageHash {
#[pyo3(get)]
pub hashes: Vec<OrientationHash>,
}

Expand Down
8 changes: 8 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
print(p.metadata.hash.to_str())
print(p.metadata.hash.to_str() == str(ImageHash.from_str(p.metadata.hash.to_str())))
print(p.metadata.hash == ImageHash.from_str(p.metadata.hash.to_str()))
hashes_str = [str(hash) for hash in p.metadata.hash.hashes]
print(hashes_str)

n = ImageHash()
for v in hashes_str:
n.add_hash(OrientationHash.from_str(v))

print(n == p.metadata.hash)

assert isinstance(a, OrientationHash)
assert isinstance(a.to_str(), str)
Expand Down

0 comments on commit 94be7fa

Please sign in to comment.