mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-09 20:37:46 +00:00
Adopt isort to ensure better code quality
This commit is contained in:
@@ -11,20 +11,21 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
language governing permissions and limitations under the License.
|
||||
"""
|
||||
|
||||
import flask
|
||||
import jinja2
|
||||
import json
|
||||
import logging
|
||||
import pathlib
|
||||
import six
|
||||
import sys
|
||||
|
||||
import flask
|
||||
import jinja2
|
||||
import six
|
||||
import werkzeug.exceptions
|
||||
import yaml
|
||||
from swagger_spec_validator.validator20 import validate_spec
|
||||
from .operation import Operation
|
||||
from . import utils
|
||||
from . import resolver
|
||||
|
||||
from . import resolver, utils
|
||||
from .handlers import AuthErrorHandler
|
||||
from .operation import Operation
|
||||
|
||||
MODULE_PATH = pathlib.Path(__file__).absolute().parent
|
||||
SWAGGER_UI_PATH = MODULE_PATH / 'vendor' / 'swagger-ui'
|
||||
|
||||
@@ -13,12 +13,14 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
|
||||
import logging
|
||||
import pathlib
|
||||
|
||||
import flask
|
||||
import werkzeug.exceptions
|
||||
from .problem import problem
|
||||
from .api import Api
|
||||
from connexion.resolver import Resolver
|
||||
from connexion.decorators.produces import JSONEncoder as ConnexionJSONEncoder
|
||||
from connexion.resolver import Resolver
|
||||
|
||||
from .api import Api
|
||||
from .problem import problem
|
||||
|
||||
logger = logging.getLogger('connexion.app')
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
language governing permissions and limitations under the License.
|
||||
"""
|
||||
import logging
|
||||
|
||||
import flask
|
||||
|
||||
from ..utils import is_flask_response
|
||||
|
||||
logger = logging.getLogger('connexion.decorators.decorator')
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import werkzeug.exceptions as exceptions
|
||||
import copy
|
||||
import flask
|
||||
import functools
|
||||
import inspect
|
||||
import logging
|
||||
import six
|
||||
|
||||
from ..utils import boolean, is_nullable, is_null
|
||||
import flask
|
||||
import six
|
||||
import werkzeug.exceptions as exceptions
|
||||
|
||||
from ..utils import boolean, is_null, is_nullable
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -13,12 +13,14 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
|
||||
# Decorators to change the return type of endpoints
|
||||
import datetime
|
||||
import flask
|
||||
from flask import json
|
||||
import functools
|
||||
import logging
|
||||
from .decorator import BaseDecorator
|
||||
|
||||
import flask
|
||||
from flask import json
|
||||
|
||||
from ..utils import is_flask_response
|
||||
from .decorator import BaseDecorator
|
||||
|
||||
logger = logging.getLogger('connexion.decorators.produces')
|
||||
|
||||
|
||||
@@ -12,16 +12,17 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
"""
|
||||
|
||||
# Decorators to change the return type of endpoints
|
||||
from flask import json
|
||||
import functools
|
||||
import logging
|
||||
from ..exceptions import NonConformingResponseBody, NonConformingResponseHeaders
|
||||
from ..problem import problem
|
||||
from ..utils import produces_json
|
||||
from .validation import ResponseBodyValidator
|
||||
from .decorator import BaseDecorator
|
||||
|
||||
from flask import json
|
||||
from jsonschema import ValidationError
|
||||
|
||||
from ..exceptions import (NonConformingResponseBody,
|
||||
NonConformingResponseHeaders)
|
||||
from ..problem import problem
|
||||
from .decorator import BaseDecorator
|
||||
from .validation import ResponseBodyValidator
|
||||
|
||||
logger = logging.getLogger('connexion.decorators.response')
|
||||
|
||||
|
||||
@@ -13,11 +13,13 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
|
||||
# Authentication and authorization related decorators
|
||||
|
||||
from flask import request
|
||||
import functools
|
||||
import logging
|
||||
import os
|
||||
|
||||
import requests
|
||||
from flask import request
|
||||
|
||||
from ..problem import problem
|
||||
|
||||
logger = logging.getLogger('connexion.api.security')
|
||||
|
||||
@@ -12,17 +12,19 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
"""
|
||||
|
||||
import copy
|
||||
import flask
|
||||
import functools
|
||||
import itertools
|
||||
import logging
|
||||
import six
|
||||
import sys
|
||||
from jsonschema import draft4_format_checker, validate, Draft4Validator, ValidationError
|
||||
|
||||
import flask
|
||||
import six
|
||||
from jsonschema import (Draft4Validator, ValidationError,
|
||||
draft4_format_checker, validate)
|
||||
from werkzeug import FileStorage
|
||||
|
||||
from ..problem import problem
|
||||
from ..utils import boolean, is_nullable, is_null
|
||||
from ..utils import boolean, is_null, is_nullable
|
||||
|
||||
logger = logging.getLogger('connexion.decorators.validation')
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
from .operation import SecureOperation
|
||||
from .problem import problem
|
||||
|
||||
|
||||
@@ -11,21 +11,23 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
language governing permissions and limitations under the License.
|
||||
"""
|
||||
|
||||
from copy import deepcopy
|
||||
import functools
|
||||
import logging
|
||||
from copy import deepcopy
|
||||
|
||||
from jsonschema import ValidationError
|
||||
|
||||
from .decorators import validation
|
||||
from .decorators.metrics import UWSGIMetricsCollector
|
||||
from .decorators.parameter import parameter_to_arg
|
||||
from .decorators.produces import BaseSerializer, Produces, Jsonifier
|
||||
from .decorators.produces import BaseSerializer, Jsonifier, Produces
|
||||
from .decorators.response import ResponseValidator
|
||||
from .decorators.security import security_passthrough, verify_oauth, get_tokeninfo_url
|
||||
from .decorators.validation import RequestBodyValidator, ParameterValidator, TypeValidationError
|
||||
from .decorators.security import (get_tokeninfo_url, security_passthrough,
|
||||
verify_oauth)
|
||||
from .decorators.validation import (ParameterValidator, RequestBodyValidator,
|
||||
TypeValidationError)
|
||||
from .exceptions import InvalidSpecification
|
||||
from .utils import flaskify_endpoint, produces_json, is_nullable
|
||||
from .utils import flaskify_endpoint, is_nullable, produces_json
|
||||
|
||||
logger = logging.getLogger('connexion.operation')
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
||||
language governing permissions and limitations under the License.
|
||||
"""
|
||||
import flask
|
||||
import json
|
||||
|
||||
import flask
|
||||
|
||||
|
||||
def problem(status, title, detail, type='about:blank', instance=None, headers=None, ext=None):
|
||||
"""
|
||||
|
||||
@@ -13,6 +13,7 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
import connexion.utils as utils
|
||||
|
||||
logger = logging.getLogger('connexion.resolver')
|
||||
|
||||
@@ -14,6 +14,7 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
import functools
|
||||
import importlib
|
||||
import re
|
||||
|
||||
import flask
|
||||
import werkzeug.wrappers
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ Warning: It is recommended to use 'decorator' package to create decorators for
|
||||
|
||||
import connexion
|
||||
import flask
|
||||
|
||||
try:
|
||||
from decorator import decorator
|
||||
except ImportError:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from connexion import NoContent
|
||||
import datetime
|
||||
|
||||
from connexion import NoContent
|
||||
|
||||
pets = {}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
import connexion
|
||||
import logging
|
||||
|
||||
import connexion
|
||||
from connexion.resolver import RestyResolver
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
from connexion.exceptions import InvalidSpecification
|
||||
from connexion.app import App
|
||||
from connexion.exceptions import InvalidSpecification
|
||||
|
||||
import pytest
|
||||
from conftest import TEST_FOLDER, build_app_from_fixture
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import pathlib
|
||||
import json
|
||||
import logging
|
||||
import pytest
|
||||
import pathlib
|
||||
|
||||
from connexion.app import App
|
||||
|
||||
import pytest
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
TEST_FOLDER = pathlib.Path(__file__).parent
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from mock import MagicMock
|
||||
from connexion.decorators.security import get_tokeninfo_url, verify_oauth
|
||||
from connexion.problem import problem
|
||||
|
||||
from mock import MagicMock
|
||||
|
||||
|
||||
def test_get_tokeninfo_url(monkeypatch):
|
||||
env = {}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from connexion import problem, request
|
||||
from connexion import NoContent
|
||||
from connexion import NoContent, problem, request
|
||||
from flask import redirect
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import pathlib
|
||||
|
||||
import pytest
|
||||
from connexion.api import Api
|
||||
|
||||
import pytest
|
||||
|
||||
TEST_FOLDER = pathlib.Path(__file__).parent
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import pathlib
|
||||
import types
|
||||
|
||||
import pytest
|
||||
|
||||
from connexion.decorators.security import security_passthrough, verify_oauth
|
||||
from connexion.exceptions import InvalidSpecification
|
||||
from connexion.operation import Operation
|
||||
from connexion.resolver import Resolver
|
||||
|
||||
import pytest
|
||||
|
||||
TEST_FOLDER = pathlib.Path(__file__).parent
|
||||
|
||||
DEFINITIONS = {'new_stack': {'required': ['image_version', 'keep_stacks', 'new_traffic', 'senza_yaml'],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import decorator
|
||||
from connexion.decorators.parameter import get_function_arguments
|
||||
|
||||
import decorator
|
||||
|
||||
|
||||
@decorator.decorator
|
||||
def the_decorator(f, *args, **kwargs):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import connexion.app
|
||||
from connexion.resolver import Resolver
|
||||
from connexion.resolver import RestyResolver
|
||||
from connexion.operation import Operation
|
||||
from connexion.resolver import Resolver, RestyResolver
|
||||
|
||||
PARAMETER_DEFINITIONS = {'myparam': {'in': 'path', 'type': 'integer'}}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import math
|
||||
|
||||
import pytest
|
||||
|
||||
import connexion.app
|
||||
import connexion.utils as utils
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_flaskify_path():
|
||||
assert utils.flaskify_path("{test-path}") == "<test_path>"
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import json
|
||||
# we are using "mock" module here for Py 2.7 support
|
||||
from mock import MagicMock
|
||||
|
||||
from connexion.decorators.validation import ParameterValidator
|
||||
|
||||
# we are using "mock" module here for Py 2.7 support
|
||||
from mock import MagicMock
|
||||
|
||||
|
||||
def test_parameter_validator(monkeypatch):
|
||||
request = MagicMock(name='request')
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import pathlib
|
||||
import json
|
||||
import logging
|
||||
import pytest
|
||||
import pathlib
|
||||
|
||||
from connexion.app import App
|
||||
|
||||
import pytest
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
TEST_FOLDER = pathlib.Path(__file__).parent
|
||||
|
||||
7
tox.ini
7
tox.ini
@@ -3,7 +3,12 @@ max-line-length=120
|
||||
exclude=connexion/__init__.py
|
||||
|
||||
[tox]
|
||||
envlist=pypy,py27,py34,py35
|
||||
envlist=pypy,py27,py34,py35,isort-check
|
||||
|
||||
[testenv]
|
||||
commands=python setup.py test
|
||||
|
||||
[testenv:isort-check]
|
||||
basepython=python3
|
||||
deps=isort
|
||||
commands=isort -ns __init__.py -rc {toxinidir}/connexion {toxinidir}/examples {toxinidir}/tests
|
||||
|
||||
Reference in New Issue
Block a user