From 91d90cfa257b70ed40225fe4ea6860e4caba94f0 Mon Sep 17 00:00:00 2001 From: andrewsoltan Date: Wed, 3 Jul 2024 12:45:12 +0100 Subject: [PATCH] Changes for haslib compatability Remove references to usedforsecurity for hashlib compatiablity --- app/processors/metrics_collector.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/processors/metrics_collector.py b/app/processors/metrics_collector.py index 865aba8..6682510 100644 --- a/app/processors/metrics_collector.py +++ b/app/processors/metrics_collector.py @@ -11,8 +11,8 @@ ANCHOR_DELIMITER = ";" DOC_SPAN_DELIMITER = "_" -STATE_MISSING = hashlib.sha1("MISSING".encode("utf-8"), usedforsecurity=False).hexdigest() -META_STATE_MISSING = hashlib.sha1("{}".encode("utf-8"), usedforsecurity=False).hexdigest() +STATE_MISSING = hashlib.sha1("MISSING".encode("utf-8")).hexdigest() +META_STATE_MISSING = hashlib.sha1("{}".encode("utf-8")).hexdigest() def sanity_check_model_with_trainer_export(trainer_export: Union[str, TextIO, Dict], @@ -425,12 +425,12 @@ def _filter_docspan_by_value(docspan2value: Dict, value: str) -> Dict: def _get_hashed_annotation_state(annotation: Dict, state_keys: Set[str]) -> str: - return hashlib.sha1("_".join([str(annotation.get(key)) for key in state_keys]).encode("utf-8"), usedforsecurity=False).hexdigest() + return hashlib.sha1("_".join([str(annotation.get(key)) for key in state_keys]).encode("utf-8"), =False).hexdigest() def _get_hashed_meta_annotation_state(meta_anno: Dict) -> str: meta_anno = {key: val for key, val in sorted(meta_anno.items(), key=lambda item: item[0])} # may not be necessary - return hashlib.sha1(str(meta_anno).encode("utf=8"), usedforsecurity=False).hexdigest() + return hashlib.sha1(str(meta_anno).encode("utf=8")).hexdigest() def _get_cohens_kappa_coefficient(y1_labels: List, y2_labels: List) -> float: