Skip to content

Commit

Permalink
fix(py3.8): ensure compatibility across py version
Browse files Browse the repository at this point in the history
* Fix breaks compatability with Python 3.8
  • Loading branch information
tkoyama010 committed Feb 15, 2024
1 parent 6139f20 commit 36a58c1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion trame_vtk/modules/vtk/serializers/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import base64
import hashlib
import sys


def rgb_float_to_hex(r, g, b):
Expand Down Expand Up @@ -48,7 +49,12 @@ def base64_encode(x):


def hash_data_array(data_array):
hashed_bit = hashlib.md5(memoryview(data_array), usedforsecurity=False).hexdigest()
if sys.version_info < (3, 9):
hashed_bit = hashlib.md5(memoryview(data_array)).hexdigest()
else:
hashed_bit = hashlib.md5(
memoryview(data_array), usedforsecurity=False
).hexdigest()
type_code = array_types_mapping[data_array.GetDataType()]
return "%s_%d%s" % (hashed_bit, data_array.GetSize(), type_code)

Expand Down

0 comments on commit 36a58c1

Please sign in to comment.