apply reorder-python-imports pre-commit config

This commit is contained in:
David Lord 2019-06-01 08:35:03 -07:00
parent ab8d60d826
commit 43483683b2
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
56 changed files with 292 additions and 247 deletions

View File

@ -1,4 +1,11 @@
repos: repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.4.0
hooks:
- id: reorder-python-imports
name: Reorder Python imports (src, tests)
files: "^(?!examples/)"
args: ["--application-directories", ".:src"]
- repo: https://github.com/python/black - repo: https://github.com/python/black
rev: 19.3b0 rev: 19.3b0
hooks: hooks:
@ -9,7 +16,7 @@ repos:
- id: flake8 - id: flake8
additional_dependencies: [flake8-bugbear] additional_dependencies: [flake8-bugbear]
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0 rev: v2.2.3
hooks: hooks:
- id: check-byte-order-marker - id: check-byte-order-marker
- id: trailing-whitespace - id: trailing-whitespace

View File

@ -1,4 +1,6 @@
from flask import jsonify, render_template, request from flask import jsonify
from flask import render_template
from flask import request
from js_example import app from js_example import app

View File

@ -1,6 +1,7 @@
import io import io
from setuptools import find_packages, setup from setuptools import find_packages
from setuptools import setup
with io.open("README.rst", "rt", encoding="utf8") as f: with io.open("README.rst", "rt", encoding="utf8") as f:
readme = f.read() readme = f.read()

View File

@ -1,5 +1,4 @@
import pytest import pytest
from flask import template_rendered from flask import template_rendered

View File

@ -1,16 +1,15 @@
import functools import functools
from flask import ( from flask import Blueprint
Blueprint, from flask import flash
flash, from flask import g
g, from flask import redirect
redirect, from flask import render_template
render_template, from flask import request
request, from flask import session
session, from flask import url_for
url_for, from werkzeug.security import check_password_hash
) from werkzeug.security import generate_password_hash
from werkzeug.security import check_password_hash, generate_password_hash
from flaskr.db import get_db from flaskr.db import get_db

View File

@ -1,4 +1,10 @@
from flask import Blueprint, flash, g, redirect, render_template, request, url_for from flask import Blueprint
from flask import flash
from flask import g
from flask import redirect
from flask import render_template
from flask import request
from flask import url_for
from werkzeug.exceptions import abort from werkzeug.exceptions import abort
from flaskr.auth import login_required from flaskr.auth import login_required

View File

@ -1,7 +1,8 @@
import sqlite3 import sqlite3
import click import click
from flask import current_app, g from flask import current_app
from flask import g
from flask.cli import with_appcontext from flask.cli import with_appcontext

View File

@ -1,6 +1,7 @@
import io import io
from setuptools import find_packages, setup from setuptools import find_packages
from setuptools import setup
with io.open("README.rst", "rt", encoding="utf8") as f: with io.open("README.rst", "rt", encoding="utf8") as f:
readme = f.read() readme = f.read()

View File

@ -2,8 +2,10 @@ import os
import tempfile import tempfile
import pytest import pytest
from flaskr import create_app from flaskr import create_app
from flaskr.db import get_db, init_db from flaskr.db import get_db
from flaskr.db import init_db
# read in SQL for populating test data # read in SQL for populating test data
with open(os.path.join(os.path.dirname(__file__), "data.sql"), "rb") as f: with open(os.path.join(os.path.dirname(__file__), "data.sql"), "rb") as f:

View File

@ -1,5 +1,7 @@
import pytest import pytest
from flask import g, session from flask import g
from flask import session
from flaskr.db import get_db from flaskr.db import get_db

View File

@ -1,4 +1,5 @@
import pytest import pytest
from flaskr.db import get_db from flaskr.db import get_db

View File

@ -1,6 +1,7 @@
import sqlite3 import sqlite3
import pytest import pytest
from flaskr.db import get_db from flaskr.db import get_db

View File

@ -4,8 +4,10 @@ from __future__ import print_function
import os import os
import re import re
import sys import sys
from datetime import date, datetime from datetime import date
from subprocess import PIPE, Popen from datetime import datetime
from subprocess import PIPE
from subprocess import Popen
_date_strip_re = re.compile(r"(?<=\d)(st|nd|rd|th)") _date_strip_re = re.compile(r"(?<=\d)(st|nd|rd|th)")

View File

@ -9,64 +9,51 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
__version__ = "1.1.dev"
# utilities we import from Werkzeug and Jinja2 that are unused # utilities we import from Werkzeug and Jinja2 that are unused
# in the module but are exported as public interface. # in the module but are exported as public interface.
from jinja2 import escape
from jinja2 import Markup
from werkzeug.exceptions import abort from werkzeug.exceptions import abort
from werkzeug.utils import redirect from werkzeug.utils import redirect
from jinja2 import Markup, escape
from .app import Flask, Request, Response
from .config import Config
from .helpers import (
url_for,
flash,
send_file,
send_from_directory,
get_flashed_messages,
get_template_attribute,
make_response,
safe_join,
stream_with_context,
)
from .globals import (
current_app,
g,
request,
session,
_request_ctx_stack,
_app_ctx_stack,
)
from .ctx import (
has_request_context,
has_app_context,
after_this_request,
copy_current_request_context,
)
from .blueprints import Blueprint
from .templating import render_template, render_template_string
# the signals
from .signals import (
signals_available,
template_rendered,
request_started,
request_finished,
got_request_exception,
request_tearing_down,
appcontext_tearing_down,
appcontext_pushed,
appcontext_popped,
message_flashed,
before_render_template,
)
# We're not exposing the actual json module but a convenient wrapper around
# it.
from . import json from . import json
from .app import Flask
from .app import Request
from .app import Response
from .blueprints import Blueprint
from .config import Config
from .ctx import after_this_request
from .ctx import copy_current_request_context
from .ctx import has_app_context
from .ctx import has_request_context
from .globals import _app_ctx_stack
from .globals import _request_ctx_stack
from .globals import current_app
from .globals import g
from .globals import request
from .globals import session
from .helpers import flash
from .helpers import get_flashed_messages
from .helpers import get_template_attribute
from .helpers import make_response
from .helpers import safe_join
from .helpers import send_file
from .helpers import send_from_directory
from .helpers import stream_with_context
from .helpers import url_for
from .json import jsonify
from .signals import appcontext_popped
from .signals import appcontext_pushed
from .signals import appcontext_tearing_down
from .signals import before_render_template
from .signals import got_request_exception
from .signals import message_flashed
from .signals import request_finished
from .signals import request_started
from .signals import request_tearing_down
from .signals import signals_available
from .signals import template_rendered
from .templating import render_template
from .templating import render_template_string
# This was the only thing that Flask used to export at one point and it had __version__ = "1.1.dev"
# a more generic name.
jsonify = json.jsonify

View File

@ -10,7 +10,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2

View File

@ -8,7 +8,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import os import os
import sys import sys
import warnings import warnings
@ -17,50 +16,58 @@ from functools import update_wrapper
from itertools import chain from itertools import chain
from threading import Lock from threading import Lock
from werkzeug.datastructures import Headers, ImmutableDict from werkzeug.datastructures import Headers
from werkzeug.exceptions import ( from werkzeug.datastructures import ImmutableDict
BadRequest, from werkzeug.exceptions import BadRequest
BadRequestKeyError, from werkzeug.exceptions import BadRequestKeyError
HTTPException, from werkzeug.exceptions import default_exceptions
InternalServerError, from werkzeug.exceptions import HTTPException
MethodNotAllowed, from werkzeug.exceptions import InternalServerError
default_exceptions, from werkzeug.exceptions import MethodNotAllowed
) from werkzeug.routing import BuildError
from werkzeug.routing import BuildError, Map, RequestRedirect, RoutingException, Rule from werkzeug.routing import Map
from werkzeug.routing import RequestRedirect
from werkzeug.routing import RoutingException
from werkzeug.routing import Rule
from werkzeug.wrappers import BaseResponse from werkzeug.wrappers import BaseResponse
from . import cli, json from . import cli
from ._compat import integer_types, reraise, string_types, text_type from . import json
from .config import Config, ConfigAttribute from ._compat import integer_types
from .ctx import AppContext, RequestContext, _AppCtxGlobals from ._compat import reraise
from .globals import _request_ctx_stack, g, request, session from ._compat import string_types
from .helpers import ( from ._compat import text_type
_PackageBoundObject, from .config import Config
_endpoint_from_view_func, from .config import ConfigAttribute
find_package, from .ctx import _AppCtxGlobals
get_env, from .ctx import AppContext
get_debug_flag, from .ctx import RequestContext
get_flashed_messages, from .globals import _request_ctx_stack
locked_cached_property, from .globals import g
url_for, from .globals import request
get_load_dotenv, from .globals import session
) from .helpers import _endpoint_from_view_func
from .helpers import _PackageBoundObject
from .helpers import find_package
from .helpers import get_debug_flag
from .helpers import get_env
from .helpers import get_flashed_messages
from .helpers import get_load_dotenv
from .helpers import locked_cached_property
from .helpers import url_for
from .json import jsonify from .json import jsonify
from .logging import create_logger from .logging import create_logger
from .sessions import SecureCookieSessionInterface from .sessions import SecureCookieSessionInterface
from .signals import ( from .signals import appcontext_tearing_down
appcontext_tearing_down, from .signals import got_request_exception
got_request_exception, from .signals import request_finished
request_finished, from .signals import request_started
request_started, from .signals import request_tearing_down
request_tearing_down, from .templating import _default_template_ctx_processor
) from .templating import DispatchingJinjaLoader
from .templating import ( from .templating import Environment
DispatchingJinjaLoader, from .wrappers import Request
Environment, from .wrappers import Response
_default_template_ctx_processor,
)
from .wrappers import Request, Response
# a singleton sentinel value for parameter defaults # a singleton sentinel value for parameter defaults
_sentinel = object() _sentinel = object()
@ -1036,7 +1043,7 @@ class Flask(_PackageBoundObject):
""" """
cls = self.test_client_class cls = self.test_client_class
if cls is None: if cls is None:
from flask.testing import FlaskClient as cls from .testing import FlaskClient as cls
return cls(self, self.response_class, use_cookies=use_cookies, **kwargs) return cls(self, self.response_class, use_cookies=use_cookies, **kwargs)
def test_cli_runner(self, **kwargs): def test_cli_runner(self, **kwargs):
@ -1052,7 +1059,7 @@ class Flask(_PackageBoundObject):
cls = self.test_cli_runner_class cls = self.test_cli_runner_class
if cls is None: if cls is None:
from flask.testing import FlaskCliRunner as cls from .testing import FlaskCliRunner as cls
return cls(self, **kwargs) return cls(self, **kwargs)
@ -2356,7 +2363,7 @@ class Flask(_PackageBoundObject):
:param kwargs: other keyword arguments passed to :param kwargs: other keyword arguments passed to
:class:`~werkzeug.test.EnvironBuilder`. :class:`~werkzeug.test.EnvironBuilder`.
""" """
from flask.testing import EnvironBuilder from .testing import EnvironBuilder
builder = EnvironBuilder(self, *args, **kwargs) builder = EnvironBuilder(self, *args, **kwargs)

View File

@ -11,7 +11,8 @@
""" """
from functools import update_wrapper from functools import update_wrapper
from .helpers import _PackageBoundObject, _endpoint_from_view_func from .helpers import _endpoint_from_view_func
from .helpers import _PackageBoundObject
# a singleton sentinel value for parameter defaults # a singleton sentinel value for parameter defaults
_sentinel = object() _sentinel = object()

View File

@ -8,7 +8,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from __future__ import print_function from __future__ import print_function
import ast import ast
@ -20,15 +19,20 @@ import sys
import traceback import traceback
from functools import update_wrapper from functools import update_wrapper
from operator import attrgetter from operator import attrgetter
from threading import Lock, Thread from threading import Lock
from threading import Thread
import click import click
from werkzeug.utils import import_string from werkzeug.utils import import_string
from . import __version__ from ._compat import getargspec
from ._compat import getargspec, itervalues, reraise, text_type from ._compat import itervalues
from ._compat import reraise
from ._compat import text_type
from .globals import current_app from .globals import current_app
from .helpers import get_debug_flag, get_env, get_load_dotenv from .helpers import get_debug_flag
from .helpers import get_env
from .helpers import get_load_dotenv
try: try:
import dotenv import dotenv
@ -147,7 +151,7 @@ def find_app_by_string(script_info, module, app_name):
``script_info`` argument and calls the function with the appropriate ``script_info`` argument and calls the function with the appropriate
arguments. arguments.
""" """
from flask import Flask from . import Flask
match = re.match(r"^ *([^ ()]+) *(?:\((.*?) *,? *\))? *$", app_name) match = re.match(r"^ *([^ ()]+) *(?:\((.*?) *,? *\))? *$", app_name)
@ -258,7 +262,9 @@ def locate_app(script_info, module_name, app_name, raise_if_not_found=True):
def get_version(ctx, param, value): def get_version(ctx, param, value):
if not value or ctx.resilient_parsing: if not value or ctx.resilient_parsing:
return return
import werkzeug import werkzeug
from . import __version__
message = "Python %(python)s\n" "Flask %(flask)s\n" "Werkzeug %(werkzeug)s" message = "Python %(python)s\n" "Flask %(flask)s\n" "Werkzeug %(werkzeug)s"
click.echo( click.echo(
@ -865,7 +871,7 @@ def shell_command():
without having to manually configure the application. without having to manually configure the application.
""" """
import code import code
from flask.globals import _app_ctx_stack from .globals import _app_ctx_stack
app = _app_ctx_stack.top.app app = _app_ctx_stack.top.app
banner = "Python %s on %s\nApp: %s [%s]\nInstance: %s" % ( banner = "Python %s on %s\nApp: %s [%s]\nInstance: %s" % (

View File

@ -8,14 +8,15 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import errno
import os import os
import types import types
import errno
from werkzeug.utils import import_string from werkzeug.utils import import_string
from ._compat import string_types, iteritems
from . import json from . import json
from ._compat import iteritems
from ._compat import string_types
class ConfigAttribute(object): class ConfigAttribute(object):

View File

@ -8,15 +8,17 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import sys import sys
from functools import update_wrapper from functools import update_wrapper
from werkzeug.exceptions import HTTPException from werkzeug.exceptions import HTTPException
from .globals import _request_ctx_stack, _app_ctx_stack from ._compat import BROKEN_PYPY_CTXMGR_EXIT
from .signals import appcontext_pushed, appcontext_popped from ._compat import reraise
from ._compat import BROKEN_PYPY_CTXMGR_EXIT, reraise from .globals import _app_ctx_stack
from .globals import _request_ctx_stack
from .signals import appcontext_popped
from .signals import appcontext_pushed
# a singleton sentinel value for parameter defaults # a singleton sentinel value for parameter defaults

View File

@ -8,11 +8,11 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import os import os
from warnings import warn from warnings import warn
from ._compat import implements_to_string, text_type from ._compat import implements_to_string
from ._compat import text_type
from .app import Flask from .app import Flask
from .blueprints import Blueprint from .blueprints import Blueprint
from .globals import _request_ctx_stack from .globals import _request_ctx_stack

View File

@ -9,9 +9,10 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from functools import partial from functools import partial
from werkzeug.local import LocalStack, LocalProxy
from werkzeug.local import LocalProxy
from werkzeug.local import LocalStack
_request_ctx_err_msg = """\ _request_ctx_err_msg = """\

View File

@ -9,29 +9,37 @@
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import io import io
import mimetypes
import os import os
import socket
import sys
import pkgutil import pkgutil
import posixpath import posixpath
import mimetypes import socket
import sys
import unicodedata
from functools import update_wrapper
from threading import RLock
from time import time from time import time
from zlib import adler32 from zlib import adler32
from threading import RLock
import unicodedata
from werkzeug.routing import BuildError
from functools import update_wrapper
from werkzeug.urls import url_quote
from werkzeug.datastructures import Headers
from werkzeug.exceptions import BadRequest, NotFound, RequestedRangeNotSatisfiable
from werkzeug.wsgi import wrap_file
from jinja2 import FileSystemLoader from jinja2 import FileSystemLoader
from werkzeug.datastructures import Headers
from werkzeug.exceptions import BadRequest
from werkzeug.exceptions import NotFound
from werkzeug.exceptions import RequestedRangeNotSatisfiable
from werkzeug.routing import BuildError
from werkzeug.urls import url_quote
from werkzeug.wsgi import wrap_file
from ._compat import fspath
from ._compat import PY2
from ._compat import string_types
from ._compat import text_type
from .globals import _app_ctx_stack
from .globals import _request_ctx_stack
from .globals import current_app
from .globals import request
from .globals import session
from .signals import message_flashed from .signals import message_flashed
from .globals import session, _request_ctx_stack, _app_ctx_stack, current_app, request
from ._compat import string_types, text_type, PY2, fspath
# sentinel # sentinel
_missing = object() _missing = object()

View File

@ -9,16 +9,17 @@ flask.json
import codecs import codecs
import io import io
import uuid import uuid
from datetime import date, datetime from datetime import date
from flask.globals import current_app, request from datetime import datetime
from flask._compat import text_type, PY2
from werkzeug.http import http_date
from jinja2 import Markup
# Use the same json implementation as itsdangerous on which we
# depend anyways.
from itsdangerous import json as _json from itsdangerous import json as _json
from jinja2 import Markup
from werkzeug.http import http_date
from .._compat import PY2
from .._compat import text_type
from ..globals import current_app
from ..globals import request
try: try:
import dataclasses import dataclasses

View File

@ -41,16 +41,19 @@ processes dicts first, so insert the new tag at the front of the order since
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from base64 import b64decode
from base64 import b64decode, b64encode from base64 import b64encode
from datetime import datetime from datetime import datetime
from uuid import UUID from uuid import UUID
from jinja2 import Markup from jinja2 import Markup
from werkzeug.http import http_date, parse_date from werkzeug.http import http_date
from werkzeug.http import parse_date
from flask._compat import iteritems, text_type from .._compat import iteritems
from flask.json import dumps, loads from .._compat import text_type
from ..json import dumps
from ..json import loads
class JSONTag(object): class JSONTag(object):

View File

@ -6,7 +6,6 @@ flask.logging
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from __future__ import absolute_import from __future__ import absolute_import
import logging import logging

View File

@ -8,17 +8,18 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import hashlib import hashlib
import warnings import warnings
from datetime import datetime from datetime import datetime
from itsdangerous import BadSignature, URLSafeTimedSerializer from itsdangerous import BadSignature
from itsdangerous import URLSafeTimedSerializer
from werkzeug.datastructures import CallbackDict from werkzeug.datastructures import CallbackDict
from flask._compat import collections_abc from ._compat import collections_abc
from flask.helpers import is_ip, total_seconds from .helpers import is_ip
from flask.json.tag import TaggedJSONSerializer from .helpers import total_seconds
from .json.tag import TaggedJSONSerializer
class SessionMixin(collections_abc.MutableMapping): class SessionMixin(collections_abc.MutableMapping):

View File

@ -9,13 +9,12 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
signals_available = False
try: try:
from blinker import Namespace from blinker import Namespace
signals_available = True signals_available = True
except ImportError: except ImportError:
signals_available = False
class Namespace(object): class Namespace(object):
def signal(self, name, doc=None): def signal(self, name, doc=None):

View File

@ -8,11 +8,14 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from jinja2 import BaseLoader
from jinja2 import Environment as BaseEnvironment
from jinja2 import TemplateNotFound
from jinja2 import BaseLoader, Environment as BaseEnvironment, TemplateNotFound from .globals import _app_ctx_stack
from .globals import _request_ctx_stack
from .globals import _request_ctx_stack, _app_ctx_stack from .signals import before_render_template
from .signals import template_rendered, before_render_template from .signals import template_rendered
def _default_template_ctx_processor(): def _default_template_ctx_processor():

View File

@ -10,17 +10,17 @@
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import warnings import warnings
import werkzeug
import werkzeug.test
from contextlib import contextmanager from contextlib import contextmanager
import werkzeug.test
from click.testing import CliRunner from click.testing import CliRunner
from flask.cli import ScriptInfo
from werkzeug.test import Client from werkzeug.test import Client
from flask import _request_ctx_stack
from flask.json import dumps as json_dumps
from werkzeug.urls import url_parse from werkzeug.urls import url_parse
from . import _request_ctx_stack
from .cli import ScriptInfo
from .json import dumps as json_dumps
class EnvironBuilder(werkzeug.test.EnvironBuilder): class EnvironBuilder(werkzeug.test.EnvironBuilder):
"""An :class:`~werkzeug.test.EnvironBuilder`, that takes defaults from the """An :class:`~werkzeug.test.EnvironBuilder`, that takes defaults from the

View File

@ -8,9 +8,8 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from .globals import request
from ._compat import with_metaclass from ._compat import with_metaclass
from .globals import request
http_method_funcs = frozenset( http_method_funcs = frozenset(

View File

@ -8,13 +8,13 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from werkzeug.exceptions import BadRequest from werkzeug.exceptions import BadRequest
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase from werkzeug.wrappers import Request as RequestBase
from werkzeug.wrappers import Response as ResponseBase
from werkzeug.wrappers.json import JSONMixin as _JSONMixin from werkzeug.wrappers.json import JSONMixin as _JSONMixin
from flask import json from . import json
from flask.globals import current_app from .globals import current_app
class JSONMixin(_JSONMixin): class JSONMixin(_JSONMixin):

View File

@ -6,7 +6,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import gc import gc
import os import os
import pkgutil import pkgutil

View File

@ -8,7 +8,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import pytest import pytest
import flask import flask

View File

@ -1,4 +1,5 @@
from flask import Blueprint, render_template from flask import Blueprint
from flask import render_template
admin = Blueprint( admin = Blueprint(
"admin", "admin",

View File

@ -1,4 +1,5 @@
from flask import Blueprint, render_template from flask import Blueprint
from flask import render_template
frontend = Blueprint("frontend", __name__, template_folder="templates") frontend = Blueprint("frontend", __name__, template_folder="templates")

View File

@ -1,4 +1,5 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import
from __future__ import print_function
from flask import Flask from flask import Flask

View File

@ -1,4 +1,5 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import
from __future__ import print_function
from flask import Flask from flask import Flask

View File

@ -1,4 +1,5 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import
from __future__ import print_function
from flask import Flask from flask import Flask

View File

@ -1,4 +1,5 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import
from __future__ import print_function
from flask import Flask from flask import Flask

View File

@ -8,7 +8,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import re import re
import sys import sys
import time import time
@ -18,7 +17,9 @@ from threading import Thread
import pytest import pytest
import werkzeug.serving import werkzeug.serving
from werkzeug.exceptions import BadRequest, Forbidden, NotFound from werkzeug.exceptions import BadRequest
from werkzeug.exceptions import Forbidden
from werkzeug.exceptions import NotFound
from werkzeug.http import parse_date from werkzeug.http import parse_date
from werkzeug.routing import BuildError from werkzeug.routing import BuildError

View File

@ -8,15 +8,14 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import functools import functools
import pytest import pytest
from jinja2 import TemplateNotFound
from werkzeug.http import parse_cache_control_header
import flask import flask
from flask._compat import text_type from flask._compat import text_type
from werkzeug.http import parse_cache_control_header
from jinja2 import TemplateNotFound
def test_blueprint_specific_error_handling(app, client): def test_blueprint_specific_error_handling(app, client):

View File

@ -6,10 +6,8 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
# This file was part of Flask-CLI and was modified under the terms of # This file was part of Flask-CLI and was modified under the terms of
# its Revised BSD License. Copyright © 2015 CERN. # its Revised BSD License. Copyright © 2015 CERN.
from __future__ import absolute_import from __future__ import absolute_import
import os import os
@ -23,21 +21,21 @@ import pytest
from _pytest.monkeypatch import notset from _pytest.monkeypatch import notset
from click.testing import CliRunner from click.testing import CliRunner
from flask import Flask, current_app, Blueprint from flask import Blueprint
from flask.cli import ( from flask import current_app
AppGroup, from flask import Flask
FlaskGroup, from flask.cli import AppGroup
NoAppException, from flask.cli import dotenv
ScriptInfo, from flask.cli import find_best_app
dotenv, from flask.cli import FlaskGroup
find_best_app, from flask.cli import get_version
get_version, from flask.cli import load_dotenv
load_dotenv, from flask.cli import locate_app
locate_app, from flask.cli import NoAppException
prepare_import, from flask.cli import prepare_import
run_command, from flask.cli import run_command
with_appcontext, from flask.cli import ScriptInfo
) from flask.cli import with_appcontext
cwd = os.getcwd() cwd = os.getcwd()
test_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "test_apps")) test_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "test_apps"))

View File

@ -6,14 +6,14 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from datetime import timedelta
import os import os
import textwrap import textwrap
from datetime import timedelta
import pytest
import flask import flask
from flask._compat import PY2 from flask._compat import PY2
import pytest
# config keys used for the TestConfig # config keys used for the TestConfig

View File

@ -8,7 +8,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import datetime import datetime
import io import io
import os import os
@ -16,13 +15,18 @@ import uuid
import pytest import pytest
from werkzeug.datastructures import Range from werkzeug.datastructures import Range
from werkzeug.exceptions import BadRequest, NotFound from werkzeug.exceptions import BadRequest
from werkzeug.http import http_date, parse_cache_control_header, parse_options_header from werkzeug.exceptions import NotFound
from werkzeug.http import http_date
from werkzeug.http import parse_cache_control_header
from werkzeug.http import parse_options_header
import flask import flask
from flask import json from flask import json
from flask._compat import StringIO, text_type from flask._compat import StringIO
from flask.helpers import get_debug_flag, get_env from flask._compat import text_type
from flask.helpers import get_debug_flag
from flask.helpers import get_env
def has_encoding(name): def has_encoding(name):

View File

@ -6,11 +6,11 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import os import os
import sys import sys
import pytest import pytest
import flask import flask
from flask._compat import PY2 from flask._compat import PY2

View File

@ -6,14 +6,14 @@ tests.test_json_tag
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from datetime import datetime from datetime import datetime
from uuid import uuid4 from uuid import uuid4
import pytest import pytest
from flask import Markup from flask import Markup
from flask.json.tag import TaggedJSONSerializer, JSONTag from flask.json.tag import JSONTag
from flask.json.tag import TaggedJSONSerializer
@pytest.mark.parametrize( @pytest.mark.parametrize(

View File

@ -6,14 +6,15 @@ tests.test_logging
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import logging import logging
import sys import sys
import pytest import pytest
from flask._compat import StringIO from flask._compat import StringIO
from flask.logging import default_handler, has_level_handler, wsgi_errors_stream from flask.logging import default_handler
from flask.logging import has_level_handler
from flask.logging import wsgi_errors_stream
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)

View File

@ -8,7 +8,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import gc import gc
import sys import sys
import threading import threading

View File

@ -8,7 +8,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import pytest import pytest
import flask import flask

View File

@ -8,7 +8,6 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import pytest import pytest
try: try:

View File

@ -9,9 +9,7 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import flask import flask
from flask._compat import StringIO from flask._compat import StringIO

View File

@ -8,13 +8,13 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import logging
import pytest import pytest
import werkzeug.serving
from jinja2 import TemplateNotFound
import flask import flask
import logging
from jinja2 import TemplateNotFound
import werkzeug.serving
def test_context_processing(app, client): def test_context_processing(app, client):

View File

@ -10,15 +10,16 @@
""" """
import click import click
import pytest import pytest
import flask
import werkzeug import werkzeug
import flask
from flask import appcontext_popped from flask import appcontext_popped
from flask._compat import text_type from flask._compat import text_type
from flask.cli import ScriptInfo from flask.cli import ScriptInfo
from flask.json import jsonify from flask.json import jsonify
from flask.testing import make_test_environ_builder, FlaskCliRunner, EnvironBuilder from flask.testing import EnvironBuilder
from flask.testing import FlaskCliRunner
from flask.testing import make_test_environ_builder
try: try:
import blinker import blinker

View File

@ -6,8 +6,11 @@ tests.test_user_error_handler
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from werkzeug.exceptions import Forbidden
from werkzeug.exceptions import HTTPException
from werkzeug.exceptions import InternalServerError
from werkzeug.exceptions import NotFound
from werkzeug.exceptions import Forbidden, InternalServerError, HTTPException, NotFound
import flask import flask

View File

@ -8,11 +8,9 @@
:copyright: © 2010 by the Pallets team. :copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
import pytest import pytest
from werkzeug.http import parse_set_header from werkzeug.http import parse_set_header
import flask
import flask.views import flask.views