From cd970b5871d980bb6622b71686d5cfe8c49252f3 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sat, 15 Oct 2022 13:53:56 -0700 Subject: [PATCH] TypedDict fixup for older python versions --- jc/utils.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/jc/utils.py b/jc/utils.py index dfef6bec..7398405a 100644 --- a/jc/utils.py +++ b/jc/utils.py @@ -6,16 +6,20 @@ import shutil from datetime import datetime, timezone from textwrap import TextWrapper from functools import lru_cache -from typing import List, Dict, Iterable, Union, Optional, TypedDict, TextIO +from typing import List, Dict, Iterable, Union, Optional, TextIO -TSFormatType = TypedDict( - 'TSFormatType', - { - 'id': int, - 'format': str, - 'locale': Optional[str] - } -) +if sys.version_info >= (3, 8): + from typing import TypedDict + TSFormatType = TypedDict( + 'TSFormatType', + { + 'id': int, + 'format': str, + 'locale': Optional[str] + } + ) +else: + TSFormatType = Dict def _asciify(string: str) -> str: