From 79fccf16ff190f3e08303f43ca813901e48b6691 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 4 Sep 2024 19:08:39 -0600 Subject: [PATCH] Use Python 3.9-compatible annotation style --- icepyx/core/APIformatting.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/icepyx/core/APIformatting.py b/icepyx/core/APIformatting.py index e852faf45..094b43ea2 100644 --- a/icepyx/core/APIformatting.py +++ b/icepyx/core/APIformatting.py @@ -1,7 +1,7 @@ """Generate and format information for submitting to API (CMR and NSIDC).""" import datetime as dt -from typing import Any, Generic, Literal, TypeVar, Union, overload +from typing import Any, Generic, Literal, Optional, TypeVar, Union, overload from icepyx.core.types import ( CMRParams, @@ -190,7 +190,7 @@ def to_string(params): ParameterType = Literal["CMR", "required", "subset"] # DevGoal: When Python 3.12 is minimum supported version, migrate to PEP695 style -T = TypeVar("T", bound=ParameterType) +T = TypeVar("T", covariant=True, bound=ParameterType) class _FmtedKeysDescriptor: @@ -256,14 +256,15 @@ class Parameters(Generic[T]): """ partype: T - _reqtype: Literal["search", "download"] | None + _reqtype: Optional[Literal["search", "download"]] fmted_keys = _FmtedKeysDescriptor() + # _fmted_keys: Union[CMRParams, EGISpecificRequiredParams, EGIParamsSubset] def __init__( self, partype: T, - values: dict | None = None, - reqtype: Literal["search", "download"] | None = None, + values: Optional[dict] = None, + reqtype: Optional[Literal["search", "download"]] = None, ): assert partype in [ "CMR",