Browse Source

🎨 Remove un-used imports, add auto-flake

pull/11/head
Sebastián Ramírez 6 years ago
parent
commit
d9fbead646
  1. 10
      fastapi/dependencies/models.py
  2. 1
      fastapi/openapi/models.py
  3. 4
      fastapi/openapi/utils.py
  4. 5
      scripts/lint.sh
  5. 5
      tests/main.py
  6. 1
      tests/test_security.py

10
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)

1
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(

4
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 = {

5
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

5
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

1
tests/test_security.py

@ -1,4 +1,3 @@
import pytest
from starlette.testclient import TestClient
from .main import app

Loading…
Cancel
Save