The following issues were found

tests/test_reqctx.py
100 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest

import flask
from flask.sessions import SecureCookieSessionInterface
from flask.sessions import SessionInterface

try:
    from greenlet import greenlet
except ImportError:

            

Reported by Pylint.

Super of 'PathAwareSessionInterface' has no 'get_cookie_name' member
Error

Line: 232 Column: 24

                          if flask.request.url.endswith("dynamic_cookie"):
                return "dynamic_cookie_name"
            else:
                return super().get_cookie_name(app)

    class CustomFlask(flask.Flask):
        session_interface = PathAwareSessionInterface()

    app = CustomFlask(__name__)

            

Reported by Pylint.

Unused variable 'end_of_request'
Error

Line: 17 Column: 5

                  buffer = []

    @app.teardown_request
    def end_of_request(exception):
        buffer.append(exception)

    ctx = app.test_request_context()
    ctx.push()
    assert buffer == []

            

Reported by Pylint.

Unused variable 'end_of_request'
Error

Line: 31 Column: 5

                  buffer = []

    @app.teardown_request
    def end_of_request(exception):
        buffer.append(exception)

    try:
        raise Exception("dummy")
    except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 36 Column: 12

              
    try:
        raise Exception("dummy")
    except Exception:
        pass

    with app.test_request_context():
        assert buffer == []
    assert buffer == [None]

            

Reported by Pylint.

Unused variable 'end_of_request'
Error

Line: 48 Column: 5

                  buffer = []

    @app.teardown_request
    def end_of_request(exception):
        buffer.append(exception)

    with app.test_request_context():
        assert buffer == []
        try:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 55 Column: 16

                      assert buffer == []
        try:
            raise Exception("dummy")
        except Exception:
            pass
    assert buffer == [None]


def test_proper_test_request_context(app):

            

Reported by Pylint.

Unused variable 'index'
Error

Line: 64 Column: 5

                  app.config.update(SERVER_NAME="localhost.localdomain:5000")

    @app.route("/")
    def index():
        return None

    @app.route("/", subdomain="foo")
    def sub():
        return None

            

Reported by Pylint.

Unused variable 'sub'
Error

Line: 68 Column: 5

                      return None

    @app.route("/", subdomain="foo")
    def sub():
        return None

    with app.test_request_context("/"):
        assert (
            flask.url_for("index", _external=True)

            

Reported by Pylint.

Access to a protected member _request_ctx_stack of a client class
Error

Line: 114 Column: 12

                      assert index() == "Hello World!"
    with app.test_request_context("/meh"):
        assert meh() == "http://localhost/meh"
    assert flask._request_ctx_stack.top is None


def test_context_test(app):
    assert not flask.request
    assert not flask.has_request_context()

            

Reported by Pylint.

src/flask/__init__.py
81 issues
Unable to import '__init__.app'
Error

Line: 7 Column: 1

              from werkzeug.utils import redirect as redirect

from . import json as json
from .app import Flask as Flask
from .app import Request as Request
from .app import Response as Response
from .blueprints import Blueprint as Blueprint
from .config import Config as Config
from .ctx import after_this_request as after_this_request

            

Reported by Pylint.

Unable to import '__init__.app'
Error

Line: 8 Column: 1

              
from . import json as json
from .app import Flask as Flask
from .app import Request as Request
from .app import Response as Response
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

            

Reported by Pylint.

Unable to import '__init__.app'
Error

Line: 9 Column: 1

              from . import json as json
from .app import Flask as Flask
from .app import Request as Request
from .app import Response as Response
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

            

Reported by Pylint.

Unable to import '__init__.blueprints'
Error

Line: 10 Column: 1

              from .app import Flask as Flask
from .app import Request as Request
from .app import Response as Response
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

            

Reported by Pylint.

Unable to import '__init__.config'
Error

Line: 11 Column: 1

              from .app import Request as Request
from .app import Response as Response
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 _app_ctx_stack as _app_ctx_stack

            

Reported by Pylint.

Unable to import '__init__.ctx'
Error

Line: 12 Column: 1

              from .app import Response as Response
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 _app_ctx_stack as _app_ctx_stack
from .globals import _request_ctx_stack as _request_ctx_stack

            

Reported by Pylint.

Unable to import '__init__.ctx'
Error

Line: 13 Column: 1

              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 _app_ctx_stack as _app_ctx_stack
from .globals import _request_ctx_stack as _request_ctx_stack
from .globals import current_app as current_app

            

Reported by Pylint.

Unable to import '__init__.ctx'
Error

Line: 14 Column: 1

              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 _app_ctx_stack as _app_ctx_stack
from .globals import _request_ctx_stack as _request_ctx_stack
from .globals import current_app as current_app
from .globals import g as g

            

Reported by Pylint.

Unable to import '__init__.ctx'
Error

Line: 15 Column: 1

              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 _app_ctx_stack as _app_ctx_stack
from .globals import _request_ctx_stack as _request_ctx_stack
from .globals import current_app as current_app
from .globals import g as g
from .globals import request as request

            

Reported by Pylint.

Unable to import '__init__.globals'
Error

Line: 16 Column: 1

              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 _app_ctx_stack as _app_ctx_stack
from .globals import _request_ctx_stack as _request_ctx_stack
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

            

Reported by Pylint.

tests/test_appctx.py
80 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest

import flask


def test_basic_url_generation(app):
    app.config["SERVER_NAME"] = "localhost"
    app.config["PREFERRED_URL_SCHEME"] = "https"


            

Reported by Pylint.

Unused variable 'index'
Error

Line: 11 Column: 5

                  app.config["PREFERRED_URL_SCHEME"] = "https"

    @app.route("/")
    def index():
        pass

    with app.app_context():
        rv = flask.url_for("index")
        assert rv == "https://localhost/"

            

Reported by Pylint.

Access to a protected member _get_current_object of a client class
Error

Line: 32 Column: 16

              
def test_request_context_means_app_context(app):
    with app.test_request_context():
        assert flask.current_app._get_current_object() == app
    assert flask._app_ctx_stack.top is None


def test_app_context_provides_current_app(app):
    with app.app_context():

            

Reported by Pylint.

Access to a protected member _app_ctx_stack of a client class
Error

Line: 33 Column: 12

              def test_request_context_means_app_context(app):
    with app.test_request_context():
        assert flask.current_app._get_current_object() == app
    assert flask._app_ctx_stack.top is None


def test_app_context_provides_current_app(app):
    with app.app_context():
        assert flask.current_app._get_current_object() == app

            

Reported by Pylint.

Access to a protected member _get_current_object of a client class
Error

Line: 38 Column: 16

              
def test_app_context_provides_current_app(app):
    with app.app_context():
        assert flask.current_app._get_current_object() == app
    assert flask._app_ctx_stack.top is None


def test_app_tearing_down(app):
    cleanup_stuff = []

            

Reported by Pylint.

Access to a protected member _app_ctx_stack of a client class
Error

Line: 39 Column: 12

              def test_app_context_provides_current_app(app):
    with app.app_context():
        assert flask.current_app._get_current_object() == app
    assert flask._app_ctx_stack.top is None


def test_app_tearing_down(app):
    cleanup_stuff = []


            

Reported by Pylint.

Unused variable 'cleanup'
Error

Line: 46 Column: 5

                  cleanup_stuff = []

    @app.teardown_appcontext
    def cleanup(exception):
        cleanup_stuff.append(exception)

    with app.app_context():
        pass


            

Reported by Pylint.

Unused variable 'cleanup'
Error

Line: 59 Column: 5

                  cleanup_stuff = []

    @app.teardown_appcontext
    def cleanup(exception):
        cleanup_stuff.append(exception)

    try:
        raise Exception("dummy")
    except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 64 Column: 12

              
    try:
        raise Exception("dummy")
    except Exception:
        pass

    with app.app_context():
        pass


            

Reported by Pylint.

Unused variable 'cleanup'
Error

Line: 77 Column: 5

                  cleanup_stuff = []

    @app.teardown_appcontext
    def cleanup(exception):
        cleanup_stuff.append(exception)

    with app.app_context():
        try:
            raise Exception("dummy")

            

Reported by Pylint.

tests/test_config.py
78 issues
Unable to import 'pytest'
Error

Line: 6 Column: 1

              import textwrap
from datetime import timedelta

import pytest

import flask


# config keys used for the TestConfig

            

Reported by Pylint.

Instance of 'Config' has no 'from_file' member
Error

Line: 37 Column: 5

              def test_config_from_file():
    app = flask.Flask(__name__)
    current_dir = os.path.dirname(os.path.abspath(__file__))
    app.config.from_file(os.path.join(current_dir, "static", "config.json"), json.load)
    common_object_test(app)


def test_config_from_mapping():
    app = flask.Flask(__name__)

            

Reported by Pylint.

Instance of 'Config' has no 'from_file' member
Error

Line: 114 Column: 9

              def test_config_missing_file():
    app = flask.Flask(__name__)
    with pytest.raises(IOError) as e:
        app.config.from_file("missing.json", load=json.load)
    msg = str(e.value)
    assert msg.startswith(
        "[Errno 2] Unable to load configuration file (No such file or directory):"
    )
    assert msg.endswith("missing.json'")

            

Reported by Pylint.

Instance of 'Config' has no 'from_file' member
Error

Line: 120 Column: 16

                      "[Errno 2] Unable to load configuration file (No such file or directory):"
    )
    assert msg.endswith("missing.json'")
    assert not app.config.from_file("missing.json", load=json.load, silent=True)


def test_custom_config_class():
    class Config(flask.Config):
        pass

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import json
import os
import textwrap
from datetime import timedelta

import pytest

import flask


            

Reported by Pylint.

Possible hardcoded password: 'config'
Security

Line: 13
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html

              
# config keys used for the TestConfig
TEST_KEY = "foo"
SECRET_KEY = "config"


def common_object_test(app):
    assert app.secret_key == "config"
    assert app.config["TEST_KEY"] == "foo"

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 16 Column: 1

              SECRET_KEY = "config"


def common_object_test(app):
    assert app.secret_key == "config"
    assert app.config["TEST_KEY"] == "foo"
    assert "TestConfig" not in app.config



            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 17
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              

def common_object_test(app):
    assert app.secret_key == "config"
    assert app.config["TEST_KEY"] == "foo"
    assert "TestConfig" not in app.config


def test_config_from_pyfile():

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 18
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
def common_object_test(app):
    assert app.secret_key == "config"
    assert app.config["TEST_KEY"] == "foo"
    assert "TestConfig" not in app.config


def test_config_from_pyfile():
    app = flask.Flask(__name__)

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 19
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def common_object_test(app):
    assert app.secret_key == "config"
    assert app.config["TEST_KEY"] == "foo"
    assert "TestConfig" not in app.config


def test_config_from_pyfile():
    app = flask.Flask(__name__)
    app.config.from_pyfile(f"{__file__.rsplit('.', 1)[0]}.py")

            

Reported by Bandit.

src/flask/cli.py
72 issues
Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              import click
from werkzeug.utils import import_string

from .globals import current_app
from .helpers import get_debug_flag
from .helpers import get_env
from .helpers import get_load_dotenv

try:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 18 Column: 1

              from werkzeug.utils import import_string

from .globals import current_app
from .helpers import get_debug_flag
from .helpers import get_env
from .helpers import get_load_dotenv

try:
    import dotenv

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 19 Column: 1

              
from .globals import current_app
from .helpers import get_debug_flag
from .helpers import get_env
from .helpers import get_load_dotenv

try:
    import dotenv
except ImportError:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 20 Column: 1

              from .globals import current_app
from .helpers import get_debug_flag
from .helpers import get_env
from .helpers import get_load_dotenv

try:
    import dotenv
except ImportError:
    dotenv = None

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 41 Column: 5

                  """Given a module instance this tries to find the best possible
    application in the module or raises an exception.
    """
    from . import Flask

    # Search for the most common names first.
    for attr_name in ("app", "application"):
        app = getattr(module, attr_name, None)


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 155 Column: 5

                  """Check if the given string is a variable name or a function. Call
    a function to get the app instance, or return the variable directly.
    """
    from . import Flask

    # Parse app_name as a single expression to determine if it's a valid
    # attribute name or function call.
    try:
        expr = ast.parse(app_name.strip(), mode="eval").body

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 286 Column: 5

                      return

    import werkzeug
    from . import __version__

    click.echo(
        f"Python {platform.python_version()}\n"
        f"Flask {__version__}\n"
        f"Werkzeug {werkzeug.__version__}",

            

Reported by Pylint.

Raising NoneType while only classes or instances are allowed
Error

Line: 346 Column: 13

              
        if exc is not None:
            self._bg_loading_exc = None
            raise exc

    def _load_unlocked(self):
        __traceback_hide__ = True  # noqa: F841
        self._app = rv = self.loader()
        self._bg_loading_exc = None

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 876 Column: 5

                  without having to manually configure the application.
    """
    import code
    from .globals import _app_ctx_stack

    app = _app_ctx_stack.top.app
    banner = (
        f"Python {sys.version} on {sys.platform}\n"
        f"App: {app.import_name} [{app.env}]\n"

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 75 Column: 17

                          except TypeError:
                if not _called_with_wrong_args(app_factory):
                    raise
                raise NoAppException(
                    f"Detected factory {attr_name!r} in module {module.__name__!r},"
                    " but could not call it without arguments. Use"
                    f" \"FLASK_APP='{module.__name__}:{attr_name}(args)'\""
                    " to specify arguments."
                )

            

Reported by Pylint.

tests/test_signals.py
59 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest

try:
    import blinker
except ImportError:
    blinker = None

import flask


            

Reported by Pylint.

Unused variable 'index'
Error

Line: 17 Column: 5

              
def test_template_rendered(app, client):
    @app.route("/")
    def index():
        return flask.render_template("simple_template.html", whiskey=42)

    recorded = []

    def record(sender, template, context):

            

Reported by Pylint.

Unused argument 'sender'
Error

Line: 22 Column: 16

              
    recorded = []

    def record(sender, template, context):
        recorded.append((template, context))

    flask.template_rendered.connect(record, app)
    try:
        client.get("/")

            

Reported by Pylint.

Unused variable 'index'
Error

Line: 40 Column: 5

                  app = flask.Flask(__name__)

    @app.route("/")
    def index():
        return flask.render_template("simple_template.html", whiskey=42)

    recorded = []

    def record(sender, template, context):

            

Reported by Pylint.

Unused argument 'sender'
Error

Line: 45 Column: 16

              
    recorded = []

    def record(sender, template, context):
        context["whiskey"] = 43
        recorded.append((template, context))

    flask.before_render_template.connect(record, app)
    try:

            

Reported by Pylint.

Unused argument 'sender'
Error

Line: 65 Column: 31

                  app = flask.Flask(__name__)
    calls = []

    def before_request_signal(sender):
        calls.append("before-signal")

    def after_request_signal(sender, response):
        assert response.data == b"stuff"
        calls.append("after-signal")

            

Reported by Pylint.

Unused argument 'sender'
Error

Line: 68 Column: 30

                  def before_request_signal(sender):
        calls.append("before-signal")

    def after_request_signal(sender, response):
        assert response.data == b"stuff"
        calls.append("after-signal")

    @app.before_request
    def before_request_handler():

            

Reported by Pylint.

Unused variable 'before_request_handler'
Error

Line: 73 Column: 5

                      calls.append("after-signal")

    @app.before_request
    def before_request_handler():
        calls.append("before-handler")

    @app.after_request
    def after_request_handler(response):
        calls.append("after-handler")

            

Reported by Pylint.

Unused variable 'after_request_handler'
Error

Line: 77 Column: 5

                      calls.append("before-handler")

    @app.after_request
    def after_request_handler(response):
        calls.append("after-handler")
        response.data = "stuff"
        return response

    @app.route("/")

            

Reported by Pylint.

Unused variable 'index'
Error

Line: 83 Column: 5

                      return response

    @app.route("/")
    def index():
        calls.append("handler")
        return "ignored anyway"

    flask.request_started.connect(before_request_signal, app)
    flask.request_finished.connect(after_request_signal, app)

            

Reported by Pylint.

src/flask/typing.py
49 issues
Module 'typing' has no 'TYPE_CHECKING' member
Error

Line: 4 Column: 4

              import typing as t


if t.TYPE_CHECKING:
    from _typeshed.wsgi import WSGIApplication  # noqa: F401
    from werkzeug.datastructures import Headers  # noqa: F401
    from .wrappers import Response  # noqa: F401

# The possible types that are directly convertible or are a Response object.

            

Reported by Pylint.

Unable to import '_typeshed.wsgi'
Error

Line: 5 Column: 5

              

if t.TYPE_CHECKING:
    from _typeshed.wsgi import WSGIApplication  # noqa: F401
    from werkzeug.datastructures import Headers  # noqa: F401
    from .wrappers import Response  # noqa: F401

# The possible types that are directly convertible or are a Response object.
ResponseValue = t.Union[

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 5

              if t.TYPE_CHECKING:
    from _typeshed.wsgi import WSGIApplication  # noqa: F401
    from werkzeug.datastructures import Headers  # noqa: F401
    from .wrappers import Response  # noqa: F401

# The possible types that are directly convertible or are a Response object.
ResponseValue = t.Union[
    "Response",
    t.AnyStr,

            

Reported by Pylint.

Module 'typing' has no 'Union' member
Error

Line: 10 Column: 17

                  from .wrappers import Response  # noqa: F401

# The possible types that are directly convertible or are a Response object.
ResponseValue = t.Union[
    "Response",
    t.AnyStr,
    t.Dict[str, t.Any],  # any jsonify-able dict
    t.Generator[t.AnyStr, None, None],
]

            

Reported by Pylint.

Module 'typing' has no 'AnyStr' member
Error

Line: 12 Column: 5

              # The possible types that are directly convertible or are a Response object.
ResponseValue = t.Union[
    "Response",
    t.AnyStr,
    t.Dict[str, t.Any],  # any jsonify-able dict
    t.Generator[t.AnyStr, None, None],
]
StatusCode = int


            

Reported by Pylint.

Module 'typing' has no 'Any' member
Error

Line: 13 Column: 17

              ResponseValue = t.Union[
    "Response",
    t.AnyStr,
    t.Dict[str, t.Any],  # any jsonify-able dict
    t.Generator[t.AnyStr, None, None],
]
StatusCode = int

# the possible types for an individual HTTP header

            

Reported by Pylint.

Module 'typing' has no 'Dict' member
Error

Line: 13 Column: 5

              ResponseValue = t.Union[
    "Response",
    t.AnyStr,
    t.Dict[str, t.Any],  # any jsonify-able dict
    t.Generator[t.AnyStr, None, None],
]
StatusCode = int

# the possible types for an individual HTTP header

            

Reported by Pylint.

Module 'typing' has no 'Generator' member
Error

Line: 14 Column: 5

                  "Response",
    t.AnyStr,
    t.Dict[str, t.Any],  # any jsonify-able dict
    t.Generator[t.AnyStr, None, None],
]
StatusCode = int

# the possible types for an individual HTTP header
HeaderName = str

            

Reported by Pylint.

Module 'typing' has no 'AnyStr' member
Error

Line: 14 Column: 17

                  "Response",
    t.AnyStr,
    t.Dict[str, t.Any],  # any jsonify-able dict
    t.Generator[t.AnyStr, None, None],
]
StatusCode = int

# the possible types for an individual HTTP header
HeaderName = str

            

Reported by Pylint.

Module 'typing' has no 'List' member
Error

Line: 20 Column: 28

              
# the possible types for an individual HTTP header
HeaderName = str
HeaderValue = t.Union[str, t.List[str], t.Tuple[str, ...]]

# the possible types for HTTP headers
HeadersValue = t.Union[
    "Headers", t.Dict[HeaderName, HeaderValue], t.List[t.Tuple[HeaderName, HeaderValue]]
]

            

Reported by Pylint.

src/flask/scaffold.py
44 issues
Attempted relative import beyond top-level package
Error

Line: 15 Column: 1

              from werkzeug.exceptions import default_exceptions
from werkzeug.exceptions import HTTPException

from .cli import AppGroup
from .globals import current_app
from .helpers import get_root_path
from .helpers import locked_cached_property
from .helpers import send_from_directory
from .templating import _default_template_ctx_processor

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 16 Column: 1

              from werkzeug.exceptions import HTTPException

from .cli import AppGroup
from .globals import current_app
from .helpers import get_root_path
from .helpers import locked_cached_property
from .helpers import send_from_directory
from .templating import _default_template_ctx_processor
from .typing import AfterRequestCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              
from .cli import AppGroup
from .globals import current_app
from .helpers import get_root_path
from .helpers import locked_cached_property
from .helpers import send_from_directory
from .templating import _default_template_ctx_processor
from .typing import AfterRequestCallable
from .typing import AppOrBlueprintKey

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 18 Column: 1

              from .cli import AppGroup
from .globals import current_app
from .helpers import get_root_path
from .helpers import locked_cached_property
from .helpers import send_from_directory
from .templating import _default_template_ctx_processor
from .typing import AfterRequestCallable
from .typing import AppOrBlueprintKey
from .typing import BeforeRequestCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 19 Column: 1

              from .globals import current_app
from .helpers import get_root_path
from .helpers import locked_cached_property
from .helpers import send_from_directory
from .templating import _default_template_ctx_processor
from .typing import AfterRequestCallable
from .typing import AppOrBlueprintKey
from .typing import BeforeRequestCallable
from .typing import GenericException

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 20 Column: 1

              from .helpers import get_root_path
from .helpers import locked_cached_property
from .helpers import send_from_directory
from .templating import _default_template_ctx_processor
from .typing import AfterRequestCallable
from .typing import AppOrBlueprintKey
from .typing import BeforeRequestCallable
from .typing import GenericException
from .typing import TeardownCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 21 Column: 1

              from .helpers import locked_cached_property
from .helpers import send_from_directory
from .templating import _default_template_ctx_processor
from .typing import AfterRequestCallable
from .typing import AppOrBlueprintKey
from .typing import BeforeRequestCallable
from .typing import GenericException
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              from .helpers import send_from_directory
from .templating import _default_template_ctx_processor
from .typing import AfterRequestCallable
from .typing import AppOrBlueprintKey
from .typing import BeforeRequestCallable
from .typing import GenericException
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import URLDefaultCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 23 Column: 1

              from .templating import _default_template_ctx_processor
from .typing import AfterRequestCallable
from .typing import AppOrBlueprintKey
from .typing import BeforeRequestCallable
from .typing import GenericException
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import URLDefaultCallable
from .typing import URLValuePreprocessorCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 24 Column: 1

              from .typing import AfterRequestCallable
from .typing import AppOrBlueprintKey
from .typing import BeforeRequestCallable
from .typing import GenericException
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import URLDefaultCallable
from .typing import URLValuePreprocessorCallable


            

Reported by Pylint.

src/flask/blueprints.py
43 issues
Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              from collections import defaultdict
from functools import update_wrapper

from .scaffold import _endpoint_from_view_func
from .scaffold import _sentinel
from .scaffold import Scaffold
from .typing import AfterRequestCallable
from .typing import BeforeFirstRequestCallable
from .typing import BeforeRequestCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              from functools import update_wrapper

from .scaffold import _endpoint_from_view_func
from .scaffold import _sentinel
from .scaffold import Scaffold
from .typing import AfterRequestCallable
from .typing import BeforeFirstRequestCallable
from .typing import BeforeRequestCallable
from .typing import TeardownCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              
from .scaffold import _endpoint_from_view_func
from .scaffold import _sentinel
from .scaffold import Scaffold
from .typing import AfterRequestCallable
from .typing import BeforeFirstRequestCallable
from .typing import BeforeRequestCallable
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              from .scaffold import _endpoint_from_view_func
from .scaffold import _sentinel
from .scaffold import Scaffold
from .typing import AfterRequestCallable
from .typing import BeforeFirstRequestCallable
from .typing import BeforeRequestCallable
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import TemplateFilterCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

              from .scaffold import _sentinel
from .scaffold import Scaffold
from .typing import AfterRequestCallable
from .typing import BeforeFirstRequestCallable
from .typing import BeforeRequestCallable
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import TemplateFilterCallable
from .typing import TemplateGlobalCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 11 Column: 1

              from .scaffold import Scaffold
from .typing import AfterRequestCallable
from .typing import BeforeFirstRequestCallable
from .typing import BeforeRequestCallable
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import TemplateFilterCallable
from .typing import TemplateGlobalCallable
from .typing import TemplateTestCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              from .typing import AfterRequestCallable
from .typing import BeforeFirstRequestCallable
from .typing import BeforeRequestCallable
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import TemplateFilterCallable
from .typing import TemplateGlobalCallable
from .typing import TemplateTestCallable
from .typing import URLDefaultCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              from .typing import BeforeFirstRequestCallable
from .typing import BeforeRequestCallable
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import TemplateFilterCallable
from .typing import TemplateGlobalCallable
from .typing import TemplateTestCallable
from .typing import URLDefaultCallable
from .typing import URLValuePreprocessorCallable

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              from .typing import BeforeRequestCallable
from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import TemplateFilterCallable
from .typing import TemplateGlobalCallable
from .typing import TemplateTestCallable
from .typing import URLDefaultCallable
from .typing import URLValuePreprocessorCallable


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 15 Column: 1

              from .typing import TeardownCallable
from .typing import TemplateContextProcessorCallable
from .typing import TemplateFilterCallable
from .typing import TemplateGlobalCallable
from .typing import TemplateTestCallable
from .typing import URLDefaultCallable
from .typing import URLValuePreprocessorCallable

if t.TYPE_CHECKING:

            

Reported by Pylint.

tests/test_instance_config.py
40 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import os
import sys

import pytest

import flask


def test_explicit_instance_paths(modules_tmpdir):

            

Reported by Pylint.

Unable to import 'main_app'
Error

Line: 24 Column: 5

                  app.write('import flask\n\napp = flask.Flask("__main__")')
    purge_module("main_app")

    from main_app import app

    here = os.path.abspath(os.getcwd())
    assert app.instance_path == os.path.join(here, "instance")



            

Reported by Pylint.

Unable to import 'config_module_app'
Error

Line: 40 Column: 5

                  )
    purge_module("config_module_app")

    from config_module_app import app

    assert app.instance_path == str(modules_tmpdir.join("instance"))


@pytest.mark.xfail(reason="weird interaction with tox")

            

Reported by Pylint.

Unable to import 'config_package_app'
Error

Line: 57 Column: 5

                  )
    purge_module("config_package_app")

    from config_package_app import app

    assert app.instance_path == str(modules_tmpdir.join("instance"))


def test_installed_module_paths(

            

Reported by Pylint.

Unable to import 'site_app'
Error

Line: 70 Column: 5

                  )
    purge_module("site_app")

    from site_app import app

    assert app.instance_path == modules_tmpdir.join("var").join("site_app-instance")


def test_installed_package_paths(

            

Reported by Pylint.

Unable to import 'installed_package'
Error

Line: 86 Column: 5

                  init.write("import flask\napp = flask.Flask(__name__)")
    purge_module("installed_package")

    from installed_package import app

    assert app.instance_path == modules_tmpdir.join("var").join(
        "installed_package-instance"
    )


            

Reported by Pylint.

Unable to import 'site_package'
Error

Line: 101 Column: 5

                  init.write("import flask\napp = flask.Flask(__name__)")
    purge_module("site_package")

    import site_package

    assert site_package.app.instance_path == modules_tmpdir.join("var").join(
        "site_package-instance"
    )


            

Reported by Pylint.

Unable to import 'site_egg'
Error

Line: 114 Column: 9

                  )
    install_egg("site_egg")
    try:
        import site_egg

        assert site_egg.app.instance_path == str(
            modules_tmpdir.join("var/").join("site_egg-instance")
        )
    finally:

            

Reported by Pylint.

Unused argument 'modules_tmpdir_prefix'
Error

Line: 63 Column: 21

              

def test_installed_module_paths(
    modules_tmpdir, modules_tmpdir_prefix, purge_module, site_packages, limit_loader
):
    site_packages.join("site_app.py").write(
        "import flask\napp = flask.Flask(__name__)\n"
    )
    purge_module("site_app")

            

Reported by Pylint.

Unused argument 'limit_loader'
Error

Line: 63 Column: 73

              

def test_installed_module_paths(
    modules_tmpdir, modules_tmpdir_prefix, purge_module, site_packages, limit_loader
):
    site_packages.join("site_app.py").write(
        "import flask\napp = flask.Flask(__name__)\n"
    )
    purge_module("site_app")

            

Reported by Pylint.