diff --git a/src/flask/__init__.py b/src/flask/__init__.py index 30dce6fd..1d892d1d 100644 --- a/src/flask/__init__.py +++ b/src/flask/__init__.py @@ -1,39 +1,90 @@ -from . import json as json -from .app import Flask as Flask -from .blueprints import Blueprint as Blueprint -from .config import Config as Config -from .ctx import after_this_request as after_this_request -from .ctx import copy_current_request_context as copy_current_request_context -from .ctx import has_app_context as has_app_context -from .ctx import has_request_context as has_request_context -from .globals import current_app as current_app -from .globals import g as g -from .globals import request as request -from .globals import session as session -from .helpers import abort as abort -from .helpers import flash as flash -from .helpers import get_flashed_messages as get_flashed_messages -from .helpers import get_template_attribute as get_template_attribute -from .helpers import make_response as make_response -from .helpers import redirect as redirect -from .helpers import send_file as send_file -from .helpers import send_from_directory as send_from_directory -from .helpers import stream_with_context as stream_with_context -from .helpers import url_for as url_for -from .json import jsonify as jsonify -from .signals import appcontext_popped as appcontext_popped -from .signals import appcontext_pushed as appcontext_pushed -from .signals import appcontext_tearing_down as appcontext_tearing_down -from .signals import before_render_template as before_render_template -from .signals import got_request_exception as got_request_exception -from .signals import message_flashed as message_flashed -from .signals import request_finished as request_finished -from .signals import request_started as request_started -from .signals import request_tearing_down as request_tearing_down -from .signals import template_rendered as template_rendered -from .templating import render_template as render_template -from .templating import render_template_string as render_template_string -from .templating import stream_template as stream_template -from .templating import stream_template_string as stream_template_string -from .wrappers import Request as Request -from .wrappers import Response as Response +""" +Refactored convenience export module for the flask package. + +Principais mudanças: +- Removidos aliases redundantes do tipo `from .module import Name as Name`. +- Agrupados imports relacionados em blocos multi-linha legíveis. +- Adicionado __all__ explícito para indicar as exportações públicas do pacote + (isso ajuda linters a não reclamarem de "imported but unused"). +- Comentário explicando propósito do módulo. +""" + +from . import json +from .app import Flask +from .blueprints import Blueprint +from .config import Config +from .ctx import ( + after_this_request, + copy_current_request_context, + has_app_context, + has_request_context, +) +from .globals import current_app, g, request, session +from .helpers import ( + abort, + flash, + get_flashed_messages, + get_template_attribute, + url_for, +) +from .json import jsonify +from .logging import create_logger +from .sansio.scaffold import Scaffold +from .signals import ( + appcontext_popped, + appcontext_pushed, + appcontext_tearing_down, + before_render_template, + got_request_exception, + message_flashed, + request_finished, + request_started, + request_tearing_down, + template_rendered, +) +from .templating import ( + render_template, + render_template_string, + stream_template, + stream_template_string, +) +from .wrappers import Request, Response + +__all__ = [ + "json", + "Flask", + "Blueprint", + "Config", + "after_this_request", + "copy_current_request_context", + "has_app_context", + "has_request_context", + "current_app", + "g", + "request", + "session", + "abort", + "flash", + "get_flashed_messages", + "get_template_attribute", + "url_for", + "jsonify", + "create_logger", + "Scaffold", + "appcontext_popped", + "appcontext_pushed", + "appcontext_tearing_down", + "before_render_template", + "got_request_exception", + "message_flashed", + "request_finished", + "request_started", + "request_tearing_down", + "template_rendered", + "render_template", + "render_template_string", + "stream_template", + "stream_template_string", + "Request", + "Response", +]