Skip to content
Myr

Merge branch '2.0.x'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parents aa1d34d, 3b83d0c · Browse files · 11 files+43 added−42 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

11 files+43 added−42 removed

  • other:+43 added−42 removed

11 files+43 added−42 removed

modified:docs/debugging.rst+1 added-1 removed
67 unmodified lines
68 > flask run6970``FLASK_ENV`` can only be set as an environment variable. When running71from Python code, passing ``debug=True`` enables debug mode, which is72mostly equivalent. Debug mode can be controled separately from72mostly equivalent. Debug mode can be controlled separately from73``FLASK_ENV`` with the ``FLASK_DEBUG`` environment variable as well.7475.. code-block:: python76
57 unmodified lines
modified:requirements/dev.txt+13 added-13 removed
20 unmodified lines
21cffi==1.14.622 # via cryptography23cfgv==3.3.124 # via pre-commit25charset-normalizer==2.0.425charset-normalizer==2.0.626 # via requests27click==8.0.128 # via pip-tools29cryptography==3.4.829cryptography==35.0.030 # via -r requirements/typing.in31distlib==0.3.231distlib==0.3.332 # via virtualenv33docutils==0.1634 # via35 # sphinx36 # sphinx-tabs37filelock==3.0.1237filelock==3.2.038 # via39 # tox40 # virtualenv41greenlet==1.1.141greenlet==1.1.242 # via -r requirements/tests.in43identify==2.2.1343identify==2.2.1544 # via pre-commit45idna==3.246 # via requests47imagesize==1.2.0
19 unmodified lines
67pallets-sphinx-themes==2.0.168 # via -r requirements/docs.in69pep517==0.11.070 # via pip-tools71pip-tools==6.2.071pip-tools==6.3.072 # via -r requirements/dev.in73platformdirs==2.3.073platformdirs==2.4.074 # via virtualenv75pluggy==1.0.076 # via77 # pytest
27 unmodified lines
105 # tox106 # virtualenv107snowballstemmer==2.1.0108 # via sphinx109sphinx==4.1.2109sphinx==4.2.0110 # via111 # -r requirements/docs.in112 # pallets-sphinx-themes113 # sphinx-issues
24 unmodified lines
138 # pytest139 # tox140tomli==1.2.1141 # via pep517142tox==3.24.3142tox==3.24.4143 # via -r requirements/dev.in144types-contextvars==0.1.4145 # via -r requirements/typing.in146types-dataclasses==0.1.7147 # via -r requirements/typing.in148types-setuptools==57.0.2148types-setuptools==57.4.0149 # via -r requirements/typing.in150typing-extensions==3.10.0.2151 # via mypy152urllib3==1.26.6152urllib3==1.26.7153 # via requests154virtualenv==20.7.2154virtualenv==20.8.1155 # via156 # pre-commit157 # tox158wheel==0.37.0
5 unmodified lines
modified:requirements/docs.txt+3 added-3 removed
8 unmodified lines
9babel==2.9.110 # via sphinx11certifi==2021.5.3012 # via requests13charset-normalizer==2.0.413charset-normalizer==2.0.614 # via requests15docutils==0.1616 # via17 # sphinx
23 unmodified lines
41requests==2.26.042 # via sphinx43snowballstemmer==2.1.044 # via sphinx45sphinx==4.1.245sphinx==4.2.046 # via47 # -r requirements/docs.in48 # pallets-sphinx-themes49 # sphinx-issues
16 unmodified lines
66sphinxcontrib-qthelp==1.0.367 # via sphinx68sphinxcontrib-serializinghtml==1.1.569 # via sphinx70urllib3==1.26.670urllib3==1.26.771 # via requests7273# The following packages are considered to be unsafe in a requirements file:74# setuptools
modified:requirements/tests.txt+1 added-1 removed
8 unmodified lines
9attrs==21.2.010 # via pytest11blinker==1.412 # via -r requirements/tests.in13greenlet==1.1.113greenlet==1.1.214 # via -r requirements/tests.in15iniconfig==1.1.116 # via pytest17packaging==21.0
13 unmodified lines
modified:requirements/typing.txt+2 added-2 removed
4 unmodified lines
5# pip-compile requirements/typing.in6#7cffi==1.14.68 # via cryptography9cryptography==3.4.89cryptography==35.0.010 # via -r requirements/typing.in11mypy==0.91012 # via -r requirements/typing.in13mypy-extensions==0.4.3
5 unmodified lines
19types-contextvars==0.1.420 # via -r requirements/typing.in21types-dataclasses==0.1.722 # via -r requirements/typing.in23types-setuptools==57.0.223types-setuptools==57.4.024 # via -r requirements/typing.in25typing-extensions==3.10.0.226 # via mypy
modified:src/flask/app.py+2 added-2 removed
1619 unmodified lines
1620 from asgiref.sync import async_to_sync as asgiref_async_to_sync1621 except ImportError:1622 raise RuntimeError(1623 "Install Flask with the 'async' extra in order to use async views."1624 )1624 ) from None16251626 # Check that Werkzeug isn't using its fallback ContextVar class.1627 if ContextVar.__module__ == "werkzeug.local":1628 raise RuntimeError(
97 unmodified lines
1726 f"{e}\nThe view function did not return a valid"1727 " response. The return type must be a string,"1728 " dict, tuple, Response instance, or WSGI"1729 f" callable, but it was a {type(rv).__name__}."1730 ).with_traceback(sys.exc_info()[2])1730 ).with_traceback(sys.exc_info()[2]) from None1731 else:1732 raise TypeError(1733 "The view function did not return a valid"1734 " response. The return type must be a string,"
359 unmodified lines
modified:src/flask/cli.py+14 added-14 removed
67 unmodified lines
68 app = call_factory(script_info, app_factory)6970 if isinstance(app, Flask):71 return app72 except TypeError:72 except TypeError as e:73 if not _called_with_wrong_args(app_factory):74 raise7576 raise NoAppException(77 f"Detected factory {attr_name!r} in module {module.__name__!r},"78 " but could not call it without arguments. Use"79 f" \"FLASK_APP='{module.__name__}:{attr_name}(args)'\""80 " to specify arguments."80 )81 ) from e8283 raise NoAppException(84 "Failed to find Flask application or factory in module"85 f" {module.__name__!r}. Use 'FLASK_APP={module.__name__}:name'"
75 unmodified lines
161 expr = ast.parse(app_name.strip(), mode="eval").body162 except SyntaxError:163 raise NoAppException(164 f"Failed to parse {app_name!r} as an attribute name or function call."164 )165 ) from None166167 if isinstance(expr, ast.Name):168 name = expr.id169 args = kwargs = None
14 unmodified lines
184 # literal_eval gives cryptic error messages, show a generic185 # message with the full expression instead.186 raise NoAppException(187 f"Failed to parse arguments as literal values: {app_name!r}."187 )188 ) from None189 else:190 raise NoAppException(191 f"Failed to parse {app_name!r} as an attribute name or function call."192 )193194 try:195 attr = getattr(module, name)195 except AttributeError:196 except AttributeError as e:197 raise NoAppException(198 f"Failed to find attribute {name!r} in {module.__name__!r}."198 )199 ) from e200201 # If the attribute is a function, call it with any args and kwargs202 # to get the real application.203 if inspect.isfunction(attr):204 try:205 app = call_factory(script_info, attr, args, kwargs)205 except TypeError:206 except TypeError as e:207 if not _called_with_wrong_args(attr):208 raise209210 raise NoAppException(211 f"The factory {app_name!r} in module"212 f" {module.__name__!r} could not be called with the"213 " specified arguments."213 )214 ) from e215 else:216 app = attr217218 if isinstance(app, Flask):
38 unmodified lines
257 __traceback_hide__ = True # noqa: F841258259 try:260 __import__(module_name)260 except ImportError:261 except ImportError as e:262 # Reraise the ImportError if it occurred within the imported module.263 # Determine this by checking whether the trace has a depth > 1.264 if sys.exc_info()[2].tb_next:265 raise NoAppException(265 f"While importing {module_name!r}, an ImportError was"266 f" raised:\n\n{traceback.format_exc()}"267 )266 f"While importing {module_name!r}, an ImportError was raised."267 ) from e268 elif raise_if_not_found:269 raise NoAppException(f"Could not import {module_name!r}.")269 raise NoAppException(f"Could not import {module_name!r}.") from e270 else:271 return272273 module = sys.modules[module_name]
450 unmodified lines
724 raise click.BadParameter(725 "Using ad-hoc certificates requires the cryptography library.",726 ctx,727 param,728 )728 ) from None729730 return value731732 obj = import_string(value, silent=True)
266 unmodified lines
modified:src/flask/debughelpers.py+3 added-2 removed
81 unmodified lines
82 class newcls(oldcls):83 def __getitem__(self, key):84 try:85 return oldcls.__getitem__(self, key)86 except KeyError:86 except KeyError as e:87 if key not in request.form:88 raise89 raise DebugFilesKeyError(request, key)8990 raise DebugFilesKeyError(request, key) from e9192 newcls.__name__ = oldcls.__name__93 newcls.__module__ = oldcls.__module__94 request.files.__class__ = newcls95
77 unmodified lines
modified:src/flask/scaffold.py+1 added-1 removed
713 unmodified lines
714 raise KeyError(715 f"'{code_or_exception}' is not a recognized HTTP error"716 " code. Use a subclass of HTTPException with that code"717 " instead."718 )718 ) from None719720 self.error_handler_spec[None][code][exc_class] = t.cast(721 "ErrorHandlerCallable[Exception]", f722 )
153 unmodified lines
modified:src/flask/signals.py+1 added-1 removed
27 unmodified lines
28 def _fail(self, *args: t.Any, **kwargs: t.Any) -> t.Any:29 raise RuntimeError(30 "Signalling support is unavailable because the blinker"31 " library is not installed."32 )32 ) from None3334 connect = connect_via = connected_to = temporarily_connected_to = _fail35 disconnect = _fail36 has_receivers_for = receivers_for = _fail
20 unmodified lines
modified:.pre-commit-config.yaml+2 added-2 removed
1ci:2 autoupdate_schedule: monthly3repos:4 - repo: https://github.com/asottile/pyupgrade5 rev: v2.25.05 rev: v2.29.06 hooks:7 - id: pyupgrade8 args: ["--py36-plus"]9 - repo: https://github.com/asottile/reorder_python_imports
3 unmodified lines
13 name: Reorder Python imports (src, tests)14 files: "^(?!examples/)"15 args: ["--application-directories", "src"]16 - repo: https://github.com/psf/black17 rev: 21.8b017 rev: 21.9b018 hooks:19 - id: black20 - repo: https://github.com/PyCQA/flake821 rev: 3.9.2
11 unmodified lines