Skip to content

Commit

Permalink
MNT: Remove individual imports of exceptions from the high-level API …
Browse files Browse the repository at this point in the history
…and add exceptions modules instead. [skip ci]
  • Loading branch information
Taher Chegini committed Oct 6, 2024
1 parent aa3bb3c commit c748099
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 20 deletions.
12 changes: 0 additions & 12 deletions src/pydaymet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

from pydaymet import exceptions
from pydaymet.core import Daymet, separate_snow
from pydaymet.exceptions import (
InputRangeError,
InputTypeError,
InputValueError,
MissingCRSError,
MissingItemError,
)
from pydaymet.pet import potential_et
from pydaymet.print_versions import show_versions
from pydaymet.pydaymet import get_bycoords, get_bygeom, get_bystac
Expand All @@ -30,11 +23,6 @@
"get_bystac",
"potential_et",
"show_versions",
"InputRangeError",
"InputTypeError",
"InputValueError",
"MissingItemError",
"MissingCRSError",
"exceptions",
"__version__",
]
4 changes: 3 additions & 1 deletion src/pydaymet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import itertools
from pathlib import Path
from typing import TYPE_CHECKING, Iterable, Literal, TypeVar
from typing import TYPE_CHECKING, Literal, TypeVar

import click
import geopandas as gpd
Expand All @@ -21,6 +21,8 @@
)

if TYPE_CHECKING:
from collections.abc import Iterable

from shapely import MultiPolygon, Point, Polygon

DFType = TypeVar("DFType", pd.DataFrame, gpd.GeoDataFrame)
Expand Down
4 changes: 3 additions & 1 deletion src/pydaymet/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import warnings
from dataclasses import dataclass
from datetime import datetime
from typing import TYPE_CHECKING, Any, Callable, Iterable, TypeVar
from typing import TYPE_CHECKING, Any, Callable, TypeVar

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -46,6 +46,8 @@ def wrapper_decorator(*args: tuple[Any, ...], **kwargs: dict[str, Any]) -> T:


if TYPE_CHECKING:
from collections.abc import Iterable

DF = TypeVar("DF", pd.DataFrame, xr.Dataset)

DATE_FMT = "%Y-%m-%d"
Expand Down
5 changes: 4 additions & 1 deletion src/pydaymet/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from __future__ import annotations

from typing import Generator, Sequence
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from collections.abc import Generator, Sequence


class MissingDependencyError(ImportError):
Expand Down
4 changes: 1 addition & 3 deletions src/pydaymet/pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
# pyright: reportReturnType=false,reportArgumentType=false
from __future__ import annotations

from collections.abc import Hashable, Iterable, KeysView
from dataclasses import dataclass, fields
from typing import (
TYPE_CHECKING,
Hashable,
Iterable,
KeysView,
Literal,
TypeVar,
Union,
Expand Down
6 changes: 4 additions & 2 deletions src/pydaymet/pydaymet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io
import itertools
import re
from typing import TYPE_CHECKING, Callable, Generator, Iterable, Literal, Sequence, Union, cast
from typing import TYPE_CHECKING, Callable, Literal, Union, cast

import numpy as np
import pandas as pd
Expand All @@ -19,10 +19,12 @@
from pydaymet.core import T_RAIN, T_SNOW, Daymet, separate_snow
from pydaymet.exceptions import InputRangeError, InputTypeError, MissingDependencyError
from pydaymet.pet import potential_et
from pygeoogc import ServiceError, ServiceURL
from pygeoogc import ServiceURL
from pygeoogc.exceptions import ServiceError
from pygeoutils import Coordinates

if TYPE_CHECKING:
from collections.abc import Generator, Iterable, Sequence
from pathlib import Path

import pyproj
Expand Down

0 comments on commit c748099

Please sign in to comment.