diff --git a/docs/conf.py b/docs/conf.py index 175b12f..b33eea9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -42,7 +42,6 @@ html_static_path = ["_static"] html_theme = "sphinx_rtd_theme" -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] nitpicky = True nitpick_ignore_regex = [ diff --git a/pyproject.toml b/pyproject.toml index 9aafb9d..8be6b2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dynamic = [ "version", @@ -38,7 +39,6 @@ optional-dependencies.lint = [ "isort", "mypy", "pyproject-fmt", - "safety", "tox-ini-fmt", ] optional-dependencies.test = [ diff --git a/src/enlyze/schema.py b/src/enlyze/schema.py index ebd31a9..7c49e04 100644 --- a/src/enlyze/schema.py +++ b/src/enlyze/schema.py @@ -1,17 +1,18 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: # pragma: no cover + from _typeshed import DataclassInstance import typing from dataclasses import is_dataclass from types import UnionType -from typing import Any, Protocol import pandas -class DataclassTypeOrInstance(Protocol): - __dataclass_fields__: dict[str, Any] - - def _flat_dataclass_schema( - dataclass_obj_or_type: DataclassTypeOrInstance, + dataclass_obj_or_type: DataclassInstance | type[DataclassInstance], path_separator: str, _parent_path: list[str] = [], ) -> list[str]: @@ -42,7 +43,7 @@ def _flat_dataclass_schema( def dataframe_ensure_schema( df: pandas.DataFrame, - dataclass_obj_or_type: DataclassTypeOrInstance, + dataclass_obj_or_type: DataclassInstance | type[DataclassInstance], path_separator: str = ".", ) -> pandas.DataFrame: """Add missing columns to ``df`` based on flattened dataclass schema"""