Skip to content

Commit

Permalink
Use Python 3.9-compatible annotation style
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisher87 committed Sep 5, 2024
1 parent ee70196 commit 434c28a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions icepyx/core/APIformatting.py
Original file line number Diff line number Diff line change
@@ -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, overload
from typing import Any, Generic, Literal, TypeVar, Union, overload

from icepyx.core.types import (
CMRParams,
Expand Down Expand Up @@ -226,7 +226,7 @@ def __get__(
self,
instance: "Parameters",
owner: Any,
) -> CMRParams | EGISpecificRequiredParams | EGIParamsSubset:
) -> Union[CMRParams, EGISpecificRequiredParams, EGIParamsSubset]:
"""
Returns the dictionary of formatted keys associated with the
parameter object.
Expand Down
5 changes: 3 additions & 2 deletions icepyx/core/granules.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pprint
import re
import time
from typing import Optional
from xml.etree import ElementTree as ET
import zipfile

Expand Down Expand Up @@ -176,8 +177,8 @@ def __init__(

def get_avail(
self,
CMRparams: CMRParams | None,
reqparams: EGISpecificRequiredParams | None,
CMRparams: Optional[CMRParams],
reqparams: Optional[EGISpecificRequiredParams],
cloud=False,
):
"""
Expand Down
5 changes: 3 additions & 2 deletions icepyx/core/query.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pprint
from typing import Optional, Union

import geopandas as gpd
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -397,7 +398,7 @@ class Query(GenQuery, EarthdataAuthMixin):

_CMRparams: apifmt.CMRParameters
_reqparams: apifmt.RequiredParameters
_subsetparams: apifmt.SubsetParameters | None
_subsetparams: Optional[apifmt.SubsetParameters]

# ----------------------------------------------------------------------
# Constructors
Expand Down Expand Up @@ -605,7 +606,7 @@ def reqparams(self) -> EGISpecificRequiredParams:
# @property
# DevQuestion: if I make this a property, I get a "dict" object is not callable
# when I try to give input kwargs... what approach should I be taking?
def subsetparams(self, **kwargs) -> EGIParamsSubset | dict[Never, Never]:
def subsetparams(self, **kwargs) -> Union[EGIParamsSubset, dict[Never, Never]]:
"""
Display the subsetting key:value pairs that will be submitted.
It generates the dictionary if it does not already exist
Expand Down
8 changes: 4 additions & 4 deletions icepyx/core/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Literal, TypedDict
from typing import Literal, TypedDict, Union

from typing_extensions import NotRequired

Expand Down Expand Up @@ -48,7 +48,7 @@ class CMRParamsWithPolygon(CMRParamsBase):
polygon: str


CMRParams = CMRParamsWithBbox | CMRParamsWithPolygon
CMRParams = Union[CMRParamsWithBbox, CMRParamsWithPolygon]


class EGISpecificParamsBase(TypedDict):
Expand Down Expand Up @@ -106,6 +106,6 @@ class EGIParamsSubsetBoundingShape(EGIParamsSubsetBase):
Boundingshape: str


EGIParamsSubset = EGIParamsSubsetBbox | EGIParamsSubsetBoundingShape
EGIParamsSubset = Union[EGIParamsSubsetBbox, EGIParamsSubsetBoundingShape]

EGISpecificRequiredParams = EGISpecificParamsSearch | EGISpecificParamsDownload
EGISpecificRequiredParams = Union[EGISpecificParamsSearch, EGISpecificParamsDownload]

0 comments on commit 434c28a

Please sign in to comment.