Skip to content

Commit

Permalink
fix linting minors
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Jun 11, 2020
1 parent b0a7f04 commit 2b1776f
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 80 deletions.
4 changes: 3 additions & 1 deletion docs/blueprints/djstripe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from djstripe.contrib.rest_framework.serializers import CreateSubscriptionSerializer, SubscriptionSerializer
from djstripe.contrib.rest_framework.serializers import (
CreateSubscriptionSerializer, SubscriptionSerializer
)

from drf_spectacular.extensions import OpenApiViewExtension
from drf_spectacular.utils import extend_schema
Expand Down
5 changes: 3 additions & 2 deletions docs/blueprints/oscarapi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

from rest_framework import serializers

from drf_spectacular.extensions import OpenApiSerializerExtension, OpenApiSerializerFieldExtension, OpenApiViewExtension
from drf_spectacular.extensions import (
OpenApiSerializerExtension, OpenApiSerializerFieldExtension, OpenApiViewExtension
)
from drf_spectacular.plumbing import build_basic_type
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, extend_schema, extend_schema_field
Expand Down
11 changes: 2 additions & 9 deletions drf_spectacular/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@

from drf_spectacular.extensions import OpenApiViewExtension
from drf_spectacular.plumbing import (
ComponentRegistry,
alpha_operation_sorter,
build_root_object,
error,
is_versioning_supported,
modify_for_versioning,
operation_matches_version,
reset_generator_stats,
warn,
ComponentRegistry, alpha_operation_sorter, build_root_object, error, is_versioning_supported,
modify_for_versioning, operation_matches_version, reset_generator_stats, warn,
)
from drf_spectacular.settings import spectacular_settings

Expand Down
24 changes: 4 additions & 20 deletions drf_spectacular/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,10 @@
from drf_spectacular.contrib import * # noqa: F403, F401
from drf_spectacular.extensions import OpenApiSerializerExtension, OpenApiSerializerFieldExtension
from drf_spectacular.plumbing import (
ComponentRegistry,
ResolvedComponent,
anyisinstance,
append_meta,
build_array_type,
build_basic_type,
build_choice_field,
build_object_type,
build_parameter_type,
error,
follow_field_source,
force_instance,
get_override,
has_override,
is_basic_type,
is_field,
is_serializer,
resolve_regex_path_parameter,
safe_ref,
warn,
ComponentRegistry, ResolvedComponent, anyisinstance, append_meta, build_array_type,
build_basic_type, build_choice_field, build_object_type, build_parameter_type, error,
follow_field_source, force_instance, get_override, has_override, is_basic_type, is_field,
is_serializer, resolve_regex_path_parameter, safe_ref, warn,
)
from drf_spectacular.settings import spectacular_settings
from drf_spectacular.types import OpenApiTypes
Expand Down
4 changes: 3 additions & 1 deletion drf_spectacular/plumbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
from uritemplate import URITemplate

from drf_spectacular.settings import spectacular_settings
from drf_spectacular.types import DJANGO_PATH_CONVERTER_MAPPING, OPENAPI_TYPE_MAPPING, PYTHON_TYPE_MAPPING, OpenApiTypes
from drf_spectacular.types import (
DJANGO_PATH_CONVERTER_MAPPING, OPENAPI_TYPE_MAPPING, PYTHON_TYPE_MAPPING, OpenApiTypes,
)
from drf_spectacular.utils import OpenApiParameter

try:
Expand Down
5 changes: 1 addition & 4 deletions drf_spectacular/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
from rest_framework.views import APIView

from drf_spectacular.renderers import (
OpenApiJsonRenderer,
OpenApiJsonRenderer2,
OpenApiYamlRenderer,
OpenApiYamlRenderer2,
OpenApiJsonRenderer, OpenApiJsonRenderer2, OpenApiYamlRenderer, OpenApiYamlRenderer2,
)
from drf_spectacular.settings import spectacular_settings
from drf_spectacular.types import OpenApiTypes
Expand Down
7 changes: 0 additions & 7 deletions pyproject.toml

This file was deleted.

3 changes: 1 addition & 2 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ pytest-cov>=2.8.1
flake8>=3.7.9
mypy>=0.770
djangorestframework-stubs>=1.1.0
isort>=4.3.21
toml>=0.10.1
isort>=4.3.21
2 changes: 1 addition & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ def is_class(string):
exit_on_failure(pytest.main(pytest_args))
if run_lint:
exit_on_failure(flake8_main(FLAKE8_ARGS))
exit_on_failure(mypy_main(MYPY_ARGS))
exit_on_failure(isort_main(ISORT_ARGS))
exit_on_failure(mypy_main(MYPY_ARGS))
4 changes: 1 addition & 3 deletions tests/contrib/test_oauth_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

from django.urls import include, path
from oauth2_provider.contrib.rest_framework import (
IsAuthenticatedOrTokenHasScope,
OAuth2Authentication,
TokenHasReadWriteScope,
IsAuthenticatedOrTokenHasScope, OAuth2Authentication, TokenHasReadWriteScope,
TokenHasResourceScope,
)
from rest_framework import mixins, routers, serializers, viewsets
Expand Down
81 changes: 51 additions & 30 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,35 @@ envlist =
{py36,py37,py38}-djmaster
skip_missing_interpreters = true

[testenv]
commands = ./runtests.py {posargs:--fast --cov=drf_spectacular --cov=tests}
setenv =
PYTHONDONTWRITEBYTECODE=1
passenv =
CI TRAVIS TRAVIS_*
deps =
django2.2: Django==2.2
django3.0: Django==3.0

drf3.10: djangorestframework==3.10
drf3.11: djangorestframework==3.11

djmaster: https://github.com/django/django/archive/master.tar.gz
djmaster: https://github.com/encode/django-rest-framework/archive/master.tar.gz

-r requirements/testing.txt
-r requirements/optionals.txt

[testenv:lint]
commands = ./runtests.py --lintonly
deps =
-r requirements/testing.txt

[testenv:docs]
commands = sphinx-build -WEa -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html
deps =
-r requirements/docs.txt

[coverage:report]
precision = 2
exclude_lines =
Expand All @@ -18,6 +47,27 @@ ignore =
W503 # line break before binary operator
max-line-length = 120

[isort]
skip = .eggs,.tox,docs,env,venv
line_length = 100
known_first_party = drf_spectacular,tests
known_third_party =
django
rest_framework
uritemplate
yaml
jsonschema
inflection
rest_framework_simplejwt
rest_polymorphic
rest_framework_jwt
polymorphic
oauth2_provider
djstripe
multi_line_output = 5
use_parentheses = true
include_trailing_comma = true

[mypy]
python_version = 3.6

Expand All @@ -43,33 +93,4 @@ ignore_missing_imports = True
ignore_missing_imports = True

[mypy-djangorestframework_camel_case.util.*]
ignore_missing_imports = True

[testenv]
commands = ./runtests.py {posargs:--fast --cov=drf_spectacular --cov=tests}
setenv =
PYTHONDONTWRITEBYTECODE=1
passenv =
CI TRAVIS TRAVIS_*
deps =
django2.2: Django==2.2
django3.0: Django==3.0

drf3.10: djangorestframework==3.10
drf3.11: djangorestframework==3.11

djmaster: https://github.com/django/django/archive/master.tar.gz
djmaster: https://github.com/encode/django-rest-framework/archive/master.tar.gz

-r requirements/testing.txt
-r requirements/optionals.txt

[testenv:lint]
commands = ./runtests.py --lintonly
deps =
-r requirements/testing.txt

[testenv:docs]
commands = sphinx-build -WEa -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html
deps =
-r requirements/docs.txt
ignore_missing_imports = True

0 comments on commit 2b1776f

Please sign in to comment.