diff --git a/aiopenapi3/models/epoch.py b/aiopenapi3/models/epoch.py deleted file mode 100644 index 1be54f4c..00000000 --- a/aiopenapi3/models/epoch.py +++ /dev/null @@ -1,63 +0,0 @@ -from __future__ import annotations - -import datetime -from typing import Any -from collections.abc import Callable - -import pydantic_core.core_schema -from pydantic import GetJsonSchemaHandler -from pydantic.json_schema import JsonSchemaValue -from pydantic_core import CoreSchema, core_schema - -EPOCH = datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc) - - -class _Base(datetime.datetime): - TYPE: str = "" - SCHEMA: pydantic_core.core_schema.CoreSchema - - @classmethod - def __get_pydantic_json_schema__( - cls, core_schema: core_schema.CoreSchema, handler: GetJsonSchemaHandler - ) -> JsonSchemaValue: - field_schema: dict[str, Any] = {} - field_schema.update(type=cls.TYPE, format="date-time") - return field_schema - - @classmethod - def __get_pydantic_core_schema__( - cls, source: type[Any], handler: Callable[[Any], CoreSchema] - ) -> core_schema.CoreSchema: - return core_schema.with_info_after_validator_function( - cls._validate, - cls.SCHEMA, - serialization=core_schema.wrap_serializer_function_ser_schema(cls._f, return_schema=cls.SCHEMA), - ) - - @classmethod - def _validate(cls, __input_value: Any, _: Any) -> datetime.datetime: - return EPOCH + datetime.timedelta(seconds=__input_value) - - @classmethod - def _f(cls, value: Any, serializer: Callable[[Any], Any]) -> Any: # pragma: no cover - raise NotImplementedError(cls) - - -class Number(_Base): - TYPE = "number" - SCHEMA = core_schema.float_schema() - - @classmethod - def _f(cls, value: Any, serializer: Callable[[float], float]) -> float: - ts = value.timestamp() - return serializer(ts) - - -class Integer(_Base): - TYPE = "integer" - SCHEMA = core_schema.int_schema() - - @classmethod - def _f(cls, value: Any, serializer: Callable[[int], int]) -> int: - ts = value.timestamp() - return serializer(int(ts)) diff --git a/pyproject.toml b/pyproject.toml index 09d09888..7757d221 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,17 +64,14 @@ requires = ["setuptools>=61", "wheel"] build-backend = "setuptools.build_meta" [tool.setuptools] -packages = [ - "aiopenapi3", - "aiopenapi3.v20", - "aiopenapi3.v30", - "aiopenapi3.v31", - "aiopenapi3.extra" -] - # https://github.com/astral-sh/uv/issues/9513#issuecomment-2519527822 license-files = [] +[tool.setuptools.packages.find] +where = ["src"] +include = ["aiopenapi3*"] +namespaces = false + [tool.setuptools.dynamic] version = {attr = "aiopenapi3.version.__version__"} diff --git a/aiopenapi3/__init__.py b/src/aiopenapi3/__init__.py similarity index 100% rename from aiopenapi3/__init__.py rename to src/aiopenapi3/__init__.py diff --git a/aiopenapi3/__main__.py b/src/aiopenapi3/__main__.py similarity index 100% rename from aiopenapi3/__main__.py rename to src/aiopenapi3/__main__.py diff --git a/aiopenapi3/_types.py b/src/aiopenapi3/_types.py similarity index 100% rename from aiopenapi3/_types.py rename to src/aiopenapi3/_types.py diff --git a/aiopenapi3/base.py b/src/aiopenapi3/base.py similarity index 100% rename from aiopenapi3/base.py rename to src/aiopenapi3/base.py diff --git a/aiopenapi3/cli.py b/src/aiopenapi3/cli.py similarity index 100% rename from aiopenapi3/cli.py rename to src/aiopenapi3/cli.py diff --git a/aiopenapi3/debug.py b/src/aiopenapi3/debug.py similarity index 100% rename from aiopenapi3/debug.py rename to src/aiopenapi3/debug.py diff --git a/aiopenapi3/errors.py b/src/aiopenapi3/errors.py similarity index 100% rename from aiopenapi3/errors.py rename to src/aiopenapi3/errors.py diff --git a/aiopenapi3/extra/__init__.py b/src/aiopenapi3/extra/__init__.py similarity index 100% rename from aiopenapi3/extra/__init__.py rename to src/aiopenapi3/extra/__init__.py diff --git a/aiopenapi3/extra/cookies.py b/src/aiopenapi3/extra/cookies.py similarity index 100% rename from aiopenapi3/extra/cookies.py rename to src/aiopenapi3/extra/cookies.py diff --git a/aiopenapi3/extra/reduce.py b/src/aiopenapi3/extra/reduce.py similarity index 100% rename from aiopenapi3/extra/reduce.py rename to src/aiopenapi3/extra/reduce.py diff --git a/aiopenapi3/json.py b/src/aiopenapi3/json.py similarity index 100% rename from aiopenapi3/json.py rename to src/aiopenapi3/json.py diff --git a/aiopenapi3/loader.py b/src/aiopenapi3/loader.py similarity index 100% rename from aiopenapi3/loader.py rename to src/aiopenapi3/loader.py diff --git a/aiopenapi3/log.py b/src/aiopenapi3/log.py similarity index 100% rename from aiopenapi3/log.py rename to src/aiopenapi3/log.py diff --git a/aiopenapi3/me.py b/src/aiopenapi3/me.py similarity index 100% rename from aiopenapi3/me.py rename to src/aiopenapi3/me.py diff --git a/aiopenapi3/model.py b/src/aiopenapi3/model.py similarity index 100% rename from aiopenapi3/model.py rename to src/aiopenapi3/model.py diff --git a/aiopenapi3/openapi.py b/src/aiopenapi3/openapi.py similarity index 100% rename from aiopenapi3/openapi.py rename to src/aiopenapi3/openapi.py diff --git a/aiopenapi3/plugin.py b/src/aiopenapi3/plugin.py similarity index 100% rename from aiopenapi3/plugin.py rename to src/aiopenapi3/plugin.py diff --git a/aiopenapi3/pydanticv2.py b/src/aiopenapi3/pydanticv2.py similarity index 100% rename from aiopenapi3/pydanticv2.py rename to src/aiopenapi3/pydanticv2.py diff --git a/aiopenapi3/request.py b/src/aiopenapi3/request.py similarity index 100% rename from aiopenapi3/request.py rename to src/aiopenapi3/request.py diff --git a/aiopenapi3/v20/__init__.py b/src/aiopenapi3/v20/__init__.py similarity index 100% rename from aiopenapi3/v20/__init__.py rename to src/aiopenapi3/v20/__init__.py diff --git a/aiopenapi3/v20/general.py b/src/aiopenapi3/v20/general.py similarity index 100% rename from aiopenapi3/v20/general.py rename to src/aiopenapi3/v20/general.py diff --git a/aiopenapi3/v20/glue.py b/src/aiopenapi3/v20/glue.py similarity index 100% rename from aiopenapi3/v20/glue.py rename to src/aiopenapi3/v20/glue.py diff --git a/aiopenapi3/v20/info.py b/src/aiopenapi3/v20/info.py similarity index 100% rename from aiopenapi3/v20/info.py rename to src/aiopenapi3/v20/info.py diff --git a/aiopenapi3/v20/parameter.py b/src/aiopenapi3/v20/parameter.py similarity index 100% rename from aiopenapi3/v20/parameter.py rename to src/aiopenapi3/v20/parameter.py diff --git a/aiopenapi3/v20/paths.py b/src/aiopenapi3/v20/paths.py similarity index 100% rename from aiopenapi3/v20/paths.py rename to src/aiopenapi3/v20/paths.py diff --git a/aiopenapi3/v20/root.py b/src/aiopenapi3/v20/root.py similarity index 100% rename from aiopenapi3/v20/root.py rename to src/aiopenapi3/v20/root.py diff --git a/aiopenapi3/v20/schemas.py b/src/aiopenapi3/v20/schemas.py similarity index 100% rename from aiopenapi3/v20/schemas.py rename to src/aiopenapi3/v20/schemas.py diff --git a/aiopenapi3/v20/security.py b/src/aiopenapi3/v20/security.py similarity index 100% rename from aiopenapi3/v20/security.py rename to src/aiopenapi3/v20/security.py diff --git a/aiopenapi3/v20/tag.py b/src/aiopenapi3/v20/tag.py similarity index 100% rename from aiopenapi3/v20/tag.py rename to src/aiopenapi3/v20/tag.py diff --git a/aiopenapi3/v20/xml.py b/src/aiopenapi3/v20/xml.py similarity index 100% rename from aiopenapi3/v20/xml.py rename to src/aiopenapi3/v20/xml.py diff --git a/aiopenapi3/v30/__init__.py b/src/aiopenapi3/v30/__init__.py similarity index 100% rename from aiopenapi3/v30/__init__.py rename to src/aiopenapi3/v30/__init__.py diff --git a/aiopenapi3/v30/components.py b/src/aiopenapi3/v30/components.py similarity index 100% rename from aiopenapi3/v30/components.py rename to src/aiopenapi3/v30/components.py diff --git a/aiopenapi3/v30/example.py b/src/aiopenapi3/v30/example.py similarity index 100% rename from aiopenapi3/v30/example.py rename to src/aiopenapi3/v30/example.py diff --git a/aiopenapi3/v30/formdata.py b/src/aiopenapi3/v30/formdata.py similarity index 100% rename from aiopenapi3/v30/formdata.py rename to src/aiopenapi3/v30/formdata.py diff --git a/aiopenapi3/v30/general.py b/src/aiopenapi3/v30/general.py similarity index 100% rename from aiopenapi3/v30/general.py rename to src/aiopenapi3/v30/general.py diff --git a/aiopenapi3/v30/glue.py b/src/aiopenapi3/v30/glue.py similarity index 100% rename from aiopenapi3/v30/glue.py rename to src/aiopenapi3/v30/glue.py diff --git a/aiopenapi3/v30/info.py b/src/aiopenapi3/v30/info.py similarity index 100% rename from aiopenapi3/v30/info.py rename to src/aiopenapi3/v30/info.py diff --git a/aiopenapi3/v30/media.py b/src/aiopenapi3/v30/media.py similarity index 100% rename from aiopenapi3/v30/media.py rename to src/aiopenapi3/v30/media.py diff --git a/aiopenapi3/v30/parameter.py b/src/aiopenapi3/v30/parameter.py similarity index 100% rename from aiopenapi3/v30/parameter.py rename to src/aiopenapi3/v30/parameter.py diff --git a/aiopenapi3/v30/paths.py b/src/aiopenapi3/v30/paths.py similarity index 100% rename from aiopenapi3/v30/paths.py rename to src/aiopenapi3/v30/paths.py diff --git a/aiopenapi3/v30/root.py b/src/aiopenapi3/v30/root.py similarity index 100% rename from aiopenapi3/v30/root.py rename to src/aiopenapi3/v30/root.py diff --git a/aiopenapi3/v30/schemas.py b/src/aiopenapi3/v30/schemas.py similarity index 100% rename from aiopenapi3/v30/schemas.py rename to src/aiopenapi3/v30/schemas.py diff --git a/aiopenapi3/v30/security.py b/src/aiopenapi3/v30/security.py similarity index 100% rename from aiopenapi3/v30/security.py rename to src/aiopenapi3/v30/security.py diff --git a/aiopenapi3/v30/servers.py b/src/aiopenapi3/v30/servers.py similarity index 100% rename from aiopenapi3/v30/servers.py rename to src/aiopenapi3/v30/servers.py diff --git a/aiopenapi3/v30/tag.py b/src/aiopenapi3/v30/tag.py similarity index 100% rename from aiopenapi3/v30/tag.py rename to src/aiopenapi3/v30/tag.py diff --git a/aiopenapi3/v30/xml.py b/src/aiopenapi3/v30/xml.py similarity index 100% rename from aiopenapi3/v30/xml.py rename to src/aiopenapi3/v30/xml.py diff --git a/aiopenapi3/v31/__init__.py b/src/aiopenapi3/v31/__init__.py similarity index 100% rename from aiopenapi3/v31/__init__.py rename to src/aiopenapi3/v31/__init__.py diff --git a/aiopenapi3/v31/components.py b/src/aiopenapi3/v31/components.py similarity index 100% rename from aiopenapi3/v31/components.py rename to src/aiopenapi3/v31/components.py diff --git a/aiopenapi3/v31/example.py b/src/aiopenapi3/v31/example.py similarity index 100% rename from aiopenapi3/v31/example.py rename to src/aiopenapi3/v31/example.py diff --git a/aiopenapi3/v31/general.py b/src/aiopenapi3/v31/general.py similarity index 100% rename from aiopenapi3/v31/general.py rename to src/aiopenapi3/v31/general.py diff --git a/aiopenapi3/v31/info.py b/src/aiopenapi3/v31/info.py similarity index 100% rename from aiopenapi3/v31/info.py rename to src/aiopenapi3/v31/info.py diff --git a/aiopenapi3/v31/media.py b/src/aiopenapi3/v31/media.py similarity index 100% rename from aiopenapi3/v31/media.py rename to src/aiopenapi3/v31/media.py diff --git a/aiopenapi3/v31/parameter.py b/src/aiopenapi3/v31/parameter.py similarity index 100% rename from aiopenapi3/v31/parameter.py rename to src/aiopenapi3/v31/parameter.py diff --git a/aiopenapi3/v31/paths.py b/src/aiopenapi3/v31/paths.py similarity index 100% rename from aiopenapi3/v31/paths.py rename to src/aiopenapi3/v31/paths.py diff --git a/aiopenapi3/v31/root.py b/src/aiopenapi3/v31/root.py similarity index 100% rename from aiopenapi3/v31/root.py rename to src/aiopenapi3/v31/root.py diff --git a/aiopenapi3/v31/schemas.py b/src/aiopenapi3/v31/schemas.py similarity index 100% rename from aiopenapi3/v31/schemas.py rename to src/aiopenapi3/v31/schemas.py diff --git a/aiopenapi3/v31/security.py b/src/aiopenapi3/v31/security.py similarity index 100% rename from aiopenapi3/v31/security.py rename to src/aiopenapi3/v31/security.py diff --git a/aiopenapi3/v31/servers.py b/src/aiopenapi3/v31/servers.py similarity index 100% rename from aiopenapi3/v31/servers.py rename to src/aiopenapi3/v31/servers.py diff --git a/aiopenapi3/v31/tag.py b/src/aiopenapi3/v31/tag.py similarity index 100% rename from aiopenapi3/v31/tag.py rename to src/aiopenapi3/v31/tag.py diff --git a/aiopenapi3/v31/xml.py b/src/aiopenapi3/v31/xml.py similarity index 100% rename from aiopenapi3/v31/xml.py rename to src/aiopenapi3/v31/xml.py diff --git a/aiopenapi3/version.py b/src/aiopenapi3/version.py similarity index 100% rename from aiopenapi3/version.py rename to src/aiopenapi3/version.py