Pandaaaa906

Untitled

Sep 22nd, 2021
563
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from typing import Optional, List, Type, Sequence, Dict, Union, Any, Callable
  2.  
  3. from bottle import Response
  4. from fastapi import FastAPI, APIRouter, params, routing
  5. from fastapi.datastructures import Default
  6. from fastapi.routing import APIRoute
  7. from starlette.responses import JSONResponse
  8. from starlette.routing import BaseRoute
  9. from starlette.types import ASGIApp
  10.  
  11. app = FastAPI()
  12. router = APIRouter()
  13.  
  14. class ClassBaseViewBase:
  15.     prefix: str = ""
  16.     tags: Optional[List[str]] = None
  17.     dependencies: Optional[Sequence[params.Depends]] = None
  18.     default_response_class: Type[Response] = Default(JSONResponse)
  19.     responses: Optional[Dict[Union[int, str], Dict[str, Any]]] = None
  20.     callbacks: Optional[List[BaseRoute]] = None
  21.     routes: Optional[List[routing.BaseRoute]] = None
  22.     redirect_slashes: bool = True
  23.     default: Optional[ASGIApp] = None
  24.     dependency_overrides_provider: Optional[Any] = None
  25.     route_class: Type[APIRoute] = APIRoute
  26.     on_startup: Optional[Sequence[Callable[[], Any]]] = None
  27.     on_shutdown: Optional[Sequence[Callable[[], Any]]] = None
  28.     deprecated: Optional[bool] = None
  29.     include_in_schema: bool = True
  30.  
  31.  
  32. class ClassBaseViewMeta(type):
  33.     def __new__(mcs, name, bases, attrs):
  34.         return super().__new__(mcs, name, bases, attrs)
  35.  
  36. class ClassBaseView(ClassBaseViewBase, metaclass=ClassBaseViewMeta):
  37.     pass
  38.  
  39.  
  40.  
  41. if __name__ == '__main__':
  42.     pass
RAW Paste Data