Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
args: ["--project", "conftest", "--thirdparty", "connexion", "--check-only", "--diff"]

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 26.3.1
hooks:
- id: black
name: black
Expand Down
1 change: 1 addition & 0 deletions connexion/apps/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module defines an AbstractApp, which defines a standardized user interface for a Connexion
application.
"""

import abc
import pathlib
import typing as t
Expand Down
1 change: 1 addition & 0 deletions connexion/apps/flask.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module defines a FlaskApp, a Connexion application to wrap a Flask application.
"""

import functools
import pathlib
import typing as t
Expand Down
1 change: 1 addition & 0 deletions connexion/decorators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module defines decorators which Connexion uses to wrap user provided view functions.
"""

from .main import ( # noqa
ASGIDecorator,
FlaskDecorator,
Expand Down
6 changes: 4 additions & 2 deletions connexion/decorators/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ class WSGIDecorator(BaseDecorator):
and provides Flask datastructures to the view function. This works for any WSGI app, since
we get the request via the connexion context provided by WSGI middleware.

This decorator does not parse responses, but passes them directly to the WSGI App."""
This decorator does not parse responses, but passes them directly to the WSGI App.
"""

framework = FlaskFramework

Expand Down Expand Up @@ -152,7 +153,8 @@ class ASGIDecorator(BaseDecorator):
and provides Starlette datastructures to the view function. This works for any ASGI app, since
we get the request via the connexion context provided by ASGI middleware.

This decorator does not parse responses, but passes them directly to the ASGI App."""
This decorator does not parse responses, but passes them directly to the ASGI App.
"""

framework = StarletteFramework

Expand Down
1 change: 1 addition & 0 deletions connexion/decorators/parameter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module defines a decorator to convert request parameters to arguments for the view function.
"""

import abc
import asyncio
import builtins
Expand Down
2 changes: 1 addition & 1 deletion connexion/decorators/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _update_headers(

@staticmethod
def _unpack_handler_response(
handler_response: t.Union[str, bytes, dict, list, tuple]
handler_response: t.Union[str, bytes, dict, list, tuple],
) -> t.Tuple[t.Union[str, bytes, dict, list, None], t.Optional[int], dict]:
"""Unpack the handler response into data, status_code and headers.

Expand Down
1 change: 1 addition & 0 deletions connexion/frameworks/flask.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module defines functionality specific to the Flask framework.
"""

import functools
import random
import re
Expand Down
1 change: 1 addition & 0 deletions connexion/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module defines interfaces for requests and responses used in Connexion for authentication,
validation, serialization, etc.
"""

import typing as t
from collections import defaultdict

Expand Down
1 change: 1 addition & 0 deletions connexion/middleware/context.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""The ContextMiddleware creates a global context based the scope. It should be last in the
middleware stack, so it exposes the scope passed to the application"""

from starlette.types import ASGIApp, Receive, Scope, Send

from connexion.context import _context, _operation, _receive, _scope
Expand Down
2 changes: 1 addition & 1 deletion connexion/middleware/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
def connexion_wrapper(
handler: t.Callable[
[ConnexionRequest, Exception], MaybeAwaitable[ConnexionResponse]
]
],
) -> t.Callable[[StarletteRequest, Exception], t.Awaitable[StarletteResponse]]:
"""Wrapper that translates Starlette requests to Connexion requests before passing
them to the error handler, and translates the returned Connexion responses to
Expand Down
1 change: 1 addition & 0 deletions connexion/middleware/request_validation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Validation Middleware.
"""

import logging
import typing as t

Expand Down
1 change: 1 addition & 0 deletions connexion/middleware/response_validation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Validation Middleware.
"""

import logging
import typing as t

Expand Down
1 change: 0 additions & 1 deletion connexion/operations/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class AbstractOperation(metaclass=abc.ABCMeta):

"""
An API routes requests to an Operation by a (path, method) pair.
The operation uses a resolver to resolve its handler function.
Expand Down
1 change: 0 additions & 1 deletion connexion/operations/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class OpenAPIOperation(AbstractOperation):

"""
A single API operation on a path.
"""
Expand Down
1 change: 0 additions & 1 deletion connexion/operations/swagger2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class Swagger2Operation(AbstractOperation):

"""
Exposes a Swagger 2.0 operation under the AbstractOperation interface.
The primary purpose of this class is to provide the `function()` method
Expand Down
1 change: 1 addition & 0 deletions connexion/options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module defines a Connexion specific options class to pass to the Connexion App or API.
"""

import dataclasses
import logging
import typing as t
Expand Down
8 changes: 3 additions & 5 deletions connexion/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def _delayed_error(*args, **kwargs):


def extract_content_type(
headers: t.Union[t.List[t.Tuple[bytes, bytes]], t.Dict[str, str]]
headers: t.Union[t.List[t.Tuple[bytes, bytes]], t.Dict[str, str]],
) -> t.Optional[str]:
"""Extract the mime type and encoding from the content type headers.

Expand Down Expand Up @@ -469,13 +469,11 @@ def inspect_function_arguments(function: t.Callable) -> t.Tuple[t.List[str], boo


@t.overload
def sort_routes(routes: t.List[str], *, key: None = None) -> t.List[str]:
...
def sort_routes(routes: t.List[str], *, key: None = None) -> t.List[str]: ...


@t.overload
def sort_routes(routes: t.List[T], *, key: t.Callable[[T], str]) -> t.List[T]:
...
def sort_routes(routes: t.List[T], *, key: t.Callable[[T], str]) -> t.List[T]: ...


def sort_routes(routes, *, key=None):
Expand Down
1 change: 1 addition & 0 deletions connexion/validators/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module defines a Validator interface with base functionality that can be subclassed
for custom validators provided to the RequestValidationMiddleware.
"""

import copy
import json
import typing as t
Expand Down
1 change: 1 addition & 0 deletions examples/apikey/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Basic example of a resource server
"""

from pathlib import Path

import connexion
Expand Down
1 change: 1 addition & 0 deletions examples/basicauth/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Basic example of a resource server
"""

from pathlib import Path

import connexion
Expand Down
5 changes: 2 additions & 3 deletions examples/jwt/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Basic example of a resource server
"""

import time
from pathlib import Path

Expand Down Expand Up @@ -37,9 +38,7 @@ def get_secret(user, token_info) -> str:
return """
You are user_id {user} and the secret is 'wbevuec'.
Decoded token claims: {token_info}.
""".format(
user=user, token_info=token_info
)
""".format(user=user, token_info=token_info)


def _current_timestamp() -> int:
Expand Down
1 change: 1 addition & 0 deletions examples/oauth2/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Basic example of a resource server
"""

from pathlib import Path

import connexion
Expand Down
1 change: 1 addition & 0 deletions examples/oauth2_local_tokeninfo/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Basic example of a resource server
"""

from pathlib import Path

import connexion
Expand Down
1 change: 1 addition & 0 deletions examples/reverseproxy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
directly from users on the web!

"""

import logging
from pathlib import Path

Expand Down
Loading