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
This signal is sent when an application context is pushed. The sender is the application. This is usually useful for unittests in order to temporarily hook in information. For instance it can be used to
<mask> to the exception that caused the teardown if there was one. <mask> <mask> .. data:: appcontext_pushed <mask> <mask> This signal is sent when an application context is pushed. The sender <mask> is the application. This is usually useful for unittests in order to <mask> temporarily hook in i...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
This signal is sent when an application context is popped. The sender is the application. This usually falls in line with the
<mask> .. versionadded:: 0.10 <mask> <mask> .. data:: appcontext_popped <mask> <mask> This signal is sent when an application context is popped. The sender <mask> is the application. This usually falls in line with the <mask> :data:`appcontext_tearing_down` signal. <mask> <mask> .. versiona...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
This signal is sent when the application is flashing a message. The
<mask> <mask> <mask> .. data:: message_flashed <mask> <mask> This signal is sent when the application is flashing a message. The <mask> messages is sent as `message` keyword argument and the category as <mask> `category`. <mask> <mask> Example subscriber:: <mask> </s> Fixed inconsistent dou...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
otherwise a dummy class that creates fake signals. This class is
<mask> <mask> .. class:: signals.Namespace <mask> <mask> An alias for :class:`blinker.base.Namespace` if blinker is available, <mask> otherwise a dummy class that creates fake signals. This class is <mask> available for Flask extensions that want to provide the same fallback <mask> system as Flask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
(``/user/<username>``). By default a variable part in the URL accepts any
<mask> 3. You can directly access the underlying Werkzeug routing system <mask> which is exposed as :attr:`flask.Flask.url_map`. <mask> <mask> Variable parts in the route can be specified with angular brackets <mask> (``/user/<username>``). By default a variable part in the URL accepts any <mask> string wi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
slashes. The idea is to keep each URL unique so the following rules
<mask> def show_post(post_id): <mask> pass <mask> <mask> An important detail to keep in mind is how Flask deals with trailing <mask> slashes. The idea is to keep each URL unique so the following rules <mask> apply: <mask> <mask> 1. If a rule ends with a slash and is requested without a slash by t...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
This is consistent with how web servers deal with static files. This
<mask> trailing slash attached. <mask> 2. If a rule does not end with a trailing slash and the user requests the <mask> page with a trailing slash, a 404 not found is raised. <mask> <mask> This is consistent with how web servers deal with static files. This <mask> also makes it possible to use relative li...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
You can also define multiple rules for the same function. They have to be unique however. Defaults can also be specified. Here for example is a
<mask> <mask> This is consistent with how web servers deal with static files. This <mask> also makes it possible to use relative link targets safely. <mask> <mask> You can also define multiple rules for the same function. They have to be <mask> unique however. Defaults can also be specified. Here for exampl...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
:meth:`~flask.Flask.add_url_rule` accept. The only difference is that
<mask> def region(id): <mask> pass <mask> <mask> Here are the parameters that :meth:`~flask.Flask.route` and <mask> :meth:`~flask.Flask.add_url_rule` accept. The only difference is that <mask> with the route parameter the view function is defined with the decorator <mask> instead of the `view_func` pa...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
`endpoint` the endpoint for the registered URL rule. Flask itself
<mask> instead of the `view_func` parameter. <mask> <mask> =============== ========================================================== <mask> `rule` the URL rule as string <mask> `endpoint` the endpoint for the registered URL rule. Flask itself <mask> assumes that the name of the vi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
provided endpoint. If this is not provided one can
<mask> `endpoint` the endpoint for the registered URL rule. Flask itself <mask> assumes that the name of the view function is the name <mask> of the endpoint if not explicitly stated. <mask> `view_func` the function to call when serving a request to the <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
`defaults` A dictionary with defaults for this rule. See the
<mask> provided endpoint. If this is not provided one can <mask> specify the function later by storing it in the <mask> :attr:`~flask.Flask.view_functions` dictionary with the <mask> endpoint as key. <mask> `defaults` A dictionary with defaults ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
matching is in use. If not specified the default
<mask> endpoint as key. <mask> `defaults` A dictionary with defaults for this rule. See the <mask> example above for how defaults work. <mask> `subdomain` specifies the rule for the subdomain in case subdomain <mask> matching is in use. If not specified th...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
:class:`~werkzeug.routing.Rule` object. A change to Werkzeug is handling of method options. methods is a list
<mask> `subdomain` specifies the rule for the subdomain in case subdomain <mask> matching is in use. If not specified the default <mask> subdomain is assumed. <mask> `**options` the options to be forwarded to the underlying <mask> :class:`~werkzeug.routing.R...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
etc.). By default a rule just listens for ``GET`` (and implicitly ``HEAD``). Starting with Flask 0.6, ``OPTIONS`` is
<mask> `**options` the options to be forwarded to the underlying <mask> :class:`~werkzeug.routing.Rule` object. A change to <mask> Werkzeug is handling of method options. methods is a list <mask> of methods this rule should be limited to (``GET``, ``POST`` <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
handling. They have to be specified as keyword arguments.
<mask> of methods this rule should be limited to (``GET``, ``POST`` <mask> etc.). By default a rule just listens for ``GET`` (and <mask> implicitly ``HEAD``). Starting with Flask 0.6, ``OPTIONS`` is <mask> implicitly added and handled by the standard...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
- `__name__`: The name of a function is by default used as endpoint. If endpoint is provided explicitly this value is used. Additionally this
<mask> customize behavior the view function would normally not have control over. <mask> The following attributes can be provided optionally to either override <mask> some defaults to :meth:`~flask.Flask.add_url_rule` or general behavior: <mask> <mask> - `__name__`: The name of a function is by default used as ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
attribute exists. If it does, it will pull the information for the
<mask> cannot be customized from the function itself. <mask> <mask> - `methods`: If methods are not provided when the URL rule is added, <mask> Flask will look on the view function object itself if a `methods` <mask> attribute exists. If it does, it will pull the information for the <mask> met...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
HTTP ``OPTIONS`` response. This can be useful when working with
<mask> methods from there. <mask> <mask> - `provide_automatic_options`: if this attribute is set Flask will <mask> either force enable or disable the automatic implementation of the <mask> HTTP ``OPTIONS`` response. This can be useful when working with <mask> decorators that want to customize ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5dfd2126a6d5210096ec6ba1ead471b79dc8bd17
docs/api.rst
- OPTIONS is now automatically implemented by Flask unless the application explictly adds 'OPTIONS' as method to the URL rule. In this case no automatic OPTIONS handling kicks in.
<mask> <mask> - after request functions are now called in reverse order of <mask> registration. <mask> <mask> Version 0.5.1 <mask> ------------- <mask> </s> Added support for automagic OPTIONS </s> remove :class:`~werkzeug.routing.Rule` object </s> add :clas...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e1b1030e8edecb0c9652f2a406933c049ea2397
CHANGES
specification. Likewise as of Flask 0.6, `OPTIONS` is implemented for you as well automatically.
<mask> If `GET` is present, `HEAD` will be added automatically for you. You <mask> don't have to deal with that. It will also make sure that `HEAD` requests <mask> are handled like the `HTTP RFC`_ (the document describing the HTTP <mask> protocol) demands, so you can completely ignore that part of the HTTP <mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e1b1030e8edecb0c9652f2a406933c049ea2397
docs/quickstart.rst
`OPTIONS` Provides a quick way for a requesting client to figure out which methods are supported by this URL. Starting with Flask 0.6, this is implemented for you automatically.
<mask> <mask> `DELETE` <mask> Remove the information that the given location. <mask> <mask> Now the interesting part is that in HTML4 and XHTML1, the only methods a <mask> form might submit to the server are `GET` and `POST`. But with JavaScript <mask> and future HTML standards you can use other methods a...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e1b1030e8edecb0c9652f2a406933c049ea2397
docs/quickstart.rst
.. versionchanged:: 0.6 `OPTIONS` is added automatically as method.
<mask> <mask> .. versionchanged:: 0.2 <mask> `view_func` parameter added. <mask> <mask> :param rule: the URL rule as string <mask> :param endpoint: the endpoint for the registered URL rule. Flask <mask> itself assumes the name of the view function as...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e1b1030e8edecb0c9652f2a406933c049ea2397
flask/app.py
:class:`~werkzeug.routing.Rule` object. A change to Werkzeug is handling of method options. methods is a list of methods this rule should be limited to (`GET`, `POST` etc.). By default a rule just ...
<mask> endpoint <mask> :param view_func: the function to call when serving a request to the <mask> provided endpoint <mask> :param options: the options to be forwarded to the underlying <mask> :class:`~werkzeug.routing.Rule`...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e1b1030e8edecb0c9652f2a406933c049ea2397
flask/app.py
assert sorted(rv.allow) == ['GET', 'HEAD', 'OPTIONS', 'POST']
<mask> assert c.post('/more').data == 'POST' <mask> assert c.get('/more').data == 'GET' <mask> rv = c.delete('/more') <mask> assert rv.status_code == 405 <mask> assert sorted(rv.allow) == ['GET', 'HEAD', 'POST'] <mask> <mask> def test_session(self): <mask> ap...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e1b1030e8edecb0c9652f2a406933c049ea2397
tests/flask_tests.py
- Allow registering new tags with ``TaggedJSONSerializer`` to support storing other types in the session cookie. (`#2352`_)
<mask> - ``TRAP_BAD_REQUEST_ERRORS`` is enabled by default in debug mode. <mask> ``BadRequestKeyError`` has a message with the bad key in debug mode instead <mask> of the generic bad request message. (`#2348`_) <mask> <mask> .. _#1489: https://github.com/pallets/flask/pull/1489 <mask> .. _#1621: https://gith...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e1ced3c055f7eb567bf7266c98de3d44ceea1b4
CHANGES
<mask> #: session cookie as keys when caching pages, preventing multiple users <mask> #: from being served the same cache. <mask> accessed = True <mask> <mask> class TaggedJSONSerializer(object): <mask> """A customized JSON serializer that supports a few extra types that <mask> we take for g...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/pallets/flask/commit/5e1ced3c055f7eb567bf7266c98de3d44ceea1b4
flask/sessions.py
session_json_serializer = TaggedJSONSerializer()
<mask> """ <mask> raise NotImplementedError() <mask> <mask> <mask> class SecureCookieSessionInterface(SessionInterface): <mask> """The default session interface that stores sessions in signed cookies <mask> through the :mod:`itsdangerous` module. <mask> """ </s> make session seria...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e1ced3c055f7eb567bf7266c98de3d44ceea1b4
flask/sessions.py
sorted_by_str = [ '{', '"values": {', '"0": "foo",', '"1": "foo",', '"10": "foo",', '"11": "foo",', '"12": "foo",', '"13": "foo",', '"14": "foo",', '"15": "foo",', '"16": "foo",', ...
<mask> <mask> c = app.test_client() <mask> rv = c.get('/') <mask> lines = [x.strip() for x in rv.data.strip().decode('utf-8').splitlines()] <mask> self.assert_equal(lines, [ <mask> '{', <mask> '"values": {', <mask> '"0": "foo",', <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e8dd8b2872584483e7fb7506337a7d940ea8cc0
flask/testsuite/helpers.py
]
<mask> '"18": "foo",', <mask> '"19": "foo"', <mask> '}', <mask> '}' <mask> ]) <mask> <mask> <mask> class SendfileTestCase(FlaskTestCase): <mask> <mask> def test_send_file_regular(self): </s> Changed sort_json test to test str sorting Tests when ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e8dd8b2872584483e7fb7506337a7d940ea8cc0
flask/testsuite/helpers.py
try: self.assert_equal(lines, sorted_by_int) except AssertionError: self.assert_equal(lines, sorted_by_str)
<mask> ] <mask> <mask> <mask> class SendfileTestCase(FlaskTestCase): <mask> <mask> def test_send_file_regular(self): <mask> app = flask.Flask(__name__) <mask> with app.test_request_context(): </s> Changed sort_json test to test str sorting Tests when simplejson was installed wer...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e8dd8b2872584483e7fb7506337a7d940ea8cc0
flask/testsuite/helpers.py
_from_import_re = re.compile(r'^\s*from flask import\s+') _direct_module_usage_re = re.compile(r'flask\.Module')
<mask> ast = None <mask> <mask> <mask> _string_re_part = r"('([^'\\]*(?:\\.[^'\\]*)*)'" \ <mask> r'|"([^"\\]*(?:\\.[^"\\]*)*)")' <mask> _url_for_re = re.compile(r'\b(url_for\()(%s)' % _string_re_part) <mask> _after_request_re = re.compile(r'((?:@\S+\.(?:app_)?))(after_request)(\b\s*$)(?m)...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e91b0c352d6493b2669c6da413fd0ed65cb6b7c
scripts/flask-07-upgrade.py
_module_constructor_re = re.compile(r'Module\(__name__\s*(?:,\s*(%s))?' % _string_re_part) _blueprint_related = [ (re.compile(r'request\.module'), 'request.blueprint'), (re.compile(r'register_module'), 'register_blueprint') ]
<mask> _string_re_part = r"('([^'\\]*(?:\\.[^'\\]*)*)'" \ <mask> r'|"([^"\\]*(?:\\.[^"\\]*)*)")' <mask> _url_for_re = re.compile(r'\b(url_for\()(%s)' % _string_re_part) <mask> _after_request_re = re.compile(r'((?:@\S+\.(?:app_)?))(after_request)(\b\s*$)(?m)') <mask> <mask> <mask> def error(me...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e91b0c352d6493b2669c6da413fd0ed65cb6b7c
scripts/flask-07-upgrade.py
new_contents = fix_teardown_funcs(new_contents) new_contents = rewrite_for_blueprints(new_contents, filename)
<mask> <mask> def upgrade_python_file(filename, contents, teardown): <mask> new_contents = fix_url_for(contents) <mask> if teardown: <mask> new_contents = fix_teardown_funcs(contents) <mask> make_diff(filename, contents, new_contents) <mask> <mask> <mask> def upgrade_template_file(filena...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5e91b0c352d6493b2669c6da413fd0ed65cb6b7c
scripts/flask-07-upgrade.py
server if we want to run that file as a standalone application::
<mask> def connect_db(): <mask> return sqlite3.connect(app.config['DATABASE']) <mask> <mask> Finally we just add a line to the bottom of the file that fires up the <mask> server if we run that file as standalone application:: <mask> <mask> if __name__ == '__main__': <mask> app.run() <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5ede53066fc26d993dd229fe0c54209e700f4c09
docs/tutorial/setup.rst
The one with the highest id (the newest entry) will be on top. The rows returned from the cursor are tuples with the columns ordered like specified in the select statement. This is good enough for small applications like here, but you might want to convert them into a dict. If you are interested in how to do that, c...
<mask> ------------ <mask> <mask> This view shows all the entries stored in the database. It listens on the <mask> root of the application and will select title and text from the database. <mask> The one with the highest id (the newest entry) on top. The rows returned <mask> from the cursor are tuples with the...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5ede53066fc26d993dd229fe0c54209e700f4c09
docs/tutorial/views.rst
`logged_in` key in the session. If the user logged in successfully, that key is set to `True`, and the user is redirected back to the `show_entries` page. In addition, a message is flashed that informs the user that he or she was logged in successfully. If an error occurred, the template is notified about that, and ...
<mask> ---------------- <mask> <mask> These functions are used to sign the user in and out. Login checks the <mask> username and password against the ones from the configuration and sets the <mask> `logged_in` key in the session. If the user logged in successfully that <mask> key is set to `True` and the user ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5ede53066fc26d993dd229fe0c54209e700f4c09
docs/tutorial/views.rst
The logout function, on the other hand, removes that key from the session
<mask> flash('You were logged in') <mask> return redirect(url_for('show_entries')) <mask> return render_template('login.html', error=error) <mask> <mask> The logout function on the other hand removes that key from the session <mask> again. We use a neat trick here: if you...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5ede53066fc26d993dd229fe0c54209e700f4c09
docs/tutorial/views.rst
of the dict and pass a second parameter to it (the default), the method
<mask> return render_template('login.html', error=error) <mask> <mask> The logout function on the other hand removes that key from the session <mask> again. We use a neat trick here: if you use the :meth:`~dict.pop` method <mask> of the dict and pass a second parameter to it (the default) the method <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5ede53066fc26d993dd229fe0c54209e700f4c09
docs/tutorial/views.rst
key is not in there. This is helpful because now we don't have to check if the user was logged in.
<mask> The logout function on the other hand removes that key from the session <mask> again. We use a neat trick here: if you use the :meth:`~dict.pop` method <mask> of the dict and pass a second parameter to it (the default) the method <mask> will delete the key from the dictionary if present or do nothing when t...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5ede53066fc26d993dd229fe0c54209e700f4c09
docs/tutorial/views.rst
<mask> import sys, os <mask> <mask> basedir = os.path.dirname(os.path.abspath(__file__)) <mask> sys.path.insert(0, basedir + '/../') <mask> <mask> from flaskr import flaskr </s> Update minitwit & improve testing for examples (#1954) * Update minitwit & improve testing for examples * Related to #1945 * Re-w...
[ "replace", "replace", "replace", "replace", "replace", "replace" ]
https://github.com/pallets/flask/commit/5f009374fd28aba381f375391b70ac131926bd9d
examples/flaskr/tests/context.py
<mask> :copyright: (c) 2015 by Armin Ronacher. <mask> :license: BSD, see LICENSE for more details. <mask> """ <mask> <mask> import pytest <mask> import os <mask> import tempfile <mask> <mask> from context import flaskr <mask> </s> Update minitwit & improve testing for examples (#1954) * Update mi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5f009374fd28aba381f375391b70ac131926bd9d
examples/flaskr/tests/test_flaskr.py
import pytest from flaskr import flaskr
<mask> """ <mask> <mask> import os <mask> import tempfile <mask> <mask> <mask> @pytest.fixture <mask> def client(request): <mask> db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp() </s> Update minitwit & improve testing for examples (#1954) * Update minitwit & improve testing for examples * ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5f009374fd28aba381f375391b70ac131926bd9d
examples/flaskr/tests/test_flaskr.py
<mask> import pytest <mask> import os <mask> import tempfile <mask> <mask> from context import flaskr <mask> <mask> @pytest.fixture <mask> def client(request): <mask> db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp() <mask> flaskr.app.config['TESTING'] = True </s> Update minitwit & improve ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/5f009374fd28aba381f375391b70ac131926bd9d
examples/flaskr/tests/test_flaskr.py
You betcha. Run the `python setup.py test` file to
<mask> http://localhost:5000/ <mask> <mask> ~ Is it tested? <mask> <mask> You betcha. Run the `test_minitwit.py` file to <mask> see the tests pass. </s> Update minitwit & improve testing for examples (#1954) * Update minitwit & improve testing for examples * Related to #1945 * Re...
[ "keep", "keep", "keep", "keep", "replace", "keep" ]
https://github.com/pallets/flask/commit/5f009374fd28aba381f375391b70ac131926bd9d
examples/minitwit/README
norecursedirs = .* *.egg *.egg-info env* artwork docs examples
<mask> [wheel] <mask> universal = 1 <mask> <mask> [pytest] <mask> norecursedirs = .* *.egg *.egg-info env* artwork docs </s> Update minitwit & improve testing for examples (#1954) * Update minitwit & improve testing for examples * Related to #1945 * Re-works minitwit to be installed and run as: pip i...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/pallets/flask/commit/5f009374fd28aba381f375391b70ac131926bd9d
setup.cfg
def reset_logging(pytestconfig):
<mask> wsgi_errors_stream <mask> <mask> <mask> @pytest.fixture(autouse=True) <mask> def reset_logging(monkeypatch): <mask> root_handlers = logging.root.handlers[:] <mask> root_level = logging.root.level <mask> <mask> logger = logging.getLogger('flask.app') <mask> logger.handlers = [] <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/604cc758fb6601782745572452715fc295dda011
tests/test_logging.py
logging.root.handlers = []
<mask> def reset_logging(pytestconfig): <mask> root_handlers = logging.root.handlers[:] <mask> root_level = logging.root.level <mask> <mask> logger = logging.getLogger('flask.app') <mask> logger.handlers = [] <mask> logger.setLevel(logging.NOTSET) <mask> </s> use config fixture, get plugi...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/604cc758fb6601782745572452715fc295dda011
tests/test_logging.py
logging_plugin = pytestconfig.pluginmanager.unregister( name='logging-plugin')
<mask> logger = logging.getLogger('flask.app') <mask> logger.handlers = [] <mask> logger.setLevel(logging.NOTSET) <mask> <mask> logging_plugin = pytest.config.pluginmanager.getplugin('logging-plugin') <mask> pytest.config.pluginmanager.unregister(name='logging-plugin') <mask> logging.roo...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/604cc758fb6601782745572452715fc295dda011
tests/test_logging.py
pytestconfig.pluginmanager.register(logging_plugin, 'logging-plugin')
<mask> logger.handlers = [] <mask> logger.setLevel(logging.NOTSET) <mask> <mask> if logging_plugin: <mask> pytest.config.pluginmanager.register(logging_plugin, 'logging-plugin') <mask> <mask> <mask> def test_logger(app): <mask> assert app.logger.name == 'flask.app' <mask> assert...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/604cc758fb6601782745572452715fc295dda011
tests/test_logging.py
$(MAKE) -C docs html dirhtml latex
<mask> find . -name '*.pyo' -exec rm -f {} + <mask> find . -name '*~' -exec rm -f {} + <mask> <mask> upload-docs: <mask> $(MAKE) -C docs dirhtml latex <mask> $(MAKE) -C docs/_build/latex all-pdf <mask> scp -r docs/_build/dirhtml/* pocoo.org:/var/www/flask.pocoo.org/docs/ <mask> scp -r docs/_build/latex/F...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/606b006e2391d12fec5313ce606d82463d7aad07
Makefile
cd docs/_build/; mv html flask-docs; zip -r flask-docs.zip flask-docs; mv flask-docs html
<mask> upload-docs: <mask> $(MAKE) -C docs html dirhtml latex <mask> $(MAKE) -C docs/_build/latex all-pdf <mask> scp -r docs/_build/dirhtml/* pocoo.org:/var/www/flask.pocoo.org/docs/ <mask> scp -r docs/_build/latex/Flask.pdf pocoo.org:/var/www/flask.pocoo.org/docs/flask-docs.pdf <mask> scp -r docs/_build/fla...
[ "keep", "keep", "add", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/606b006e2391d12fec5313ce606d82463d7aad07
Makefile
scp -r docs/_build/flask-docs.zip pocoo.org:/var/www/flask.pocoo.org/docs/
<mask> $(MAKE) -C docs/_build/latex all-pdf <mask> cd docs/_build/; mv html flask-docs; zip -r flask-docs.zip flask-docs; mv flask-docs html <mask> scp -r docs/_build/dirhtml/* pocoo.org:/var/www/flask.pocoo.org/docs/ <mask> scp -r docs/_build/latex/Flask.pdf pocoo.org:/var/www/flask.pocoo.org/docs/flask-docs.p...
[ "keep", "keep", "keep", "add" ]
https://github.com/pallets/flask/commit/606b006e2391d12fec5313ce606d82463d7aad07
Makefile
.. include:: contents.rst.inc
<mask> <mask> .. _Jinja2: http://jinja.pocoo.org/2/ <mask> .. _Werkzeug: http://werkzeug.pocoo.org/ <mask> <mask> .. include:: contents.rst </s> Fixed at least one build warning by renaming files. </s> remove .. include:: contents.rst </s> add .. include:: contents.rst.inc </s> remove $(MAKE) -C docs dirhtml ...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/pallets/flask/commit/606b006e2391d12fec5313ce606d82463d7aad07
docs/index.rst
.. include:: contents.rst.inc
<mask> Flask Documentation <mask> =================== <mask> <mask> .. include:: contents.rst </s> Fixed at least one build warning by renaming files. </s> remove .. include:: contents.rst </s> add .. include:: contents.rst.inc </s> remove $(MAKE) -C docs dirhtml latex </s> add $(MAKE) -C docs html dirhtml la...
[ "keep", "keep", "keep", "replace" ]
https://github.com/pallets/flask/commit/606b006e2391d12fec5313ce606d82463d7aad07
docs/latexindex.rst
- Hsiaoming Yang @lepture
<mask> - David Lord @davidism <mask> - Edmond Burnett <mask> - Florent Xicluna <mask> - Georg Brandl <mask> - Jeff Widman @jeffwidman <mask> - Joshua Bronson @jab <mask> - Justin Quick <mask> - Kenneth Reitz <mask> - Keyan Pishdadian <mask> - Marian Sigler </s> Remove python 2.6 and 3.3 everywhere. (#2583) <...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60eecb547d8af9916c55163c7356999ca2d5ffb9
AUTHORS
combinations of Python and dependencies. You need to have Python 2.7, 3.4, 3.5 3.6, and PyPy 2.7 installed to run all of the environments. Then run::
<mask> depends on which part of Flask you're working on. Travis-CI will run the full <mask> suite when you submit your pull request. <mask> <mask> The full test suite takes a long time to run because it tests multiple <mask> combinations of Python and dependencies. You need to have Python 2.6, 2.7, 3.3, <mask> 3...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60eecb547d8af9916c55163c7356999ca2d5ffb9
CONTRIBUTING.rst
sys.path.insert(0, '<your_local_path>/lib/python<your_python_version>/site-packages')
<mask> <mask> #!/usr/bin/python <mask> #: optional path to your local python site-packages folder <mask> import sys <mask> sys.path.insert(0, '<your_local_path>/lib/python2.6/site-packages') <mask> <mask> from flup.server.fcgi import WSGIServer <mask> from yourapplication import app <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60eecb547d8af9916c55163c7356999ca2d5ffb9
docs/deploying/fastcgi.rst
<mask> 'License :: OSI Approved :: BSD License', <mask> 'Operating System :: OS Independent', <mask> 'Programming Language :: Python', <mask> 'Programming Language :: Python :: 2', <mask> 'Programming Language :: Python :: 2.6', <mask> 'Programming Language :: Pytho...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60eecb547d8af9916c55163c7356999ca2d5ffb9
setup.py
<mask> 'Programming Language :: Python :: 2', <mask> 'Programming Language :: Python :: 2.6', <mask> 'Programming Language :: Python :: 2.7', <mask> 'Programming Language :: Python :: 3', <mask> 'Programming Language :: Python :: 3.3', <mask> 'Programming Language :...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60eecb547d8af9916c55163c7356999ca2d5ffb9
setup.py
$ virtualenv venv New python executable in venv/bin/python
<mask> folder within:: <mask> <mask> $ mkdir myproject <mask> $ cd myproject <mask> $ virtualenv env <mask> New python executable in env/bin/python <mask> Installing setuptools............done. <mask> <mask> Now, whenever you want to work on a project, you only have to activate the <mask...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60f7e3a7b463db68f3cc22085b6c5eaac985e7f7
docs/installation.rst
$ source venv/bin/activate
<mask> <mask> Now, whenever you want to work on a project, you only have to activate the <mask> corresponding environment. On OS X and Linux, do the following:: <mask> <mask> $ . env/bin/activate <mask> <mask> (Note the space between the dot and the script name. The dot means that this <mask> script sh...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60f7e3a7b463db68f3cc22085b6c5eaac985e7f7
docs/installation.rst
$ venv\scripts\activate
<mask> not work in your shell, try replacing the dot with ``source``.) <mask> <mask> If you are a Windows user, the following command is for you:: <mask> <mask> $ env\scripts\activate <mask> <mask> Either way, you should now be using your virtualenv (notice how the prompt of <mask> your shell has changed...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60f7e3a7b463db68f3cc22085b6c5eaac985e7f7
docs/installation.rst
$ pip install Flask
<mask> <mask> Now you can just enter the following command to get Flask activated in your <mask> virtualenv:: <mask> <mask> $ easy_install Flask <mask> <mask> A few seconds later and you are good to go. <mask> <mask> <mask> System-Wide Installation </s> vent and no more . </s> remove $ env\scrip...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60f7e3a7b463db68f3cc22085b6c5eaac985e7f7
docs/installation.rst
$ virtualenv venv --distribute
<mask> <mask> $ git clone http://github.com/mitsuhiko/flask.git <mask> Initialized empty Git repository in ~/dev/flask/.git/ <mask> $ cd flask <mask> $ virtualenv env <mask> $ . env/bin/activate <mask> New python executable in env/bin/python <mask> Installing setuptools............d...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60f7e3a7b463db68f3cc22085b6c5eaac985e7f7
docs/installation.rst
$ source env/bin/activate
<mask> New python executable in env/bin/python <mask> Installing setuptools............done. <mask> $ python setup.py develop <mask> ... <mask> Finished processing dependencies for Flask <mask> <mask> This will pull in the dependencies and activate the git head as the current <mask> version...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60f7e3a7b463db68f3cc22085b6c5eaac985e7f7
docs/installation.rst
$ virtualenv venv --distribute $ source venv/bin/activate New python executable in venv/bin/python Installing distribute............done.
<mask> To just get the development version without git, do this instead:: <mask> <mask> $ mkdir flask <mask> $ cd flask <mask> $ virtualenv env <mask> $ . env/bin/activate <mask> New python executable in env/bin/python <mask> Installing setuptools............done. <mask> $ pip inst...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/60f7e3a7b463db68f3cc22085b6c5eaac985e7f7
docs/installation.rst
- flask.json.jsonify now supports the datetime.date type
<mask> the user registered an overriding rule with the lowercase-version <mask> ``options`` (issue ``#1288``). <mask> <mask> Version 0.10.2 <mask> -------------- <mask> </s> Add datetime.date support to JSONEncoder </s> remove if isinstance(o, datetime): return http_date(o) </s> add ...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61263e08f9c763a6c2b3fec6428c972dea2f7cad
CHANGES
from datetime import date
<mask> :license: BSD, see LICENSE for more details. <mask> """ <mask> import io <mask> import uuid <mask> from datetime import datetime <mask> from .globals import current_app, request <mask> from ._compat import text_type, PY2 <mask> <mask> from werkzeug.http import http_date <mask> from jinja2 import M...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61263e08f9c763a6c2b3fec6428c972dea2f7cad
flask/json.py
if isinstance(o, date): return http_date(o.timetuple())
<mask> else: <mask> return list(iterable) <mask> return JSONEncoder.default(self, o) <mask> """ <mask> if isinstance(o, datetime): <mask> return http_date(o) <mask> if isinstance(o, uuid.UUID): <mask> return str(...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61263e08f9c763a6c2b3fec6428c972dea2f7cad
flask/json.py
import datetime
<mask> <mask> import os <mask> import flask <mask> from logging import StreamHandler <mask> from werkzeug.http import parse_cache_control_header, parse_options_header <mask> from werkzeug.http import http_date </s> Add datetime.date support to JSONEncoder </s> remove from datetime import datetime </s> add from...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61263e08f9c763a6c2b3fec6428c972dea2f7cad
tests/test_helpers.py
from werkzeug.http import http_date
<mask> import flask <mask> from logging import StreamHandler <mask> from werkzeug.http import parse_cache_control_header, parse_options_header <mask> from flask._compat import StringIO, text_type <mask> <mask> <mask> def has_encoding(name): </s> Add datetime.date support to JSONEncoder </s> remove from dateti...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61263e08f9c763a6c2b3fec6428c972dea2f7cad
tests/test_helpers.py
- Logger now only returns the debug log setting if it was not set explicitly.
<mask> - The :func:`flask.url_for` function now can generate anchors to the <mask> generated links. <mask> <mask> Version 0.8.1 <mask> ------------- <mask> <mask> Bugfix release, release date to be decided <mask> </s> Changed logic for debug level log settings </s> remove return DEBUG if app.d...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61a95196ac28771466ada43a1c01effda42040a5
CHANGES
if x.level == 0 and app.debug: return DEBUG return Logger.getEffectiveLevel(x)
<mask> Logger = getLoggerClass() <mask> <mask> class DebugLogger(Logger): <mask> def getEffectiveLevel(x): <mask> return DEBUG if app.debug else Logger.getEffectiveLevel(x) <mask> <mask> class DebugHandler(StreamHandler): <mask> def emit(x, record): <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61a95196ac28771466ada43a1c01effda42040a5
flask/logging.py
def test_debug_log_override(self): app = flask.Flask(__name__) app.debug = True app.logger_name = 'flask_tests/test_debug_log_override' app.logger.level = 10 self.assert_equal(app.logger.level, 10)
<mask> else: <mask> self.assert_(False, 'debug log ate the exception') <mask> <mask> def test_exception_logging(self): <mask> out = StringIO() <mask> app = flask.Flask(__name__) <mask> app.logger_name = 'flask_tests/test_exception_logging' <mask> ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61a95196ac28771466ada43a1c01effda42040a5
flask/testsuite/helpers.py
# Proxy exceptions don't have error codes. We want to always return # those unchanged as errors if e.code is None: return e
<mask> .. versionadded:: 0.3 <mask> """ <mask> handlers = self.error_handler_spec.get(request.blueprint) <mask> if handlers and e.code in handlers: <mask> handler = handlers[e.code] <mask> else: <mask> handler = self.error_handler_spec[None].get(e.c...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61d3bbf1d237cd8f03e37af88ad4a6b59f27d4e1
flask/app.py
# trap_http_exception method so that's their fault then. if isinstance(e, HTTPException) and not self.trap_http_exception(e):
<mask> <mask> # ensure not to trash sys.exc_info() at that point in case someone <mask> # wants the traceback preserved in handle_http_exception. Of course <mask> # we cannot prevent users from trashing it themselves in a custom <mask> # trap_http_exception method so that's their ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61d3bbf1d237cd8f03e37af88ad4a6b59f27d4e1
flask/app.py
suite.addTest(unittest.makeSuite(ExceptionTestCase))
<mask> <mask> def suite(): <mask> suite = unittest.TestSuite() <mask> suite.addTest(unittest.makeSuite(MemoryTestCase)) <mask> return suite </s> Fixed last commit and added test </s> remove # trap_http_exception method so that's their fault then. Proxy # exceptions generally must alw...
[ "keep", "keep", "keep", "add", "keep" ]
https://github.com/pallets/flask/commit/61d3bbf1d237cd8f03e37af88ad4a6b59f27d4e1
flask/testsuite/regression.py
from . import typing as ft
<mask> from . import cli <mask> from . import json <mask> from .config import Config <mask> from .config import ConfigAttribute <mask> from .ctx import _AppCtxGlobals <mask> from .ctx import AppContext <mask> from .ctx import RequestContext </s> access flask types through namespace alias </s> remove from .typin...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
<mask> from .signals import request_started <mask> from .signals import request_tearing_down <mask> from .templating import DispatchingJinjaLoader <mask> from .templating import Environment <mask> from .typing import BeforeFirstRequestCallable <mask> from .typing import ResponseReturnValue <mask> from .typing im...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
<mask> import typing_extensions as te <mask> from .blueprints import Blueprint <mask> from .testing import FlaskClient <mask> from .testing import FlaskCliRunner <mask> from .typing import ErrorHandlerCallable <mask> <mask> if sys.version_info >= (3, 8): <mask> iscoroutinefunction = ins...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
self.before_first_request_funcs: t.List[ft.BeforeFirstRequestCallable] = []
<mask> #: first request to this instance. To register a function, use the <mask> #: :meth:`before_first_request` decorator. <mask> #: <mask> #: .. versionadded:: 0.8 <mask> self.before_first_request_funcs: t.List[BeforeFirstRequestCallable] = [] <mask> <mask> #: A...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
self.teardown_appcontext_funcs: t.List[ft.TeardownCallable] = []
<mask> #: if the request ends this is the place to store code that disconnects <mask> #: from databases. <mask> #: <mask> #: .. versionadded:: 0.9 <mask> self.teardown_appcontext_funcs: t.List[TeardownCallable] = [] <mask> <mask> #: A list of shell context process...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
) -> t.Callable[[ft.TemplateFilterCallable], ft.TemplateFilterCallable]:
<mask> <mask> @setupmethod <mask> def template_filter( <mask> self, name: t.Optional[str] = None <mask> ) -> t.Callable[[TemplateFilterCallable], TemplateFilterCallable]: <mask> """A decorator that is used to register custom template filter. <mask> You can specify a name for ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
def decorator(f: ft.TemplateFilterCallable) -> ft.TemplateFilterCallable:
<mask> :param name: the optional name of the filter, otherwise the <mask> function name will be used. <mask> """ <mask> <mask> def decorator(f: TemplateFilterCallable) -> TemplateFilterCallable: <mask> self.add_template_filter(f, name=name) <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
self, f: ft.TemplateFilterCallable, name: t.Optional[str] = None
<mask> return decorator <mask> <mask> @setupmethod <mask> def add_template_filter( <mask> self, f: TemplateFilterCallable, name: t.Optional[str] = None <mask> ) -> None: <mask> """Register a custom template filter. Works exactly like the <mask> :meth:`template_filte...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
) -> t.Callable[[ft.TemplateTestCallable], ft.TemplateTestCallable]:
<mask> <mask> @setupmethod <mask> def template_test( <mask> self, name: t.Optional[str] = None <mask> ) -> t.Callable[[TemplateTestCallable], TemplateTestCallable]: <mask> """A decorator that is used to register custom template test. <mask> You can specify a name for the test...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
def decorator(f: ft.TemplateTestCallable) -> ft.TemplateTestCallable:
<mask> :param name: the optional name of the test, otherwise the <mask> function name will be used. <mask> """ <mask> <mask> def decorator(f: TemplateTestCallable) -> TemplateTestCallable: <mask> self.add_template_test(f, name=name) <mask> ret...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
self, f: ft.TemplateTestCallable, name: t.Optional[str] = None
<mask> return decorator <mask> <mask> @setupmethod <mask> def add_template_test( <mask> self, f: TemplateTestCallable, name: t.Optional[str] = None <mask> ) -> None: <mask> """Register a custom template test. Works exactly like the <mask> :meth:`template_test` decor...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
) -> t.Callable[[ft.TemplateGlobalCallable], ft.TemplateGlobalCallable]:
<mask> <mask> @setupmethod <mask> def template_global( <mask> self, name: t.Optional[str] = None <mask> ) -> t.Callable[[TemplateGlobalCallable], TemplateGlobalCallable]: <mask> """A decorator that is used to register a custom template global function. <mask> You can specify ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
def decorator(f: ft.TemplateGlobalCallable) -> ft.TemplateGlobalCallable:
<mask> :param name: the optional name of the global function, otherwise the <mask> function name will be used. <mask> """ <mask> <mask> def decorator(f: TemplateGlobalCallable) -> TemplateGlobalCallable: <mask> self.add_template_global(f, name=name) <mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
self, f: ft.TemplateGlobalCallable, name: t.Optional[str] = None
<mask> return decorator <mask> <mask> @setupmethod <mask> def add_template_global( <mask> self, f: TemplateGlobalCallable, name: t.Optional[str] = None <mask> ) -> None: <mask> """Register a custom template global function. Works exactly like the <mask> :meth:`templa...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
self, f: ft.BeforeFirstRequestCallable ) -> ft.BeforeFirstRequestCallable:
<mask> self.jinja_env.globals[name or f.__name__] = f <mask> <mask> @setupmethod <mask> def before_first_request( <mask> self, f: BeforeFirstRequestCallable <mask> ) -> BeforeFirstRequestCallable: <mask> """Registers a function to be run before the first request to this <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
def teardown_appcontext(self, f: ft.TeardownCallable) -> ft.TeardownCallable:
<mask> self.before_first_request_funcs.append(f) <mask> return f <mask> <mask> @setupmethod <mask> def teardown_appcontext(self, f: TeardownCallable) -> TeardownCallable: <mask> """Registers a function to be called when the application context <mask> ends. These function...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
def _find_error_handler(self, e: Exception) -> t.Optional[ft.ErrorHandlerCallable]:
<mask> """ <mask> self.shell_context_processors.append(f) <mask> return f <mask> <mask> def _find_error_handler(self, e: Exception) -> t.Optional["ErrorHandlerCallable"]: <mask> """Return a registered error handler for an exception in this order: <mask> blueprint hand...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
) -> t.Union[HTTPException, ft.ResponseReturnValue]:
<mask> return None <mask> <mask> def handle_http_exception( <mask> self, e: HTTPException <mask> ) -> t.Union[HTTPException, ResponseReturnValue]: <mask> """Handles an HTTP exception. By default this will invoke the <mask> registered error handlers and fall back to retur...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
) -> t.Union[HTTPException, ft.ResponseReturnValue]:
<mask> return False <mask> <mask> def handle_user_exception( <mask> self, e: Exception <mask> ) -> t.Union[HTTPException, ResponseReturnValue]: <mask> """This method is called whenever an exception occurs that <mask> should be handled. A special case is :class:`~werkzeug ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
server_error: t.Union[InternalServerError, ft.ResponseReturnValue]
<mask> <mask> raise e <mask> <mask> self.log_exception(exc_info) <mask> server_error: t.Union[InternalServerError, ResponseReturnValue] <mask> server_error = InternalServerError(original_exception=e) <mask> handler = self._find_error_handler(server_error) <mask> <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
def dispatch_request(self) -> ft.ResponseReturnValue:
<mask> from .debughelpers import FormDataRoutingRedirect <mask> <mask> raise FormDataRoutingRedirect(request) <mask> <mask> def dispatch_request(self) -> ResponseReturnValue: <mask> """Does the request dispatching. Matches the URL and returns the <mask> return value of the ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
rv: t.Union[ft.ResponseReturnValue, HTTPException],
<mask> return self.finalize_request(rv) <mask> <mask> def finalize_request( <mask> self, <mask> rv: t.Union[ResponseReturnValue, HTTPException], <mask> from_error_handler: bool = False, <mask> ) -> Response: <mask> """Given the return value from a view function t...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py