From 6c4840de8f19331e6c51b51f0052032af9834720 Mon Sep 17 00:00:00 2001 From: Pip Liggins Date: Thu, 28 Nov 2024 13:43:26 +0000 Subject: [PATCH] fix for 3.9? --- src/adtl/parser.py | 6 +++--- tests/test_parser.py | 2 ++ tests/test_python_interface.py | 2 ++ tests/test_transformations.py | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/adtl/parser.py b/src/adtl/parser.py index 17c2ba9..0101cfa 100644 --- a/src/adtl/parser.py +++ b/src/adtl/parser.py @@ -13,7 +13,7 @@ from datetime import datetime from functools import lru_cache from pathlib import Path -from typing import Any, Callable, Iterable, Literal +from typing import Any, Callable, Iterable, Literal, Union import fastjsonschema import pint @@ -29,8 +29,8 @@ DEFAULT_DATE_FORMAT = "%Y-%m-%d" StrDict = dict[str, Any] -Rule = str | StrDict -Context = dict[str, bool | int | str | list[str]] | None +Rule = Union[str, StrDict] +Context = Union[dict[str, bool | int | str | list[str]], None] def get_value(row: StrDict, rule: Rule, ctx: Context = None) -> Any: diff --git a/tests/test_parser.py b/tests/test_parser.py index 6cd4407..047e8e9 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import collections import contextlib import io diff --git a/tests/test_python_interface.py b/tests/test_python_interface.py index b7e526b..415aa77 100644 --- a/tests/test_python_interface.py +++ b/tests/test_python_interface.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from pathlib import Path import adtl diff --git a/tests/test_transformations.py b/tests/test_transformations.py index 1b767a8..1dc23c0 100644 --- a/tests/test_transformations.py +++ b/tests/test_transformations.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from datetime import datetime import pytest