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
As you noticed, ``init_app`` does not assign ``app`` to ``self``. This is intentional! Class based Flask extensions must only store the application on the object when the application was passed to the constructor. This tells the extension: I am not interested in using multiple applications.
<mask> Keep in mind that supporting this factory pattern for creating apps is required <mask> for approved flask extensions (described below). <mask> <mask> <mask> Using _request_ctx_stack <mask> ------------------------ <mask> <mask> In the example above, before every request, a ``sqlite3_db`` variable is a...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
docs/extensiondev.rst
Another thing of note is that the request context will automatically also create an :ref:`application context <app-context>` when it's pushed and there is no application context for that application so far.
<mask> stack again. On popping the application's <mask> :func:`~flask.Flask.teardown_request` functions are also executed. <mask> <mask> .. _callbacks-and-errors: <mask> <mask> Callbacks and Errors <mask> -------------------- <mask> <mask> What happens if an error occurs in Flask during request processing?...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
docs/reqcontext.rst
request_tearing_down, appcontext_tearing_down
<mask> from .module import blueprint_is_module <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 <mask> <mask> # a lock used for ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/app.py
#: A list of functions that are called when the application context #: is destroyed. Since the application context is also torn down #: if the request ends this is the place to store code that disconnects #: from databases. #: #: .. versionadded:: 0.9 self.teardo...
<mask> self.teardown_request_funcs = {} <mask> <mask> #: A dictionary with lists of functions that can be used as URL <mask> #: value processor functions. Whenever a URL is built these functions <mask> #: are called to modify the dictionary of values in place. The key <mask> ...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/app.py
When a teardown function was called because of a exception it will be passed an error object.
<mask> that they will fail. If they do execute code that might fail they <mask> will have to surround the execution of these code by try/except <mask> statements and log ocurring errors. <mask> """ <mask> self.teardown_request_funcs.setdefault(None, []).append(f) <mask> ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/app.py
def do_teardown_request(self, exc=None):
<mask> if not self.session_interface.is_null_session(ctx.session): <mask> self.save_session(ctx.session, response) <mask> return response <mask> <mask> def do_teardown_request(self): <mask> """Called after the actual request dispatching and will <mask> call every ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/app.py
.. versionchanged:: 0.9 Added the `exc` argument. Previously this was always using the current exception information.
<mask> call every as :meth:`teardown_request` decorated function. This is <mask> not actually called by the :class:`Flask` object itself but is always <mask> triggered when the request context is popped. That way we have a <mask> tighter control over certain resources under testing...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/app.py
if exc is None: exc = sys.exc_info()[1]
<mask> .. versionchanged:: 0.9 <mask> Added the `exc` argument. Previously this was always using the <mask> current exception information. <mask> """ <mask> funcs = reversed(self.teardown_request_funcs.get(None, ())) <mask> bp = _request_ctx_stack.top.request...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/app.py
<mask> funcs = reversed(self.teardown_request_funcs.get(None, ())) <mask> bp = _request_ctx_stack.top.request.blueprint <mask> if bp is not None and bp in self.teardown_request_funcs: <mask> funcs = chain(funcs, reversed(self.teardown_request_funcs[bp])) <mask> exc = sys...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/app.py
request_tearing_down.send(self, exc=exc) def do_teardown_appcontext(self, exc=None): """Called when an application context is popped. This works pretty much the same as :meth:`do_teardown_request` but for the application context. .. versionadded:: 0.9 """ i...
<mask> funcs = chain(funcs, reversed(self.teardown_request_funcs[bp])) <mask> exc = sys.exc_info()[1] <mask> for func in funcs: <mask> rv = func(exc) <mask> if rv is not None: <mask> return rv <mask> request_tearing_down.send(self) <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/app.py
def pop(self, exc=None):
<mask> self.session = self.app.open_session(self.request) <mask> if self.session is None: <mask> self.session = self.app.make_null_session() <mask> <mask> def pop(self): <mask> """Pops the request context and unbinds it by doing that. This will <mask> also trigge...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/ctx.py
def test_app_tearing_down(self): cleanup_stuff = [] app = flask.Flask(__name__) @app.teardown_appcontext def cleanup(exception): cleanup_stuff.append(exception) with app.app_context(): pass self.assert_equal(cleanup_stuff, [None])
<mask> with app.app_context(): <mask> self.assert_equal(flask.current_app._get_current_object(), app) <mask> self.assert_equal(flask._app_ctx_stack.top, None) <mask> <mask> <mask> def suite(): <mask> suite = unittest.TestSuite() <mask> suite.addTest(unittest.makeSuite(AppCo...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bed20c07c40a163077b936f740a4e96a6213688
flask/testsuite/appctx.py
``app, code``, ``blueprint, exception``, ``app, exception``. (`#2314`_) - ``Cookie`` is added to the response's ``Vary`` header if the session is accessed at all during the request (and not deleted). (`#2288`_) - :meth:`~Flask.test_request_context` accepts ``subdomain`` and ``url_scheme`` arguments for use when...
<mask> although `pip install -e` should still be preferred. (`#2414`_) <mask> - ``View.provide_automatic_options = True`` is set on the view function from <mask> ``View.as_view``, to be detected in ``app.add_url_rule``. (`#2316`_) <mask> - Error handling will try handlers registered for ``blueprint, code``, <m...
[ "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/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
CHANGES.rst
- Template auto reloading will honor debug mode even even if :attr:`~Flask.jinja_env` was already accessed. (`#2373`_)
<mask> - Removed error handler caching because it caused unexpected results for some <mask> exception inheritance hierarchies. Register handlers explicitly for each <mask> exception if you don't want to traverse the MRO. (`#2362`_) <mask> - Fix incorrect JSON encoding of aware, non-UTC datetimes. (`#2374`_) <m...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
CHANGES.rst
- ``Flask.init_jinja_globals`` - extend :meth:`Flask.create_jinja_environment` instead. - ``Flask.error_handlers`` - tracked by :attr:`Flask.error_handler_spec`, use :meth:`Flask.errorhandler` to register handlers. - ``Flask.request_globals_class`` - use :attr:`Flask.app_ctx_globals_class` instead...
<mask> <mask> - ``flask.ext`` - import extensions directly by their name instead of <mask> through the ``flask.ext`` namespace. For example, <mask> ``import flask.ext.sqlalchemy`` becomes ``import flask_sqlalchemy``. <mask> - ``Flask.init_jinja_globals`` - extend ``Flask.create_jinja_environment`` <m...
[ "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/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
CHANGES.rst
.. _#1559: https://github.com/pallets/flask/issues/1559
<mask> <mask> .. _pallets/meta#24: https://github.com/pallets/meta/issues/24 <mask> .. _#1421: https://github.com/pallets/flask/issues/1421 <mask> .. _#1489: https://github.com/pallets/flask/pull/1489 <mask> .. _#1621: https://github.com/pallets/flask/pull/1621 <mask> .. _#1898: https://github.com/pallets/flask/...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
CHANGES.rst
Building the docs ~~~~~~~~~~~~~~~~~ Build the docs in the ``docs`` directory using Sphinx:: cd docs make html Open ``_build/html/index.html`` in your browser to view the docs. Read more about `Sphinx <http://www.sphinx-doc.org>`_. make targets ~~~~~~~~~~~~
<mask> <mask> Running the full test suite with ``tox`` will combine the coverage reports <mask> from all runs. <mask> <mask> ``make`` targets <mask> ~~~~~~~~~~~~~~~~ <mask> <mask> Flask provides a ``Makefile`` with various shortcuts. They will ensure that <mask> all dependencies are installed. <mask> <ma...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
CONTRIBUTING.rst
Redistribution and use in source and binary forms of the software as well as documentation, with or without modification, are permitted provided that the following conditions are met:
<mask> for more details. <mask> <mask> Some rights reserved. <mask> <mask> Redistribution and use in source and binary forms of the software as well <mask> as documentation, with or without modification, are permitted provided <mask> that the following conditions are met: <mask> <mask> * Redistributions of ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
LICENSE
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
<mask> Redistribution and use in source and binary forms of the software as well <mask> as documentation, with or without modification, are permitted provided <mask> that the following conditions are met: <mask> <mask> * Redistributions of source code must retain the above copyright <mask> notice, this list of...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
LICENSE
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
<mask> <mask> * Redistributions of source code must retain the above copyright <mask> notice, this list of conditions and the following disclaimer. <mask> <mask> * Redistributions in binary form must reproduce the above <mask> copyright notice, this list of conditions and the following <mask> disclaimer ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
LICENSE
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
<mask> copyright notice, this list of conditions and the following <mask> disclaimer in the documentation and/or other materials provided <mask> with the distribution. <mask> <mask> * The names of the contributors may not be used to endorse or <mask> promote products derived from this software without sp...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
LICENSE
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE...
<mask> promote products derived from this software without specific <mask> prior written permission. <mask> <mask> THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND <mask> CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT <mask> NOT LIMITED TO, THE IMPLIED WARR...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
LICENSE
include Makefile CHANGES.rst LICENSE AUTHORS tox.ini
<mask> include Makefile CHANGES LICENSE AUTHORS tox.ini <mask> <mask> graft artwork <mask> graft tests <mask> graft examples <mask> graft docs </s> update project metadata new readme readme as setup.py long_description links in changes git in authors add travis osx env break out docs build in travis remove pyth...
[ "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
MANIFEST.in
<mask> test: clean-pyc install-dev <mask> pytest <mask> <mask> coverage: clean-pyc install-dev <mask> pip install -q -e .[test] <mask> coverage run -m pytest <mask> coverage report <mask> coverage html <mask> <mask> cov: coverage </s> update project metadata new readme readme as setup.py long_descript...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
Makefile
<mask> clean-pyc: <mask> find . -name '*.pyc' -exec rm -f {} + <mask> find . -name '*.pyo' -exec rm -f {} + <mask> find . -name '*~' -exec rm -f {} + <mask> <mask> upload-docs: <mask> $(MAKE) -C docs html dirhtml latex epub <mask> $(MAKE) -C docs/_build/latex all-pdf <mask> cd docs/_build/; mv html flas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
Makefile
:alt: Flask: web development, one drop at a time :class: floatingflask
<mask> Welcome to Flask <mask> ================ <mask> <mask> .. image:: _static/logo-full.png <mask> :alt: Flask: web development, one drop at a time <mask> :class: floatingflask <mask> <mask> Welcome to Flask's documentation. This documentation is divided into <mask> different parts. I recommend th...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
docs/index.rst
Welcome to Flask's documentation. Get started with :ref:`installation` and then get an overview with the :ref:`quickstart`. There is also a more detailed :ref:`tutorial` that shows how to create a small but complete application with Flask. Common patterns are described in the :ref:`patterns` section. The rest of the do...
<mask> .. image:: _static/logo-full.png <mask> :alt: Flask: web development, one drop at a time <mask> :class: floatingflask <mask> <mask> Welcome to Flask's documentation. This documentation is divided into <mask> different parts. I recommend that you get started with <mask> :ref:`installation` and the...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
docs/index.rst
Flask depends on the `Jinja`_ template engine and the `Werkzeug`_ WSGI toolkit. The documentation for these libraries can be found at:
<mask> you'd rather dive into the internals of Flask, check out <mask> the :ref:`api` documentation. Common patterns are described in the <mask> :ref:`patterns` section. <mask> <mask> Flask depends on two external libraries: the `Jinja2`_ template <mask> engine and the `Werkzeug`_ WSGI toolkit. These libraries...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
docs/index.rst
- `Jinja documentation <http://jinja.pocoo.org/docs>`_ - `Werkzeug documentation <http://werkzeug.pocoo.org/docs>`_
<mask> engine and the `Werkzeug`_ WSGI toolkit. These libraries are not documented <mask> here. If you want to dive into their documentation, check out the <mask> following links: <mask> <mask> - `Jinja2 Documentation <http://jinja.pocoo.org/docs>`_ <mask> - `Werkzeug Documentation <http://werkzeug.pocoo.o...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
docs/index.rst
.. _Jinja: https://www.palletsprojects.com/p/jinja/ .. _Werkzeug: https://www.palletsprojects.com/p/werkzeug/
<mask> <mask> - `Jinja2 Documentation <http://jinja.pocoo.org/docs>`_ <mask> - `Werkzeug Documentation <http://werkzeug.pocoo.org/docs>`_ <mask> <mask> <mask> .. _Jinja2: http://jinja.pocoo.org/ <mask> .. _Werkzeug: http://werkzeug.pocoo.org/ <mask> <mask> .. include:: contents.rst.inc </s> update pro...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
docs/index.rst
<mask> #!/usr/bin/env python <mask> # -*- coding: utf-8 -*- <mask> """ <mask> make-release <mask> ~~~~~~~~~~~~ <mask> <mask> Helper script that performs a release. Does pretty much everything <mask> automatically for us. <mask> <mask> :copyright: (c) 2015 by Armin Ronacher. <mask> ...
[ "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
<mask> :copyright: (c) 2015 by Armin Ronacher. <mask> :license: BSD, see LICENSE for more details. <mask> """ <mask> from __future__ import print_function <mask> import sys <mask> import os <mask> import re <mask> from datetime import datetime, date <mask> from subprocess import Popen, PIPE <mask> <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
import sys from datetime import date, datetime from subprocess import PIPE, Popen
<mask> from __future__ import print_function <mask> import sys <mask> import os <mask> import re <mask> from datetime import datetime, date <mask> from subprocess import Popen, PIPE <mask> <mask> _date_clean_re = re.compile(r'(\d+)(st|nd|rd|th)') <mask> <mask> <mask> def parse_changelog(): </s> update pr...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')
<mask> import re <mask> from datetime import datetime, date <mask> from subprocess import Popen, PIPE <mask> <mask> _date_clean_re = re.compile(r'(\d+)(st|nd|rd|th)') <mask> <mask> <mask> def parse_changelog(): <mask> with open('CHANGES.rst') as f: <mask> lineiter = iter(f) </s> update project...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
if next(lineiter).count('-') != len(match.group(0)):
<mask> match = re.search('^Version\s+(.*)', line.strip()) <mask> if match is None: <mask> continue <mask> version = match.group(1).strip() <mask> if lineiter.next().count('-') != len(match.group(0)): <mask> continue <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
change_info = next(lineiter).strip()
<mask> version = match.group(1).strip() <mask> if lineiter.next().count('-') != len(match.group(0)): <mask> continue <mask> while 1: <mask> change_info = lineiter.next().strip() <mask> if change_info: <mask> b...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
match = re.search( r'released on (\w+\s+\d+\w+\s+\d+)(?:, codename (.*))?', change_info, flags=re.IGNORECASE )
<mask> change_info = lineiter.next().strip() <mask> if change_info: <mask> break <mask> <mask> match = re.search(r'released on (\w+\s+\d+\w+\s+\d+)' <mask> r'(?:, codename (.*))?(?i)', change_info) <mask> i...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
parts = [int(i) for i in version.split('.')]
<mask> <mask> <mask> def bump_version(version): <mask> try: <mask> parts = map(int, version.split('.')) <mask> except ValueError: <mask> fail('Current version is not numeric') <mask> parts[-1] += 1 <mask> return '.'.join(map(str, parts)) <mask> </s> update project metadata ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
string = _date_strip_re.sub('', string)
<mask> return '.'.join(map(str, parts)) <mask> <mask> <mask> def parse_date(string): <mask> string = _date_clean_re.sub(r'\1', string) <mask> return datetime.strptime(string, '%B %d %Y') <mask> <mask> <mask> def set_filename_version(filename, version_number, pattern): <mask> changed = [] ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
contents = re.sub( r"^(\s*%s\s*=\s*')(.+?)(')" % pattern, inject_version, f.read(), flags=re.DOTALL | re.MULTILINE )
<mask> before, old, after = match.groups() <mask> changed.append(True) <mask> return before + version_number + after <mask> with open(filename) as f: <mask> contents = re.sub(r"^(\s*%s\s*=\s*')(.+?)(')(?sm)" % pattern, <mask> inject_version, f.read()) ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
def build(): cmd = [sys.executable, 'setup.py', 'sdist', 'bdist_wheel'] Popen(cmd).wait()
<mask> info('Setting __init__.py version to %s', version) <mask> set_filename_version('flask/__init__.py', version, '__version__') <mask> <mask> <mask> def build_and_upload(): <mask> Popen([sys.executable, 'setup.py', 'release', 'sdist', 'bdist_wheel', 'upload']).wait() <mask> <mask> <mask> def...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
return set( Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines() )
<mask> print(message % args, file=sys.stderr) <mask> <mask> <mask> def get_git_tags(): <mask> return set(Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines()) <mask> <mask> <mask> def git_is_clean(): <mask> return Popen(['git', 'diff', '--quiet']).wait() == 0 <mask> </s> update p...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
dev_version = bump_version(version) + '.dev'
<mask> if rv is None: <mask> fail('Could not parse changelog') <mask> <mask> version, release_date, codename = rv <mask> dev_version = bump_version(version) + '-dev' <mask> <mask> info('Releasing %s (codename %s, release date %s)', <mask> version, codename, release_date.strfti...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
info( 'Releasing %s (codename %s, release date %s)', version, codename, release_date.strftime('%d/%m/%Y') )
<mask> <mask> version, release_date, codename = rv <mask> dev_version = bump_version(version) + '-dev' <mask> <mask> info('Releasing %s (codename %s, release date %s)', <mask> version, codename, release_date.strftime('%d/%m/%Y')) <mask> tags = get_git_tags() <mask> <mask> if ver...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
fail( 'Release date is not today (%s != %s)', release_date.date(), date.today() )
<mask> <mask> if version in tags: <mask> fail('Version "%s" is already tagged', version) <mask> if release_date.date() != date.today(): <mask> fail('Release date is not today (%s != %s)', <mask> release_date.date(), date.today()) <mask> <mask> if not git_is_clean(): <...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
try: import wheel # noqa: F401 except ImportError: fail('You need to install the wheel package.')
<mask> if not git_is_clean(): <mask> fail('You have uncommitted changes in git') <mask> <mask> set_init_version(version) <mask> make_git_commit('Bump version number to %s', version) <mask> make_git_tag(version) <mask> build() <mask> set_init_version(dev_version) <mask> </s> u...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
build()
<mask> <mask> set_init_version(version) <mask> make_git_commit('Bump version number to %s', version) <mask> make_git_tag(version) <mask> build_and_upload() <mask> set_init_version(dev_version) <mask> <mask> <mask> if __name__ == '__main__': <mask> main() </s> update project metadat...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
scripts/make-release.py
release = egg_info -Db ''
<mask> [aliases] <mask> release = egg_info -RDb '' <mask> <mask> [bdist_wheel] <mask> universal = 1 <mask> <mask> [metadata] </s> update project metadata new readme readme as setup.py long_description links in changes git in authors add travis osx env break out docs build in travis remove python_requires for ...
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
setup.cfg
#!/usr/bin/env python import io
<mask> """ <mask> Flask <mask> ----- <mask> <mask> Flask is a microframework for Python based on Werkzeug, Jinja 2 and good <mask> intentions. And before you ask: It's BSD licensed! <mask> <mask> Flask is Fun <mask> ```````````` <mask> <mask> Save in a hello.py: <mask> <mask> .. code:: python <mask> ...
[ "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "rep...
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
setup.py
<mask> <https://github.com/pallets/flask/zipball/master#egg=Flask-dev>`_ <mask> <mask> """ <mask> import re <mask> import ast <mask> from setuptools import setup <mask> <mask> _version_re = re.compile(r'__version__\s+=\s+(.*)') <mask> <mask> with open('flask/__init__.py', 'rb') as f: </s> update project...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
setup.py
with io.open('README.rst', 'rt', encoding='utf8') as f: readme = f.read()
<mask> import re <mask> import ast <mask> from setuptools import setup <mask> <mask> _version_re = re.compile(r'__version__\s+=\s+(.*)') <mask> <mask> with open('flask/__init__.py', 'rb') as f: <mask> version = str(ast.literal_eval(_version_re.search( <mask> f.read().decode('utf-8')).group(1))) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
setup.py
with io.open('flask/__init__.py', 'rt', encoding='utf8') as f: version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
<mask> from setuptools import setup <mask> <mask> _version_re = re.compile(r'__version__\s+=\s+(.*)') <mask> <mask> with open('flask/__init__.py', 'rb') as f: <mask> version = str(ast.literal_eval(_version_re.search( <mask> f.read().decode('utf-8')).group(1))) <mask> <mask> setup( <mask> na...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
setup.py
url='https://www.palletsprojects.com/p/flask/',
<mask> <mask> setup( <mask> name='Flask', <mask> version=version, <mask> url='https://github.com/pallets/flask/', <mask> license='BSD', <mask> author='Armin Ronacher', <mask> author_email='armin.ronacher@active-4.com', <mask> description='A microframework based on Werkzeug, Jinja2 ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
setup.py
description='A simple framework for building complex web applications.', long_description=readme,
<mask> url='https://github.com/pallets/flask/', <mask> license='BSD', <mask> author='Armin Ronacher', <mask> author_email='armin.ronacher@active-4.com', <mask> description='A microframework based on Werkzeug, Jinja2 ' <mask> 'and good intentions', <mask> long_description=_...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
setup.py
<mask> packages=['flask', 'flask.json'], <mask> include_package_data=True, <mask> zip_safe=False, <mask> platforms='any', <mask> python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', <mask> install_requires=[ <mask> 'Werkzeug>=0.14', <mask> 'Jinja2>=2.10', <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9bf5c3b3a3bdc3f2f2dcca2b5747378470d0d354
setup.py
if (entry.startswith('flask.ext.') or entry.startswith('flask_') or entry.startswith('flaskext.')) and value is not None:
<mask> class ExtImportHookTestCase(FlaskTestCase): <mask> <mask> def setup(self): <mask> for entry, value in sys.modules.items(): <mask> if entry.startswith('flask.ext.') and value is not None: <mask> sys.modules.pop(entry, None) <mask> from flask import ext <mas...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9c82840f5256e8aca82c26ab4025712e5c928977
flask/testsuite/ext.py
def test_flaskext_new_package_import_submodule_function(self): from flask.ext.newext_package.submodule import test_function self.assert_equal(test_function(), 42)
<mask> self.assert_equal(newext_package.__name__, 'flask_newext_package') <mask> <mask> def test_flaskext_new_package_import_submodule(self): <mask> from flask.ext.newext_package import submodule <mask> self.assert_equal(submodule.__name__, 'flask_newext_package.submodule') <mask> ...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9c82840f5256e8aca82c26ab4025712e5c928977
flask/testsuite/ext.py
def test_flaskext_old_package_import_submodule_function(self): from flask.ext.oldext_package.submodule import test_function self.assert_equal(test_function(), 42)
<mask> from flask.ext.oldext_package import submodule <mask> self.assert_equal(submodule.__name__, 'flaskext.oldext_package.submodule') <mask> self.assert_equal(submodule.test_function(), 42) <mask> <mask> <mask> def suite(): <mask> suite = unittest.TestSuite() <mask> suite.add...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9c82840f5256e8aca82c26ab4025712e5c928977
flask/testsuite/ext.py
return flask.redirect('/getsession')
<mask> <mask> @app.route('/', methods=['GET', 'POST']) <mask> def index(): <mask> if flask.request.method == 'POST': <mask> return flask.redirect('/redirect') <mask> flask.session['data'] = 'foo' <mask> return 'index' <mask> <mask> @...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9c8f138a42aa43ee8177ed84df5946f8ef6d0c58
flask/testsuite/testing.py
@app.route('/getsession') def get_session(): return flask.session.get('data', '<missing>')
<mask> return flask.redirect('/redirect') <mask> flask.session['data'] = 'foo' <mask> return 'index' <mask> <mask> @app.route('/redirect') <mask> def redirect(): <mask> return 'redirect' <mask> <mask> with app.test_client() as c: <m...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9c8f138a42aa43ee8177ed84df5946f8ef6d0c58
flask/testsuite/testing.py
rv = c.get('/getsession') assert rv.data == '<missing>'
<mask> def redirect(): <mask> return 'redirect' <mask> <mask> with app.test_client() as c: <mask> ctx = app.test_request_context() <mask> ctx.push() <mask> rv = c.get('/') <mask> assert rv.data == 'index' <mask> assert fla...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9c8f138a42aa43ee8177ed84df5946f8ef6d0c58
flask/testsuite/testing.py
assert rv.data == 'foo' # XXX: Currently the test client does not support # keeping the context around if a redirect is followed. # This would be nice to fix but right now the Werkzeug # test client does not support that. ##assert flask.session.ge...
<mask> rv = c.get('/') <mask> assert rv.data == 'index' <mask> assert flask.session.get('data') == 'foo' <mask> rv = c.post('/', data={}, follow_redirects=True) <mask> assert rv.data == 'redirect' <mask> assert flask.session.get('data') == 'f...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9c8f138a42aa43ee8177ed84df5946f8ef6d0c58
flask/testsuite/testing.py
self.assert_(req is not None)
<mask> with app.test_client() as c: <mask> rv = c.get('/') <mask> req = flask.request._get_current_object() <mask> with c.session_transaction(): <mask> self.assert_(req is flask.request._get_current_object()) <mask> <mask> def test_session_transact...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9c8f138a42aa43ee8177ed84df5946f8ef6d0c58
flask/testsuite/testing.py
- Signals are always available. ``blinker>=1.6.2`` is a required dependency. The ``signals_available`` attribute is deprecated. :issue:`5056`
<mask> - The ``locked_cached_property`` decorator is deprecated. Use a lock inside the <mask> decorated function if locking is needed. :issue:`4993` <mask> - Remove uses of locks that could cause requests to block each other very briefly. <mask> :issue:`4993` <mask> - Use modern packaging metadata wi...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
CHANGES.rst
Signals are provided by the `Blinker`_ library. See :doc:`signals` for an introduction.
<mask> <mask> Signals <mask> ------- <mask> <mask> .. versionadded:: 0.6 <mask> <mask> .. data:: signals.signals_available <mask> <mask> ``True`` if the signaling system is available. This is the case <mask> when `blinker`_ is installed. </s> blinker is required, signals are always available </s> r...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/api.rst
.. _blinker: https://blinker.readthedocs.io/
<mask> ------- <mask> <mask> .. versionadded:: 0.6 <mask> <mask> .. data:: signals.signals_available <mask> <mask> ``True`` if the signaling system is available. This is the case <mask> when `blinker`_ is installed. <mask> <mask> The following signals exist in Flask: <mask> <mask> .. data:: templ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/api.rst
.. data:: signals.signals_available
<mask> message_flashed.connect(record, app) <mask> <mask> .. versionadded:: 0.10 <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> a...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/api.rst
.. deprecated:: 2.3 Will be removed in Flask 2.4. Signals are always available
<mask> do nothing but will fail with a :exc:`RuntimeError` for all other <mask> operations, including connecting. <mask> <mask> <mask> .. _blinker: https://pypi.org/project/blinker/ <mask> <mask> <mask> Class-Based Views <mask> ----------------- <mask> </s> blinker is required, signals are a...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/api.rst
The application will call functions registered with :meth:`~Flask.teardown_appcontext` when the application context is popped.
<mask> <mask> Events and Signals <mask> ------------------ <mask> <mask> The application will call functions registered with <mask> :meth:`~Flask.teardown_appcontext` when the application context is <mask> popped. <mask> <mask> If :data:`~signals.signals_available` is true, the following signals are <mask>...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/appcontext.rst
The following signals are sent: :data:`appcontext_pushed`, :data:`appcontext_tearing_down`, and :data:`appcontext_popped`.
<mask> The application will call functions registered with <mask> :meth:`~Flask.teardown_appcontext` when the application context is <mask> popped. <mask> <mask> If :data:`~signals.signals_available` is true, the following signals are <mask> sent: :data:`appcontext_pushed`, :data:`appcontext_tearing_down`, and ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/appcontext.rst
* `Blinker`_ provides support for :doc:`signals`.
<mask> to protect Flask's session cookie. <mask> * `Click`_ is a framework for writing command line applications. It provides <mask> the ``flask`` command and allows adding custom management commands. <mask> <mask> .. _Werkzeug: https://palletsprojects.com/p/werkzeug/ <mask> .. _Jinja: https://palletsproject...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/installation.rst
.. _Blinker: https://blinker.readthedocs.io/
<mask> .. _Jinja: https://palletsprojects.com/p/jinja/ <mask> .. _MarkupSafe: https://palletsprojects.com/p/markupsafe/ <mask> .. _ItsDangerous: https://palletsprojects.com/p/itsdangerous/ <mask> .. _Click: https://palletsprojects.com/p/click/ <mask> <mask> <mask> Optional dependencies <mask> ~~~~~~~~~~~~~~~~...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/installation.rst
<mask> <mask> These distributions will not be installed automatically. Flask will detect and <mask> use them if you install them. <mask> <mask> * `Blinker`_ provides support for :doc:`signals`. <mask> * `python-dotenv`_ enables support for :ref:`dotenv` when running ``flask`` <mask> commands. <mask> * `Watc...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/installation.rst
<mask> commands. <mask> * `Watchdog`_ provides a faster, more efficient reloader for the development <mask> server. <mask> <mask> .. _Blinker: https://blinker.readthedocs.io/en/stable/ <mask> .. _python-dotenv: https://github.com/theskumar/python-dotenv#readme <mask> .. _watchdog: https://pythonhosted.org/w...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/installation.rst
The following signals are sent: #. :data:`request_started` is sent before the :meth:`~Flask.before_request` functions are called. #. :data:`request_finished` is sent after the :meth:`~Flask.after_request` functions are called. #. :data:`got_request_exception` is sent when an exception begins to be handled, ...
<mask> <mask> Signals <mask> ~~~~~~~ <mask> <mask> If :data:`~signals.signals_available` is true, the following signals are <mask> sent: <mask> <mask> #. :data:`request_started` is sent before the <mask> :meth:`~Flask.before_request` functions are called. <mask> <mask> #. :data:`request_finished` i...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/reqcontext.rst
Signals are a lightweight way to notify subscribers of certain events during the lifecycle of the application and each request. When an event occurs, it emits the signal, which calls each subscriber. Signals are implemented by the `Blinker`_ library. See its documentation for detailed information. Flask provides some ...
<mask> Signals <mask> ======= <mask> <mask> .. versionadded:: 0.6 <mask> <mask> Starting with Flask 0.6, there is integrated support for signalling in <mask> Flask. This support is provided by the excellent `blinker`_ library and <mask> will gracefully fall back if it is not available. <mask> <mask> What ...
[ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", ...
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/signals.rst
<mask> with captured_templates(app, templates, **extra): <mask> ... <mask> template, context = templates[0] <mask> <mask> .. admonition:: Blinker API Changes <mask> <mask> The :meth:`~blinker.base.Signal.connected_to` method arrived in Blinker <mask> with version 1.1. <mask> <mask...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/signals.rst
<mask> The name for the signal here makes it unique and also simplifies <mask> debugging. You can access the name of the signal with the <mask> :attr:`~blinker.base.NamedSignal.name` attribute. <mask> <mask> .. admonition:: For Extension Developers <mask> <mask> If you are writing a Flask extension and you...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/signals.rst
You can also easily subscribe to signals by using the
<mask> <mask> Decorator Based Signal Subscriptions <mask> ------------------------------------ <mask> <mask> With Blinker 1.1 you can also easily subscribe to signals by using the new <mask> :meth:`~blinker.base.NamedSignal.connect_via` decorator:: <mask> <mask> from flask import template_rendered <mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/signals.rst
<mask> @template_rendered.connect_via(app) <mask> def when_template_rendered(sender, template, context, **extra): <mask> print(f'Template {template.name} is rendered with {context}') <mask> <mask> Core Signals <mask> ------------ <mask> <mask> Take a look at :ref:`core-signals-list` for a list...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
docs/signals.rst
test = ["pytest"]
<mask> [project.urls] <mask> Documentation = "https://flask.palletsprojects.com/patterns/jquery/" <mask> <mask> [project.optional-dependencies] <mask> test = ["pytest", "blinker"] <mask> <mask> [build-system] <mask> requires = ["setuptools"] <mask> build-backend = "setuptools.build_meta" <mask> </s> blink...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
examples/javascript/pyproject.toml
"blinker>=1.6.2",
<mask> "itsdangerous>=2.0", <mask> "click>=8.0", <mask> "importlib-metadata>=3.6.0; python_version < '3.10'", <mask> ] <mask> dynamic = ["version"] <mask> </s> blinker is required, signals are always available </s> remove blinker </s> add </s> remove "blinker.*", </s> add </s> remove blinker...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
pyproject.toml
<mask> <mask> [[tool.mypy.overrides]] <mask> module = [ <mask> "asgiref.*", <mask> "blinker.*", <mask> "dotenv.*", <mask> "cryptography.*", <mask> "importlib_metadata", <mask> ] <mask> ignore_missing_imports = true </s> blinker is required, signals are always available </s> remove test =...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
pyproject.toml
<mask> packaging==23.0 <mask> # via build <mask> pyproject-hooks==1.0.0 <mask> # via build <mask> tomli==2.0.1 <mask> # via build </s> blinker is required, signals are always available </s> remove blinker==1.6.1 # via -r requirements/tests.in exceptiongroup==1.1.1 # via pytest greenlet==2.0.2...
[ "keep", "keep", "keep", "keep", "replace", "replace" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
requirements/build.txt
# SHA1:575f86f45391b662630a6080f0a12676215eb0cf
<mask> # SHA1:4de7d9e6254a945fd97ec10880dd23b6cd43b70d <mask> # <mask> # This file is autogenerated by pip-compile-multi <mask> # To update, run: <mask> # <mask> # pip-compile-multi </s> blinker is required, signals are always available </s> remove # SHA1:30698f5f4f9cba5088318306829a15b0dc123b38 </s> add # S...
[ "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
requirements/tests-pallets-min.txt
blinker==1.6.2 # via -r requirements/tests-pallets-min.in
<mask> # To update, run: <mask> # <mask> # pip-compile-multi <mask> # <mask> click==8.0.0 <mask> # via -r requirements/tests-pallets-min.in <mask> itsdangerous==2.0.0 <mask> # via -r requirements/tests-pallets-min.in <mask> jinja2==3.0.0 <mask> # via -r requirements/tests-pallets-min.in </s> b...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
requirements/tests-pallets-min.txt
<mask> pytest <mask> asgiref <mask> blinker <mask> greenlet ; python_version < "3.11" <mask> python-dotenv>=1; python_version >= "3.8" </s> blinker is required, signals are always available </s> remove tomli==2.0.1 # via pytest typing-extensions==4.5.0 # via blinker </s> add </s> remove blinker==1.6.1 ...
[ "keep", "keep", "replace", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
requirements/tests.in
# SHA1:3c8dde35aba20388b22430b17974af8ef8205b4f
<mask> # SHA1:30698f5f4f9cba5088318306829a15b0dc123b38 <mask> # <mask> # This file is autogenerated by pip-compile-multi <mask> # To update, run: <mask> # <mask> # pip-compile-multi </s> blinker is required, signals are always available </s> remove # SHA1:4de7d9e6254a945fd97ec10880dd23b6cd43b70d </s> add # S...
[ "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
requirements/tests.txt
<mask> # pip-compile-multi <mask> # <mask> asgiref==3.6.0 <mask> # via -r requirements/tests.in <mask> blinker==1.6.1 <mask> # via -r requirements/tests.in <mask> exceptiongroup==1.1.1 <mask> # via pytest <mask> greenlet==2.0.2 ; python_version < "3.11" <mask> # via -r requirements/tests.in...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
requirements/tests.txt
<mask> pytest==7.3.0 <mask> # via -r requirements/tests.in <mask> python-dotenv==1.0.0 ; python_version >= "3.8" <mask> # via -r requirements/tests.in <mask> tomli==2.0.1 <mask> # via pytest <mask> typing-extensions==4.5.0 <mask> # via blinker </s> blinker is required, signals are always availa...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
requirements/tests.txt
<mask> mypy-extensions==1.0.0 <mask> # via mypy <mask> pycparser==2.21 <mask> # via cffi <mask> tomli==2.0.1 <mask> # via mypy <mask> types-contextvars==2.4.7.2 <mask> # via -r requirements/typing.in <mask> types-dataclasses==0.6.6 <mask> # via -r requirements/typing.in <mask> types-setup...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
requirements/typing.txt
<mask> from .signals import message_flashed as message_flashed <mask> from .signals import request_finished as request_finished <mask> from .signals import request_started as request_started <mask> from .signals import request_tearing_down as request_tearing_down <mask> from .signals import signals_available as si...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
src/flask/__init__.py
if name == "signals_available": import warnings warnings.warn( "'signals_available' is deprecated and will be removed in Flask 2.4." " Signals are always available", DeprecationWarning, stacklevel=2, ) return True
<mask> stacklevel=2, <mask> ) <mask> return Markup <mask> <mask> raise AttributeError(name) </s> blinker is required, signals are always available </s> remove pytestmark = pytest.mark.skipif( blinker is None, reason="Signals require the blinker library." ) </s> add </s> rem...
[ "keep", "keep", "keep", "add", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
src/flask/__init__.py
from __future__ import annotations
<mask> import typing as t <mask> <mask> try: <mask> from blinker import Namespace <mask> <mask> signals_available = True <mask> except ImportError: <mask> signals_available = False <mask> <mask> class Namespace: # type: ignore <mask> def signal(self, name: str, doc: t.Optional[str...
[ "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "rep...
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
src/flask/signals.py
import typing as t import warnings
<mask> <mask> def send(self, *args: t.Any, **kwargs: t.Any) -> t.Any: <mask> pass <mask> <mask> def _fail(self, *args: t.Any, **kwargs: t.Any) -> t.Any: <mask> raise RuntimeError( <mask> "Signalling support is unavailable because the blinker" <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
src/flask/signals.py
from blinker import Namespace
<mask> import warnings <mask> <mask> <mask> # This namespace is only for signals provided by Flask itself. <mask> _signals = Namespace() <mask> <mask> template_rendered = _signals.signal("template-rendered") </s> blinker is required, signals are always available </s> remove # The namespace for code signals. ...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
src/flask/signals.py
# This namespace is only for signals provided by Flask itself.
<mask> has_receivers_for = receivers_for = _fail <mask> del _fail <mask> <mask> <mask> # The namespace for code signals. If you are not Flask code, do <mask> # not put signals in here. Create your own namespace instead. <mask> _signals = Namespace() <mask> <mask> <mask> # Core signals. ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
src/flask/signals.py
<mask> # The namespace for code signals. If you are not Flask code, do <mask> # not put signals in here. Create your own namespace instead. <mask> _signals = Namespace() <mask> <mask> <mask> # Core signals. For usage examples grep the source code or consult <mask> # the API documentation in docs/api.rst as ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
src/flask/signals.py
<mask> import pytest <mask> <mask> try: <mask> import blinker <mask> except ImportError: <mask> blinker = None <mask> <mask> import flask <mask> <mask> pytestmark = pytest.mark.skipif( <mask> blinker is None, reason="Signals require the blinker library." <mask> ) </s> blinker is required, si...
[ "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
tests/test_signals.py
<mask> blinker = None <mask> <mask> import flask <mask> <mask> pytestmark = pytest.mark.skipif( <mask> blinker is None, reason="Signals require the blinker library." <mask> ) <mask> <mask> <mask> def test_template_rendered(app, client): <mask> @app.route("/") <mask> def index(): <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9cb1a7a52d7927071e2b737d52f902f006969e82
tests/test_signals.py