Skip to content

Commit

Permalink
ENH: Instead of NamedTuple, use dataclass instead for simplicity, eff…
Browse files Browse the repository at this point in the history
…iciency and consistency. [skip ci]
  • Loading branch information
Taher Chegini committed Jan 20, 2024
1 parent 4c8fda9 commit da4f9ed
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pynhd/core.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Base classes for PyNHD functions."""

# pyright: reportGeneralTypeIssues=false
from __future__ import annotations

import warnings
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterator, Literal, NamedTuple, Union, cast, overload
from typing import TYPE_CHECKING, Any, Iterator, Literal, Union, cast, overload

import cytoolz.curried as tlz
import geopandas as gpd
Expand Down Expand Up @@ -53,7 +55,8 @@ def get_parquet(parquet_path: Path | str) -> Path:
return output


class ServiceInfo(NamedTuple):
@dataclass(frozen=True)
class ServiceInfo:
"""Information about a web service."""

url: str
Expand Down Expand Up @@ -513,12 +516,14 @@ def get_file_urls(item: str) -> pd.DataFrame:
return pd.DataFrame(urls, columns=["name", "url", "metadata_url"]).set_index("name")


class GCXURL(NamedTuple):
@dataclass(frozen=True)
class GCXURL:
items: str
queryables: str


class EndPoints(NamedTuple):
@dataclass(frozen=True)
class EndPoints:
name: str
description: str
url: str
Expand Down

0 comments on commit da4f9ed

Please sign in to comment.