Skip to content

Commit

Permalink
Removed pyhash dependency (#2170)
Browse files Browse the repository at this point in the history
* Removed problematic pyhash dependency

* Added CHANGELOG
ActiveChooN authored Sep 12, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ca70941 commit b8346ce
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed multiple errors which arises when polygon is of length 5 or less (<https://github.com/opencv/cvat/pull/2100>)
- Fixed task creation from PDF (<https://github.com/opencv/cvat/pull/2141>)
- Fixed CVAT format import for frame stepped tasks (<https://github.com/openvinotoolkit/cvat/pull/2151>)
- Fixed unnecessary pyhash dependency (<https://github.com/openvinotoolkit/cvat/pull/2170>)

### Security
-
6 changes: 3 additions & 3 deletions cvat/apps/dataset_manager/formats/utils.py
Original file line number Diff line number Diff line change
@@ -3,11 +3,10 @@
# SPDX-License-Identifier: MIT

import os.path as osp
from pyhash import murmur3_32
from hashlib import blake2s

from datumaro.cli.util import make_file_name

hasher = murmur3_32()

def get_color_from_index(index):
def get_bit(number, index):
@@ -69,7 +68,8 @@ def get_label_color(label_name, label_names):
normalized_name = normalize_label(label_name)

color = predefined.get(normalized_name, None)
offset = hasher(normalized_name) + normalized_names.count(normalized_name)
name_hash = int.from_bytes(blake2s(normalized_name.encode(), digest_size=4).digest(), byteorder="big")
offset = name_hash + normalized_names.count(normalized_name)

if color is None:
color = get_color_from_index(DEFAULT_COLORMAP_CAPACITY + offset)
1 change: 0 additions & 1 deletion cvat/requirements/base.txt
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ Pillow==7.2.0
numpy==1.18.5
python-ldap==3.3.1
pytz==2020.1
pyhash==0.9.3
pyunpack==0.2.1
rcssmin==1.0.6
redis==3.5.3

0 comments on commit b8346ce

Please sign in to comment.