1010import statistics
1111import uuid
1212from dataclasses import dataclass , field
13- from typing import TypedDict
13+ from typing import Optional , TypedDict , Union
1414
1515from backports .zoneinfo import ZoneInfo
1616from PIL import Image , ImageStat
@@ -27,12 +27,12 @@ class TargetDict(TypedDict):
2727 width : float
2828 image_base64 : str
2929 active_flag : bool
30- processing_time_seconds : int | float
30+ processing_time_seconds : Union [ int , float ]
3131 processed_tracking_rating : int
32- application_metadata : str | None
32+ application_metadata : Optional [ str ]
3333 target_id : str
3434 last_modified_date : str
35- delete_date_optional : str | None
35+ delete_date_optional : Optional [ str ]
3636 upload_date : str
3737
3838
@@ -66,13 +66,13 @@ class Target:
6666 """
6767
6868 active_flag : bool
69- application_metadata : str | None
69+ application_metadata : Optional [ str ]
7070 image_value : bytes
7171 name : str
7272 processing_time_seconds : float
7373 width : float
7474 current_month_recos : int = 0
75- delete_date : datetime .datetime | None = None
75+ delete_date : Optional [ datetime .datetime ] = None
7676 last_modified_date : datetime .datetime = field (default_factory = _time_now )
7777 previous_month_recos : int = 0
7878 processed_tracking_rating : int = field (
@@ -208,7 +208,7 @@ def to_dict(self) -> TargetDict:
208208 """
209209 Dump a target to a dictionary which can be loaded as JSON.
210210 """
211- delete_date : str | None = None
211+ delete_date : Optional [ str ] = None
212212 if self .delete_date :
213213 delete_date = datetime .datetime .isoformat (self .delete_date )
214214
0 commit comments