Skip to content

Commit

Permalink
Switch to Flask's top level name exportion style
Browse files Browse the repository at this point in the history
The odd `name as name` style is required for mypy to recognise the
names, see python/mypy#10198.
  • Loading branch information
pgjones committed Jul 8, 2022
1 parent ff7f47d commit c219d96
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 111 deletions.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
ignore = E203, E252, FI58, W503, W504
max_line_length = 100
min_version = 3.7
per-file-ignores =
src/quart/__init__.py:F401
require_code = True
163 changes: 52 additions & 111 deletions src/quart/__init__.py
Original file line number Diff line number Diff line change
@@ -1,124 +1,65 @@
from __future__ import annotations

from markupsafe import escape, Markup
from werkzeug.exceptions import abort
from werkzeug.utils import redirect
from markupsafe import escape as escape, Markup as Markup
from werkzeug.exceptions import abort as abort
from werkzeug.utils import redirect as redirect

from .app import Quart
from .blueprints import Blueprint
from .config import Config
from .app import Quart as Quart
from .blueprints import Blueprint as Blueprint
from .config import Config as Config
from .ctx import (
after_this_request,
copy_current_app_context,
copy_current_request_context,
copy_current_websocket_context,
has_app_context,
has_request_context,
has_websocket_context,
after_this_request as after_this_request,
copy_current_app_context as copy_current_app_context,
copy_current_request_context as copy_current_request_context,
copy_current_websocket_context as copy_current_websocket_context,
has_app_context as has_app_context,
has_request_context as has_request_context,
has_websocket_context as has_websocket_context,
)
from .globals import (
_app_ctx_stack,
_request_ctx_stack,
_websocket_ctx_stack,
current_app,
g,
request,
session,
websocket,
_app_ctx_stack as _app_ctx_stack,
_request_ctx_stack as _request_ctx_stack,
_websocket_ctx_stack as _websocket_ctx_stack,
current_app as current_app,
g as g,
request as request,
session as session,
websocket as websocket,
)
from .helpers import (
flash,
get_flashed_messages,
get_template_attribute,
make_push_promise,
make_response,
send_file,
send_from_directory,
stream_with_context,
url_for,
flash as flash,
get_flashed_messages as get_flashed_messages,
get_template_attribute as get_template_attribute,
make_push_promise as make_push_promise,
make_response as make_response,
send_file as send_file,
send_from_directory as send_from_directory,
stream_with_context as stream_with_context,
url_for as url_for,
)
from .json import jsonify
from .json import jsonify as jsonify
from .signals import (
appcontext_popped,
appcontext_pushed,
appcontext_tearing_down,
before_render_template,
got_request_exception,
got_websocket_exception,
message_flashed,
request_finished,
request_started,
request_tearing_down,
signals_available,
template_rendered,
websocket_finished,
websocket_started,
websocket_tearing_down,
appcontext_popped as appcontext_popped,
appcontext_pushed as appcontext_pushed,
appcontext_tearing_down as appcontext_tearing_down,
before_render_template as before_render_template,
got_request_exception as got_request_exception,
got_websocket_exception as got_websocket_exception,
message_flashed as message_flashed,
request_finished as request_finished,
request_started as request_started,
request_tearing_down as request_tearing_down,
signals_available as signals_available,
template_rendered as template_rendered,
websocket_finished as websocket_finished,
websocket_started as websocket_started,
websocket_tearing_down as websocket_tearing_down,
)
from .templating import (
render_template,
render_template_string,
stream_template,
stream_template_string,
)
from .typing import ResponseReturnValue
from .wrappers import Request, Response, Websocket

__all__ = (
"_app_ctx_stack",
"_request_ctx_stack",
"_websocket_ctx_stack",
"abort",
"after_this_request",
"appcontext_popped",
"appcontext_pushed",
"appcontext_tearing_down",
"before_render_template",
"Blueprint",
"Config",
"copy_current_app_context",
"copy_current_request_context",
"copy_current_websocket_context",
"current_app",
"escape",
"flash",
"g",
"get_flashed_messages",
"get_template_attribute",
"got_request_exception",
"got_websocket_exception",
"has_app_context",
"has_request_context",
"has_websocket_context",
"jsonify",
"make_push_promise",
"make_response",
"Markup",
"message_flashed",
"Quart",
"redirect",
"render_template",
"render_template_string",
"request",
"Request",
"request_finished",
"request_started",
"request_tearing_down",
"Response",
"ResponseReturnValue",
"safe_join",
"send_file",
"send_from_directory",
"session",
"signals_available",
"stream_template",
"stream_template_string",
"stream_with_context",
"template_rendered",
"url_for",
"websocket",
"websocket_finished",
"websocket_started",
"websocket_tearing_down",
"Websocket",
render_template as render_template,
render_template_string as render_template_string,
stream_template as stream_template,
stream_template_string as stream_template_string,
)
from .typing import ResponseReturnValue as ResponseReturnValue
from .wrappers import Request as Request, Response as Response, Websocket as Websocket

0 comments on commit c219d96

Please sign in to comment.