pyhyperminhash 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/Cargo.lock +5 -5
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/Cargo.toml +1 -1
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/PKG-INFO +1 -1
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/pyhyperminhash.pyi +1 -0
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/src/lib.rs +28 -0
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/tests/test_pyhyperminhash.py +21 -0
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/.github/workflows/CI.yml +0 -0
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/.gitignore +0 -0
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/LICENSE +0 -0
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/README.md +0 -0
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/build.rs +0 -0
- {pyhyperminhash-0.1.2 → pyhyperminhash-0.1.3}/pyproject.toml +0 -0
|
@@ -83,9 +83,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|
|
83
83
|
|
|
84
84
|
[[package]]
|
|
85
85
|
name = "hyperminhash"
|
|
86
|
-
version = "0.1.
|
|
86
|
+
version = "0.1.3"
|
|
87
87
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
88
|
-
checksum = "
|
|
88
|
+
checksum = "7812609f2901ae4daa1c73bdd0bbbdee09bca9729fbf10380d745a0cc887362f"
|
|
89
89
|
dependencies = [
|
|
90
90
|
"byteorder",
|
|
91
91
|
"xxhash-rust",
|
|
@@ -210,7 +210,7 @@ dependencies = [
|
|
|
210
210
|
|
|
211
211
|
[[package]]
|
|
212
212
|
name = "pyhyperminhash"
|
|
213
|
-
version = "0.1.
|
|
213
|
+
version = "0.1.3"
|
|
214
214
|
dependencies = [
|
|
215
215
|
"built",
|
|
216
216
|
"hyperminhash",
|
|
@@ -350,9 +350,9 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
|
|
|
350
350
|
|
|
351
351
|
[[package]]
|
|
352
352
|
name = "syn"
|
|
353
|
-
version = "2.0.
|
|
353
|
+
version = "2.0.52"
|
|
354
354
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
355
|
-
checksum = "
|
|
355
|
+
checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
|
|
356
356
|
dependencies = [
|
|
357
357
|
"proc-macro2",
|
|
358
358
|
"quote",
|
|
@@ -130,6 +130,17 @@ impl Sketch {
|
|
|
130
130
|
inner.union(&other.inner);
|
|
131
131
|
Ok(Self { inner })
|
|
132
132
|
}
|
|
133
|
+
|
|
134
|
+
fn __eq__(&self, other: &Self) -> bool {
|
|
135
|
+
self.inner == other.inner
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
fn __hash__(&self) -> u64 {
|
|
139
|
+
use std::hash::{Hash, Hasher};
|
|
140
|
+
let mut s = std::hash::DefaultHasher::new();
|
|
141
|
+
self.inner.hash(&mut s);
|
|
142
|
+
s.finish()
|
|
143
|
+
}
|
|
133
144
|
}
|
|
134
145
|
|
|
135
146
|
#[pyfunction]
|
|
@@ -141,12 +152,29 @@ fn __version_info__() -> PyResult<String> {
|
|
|
141
152
|
))
|
|
142
153
|
}
|
|
143
154
|
|
|
155
|
+
#[allow(clippy::single_match)]
|
|
156
|
+
const fn __hyperminhash_version__() -> &'static str {
|
|
157
|
+
let mut idx = 0;
|
|
158
|
+
while idx < built_info::DEPENDENCIES.len() {
|
|
159
|
+
let (pkg, version) = built_info::DEPENDENCIES[idx];
|
|
160
|
+
match pkg.as_bytes() {
|
|
161
|
+
b"hyperminhash" => {
|
|
162
|
+
return version;
|
|
163
|
+
}
|
|
164
|
+
_ => {}
|
|
165
|
+
}
|
|
166
|
+
idx += 1;
|
|
167
|
+
}
|
|
168
|
+
""
|
|
169
|
+
}
|
|
170
|
+
|
|
144
171
|
/// A Python module implemented in Rust.
|
|
145
172
|
#[pymodule]
|
|
146
173
|
fn pyhyperminhash(_py: Python, m: &PyModule) -> PyResult<()> {
|
|
147
174
|
m.add_class::<Sketch>()?;
|
|
148
175
|
m.add_function(wrap_pyfunction!(__version_info__, m)?)?;
|
|
149
176
|
m.add("__version__", built_info::PKG_VERSION)?;
|
|
177
|
+
m.add("__hyperminhash_version__", __hyperminhash_version__())?;
|
|
150
178
|
m.add("__profile__", built_info::PROFILE)?;
|
|
151
179
|
Ok(())
|
|
152
180
|
}
|
|
@@ -11,6 +11,9 @@ class TestPyhyperminhash(unittest.TestCase):
|
|
|
11
11
|
def test_version_info(self):
|
|
12
12
|
self.assertIsInstance(pyhyperminhash.__version_info__(), str)
|
|
13
13
|
|
|
14
|
+
def test_hyperminhash_version(self):
|
|
15
|
+
self.assertIsInstance(pyhyperminhash.__hyperminhash_version__, str)
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
class TestSketch(unittest.TestCase):
|
|
16
19
|
|
|
@@ -83,3 +86,21 @@ class TestSketch(unittest.TestCase):
|
|
|
83
86
|
sk2.add_bytes(b'foo %i' % (i, ))
|
|
84
87
|
sk2.add_bytes(b'foo1 %i' % (i, ))
|
|
85
88
|
self.assertAlmostEqual(sk1.intersection(sk2) / 1000, 5, 1)
|
|
89
|
+
|
|
90
|
+
def test_hash_eq(self):
|
|
91
|
+
sk1 = pyhyperminhash.Sketch()
|
|
92
|
+
sk2 = pyhyperminhash.Sketch()
|
|
93
|
+
self.assertEqual(sk1, sk2)
|
|
94
|
+
self.assertEqual(hash(sk1), hash(sk2))
|
|
95
|
+
sk1.add('foo')
|
|
96
|
+
self.assertNotEqual(sk1, sk2)
|
|
97
|
+
self.assertNotEqual(hash(sk1), hash(sk2))
|
|
98
|
+
sk2.add('foo')
|
|
99
|
+
self.assertEqual(sk1, sk2)
|
|
100
|
+
self.assertEqual(hash(sk1), hash(sk2))
|
|
101
|
+
sk2.add('foo')
|
|
102
|
+
self.assertEqual(sk1, sk2)
|
|
103
|
+
self.assertEqual(hash(sk1), hash(sk2))
|
|
104
|
+
sk2.add('bar')
|
|
105
|
+
self.assertNotEqual(sk1, sk2)
|
|
106
|
+
self.assertNotEqual(hash(sk1), hash(sk2))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|