docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
listlengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
if json_available: self.jinja_env.filters['tojson'] = json.dumps
<mask> url_for=url_for, <mask> get_flashed_messages=get_flashed_messages <mask> ) <mask> <mask> def create_jinja_loader(self): <mask> """Creates the Jinja loader. By default just a package loader for <mask> the configured package is returned that looks up tem...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e2be6a0b3aba4ab49cf3ed1a10ac13c6b771aba
flask.py
class BasicFunctionalityTestCase(unittest.TestCase):
<mask> with app.test_request_context('/meh'): <mask> assert meh() == 'http://localhost/meh' <mask> <mask> <mask> class BasicFunctionality(unittest.TestCase): <mask> <mask> def test_request_dispatching(self): <mask> app = flask.Flask(__name__) <mask> @app.route('/') <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e2be6a0b3aba4ab49cf3ed1a10ac13c6b771aba
tests/flask_tests.py
class JSONTestCase(unittest.TestCase): def test_jsonify(self): d = dict(a=23, b=42, c=[1, 2, 3]) app = flask.Flask(__name__) @app.route('/kw') def return_kwargs(): return flask.jsonify(**d) @app.route('/dict') def return_dict(): return flask.j...
<mask> assert flask.url_for('static', filename='index.html') \ <mask> == '/static/index.html' <mask> <mask> <mask> class Templating(unittest.TestCase): <mask> <mask> def test_context_processing(self): <mask> app = flask.Flask(__name__) <mask> @app.context_proc...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e2be6a0b3aba4ab49cf3ed1a10ac13c6b771aba
tests/flask_tests.py
Version 0.11.2 -------------- Bugfix release, unreleased - Fix crash when running under PyPy3, see pull request ``#1814``.
<mask> <mask> Here you can see the full list of changes between each Flask release. <mask> <mask> Version 0.11.1 <mask> -------------- <mask> <mask> Bugfix release, released on June 7th 2016. <mask> </s> Fix PyPy3 support and add bug references Fix #1841 </s> remove # breaks the __exit__ function in a ver...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e46d0cd3969f6c13ff61c95c81a975192232fed
CHANGES
# breaks the __exit__ function in a very peculiar way. The second level of # exception blocks is necessary because pypy seems to forget to check if an # exception happened until the next bytecode instruction? # # Relevant PyPy bugfix commit: # https://bitbucket.org/pypy/pypy/commits/77ecf91c635a287e88e60d8ddb0f4e9df40...
<mask> return type.__new__(metaclass, 'temporary_class', (), {}) <mask> <mask> <mask> # Certain versions of pypy have a bug where clearing the exception stack <mask> # breaks the __exit__ function in a very peculiar way. This is currently <mask> # true for pypy 2.2.1 for instance. The second level of exce...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e46d0cd3969f6c13ff61c95c81a975192232fed
flask/_compat.py
if hasattr(sys, 'exc_clear'): # Python 3 (PyPy3) doesn't have exc_clear sys.exc_clear()
<mask> class _Mgr(object): <mask> def __enter__(self): <mask> return self <mask> def __exit__(self, *args): <mask> sys.exc_clear() <mask> try: <mask> try: <mask> with _Mgr(): <mask> raise AssertionError() <mask> except...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e46d0cd3969f6c13ff61c95c81a975192232fed
flask/_compat.py
conceptually only instance depending and outside version control so it's
<mask> error if not handled. This is a backwards incompatible change. <mask> - Applications now not only have a root path where the resources and modules <mask> are located but also an instance path which is the designated place to <mask> drop files that are modified at runtime (uploads etc.). Also this is ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e6c3a4636387892e3725f1ba13457966c188b87
CHANGES
cost of cacheability.
<mask> caches. You can override the default <mask> behavior by changing this variable. <mask> This is not recommended but might give <mask> you a performance improvement on the <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e6c3a4636387892e3725f1ba13457966c188b87
docs/config.rst
routes, they are registered for exceptions that are raised while trying to
<mask> You might want to show custom error pages to the user when an error occurs. <mask> This can be done by registering error handlers. <mask> <mask> Error handlers are normal :ref:`views` but instead of being registered for <mask> routes they are registered for exceptions that are rised while trying to <mask>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e6c3a4636387892e3725f1ba13457966c188b87
docs/errorhandling.rst
JavaScript files go. Inside the :file:`templates` folder, Flask will look for
<mask> creating the database schema as well as the main module. <mask> <mask> As a quick side note, the files inside of the :file:`static` folder are <mask> available to users of the application via HTTP. This is the place where CSS and <mask> Javascript files go. Inside the :file:`templates` folder, Flask will...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e6c3a4636387892e3725f1ba13457966c188b87
docs/tutorial/folders.rst
# reset normally. This makes it possible to restart the server
<mask> try: <mask> run_simple(host, port, self, **options) <mask> finally: <mask> # reset the first request information if the development server <mask> # resetted normally. This makes it possible to restart the server <mask> # without reloader and ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6e6c3a4636387892e3725f1ba13457966c188b87
flask/app.py
from ._compat import BROKEN_PYPY_CTXMGR_EXIT
<mask> from .module import blueprint_is_module <mask> from .signals import appcontext_pushed, appcontext_popped <mask> <mask> <mask> class _AppCtxGlobals(object): <mask> """A plain object.""" <mask> </s> Added a workaround for a pypy bug in context managers
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ec83e18dca497a8fbfca6caca5999984bd32f2e
flask/ctx.py
if BROKEN_PYPY_CTXMGR_EXIT and exc_type is not None: raise exc_type, exc_value, tb
<mask> self.pop(exc_value) <mask> <mask> <mask> class RequestContext(object): <mask> """The request context contains all request relevant information. It is <mask> created at the beginning of the request and pushed to the </s> Added a workaround for a pypy bug in context managers
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ec83e18dca497a8fbfca6caca5999984bd32f2e
flask/ctx.py
if BROKEN_PYPY_CTXMGR_EXIT and exc_type is not None: raise exc_type, exc_value, tb
<mask> # the context can be force kept alive for the test client. <mask> # See flask.testing for how this works. <mask> self.auto_pop(exc_value) <mask> <mask> def __repr__(self): <mask> return '<%s \'%s\' [%s] of %s>' % ( <mask> self.__class__.__name__, <mask> ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ec83e18dca497a8fbfca6caca5999984bd32f2e
flask/ctx.py
# via -r requirements/tests.in
<mask> # via pytest <mask> babel==2.9.1 <mask> # via sphinx <mask> blinker==1.4 <mask> # via -r tests.in <mask> certifi==2020.12.5 <mask> # via requests <mask> cfgv==3.3.0 <mask> # via pre-commit <mask> chardet==4.0.0 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-tabs](https://...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/tests.in
<mask> # via <mask> # tox <mask> # virtualenv <mask> greenlet==1.1.0 <mask> # via -r tests.in <mask> identify==2.2.4 <mask> # via pre-commit <mask> idna==2.10 <mask> # via requests <mask> imagesize==1.2.0 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-tabs](https://githu...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
mypy==0.812 # via -r requirements/typing.in
<mask> jinja2==3.0.1 <mask> # via sphinx <mask> markupsafe==2.0.1 <mask> # via jinja2 <mask> mypy-extensions==0.4.3 <mask> # via mypy <mask> nodeenv==1.6.0 <mask> # via pre-commit <mask> packaging==20.9 <mask> # via </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-tabs](https://gi...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
<mask> markupsafe==2.0.1 <mask> # via jinja2 <mask> mypy-extensions==0.4.3 <mask> # via mypy <mask> mypy==0.812 <mask> # via -r typing.in <mask> nodeenv==1.6.0 <mask> # via pre-commit <mask> packaging==20.9 <mask> # via <mask> # pallets-sphinx-themes </s> Bump sphinx-tabs from 3.0....
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/docs.in
<mask> # pytest <mask> # sphinx <mask> # tox <mask> pallets-sphinx-themes==2.0.1 <mask> # via -r docs.in <mask> pep517==0.10.0 <mask> # via pip-tools <mask> pip-tools==6.1.0 <mask> # via -r dev.in <mask> pluggy==0.13.1 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-tab...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/dev.in
<mask> # via -r docs.in <mask> pep517==0.10.0 <mask> # via pip-tools <mask> pip-tools==6.1.0 <mask> # via -r dev.in <mask> pluggy==0.13.1 <mask> # via <mask> # pytest <mask> # tox <mask> pre-commit==2.13.0 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-tabs](https://gith...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/dev.in
<mask> # via <mask> # pytest <mask> # tox <mask> pre-commit==2.13.0 <mask> # via -r dev.in <mask> py==1.10.0 <mask> # via <mask> # pytest <mask> # tox <mask> pygments==2.9.0 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-tabs](https://github.com/executablebooks/s...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/tests.in
<mask> # sphinx-tabs <mask> pyparsing==2.4.7 <mask> # via packaging <mask> pytest==6.2.4 <mask> # via -r tests.in <mask> python-dotenv==0.17.1 <mask> # via -r tests.in <mask> pytz==2021.1 <mask> # via babel <mask> pyyaml==5.4.1 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-ta...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/tests.in
<mask> # via packaging <mask> pytest==6.2.4 <mask> # via -r tests.in <mask> python-dotenv==0.17.1 <mask> # via -r tests.in <mask> pytz==2021.1 <mask> # via babel <mask> pyyaml==5.4.1 <mask> # via pre-commit <mask> requests==2.25.1 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-t...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
<mask> # tox <mask> # virtualenv <mask> snowballstemmer==2.1.0 <mask> # via sphinx <mask> sphinx-issues==1.2.0 <mask> # via -r docs.in <mask> sphinx-tabs==3.0.0 <mask> # via -r docs.in <mask> sphinx==4.0.2 <mask> # via <mask> # -r docs.in <mask> # pallets-sphinx-theme...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# -r requirements/docs.in
<mask> sphinx-tabs==3.0.0 <mask> # via -r docs.in <mask> sphinx==4.0.2 <mask> # via <mask> # -r docs.in <mask> # pallets-sphinx-themes <mask> # sphinx-issues <mask> # sphinx-tabs <mask> # sphinxcontrib-log-cabinet <mask> sphinxcontrib-applehelp==1.0.2 </s> Bump sphinx-ta...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
sphinx-issues==1.2.0 # via -r requirements/docs.in sphinx-tabs==3.1.0 # via -r requirements/docs.in
<mask> # sphinx-issues <mask> # sphinx-tabs <mask> # sphinxcontrib-log-cabinet <mask> sphinxcontrib-applehelp==1.0.2 <mask> # via sphinx <mask> sphinxcontrib-devhelp==1.0.2 <mask> # via sphinx <mask> sphinxcontrib-htmlhelp==1.0.3 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphin...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/docs.in
<mask> # via sphinx <mask> sphinxcontrib-jsmath==1.0.1 <mask> # via sphinx <mask> sphinxcontrib-log-cabinet==1.0.1 <mask> # via -r docs.in <mask> sphinxcontrib-qthelp==1.0.3 <mask> # via sphinx <mask> sphinxcontrib-serializinghtml==1.1.4 <mask> # via sphinx <mask> toml==0.10.2 </s> Bump s...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/dev.in
<mask> # pre-commit <mask> # pytest <mask> # tox <mask> tox==3.23.1 <mask> # via -r dev.in <mask> typed-ast==1.4.3 <mask> # via mypy <mask> typing-extensions==3.10.0.0 <mask> # via mypy <mask> urllib3==1.26.5 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-tabs](https:/...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/dev.txt
# via -r requirements/docs.in
<mask> # via <mask> # pallets-sphinx-themes <mask> # sphinx <mask> pallets-sphinx-themes==2.0.1 <mask> # via -r docs.in <mask> pygments==2.9.0 <mask> # via <mask> # sphinx <mask> # sphinx-tabs <mask> pyparsing==2.4.7 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/docs.txt
<mask> requests==2.25.1 <mask> # via sphinx <mask> snowballstemmer==2.1.0 <mask> # via sphinx <mask> sphinx-issues==1.2.0 <mask> # via -r docs.in <mask> sphinx-tabs==3.0.0 <mask> # via -r docs.in <mask> sphinx==4.0.2 <mask> # via <mask> # -r docs.in <mask> # pallets-sphinx-th...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/docs.txt
# -r requirements/docs.in
<mask> sphinx-tabs==3.0.0 <mask> # via -r docs.in <mask> sphinx==4.0.2 <mask> # via <mask> # -r docs.in <mask> # pallets-sphinx-themes <mask> # sphinx-issues <mask> # sphinx-tabs <mask> # sphinxcontrib-log-cabinet <mask> sphinxcontrib-applehelp==1.0.2 </s> Bump sphinx-ta...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/docs.txt
sphinx-issues==1.2.0 # via -r requirements/docs.in sphinx-tabs==3.1.0 # via -r requirements/docs.in
<mask> # sphinx-tabs <mask> # sphinxcontrib-log-cabinet <mask> sphinxcontrib-applehelp==1.0.2 <mask> # via sphinx <mask> sphinxcontrib-devhelp==1.0.2 <mask> # via sphinx <mask> sphinxcontrib-htmlhelp==1.0.3 </s> Bump sphinx-tabs from 3.0.0 to 3.1.0 Bumps [sphinx-tabs](https://github.com/exe...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/docs.txt
# via -r requirements/docs.in
<mask> # via sphinx <mask> sphinxcontrib-jsmath==1.0.1 <mask> # via sphinx <mask> sphinxcontrib-log-cabinet==1.0.1 <mask> # via -r docs.in <mask> sphinxcontrib-qthelp==1.0.3 <mask> # via sphinx <mask> sphinxcontrib-serializinghtml==1.1.4 <mask> # via sphinx <mask> urllib3==1.26.5 </s> Bum...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6fe9235f866fdc9a76cc086bea1512b6825713e8
requirements/docs.txt
iniconfig==1.0.0 # via pytest
<mask> idna==2.9 # via requests <mask> imagesize==1.2.0 # via sphinx <mask> jinja2==2.11.2 # via sphinx <mask> markupsafe==1.1.1 # via jinja2 <mask> more-itertools==8.3.0 # via pytest <mask> nodeenv==1.3.5 # via pre-commit </s> Bump pytest from 5.4.3 to ...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/dev.txt
py==1.9.0 # via pytest, tox
<mask> pallets-sphinx-themes==1.2.3 # via -r requirements/docs.in <mask> pip-tools==5.3.0 # via -r requirements/dev.in <mask> pluggy==0.13.1 # via pytest, tox <mask> pre-commit==2.6.0 # via -r requirements/dev.in <mask> py==1.8.1 # via pytest, tox <mask> pygments==2.6....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/dev.txt
pytest==6.0.0 # via -r requirements/tests.in
<mask> pre-commit==2.6.0 # via -r requirements/dev.in <mask> py==1.8.1 # via pytest, tox <mask> pygments==2.6.1 # via sphinx <mask> pyparsing==2.4.7 # via packaging <mask> pytest==5.4.3 # via -r requirements/tests.in <mask> python-dotenv==0.14.0 # via -r ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/dev.txt
toml==0.10.1 # via pre-commit, pytest, tox
<mask> sphinxcontrib-jsmath==1.0.1 # via sphinx <mask> sphinxcontrib-log-cabinet==1.0.1 # via -r requirements/docs.in <mask> sphinxcontrib-qthelp==1.0.3 # via sphinx <mask> sphinxcontrib-serializinghtml==1.1.4 # via sphinx <mask> toml==0.10.1 # via pre-commit, tox <mask> tox==3.18.0 ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/dev.txt
<mask> toml==0.10.1 # via pre-commit, tox <mask> tox==3.18.0 # via -r requirements/dev.in <mask> urllib3==1.25.9 # via requests <mask> virtualenv==20.0.21 # via pre-commit, tox <mask> wcwidth==0.1.9 # via pytest <mask> <mask> # The following packages are con...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/dev.txt
iniconfig==1.0.0 # via pytest
<mask> attrs==19.3.0 # via pytest <mask> blinker==1.4 # via -r requirements/tests.in <mask> greenlet==0.4.16 # via -r requirements/tests.in <mask> more-itertools==8.3.0 # via pytest <mask> packaging==20.4 # via pytest <mask> pluggy==0.13.1 # via pytest <...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/tests.txt
py==1.9.0 # via pytest
<mask> greenlet==0.4.16 # via -r requirements/tests.in <mask> more-itertools==8.3.0 # via pytest <mask> packaging==20.4 # via pytest <mask> pluggy==0.13.1 # via pytest <mask> py==1.8.1 # via pytest <mask> pyparsing==2.4.7 # via packaging <mask> pytest==5...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/tests.txt
pytest==6.0.0 # via -r requirements/tests.in
<mask> packaging==20.4 # via pytest <mask> pluggy==0.13.1 # via pytest <mask> py==1.8.1 # via pytest <mask> pyparsing==2.4.7 # via packaging <mask> pytest==5.4.3 # via -r requirements/tests.in <mask> python-dotenv==0.14.0 # via -r requirements/tests.in...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/tests.txt
toml==0.10.1 # via pytest
<mask> pyparsing==2.4.7 # via packaging <mask> pytest==5.4.3 # via -r requirements/tests.in <mask> python-dotenv==0.14.0 # via -r requirements/tests.in <mask> six==1.15.0 # via packaging <mask> wcwidth==0.1.9 # via pytest </s> Bump pytest from 5.4.3 to 6.0.0 Bump...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/pallets/flask/commit/6ff7004db01d0dc3ddbcc943ea727cb1811ba1aa
requirements/tests.txt
python setup.py test
<mask> <mask> all: clean-pyc test <mask> <mask> test: <mask> python tests/flask_tests.py <mask> <mask> release: <mask> python setup.py release sdist upload <mask> <mask> clean-pyc: </s> use setup.py test. This fixes #56 </s> remove ] </s> add ], test_suite='__main__.run_tests'
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/707b30749daf407c07b5b265bd892564576ad80a
Makefile
def run_tests(): import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), 'tests')) from flask_tests import suite return suite()
<mask> """ <mask> from setuptools import setup <mask> <mask> <mask> setup( <mask> name='Flask', <mask> version='0.4', <mask> url='http://github.com/mitsuhiko/flask/', </s> use setup.py test. This fixes #56 </s> remove ] </s> add ], test_suite='__main__.run_tests' </s> remove python ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/707b30749daf407c07b5b265bd892564576ad80a
setup.py
], test_suite='__main__.run_tests'
<mask> 'Operating System :: OS Independent', <mask> 'Programming Language :: Python', <mask> 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', <mask> 'Topic :: Software Development :: Libraries :: Python Modules' <mask> ] <mask> ) </s> use setup.py test. This fixes #56 </s> ...
[ "keep", "keep", "keep", "keep", "replace", "keep" ]
https://github.com/pallets/flask/commit/707b30749daf407c07b5b265bd892564576ad80a
setup.py
headers)`` or ``(response, headers)`` where at least one item has to be in the tuple. The `status` value will override the status code and `headers` can be a list or dictionary of additional header values.
<mask> 2. If it's a string, a response object is created with that data and the <mask> default parameters. <mask> 3. If a tuple is returned the items in the tuple can provide extra <mask> information. Such tuples have to be in the form ``(response, status, <mask> headers)`` where at least one item h...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
docs/quickstart.rst
headers)`` or ``(response, headers)`` where `response` is any of the
<mask> string encoded to utf-8 as body <mask> a WSGI function the function is called as WSGI application <mask> and buffered as response object <mask> :class:`tuple` A tuple in the form ``(response, status, <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/app.py
status_or_headers = headers = None
<mask> .. versionchanged:: 0.9 <mask> Previously a tuple was interpreted as the arguments for the <mask> response object. <mask> """ <mask> status = headers = None <mask> if isinstance(rv, tuple): <mask> rv, status, headers = rv + (None,) * (3 - l...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/app.py
rv, status_or_headers, headers = rv + (None,) * (3 - len(rv))
<mask> response object. <mask> """ <mask> status = headers = None <mask> if isinstance(rv, tuple): <mask> rv, status, headers = rv + (None,) * (3 - len(rv)) <mask> <mask> if rv is None: <mask> raise ValueError('View function did not return a re...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/app.py
if isinstance(status_or_headers, (dict, list)): headers, status_or_headers = status_or_headers, None
<mask> if rv is None: <mask> raise ValueError('View function did not return a response') <mask> <mask> if not isinstance(rv, self.response_class): <mask> # When we create a response object directly, we let the constructor <mask> # set the headers and status. W...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/app.py
rv = self.response_class(rv, headers=headers, status=status_or_headers) headers = status_or_headers = None
<mask> # set the headers and status. We do this because there can be <mask> # some extra logic involved when creating these objects with <mask> # specific values (like default content type selection). <mask> if isinstance(rv, (text_type, bytes, bytearray)): <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/app.py
if status_or_headers is not None: if isinstance(status_or_headers, string_types): rv.status = status_or_headers
<mask> headers = status = None <mask> else: <mask> rv = self.response_class.force_type(rv, request.environ) <mask> <mask> if status is not None: <mask> if isinstance(status, string_types): <mask> rv.status = status <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/app.py
rv.status_code = status_or_headers
<mask> if status is not None: <mask> if isinstance(status, string_types): <mask> rv.status = status <mask> else: <mask> rv.status_code = status <mask> if headers: <mask> rv.headers.extend(headers) <mask> <mask> return ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/app.py
} @app.route("/two_args") def from_two_args_tuple(): return "Hello", { 'X-Foo': 'Test', 'Content-Type': 'text/plain; charset=utf-8'
<mask> 'X-Foo': 'Testing', <mask> 'Content-Type': 'text/plain; charset=utf-8' <mask> } <mask> @app.route("/args_status") <mask> def from_status_tuple(): <mask> return "Hi, status!", 400 </s> added a new behaviour for responses that enable th...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/testsuite/basic.py
rv2 = c.get("/two_args") self.assert_equal(rv2.data, b'Hello') self.assert_equal(rv2.headers['X-Foo'], 'Test') self.assert_equal(rv2.status_code, 200) self.assert_equal(rv2.mimetype, 'text/plain') rv3 = c.get("/args_status") self.assert_equal(rv3.data, b'Hi, stat...
<mask> self.assert_equal(rv.status_code, 400) <mask> self.assert_equal(rv.mimetype, 'text/plain') <mask> <mask> def test_make_response(self): <mask> app = flask.Flask(__name__) <mask> with app.test_request_context(): <mask> rv = flask.make_response() <mask> ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/70f8b39c52527573e65e7066024a187867564c01
flask/testsuite/basic.py
import ast import inspect
<mask> """ <mask> <mask> import os <mask> import re <mask> import sys <mask> import traceback </s> Handle app factory with arguments in FLASK_APP </s> remove pytest.raises(NoAppException, locate_app, script_info, "notanpp.py") pytest.raises(NoAppException, locate_app, ...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
flask/cli.py
import re
<mask> import ast <mask> import inspect <mask> import os <mask> import sys <mask> import traceback <mask> from functools import update_wrapper <mask> from operator import attrgetter <mask> from threading import Lock, Thread </s> Handle app factory with arguments in FLASK_APP </s> remove pytest.raises(NoApp...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
flask/cli.py
# Search for app factory functions.
<mask> ' Use "FLASK_APP={module}:name" to specify the correct' <mask> ' one.'.format(module=module.__name__) <mask> ) <mask> <mask> # Search for app factory callables. <mask> for attr_name in ('create_app', 'make_app'): <mask> app_factory = getattr(module, attr_na...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
flask/cli.py
if inspect.isfunction(app_factory):
<mask> # Search for app factory callables. <mask> for attr_name in ('create_app', 'make_app'): <mask> app_factory = getattr(module, attr_name, None) <mask> <mask> if callable(app_factory): <mask> try: <mask> app = call_factory(app_factory, script_info) <mask>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
flask/cli.py
'Auto-detected "{function}()" in module "{module}", but '
<mask> if isinstance(app, Flask): <mask> return app <mask> except TypeError: <mask> raise NoAppException( <mask> 'Auto-detected "{callable}()" in module "{module}", but ' <mask> 'could not call it without speci...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
flask/cli.py
function=attr_name, module=module.__name__
<mask> except TypeError: <mask> raise NoAppException( <mask> 'Auto-detected "{callable}()" in module "{module}", but ' <mask> 'could not call it without specifying arguments.'.format( <mask> callable=attr_name, module=modul...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
flask/cli.py
function_regex = r'^([\w_][\w_\d]*)\((.*)\)$' match = re.match(function_regex, app_obj) try: if match: function_name = match.group(1) arguments = match.group(2) if arguments: arguments = ast.literal_eval( ...
<mask> mod = sys.modules[module] <mask> if app_obj is None: <mask> app = find_best_app(script_info, mod) <mask> else: <mask> app = getattr(mod, app_obj, None) <mask> if app is None: <mask> raise RuntimeError('Failed to find application in module "%s"' <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
flask/cli.py
raise RuntimeError('Failed to find application in module ' '"{name}"'.format(name=module))
<mask> app = find_best_app(script_info, mod) <mask> else: <mask> app = getattr(mod, app_obj, None) <mask> if app is None: <mask> raise RuntimeError('Failed to find application in module "%s"' <mask> % module) <mask> <mask> return app <...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
flask/cli.py
assert locate_app(script_info, "cliapp.factory").name == "create_app" assert locate_app( script_info, "cliapp.factory").name == "create_app" assert locate_app( script_info, "cliapp.factory:create_app").name == "create_app" assert locate_app( script_info, "cliapp.factory:create_ap...
<mask> """Test of locate_app.""" <mask> script_info = ScriptInfo() <mask> assert locate_app(script_info, "cliapp.app").name == "testapp" <mask> assert locate_app(script_info, "cliapp.app:testapp").name == "testapp" <mask> assert locate_app(script_info, "cliapp.multiapp:app1").name == "app1" <m...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
tests/test_cli.py
pytest.raises( NoAppException, locate_app, script_info, "notanpp.py") pytest.raises( NoAppException, locate_app, script_info, "cliapp/app") pytest.raises( RuntimeError, locate_app, script_info, "cliapp.app:notanapp") pytest.raises( NoAppException, locate_app, scri...
<mask> script_info = ScriptInfo() <mask> assert locate_app(script_info, "cliapp.app").name == "testapp" <mask> assert locate_app(script_info, "cliapp.app:testapp").name == "testapp" <mask> assert locate_app(script_info, "cliapp.multiapp:app1").name == "app1" <mask> pytest.raises(NoAppException,...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7106fb63578deef49741096d3d5aa04db89e15ae
tests/test_cli.py
<mask> <mask> :copyright: (c) 2015 by Armin Ronacher. <mask> :license: BSD, see LICENSE for more details. <mask> """ <mask> from collections import ChainMap <mask> <mask> import os <mask> import sys <mask> from threading import Lock <mask> from datetime import timedelta <mask> from itertools import...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
from collections import Mapping
<mask> from itertools import chain <mask> from functools import update_wrapper <mask> <mask> from werkzeug.datastructures import ImmutableDict <mask> from werkzeug.routing import Map, Rule, RequestRedirect, BuildError <mask> from werkzeug.exceptions import HTTPException, InternalServerError, \ <mask> Metho...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
from ._compat import reraise, string_types, text_type, integer_types, iterkeys
<mask> from .templating import DispatchingJinjaLoader, Environment, \ <mask> _default_template_ctx_processor <mask> from .signals import request_started, request_finished, got_request_exception, \ <mask> request_tearing_down, appcontext_tearing_down <mask> from ._compat import reraise, string_types, text...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
super(ExceptionHandlerDict, self).__init__()
<mask> Returns None if no handler is defined for blueprint or app <mask> """ <mask> def __init__(self, app, blueprint): <mask> self.app = app <mask> self.data = {} <mask> if blueprint: # fall back to app mapping <mask> self.fallback = app.error_handler_spec[None] ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
self.data = {}
<mask> Returns None if no handler is defined for blueprint or app <mask> """ <mask> def __init__(self, app, blueprint): <mask> self.app = app <mask> init = super(ExceptionHandlerDict, self).__init__ <mask> if blueprint: # fall back to app mapping <mask> init({}, a...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
self.fallback = app.error_handler_spec[None]
<mask> def __init__(self, app, blueprint): <mask> self.app = app <mask> init = super(ExceptionHandlerDict, self).__init__ <mask> if blueprint: # fall back to app mapping <mask> init({}, app.error_handler_spec[None]) <mask> else: <mask> init({}) <mask>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
self.fallback = {}
<mask> init = super(ExceptionHandlerDict, self).__init__ <mask> if blueprint: # fall back to app mapping <mask> init({}, app.error_handler_spec[None]) <mask> else: <mask> init({}) <mask> <mask> def get_class(self, exc_class_or_code): <mask> if is...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
clazz = self.get_class(e_or_c) return clazz in self.data or clazz in self.fallback
<mask> exc_class = exc_class_or_code <mask> return exc_class <mask> <mask> def __contains__(self, e_or_c): <mask> return super(ExceptionHandlerDict, self).__contains__(self.get_class(e_or_c)) <mask> <mask> def __getitem__(self, e_or_c): <mask> return super(E...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
clazz = self.get_class(e_or_c) item = self.data.get(clazz) if item is not None: return item elif len(self.fallback): return self.fallback[clazz] else: raise KeyError(e_or_c)
<mask> def __contains__(self, e_or_c): <mask> return super(ExceptionHandlerDict, self).__contains__(self.get_class(e_or_c)) <mask> <mask> def __getitem__(self, e_or_c): <mask> return super(ExceptionHandlerDict, self).__getitem__(self.get_class(e_or_c)) <mask> <mask> def __se...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
self.data[self.get_class(e_or_c)] = handler def __iter__(self): return iterkeys(self.data) def __len__(self): return len(self.data)
<mask> return super(ExceptionHandlerDict, self).__getitem__(self.get_class(e_or_c)) <mask> <mask> def __setitem__(self, e_or_c, handler): <mask> assert callable(handler) <mask> return super(ExceptionHandlerDict, self).__setitem__(self.get_class(e_or_c), handler) <mask> <mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7126a22334c881101b5c5f8bdc00d008cb7229aa
flask/app.py
Applications need some kind of configuration. There are different settings you might want to change depending on the application environment like toggling the debug mode, setting the secret key, and other such environment-specific things.
<mask> ====================== <mask> <mask> .. versionadded:: 0.3 <mask> <mask> Applications need some kind of configuration. There are different things <mask> you might want to change like toggling debug mode, the secret key, and a <mask> lot of very similar things. <mask> <mask> The way Flask is designed...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/713ced603e246b34fd88a417ae0be4d71505be70
docs/config.rst
:attr:`~flask.Flask` object so you can read and write them from there::
<mask> app = Flask(__name__) <mask> app.config['DEBUG'] = True <mask> <mask> Certain configuration values are also forwarded to the <mask> :attr:`~flask.Flask` object so that you can read and write them from <mask> there:: <mask> <mask> app.debug = True <mask> <mask> To update multiple keys at ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/713ced603e246b34fd88a417ae0be4d71505be70
docs/config.rst
Configuration becomes more useful if you can store it in a separate file, ideally located outside the actual application package. This makes packaging and distributing your application possible via various package handling tools (:ref:`distribute-deployment`) and finally modifying the configuration file afterwards.
<mask> <mask> Configuring from Files <mask> ---------------------- <mask> <mask> Configuration becomes more useful if you can configure from a file, and <mask> ideally that file would be outside of the actual application package so that <mask> you can install the package with distribute (:ref:`distribute-deplo...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/713ced603e246b34fd88a417ae0be4d71505be70
docs/config.rst
Here is an example of a configuration file::
<mask> The configuration files themselves are actual Python files. Only values <mask> in uppercase are actually stored in the config object later on. So make <mask> sure to use uppercase letters for your config keys. <mask> <mask> Here is an example configuration file:: <mask> <mask> DEBUG = False <mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/713ced603e246b34fd88a417ae0be4d71505be70
docs/config.rst
# Example configuration
<mask> sure to use uppercase letters for your config keys. <mask> <mask> Here is an example of a configuration file:: <mask> <mask> DEBUG = False <mask> SECRET_KEY = '?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83' <mask> <mask> Make sure to load the configuration very early on, so that...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/713ced603e246b34fd88a417ae0be4d71505be70
docs/config.rst
Make sure to load the configuration very early on, so that extensions have
<mask> <mask> DEBUG = False <mask> SECRET_KEY = '?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83' <mask> <mask> Make sure to load the configuration very early on so that extensions have <mask> the ability to access the configuration when starting up. There are other <mask> methods on the ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/713ced603e246b34fd88a417ae0be4d71505be70
docs/config.rst
a little harder. There is no single 100% solution for this problem in general, but there are a couple of things you can keep in mind to improve that experience:
<mask> Configuration Best Practices <mask> ---------------------------- <mask> <mask> The downside with the approach mentioned earlier is that it makes testing <mask> a little harder. There is no one 100% solution for this problem in <mask> general, but there are a couple of things you can do to improve that <...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/713ced603e246b34fd88a417ae0be4d71505be70
docs/config.rst
Most applications need more than one configuration. There should be at least separate configurations for the production server and the one used during development. The easiest way to handle this is to use a default configuration that is always loaded and part of the version control, and a
<mask> <mask> Development / Production <mask> ------------------------ <mask> <mask> Most applications need more than one configuration. There will at least <mask> be a separate configuration for a production server and one used during <mask> development. The easiest way to handle this is to use a default <...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/713ced603e246b34fd88a417ae0be4d71505be70
docs/config.rst
- Setting or accessing ``json_encoder`` or ``json_decoder`` raises a deprecation warning. :issue:`4732`
<mask> <mask> Unreleased <mask> <mask> <mask> Version 2.2.0 <mask> ------------- <mask> <mask> Released 2022-08-01 </s> show deprecation warning on json_encoder/decoder access </s> remove json_decoder: None = None </s> add json_decoder: t.Union[t.Type[json.JSONDecoder], None] = None </s> remove ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
CHANGES.rst
``app.json``. :pr:`4692`
<mask> - ``flask.json`` is an instance of ``JSONProvider``. A different <mask> provider can be set to use a different JSON library. <mask> ``flask.jsonify`` will call ``app.json.response``, other <mask> functions in ``flask.json`` will call corresponding functions in <mask> ``...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
CHANGES.rst
deprecated. :pr:`4692`
<mask> <mask> - JSON configuration is moved to attributes on the default <mask> ``app.json`` provider. ``JSON_AS_ASCII``, ``JSON_SORT_KEYS``, <mask> ``JSONIFY_MIMETYPE``, and ``JSONIFY_PRETTYPRINT_REGULAR`` are <mask> deprecated. :pr:`4688` <mask> - Setting custom ``json_encoder`` and ``json_deco...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
CHANGES.rst
overridden using the ``app.json`` provider interface. :pr:`4692`
<mask> deprecated. :pr:`4688` <mask> - Setting custom ``json_encoder`` and ``json_decoder`` classes on the <mask> app or a blueprint, and the corresponding ``json.JSONEncoder`` and <mask> ``JSONDecoder`` classes, are deprecated. JSON behavior can now be <mask> overridden using the ``app.json`` pr...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
CHANGES.rst
the function is built-in to Jinja now. :pr:`4692`
<mask> app or a blueprint, and the corresponding ``json.JSONEncoder`` and <mask> ``JSONDecoder`` classes, are deprecated. JSON behavior can now be <mask> overridden using the ``app.json`` provider interface. :pr:`4688` <mask> - ``json.htmlsafe_dumps`` and ``json.htmlsafe_dump`` are deprecated, <mask>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
CHANGES.rst
import json
<mask> import functools <mask> import inspect <mask> import logging <mask> import os <mask> import sys <mask> import typing as t <mask> import weakref <mask> from collections.abc import Iterator as _abc_Iterator </s> show deprecation warning on json_encoder/decoder access </s> remove #: The JSON decoder cl...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/app.py
_json_encoder: t.Union[t.Type[json.JSONEncoder], None] = None _json_decoder: t.Union[t.Type[json.JSONDecoder], None] = None
<mask> stacklevel=2, <mask> ) <mask> self.config["USE_X_SENDFILE"] = value <mask> <mask> #: The JSON encoder class to use. Defaults to <mask> #: :class:`~flask.json.JSONEncoder`. <mask> #: <mask> #: .. deprecated:: 2.2 <mask> #: Will be removed in Flask 2.3...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/app.py
@property # type: ignore[override] def json_encoder(self) -> t.Type[json.JSONEncoder]: # type: ignore[override] """The JSON encoder class to use. Defaults to :class:`~flask.json.JSONEncoder`. .. deprecated:: 2.2 Will be removed in Flask 2.3. Customize :attr:`...
<mask> #: <mask> #: .. versionadded:: 0.10 <mask> json_encoder: None = None <mask> <mask> #: The JSON decoder class to use. Defaults to <mask> #: :class:`~flask.json.JSONDecoder`. <mask> #: <mask> #: .. deprecated:: 2.2 <mask> #: Will be removed in Flask 2.3. Customize <m...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/app.py
_json_encoder: t.Union[t.Type[json.JSONEncoder], None] = None _json_decoder: t.Union[t.Type[json.JSONDecoder], None] = None @property # type: ignore[override] def json_encoder( # type: ignore[override] self, ) -> t.Union[t.Type[json.JSONEncoder], None]: """Blueprint-local JSON enc...
<mask> """ <mask> <mask> _got_registered_once = False <mask> <mask> #: Blueprint local JSON encoder class to use. Set to ``None`` to use <mask> #: the app's :class:`~flask.Flask.json_encoder`. <mask> #: <mask> #: .. deprecated:: 2.2 <mask> #: Will be removed in Flask 2.3. <m...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/blueprints.py
cls = self._app._json_encoder
<mask> <mask> :param obj: The data to serialize. <mask> :param kwargs: Passed to :func:`json.dumps`. <mask> """ <mask> cls = self._app.json_encoder <mask> bp = self._app.blueprints.get(request.blueprint) if request else None <mask> <mask> if bp is not None and b...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/json/provider.py
if bp is not None and bp._json_encoder is not None: cls = bp._json_encoder
<mask> """ <mask> cls = self._app.json_encoder <mask> bp = self._app.blueprints.get(request.blueprint) if request else None <mask> <mask> if bp is not None and bp.json_encoder is not None: <mask> cls = bp.json_encoder <mask> <mask> if cls is not None: <mask...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/json/provider.py
cls = self._app._json_decoder
<mask> <mask> :param s: Text or UTF-8 bytes. <mask> :param kwargs: Passed to :func:`json.loads`. <mask> """ <mask> cls = self._app.json_decoder <mask> bp = self._app.blueprints.get(request.blueprint) if request else None <mask> <mask> if bp is not None and bp.js...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/json/provider.py
if bp is not None and bp._json_decoder is not None: cls = bp._json_decoder
<mask> """ <mask> cls = self._app.json_decoder <mask> bp = self._app.blueprints.get(request.blueprint) if request else None <mask> <mask> if bp is not None and bp.json_decoder is not None: <mask> cls = bp.json_decoder <mask> <mask> if cls is not None: <mask...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/json/provider.py
import json
<mask> import importlib.util <mask> import os <mask> import pathlib <mask> import pkgutil <mask> import sys </s> show deprecation warning on json_encoder/decoder access </s> remove #: The JSON decoder class to use. Defaults to #: :class:`~flask.json.JSONDecoder`. #: #: .. deprecated:: 2.2 #: ...
[ "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/scaffold.py
json_encoder: t.Union[t.Type[json.JSONEncoder], None] = None
<mask> #: blueprint sets this, it will be used instead of the app's value. <mask> #: <mask> #: .. deprecated:: 2.2 <mask> #: Will be removed in Flask 2.3. <mask> json_encoder: None = None <mask> <mask> #: JSON decoder class used by :func:`flask.json.loads`. If a <mask> #: bluep...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/scaffold.py
json_decoder: t.Union[t.Type[json.JSONDecoder], None] = None
<mask> #: blueprint sets this, it will be used instead of the app's value. <mask> #: <mask> #: .. deprecated:: 2.2 <mask> #: Will be removed in Flask 2.3. <mask> json_decoder: None = None <mask> <mask> def __init__( <mask> self, <mask> import_name: str, <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/714ccefeca33db9e87e8ef4abd0008af05c32a4d
src/flask/scaffold.py
- HTTP exceptions and Bad Request Key Errors can now be trapped so that they show up normally in the traceback.
<mask> - Empty session cookies are now deleted properly automatically. <mask> - View functions can now opt out of getting the automatic <mask> OPTIONS implementation. <mask> <mask> Version 0.7.3 <mask> ------------- <mask> </s> Added HTTP exception trapping. This should fix #294 </s> remove # ensur...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/7155f11a723695352323d484610b9a1c6798eb69
CHANGES