From 12cf076118570eebbff08c6b3090e0d4798447a1 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Wed, 3 Apr 2024 03:17:55 -0400 Subject: no venv --- .../litestar/contrib/attrs/__init__.py | 3 -- .../attrs/__pycache__/__init__.cpython-311.pyc | Bin 297 -> 0 bytes .../attrs_schema_plugin.cpython-311.pyc | Bin 3570 -> 0 bytes .../litestar/contrib/attrs/attrs_schema_plugin.py | 49 --------------------- 4 files changed, 52 deletions(-) delete mode 100644 venv/lib/python3.11/site-packages/litestar/contrib/attrs/__init__.py delete mode 100644 venv/lib/python3.11/site-packages/litestar/contrib/attrs/__pycache__/__init__.cpython-311.pyc delete mode 100644 venv/lib/python3.11/site-packages/litestar/contrib/attrs/__pycache__/attrs_schema_plugin.cpython-311.pyc delete mode 100644 venv/lib/python3.11/site-packages/litestar/contrib/attrs/attrs_schema_plugin.py (limited to 'venv/lib/python3.11/site-packages/litestar/contrib/attrs') diff --git a/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__init__.py b/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__init__.py deleted file mode 100644 index ddd2a3f..0000000 --- a/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .attrs_schema_plugin import AttrsSchemaPlugin - -__all__ = ("AttrsSchemaPlugin",) diff --git a/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index a224be6..0000000 Binary files a/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__pycache__/attrs_schema_plugin.cpython-311.pyc b/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__pycache__/attrs_schema_plugin.cpython-311.pyc deleted file mode 100644 index 730252a..0000000 Binary files a/venv/lib/python3.11/site-packages/litestar/contrib/attrs/__pycache__/attrs_schema_plugin.cpython-311.pyc and /dev/null differ diff --git a/venv/lib/python3.11/site-packages/litestar/contrib/attrs/attrs_schema_plugin.py b/venv/lib/python3.11/site-packages/litestar/contrib/attrs/attrs_schema_plugin.py deleted file mode 100644 index cf67fe4..0000000 --- a/venv/lib/python3.11/site-packages/litestar/contrib/attrs/attrs_schema_plugin.py +++ /dev/null @@ -1,49 +0,0 @@ -from __future__ import annotations - -from typing import TYPE_CHECKING, Any - -from litestar.exceptions import MissingDependencyException -from litestar.plugins import OpenAPISchemaPluginProtocol -from litestar.typing import FieldDefinition -from litestar.utils import is_attrs_class, is_optional_union - -try: - import attr - import attrs -except ImportError as e: - raise MissingDependencyException("attrs") from e - -if TYPE_CHECKING: - from litestar._openapi.schema_generation import SchemaCreator - from litestar.openapi.spec import Schema - - -class AttrsSchemaPlugin(OpenAPISchemaPluginProtocol): - @staticmethod - def is_plugin_supported_type(value: Any) -> bool: - return is_attrs_class(value) or is_attrs_class(type(value)) - - def to_openapi_schema(self, field_definition: FieldDefinition, schema_creator: SchemaCreator) -> Schema: - """Given a type annotation, transform it into an OpenAPI schema class. - - Args: - field_definition: FieldDefinition instance. - schema_creator: An instance of the schema creator class - - Returns: - An :class:`OpenAPI ` instance. - """ - - type_hints = field_definition.get_type_hints(include_extras=True, resolve_generics=True) - attr_fields = attr.fields_dict(field_definition.type_) - return schema_creator.create_component_schema( - field_definition, - required=sorted( - field_name - for field_name, attribute in attr_fields.items() - if attribute.default is attrs.NOTHING and not is_optional_union(type_hints[field_name]) - ), - property_fields={ - field_name: FieldDefinition.from_kwarg(type_hints[field_name], field_name) for field_name in attr_fields - }, - ) -- cgit v1.2.3