Skip to content

Commit 8b2aa9c

Browse files
committed
Fixing types for python 3.8
1 parent aaa04c5 commit 8b2aa9c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

deepdiff/helper.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import string
99
import time
1010
import enum
11-
from typing import NamedTuple, Any, List, Optional
11+
from typing import NamedTuple, Any, List, Optional, Dict, Union
1212
from ast import literal_eval
1313
from decimal import Decimal, localcontext, InvalidOperation as InvalidDecimalOperation
1414
from itertools import repeat
@@ -817,7 +817,7 @@ class FlatDeltaRow(NamedTuple):
817817
__repr__ = __str__ = named_tuple_repr
818818

819819

820-
JSON = dict[str, str] | list[str] | list[int] | dict[str, "JSON"] | list["JSON"] | str | int | float | bool | None
820+
JSON = Union[Dict[str, str], List[str], List[int], Dict[str, "JSON"], List["JSON"], str, int, float, bool, None]
821821

822822

823823
class SummaryNodeType(EnumBase):

deepdiff/summarize.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import Tuple
12
from deepdiff.helper import JSON, SummaryNodeType
23
from deepdiff.serialization import json_dumps
34

@@ -56,7 +57,7 @@ def calculate_weights(node):
5657
# (Implementing directly the balanced summarization algorithm as above)
5758

5859
# Balanced algorithm (simplified version):
59-
def shrink_tree_balanced(node_structure, max_weight: int, balance_threshold: float) -> tuple[JSON, float]:
60+
def shrink_tree_balanced(node_structure, max_weight: int, balance_threshold: float) -> Tuple[JSON, float]:
6061
node_type, node_info = node_structure
6162

6263
if node_type is SummaryNodeType.leaf:

0 commit comments

Comments
 (0)