Skip to content

Commit

Permalink
Make cache compatible with python 3.8 (#1172)
Browse files Browse the repository at this point in the history
Signed-off-by: elronbandel <elronbandel@gmail.com>
  • Loading branch information
elronbandel authored and csrajmohan committed Aug 29, 2024
1 parent 62e5e9e commit 0b0baf5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/unitxt/metric_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from collections import defaultdict
from functools import cache
from functools import lru_cache
from statistics import mean
from typing import Any, Dict, Iterable, List, Optional

Expand Down Expand Up @@ -79,7 +79,7 @@ def process(
)


@cache
@lru_cache(maxsize=None)
def group_str(json_str):
data = json.loads(json_str)
return ",".join(f"{k}:{v}" for k, v in data.items())
Expand Down Expand Up @@ -128,7 +128,7 @@ def process(self, multi_stream: MultiStream) -> MultiStream:
return MultiStream.from_iterables(result, copying=True)


@cache
@lru_cache(maxsize=None)
def group_str_to_key_value(group_str):
keys = []
values = []
Expand All @@ -152,7 +152,7 @@ def group_str_to_key_value(group_str):
return key, value


@cache
@lru_cache(maxsize=None)
def stream_name_to_origin_subset_group(stream_name):
origin, subset_group = stream_name.split("://")
if "?" in subset_group:
Expand Down

0 comments on commit 0b0baf5

Please sign in to comment.