diff --git a/fastapi/dependencies/models.py b/fastapi/dependencies/models.py index da5d9b72d..748fe4a9e 100644 --- a/fastapi/dependencies/models.py +++ b/fastapi/dependencies/models.py @@ -1,13 +1,7 @@ -from typing import Any, Callable, Dict, List, Sequence, Tuple +from typing import Callable, List, Sequence from fastapi.security.base import SecurityBase -from pydantic import BaseConfig, Schema -from pydantic.error_wrappers import ErrorWrapper -from pydantic.errors import MissingError -from pydantic.fields import Field, Required -from pydantic.schema import get_annotation_from_schema -from starlette.concurrency import run_in_threadpool -from starlette.requests import Request +from pydantic.fields import Field param_supported_types = (str, int, float, bool) diff --git a/fastapi/openapi/models.py b/fastapi/openapi/models.py index 7cdee02a4..e3b13da71 100644 --- a/fastapi/openapi/models.py +++ b/fastapi/openapi/models.py @@ -6,7 +6,6 @@ from pydantic import BaseModel, Schema as PSchema from pydantic.types import UrlStr try: - import email_validator from pydantic.types import EmailStr # type: ignore except ImportError: logging.warning( diff --git a/fastapi/openapi/utils.py b/fastapi/openapi/utils.py index 6f490a5d0..0f0a03624 100644 --- a/fastapi/openapi/utils.py +++ b/fastapi/openapi/utils.py @@ -11,8 +11,8 @@ from fastapi.utils import get_flat_models_from_routes, get_model_definitions from pydantic.fields import Field from pydantic.schema import Schema, field_schema, get_model_name_map from pydantic.utils import lenient_issubclass -from starlette.responses import HTMLResponse, JSONResponse -from starlette.routing import BaseRoute, Route +from starlette.responses import JSONResponse +from starlette.routing import BaseRoute from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY validation_error_definition = { diff --git a/scripts/lint.sh b/scripts/lint.sh index 8f71ee4a6..90a3df995 100644 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,5 +1,6 @@ #!/bin/sh -e set -x -black fastapi tests -isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --combine-as --line-width 88 --recursive --apply fastapi tests +autoflake --remove-all-unused-imports --recursive --remove-unused-variables --in-place docs/tutorial/src/ fastapi tests --exclude=__init__.py +black fastapi tests docs/tutorial/src +isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --combine-as --line-width 88 --recursive --apply fastapi tests docs/tutorial/src diff --git a/tests/main.py b/tests/main.py index 23f06dff3..468f4c764 100644 --- a/tests/main.py +++ b/tests/main.py @@ -1,6 +1,3 @@ -from typing import Optional - -import fastapi from fastapi import ( Body, Cookie, @@ -20,10 +17,8 @@ from fastapi.security import ( OAuth2PasswordRequestForm, ) from pydantic import BaseModel -from starlette.exceptions import HTTPException from starlette.responses import HTMLResponse, JSONResponse, PlainTextResponse from starlette.status import HTTP_202_ACCEPTED -from starlette.testclient import TestClient from .endpoints.a import router as router_a from .endpoints.b import router as router_b diff --git a/tests/test_security.py b/tests/test_security.py index 25ec0c51f..672a8460f 100644 --- a/tests/test_security.py +++ b/tests/test_security.py @@ -1,4 +1,3 @@ -import pytest from starlette.testclient import TestClient from .main import app