Skip to content

Commit

Permalink
ENH: remove xxhash dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Dec 19, 2024
1 parent df3efb1 commit b722c2e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 109 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ test = [
"pytest-cov",
"pytest-profiling",
"pytest-xdist",
"xxhash",
]
types = [
"ipython",
Expand All @@ -120,7 +119,6 @@ types = [
"sphinx-api-relink",
"types-PyYAML",
"types-setuptools",
"xxhash",
]

[tool.setuptools]
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_topology.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import hashlib
import pickle # noqa: S403
import typing

import pytest
import xxhash
from attrs.exceptions import FrozenInstanceError
from IPython.lib.pretty import pretty

Expand Down Expand Up @@ -325,7 +325,7 @@ def test_create_n_body_topology(n_initial: int, n_final: int, exception):

def _compute_hash(obj) -> str:
b = _to_bytes(obj)
h = xxhash.xxh128(b)
h = hashlib.md5(b) # noqa: S324
return h.hexdigest()


Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_transition.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# pyright: reportUnusedImport=false
import hashlib
import pickle # noqa: S403
from copy import deepcopy
from fractions import Fraction

import pytest
import xxhash
from IPython.lib.pretty import pretty

from qrules.particle import Parity, Particle, ParticleCollection, Spin # noqa: F401
Expand Down Expand Up @@ -48,8 +48,8 @@ def test_hash(self, reaction: ReactionInfo):

def test_xxhash(self, reaction: ReactionInfo):
expected_hash = {
"canonical-helicity": "de995528a15267dd3a72fe6c5dfa6136",
"helicity": "61c08ea813390cfbae8b083a89a5673a",
"canonical-helicity": "65106a44301f9340e633d09f66ad7d17",
"helicity": "9646d3ee5c5e8534deb8019435161f2e",
}[reaction.formalism]
assert _compute_hash(reaction) == expected_hash

Expand Down Expand Up @@ -119,7 +119,7 @@ def test_regex_pattern(self):

def _compute_hash(obj) -> str:
b = _to_bytes(obj)
h = xxhash.xxh128(b)
h = hashlib.md5(b) # noqa: S324
return h.hexdigest()


Expand Down
Loading

0 comments on commit b722c2e

Please sign in to comment.