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
def make_response(self, rv: ft.ResponseReturnValue) -> Response:
<mask> ) from None <mask> <mask> return asgiref_async_to_sync(func) <mask> <mask> def make_response(self, rv: ResponseReturnValue) -> Response: <mask> """Convert the return value from a view function to an instance of <mask> :attr:`response_class`. <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
rv = self.response_class.force_type( rv, request.environ # type: ignore[arg-type] )
<mask> elif isinstance(rv, BaseResponse) or callable(rv): <mask> # evaluate a WSGI callable, or coerce a different response <mask> # class to the correct type <mask> try: <mask> rv = self.response_class.force_type(rv, request.environ) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
def preprocess_request(self) -> t.Optional[ft.ResponseReturnValue]:
<mask> raise <mask> <mask> raise error <mask> <mask> def preprocess_request(self) -> t.Optional[ResponseReturnValue]: <mask> """Called before the request is dispatched. Calls <mask> :attr:`url_value_preprocessors` registered with the app and the <mask> current b...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/app.py
from . import typing as ft
<mask> import typing as t <mask> from collections import defaultdict <mask> from functools import update_wrapper <mask> <mask> from .scaffold import _endpoint_from_view_func <mask> from .scaffold import _sentinel <mask> from .scaffold import Scaffold <mask> <mask> if t.TYPE_CHECKING: </s> access flask types...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
<mask> <mask> from .scaffold import _endpoint_from_view_func <mask> from .scaffold import _sentinel <mask> from .scaffold import Scaffold <mask> from .typing import AfterRequestCallable <mask> from .typing import BeforeFirstRequestCallable <mask> from .typing import BeforeRequestCallable <mask> from .typing im...
[ "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/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
<mask> from .typing import URLValuePreprocessorCallable <mask> <mask> if t.TYPE_CHECKING: <mask> from .app import Flask <mask> from .typing import ErrorHandlerCallable <mask> <mask> DeferredSetupFunction = t.Callable[["BlueprintSetupState"], t.Callable] <mask> <mask> <mask> class BlueprintSetupSta...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
) -> t.Callable[[ft.TemplateFilterCallable], ft.TemplateFilterCallable]:
<mask> ) <mask> <mask> def app_template_filter( <mask> self, name: t.Optional[str] = None <mask> ) -> t.Callable[[TemplateFilterCallable], TemplateFilterCallable]: <mask> """Register a custom template filter, available application wide. Like <mask> :meth:`Flask.template_...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.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_app_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/blueprints.py
self, f: ft.TemplateFilterCallable, name: t.Optional[str] = None
<mask> <mask> return decorator <mask> <mask> def add_app_template_filter( <mask> self, f: TemplateFilterCallable, name: t.Optional[str] = None <mask> ) -> None: <mask> """Register a custom template filter, available application wide. Like <mask> :meth:`Flask.add_templa...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
) -> t.Callable[[ft.TemplateTestCallable], ft.TemplateTestCallable]:
<mask> self.record_once(register_template) <mask> <mask> def app_template_test( <mask> self, name: t.Optional[str] = None <mask> ) -> t.Callable[[TemplateTestCallable], TemplateTestCallable]: <mask> """Register a custom template test, available application wide. Like <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.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_app_template_test(f, name=name) <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
self, f: ft.TemplateTestCallable, name: t.Optional[str] = None
<mask> <mask> return decorator <mask> <mask> def add_app_template_test( <mask> self, f: TemplateTestCallable, name: t.Optional[str] = None <mask> ) -> None: <mask> """Register a custom template test, available application wide. Like <mask> :meth:`Flask.add_template_tes...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
) -> t.Callable[[ft.TemplateGlobalCallable], ft.TemplateGlobalCallable]:
<mask> self.record_once(register_template) <mask> <mask> def app_template_global( <mask> self, name: t.Optional[str] = None <mask> ) -> t.Callable[[TemplateGlobalCallable], TemplateGlobalCallable]: <mask> """Register a custom template global, available application wide. Like <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
def decorator(f: ft.TemplateGlobalCallable) -> ft.TemplateGlobalCallable:
<mask> :param name: the optional name of the global, otherwise the <mask> function name will be used. <mask> """ <mask> <mask> def decorator(f: TemplateGlobalCallable) -> TemplateGlobalCallable: <mask> self.add_app_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/blueprints.py
self, f: ft.TemplateGlobalCallable, name: t.Optional[str] = None
<mask> <mask> return decorator <mask> <mask> def add_app_template_global( <mask> self, f: TemplateGlobalCallable, name: t.Optional[str] = None <mask> ) -> None: <mask> """Register a custom template global, available application wide. Like <mask> :meth:`Flask.add_templa...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
def before_app_request( self, f: ft.BeforeRequestCallable ) -> ft.BeforeRequestCallable:
<mask> state.app.jinja_env.globals[name or f.__name__] = f <mask> <mask> self.record_once(register_template) <mask> <mask> def before_app_request(self, f: BeforeRequestCallable) -> BeforeRequestCallable: <mask> """Like :meth:`Flask.before_request`. Such a function is executed <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
self, f: ft.BeforeFirstRequestCallable ) -> ft.BeforeFirstRequestCallable:
<mask> ) <mask> return f <mask> <mask> def before_app_first_request( <mask> self, f: BeforeFirstRequestCallable <mask> ) -> BeforeFirstRequestCallable: <mask> """Like :meth:`Flask.before_first_request`. Such a function is <mask> executed before the first request...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
def after_app_request(self, f: ft.AfterRequestCallable) -> ft.AfterRequestCallable:
<mask> """ <mask> self.record_once(lambda s: s.app.before_first_request_funcs.append(f)) <mask> return f <mask> <mask> def after_app_request(self, f: AfterRequestCallable) -> AfterRequestCallable: <mask> """Like :meth:`Flask.after_request` but for a blueprint. Such a function...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
def teardown_app_request(self, f: ft.TeardownCallable) -> ft.TeardownCallable:
<mask> lambda s: s.app.after_request_funcs.setdefault(None, []).append(f) <mask> ) <mask> return f <mask> <mask> def teardown_app_request(self, f: TeardownCallable) -> TeardownCallable: <mask> """Like :meth:`Flask.teardown_request` but for a blueprint. Such a <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
self, f: ft.TemplateContextProcessorCallable ) -> ft.TemplateContextProcessorCallable:
<mask> ) <mask> return f <mask> <mask> def app_context_processor( <mask> self, f: TemplateContextProcessorCallable <mask> ) -> TemplateContextProcessorCallable: <mask> """Like :meth:`Flask.context_processor` but for a blueprint. Such a <mask> function is execute...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
def decorator(f: ft.ErrorHandlerCallable) -> ft.ErrorHandlerCallable:
<mask> """Like :meth:`Flask.errorhandler` but for a blueprint. This <mask> handler is used for all requests, even if outside of the blueprint. <mask> """ <mask> <mask> def decorator(f: "ErrorHandlerCallable") -> "ErrorHandlerCallable": <mask> self.record_once(lambda s...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
self, f: ft.URLValuePreprocessorCallable ) -> ft.URLValuePreprocessorCallable:
<mask> <mask> return decorator <mask> <mask> def app_url_value_preprocessor( <mask> self, f: URLValuePreprocessorCallable <mask> ) -> URLValuePreprocessorCallable: <mask> """Same as :meth:`url_value_preprocessor` but application wide.""" <mask> self.record_once( <mask>...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
def app_url_defaults(self, f: ft.URLDefaultCallable) -> ft.URLDefaultCallable:
<mask> lambda s: s.app.url_value_preprocessors.setdefault(None, []).append(f) <mask> ) <mask> return f <mask> <mask> def app_url_defaults(self, f: URLDefaultCallable) -> URLDefaultCallable: <mask> """Same as :meth:`url_defaults` but application wide.""" <mask> sel...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/blueprints.py
from . import typing as ft
<mask> from werkzeug.exceptions import HTTPException <mask> <mask> from .globals import _app_ctx_stack <mask> from .globals import _request_ctx_stack <mask> from .signals import appcontext_popped <mask> from .signals import appcontext_pushed <mask> <mask> if t.TYPE_CHECKING: </s> access flask types through n...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/ctx.py
<mask> from .globals import _app_ctx_stack <mask> from .globals import _request_ctx_stack <mask> from .signals import appcontext_popped <mask> from .signals import appcontext_pushed <mask> from .typing import AfterRequestCallable <mask> <mask> if t.TYPE_CHECKING: <mask> from .app import Flask <mask> f...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/ctx.py
def after_this_request(f: ft.AfterRequestCallable) -> ft.AfterRequestCallable:
<mask> return f"<flask.g of {top.app.name!r}>" <mask> return object.__repr__(self) <mask> <mask> <mask> def after_this_request(f: AfterRequestCallable) -> AfterRequestCallable: <mask> """Executes a function after this request. This is useful to modify <mask> response objects. The ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/ctx.py
self._after_request_functions: t.List[ft.AfterRequestCallable] = []
<mask> <mask> # Functions that should be executed after the request on the response <mask> # object. These will be called before the regular "after_request" <mask> # functions. <mask> self._after_request_functions: t.List[AfterRequestCallable] = [] <mask> <mask> @property ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/ctx.py
from . import typing as ft
<mask> from jinja2 import FileSystemLoader <mask> from werkzeug.exceptions import default_exceptions <mask> from werkzeug.exceptions import HTTPException <mask> <mask> from .cli import AppGroup <mask> from .globals import current_app <mask> from .helpers import get_root_path <mask> from .helpers import locked_...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
<mask> from .helpers import get_root_path <mask> from .helpers import locked_cached_property <mask> from .helpers import send_from_directory <mask> from .templating import _default_template_ctx_processor <mask> from .typing import AfterRequestCallable <mask> from .typing import AppOrBlueprintKey <mask> from .typ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
<mask> from .typing import URLValuePreprocessorCallable <mask> <mask> if t.TYPE_CHECKING: <mask> from .wrappers import Response <mask> from .typing import ErrorHandlerCallable <mask> <mask> # a singleton sentinel value for parameter defaults <mask> _sentinel = object() <mask> <mask> F = t.TypeVar("...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
ft.AppOrBlueprintKey, t.Dict[t.Optional[int], t.Dict[t.Type[Exception], ft.ErrorHandlerCallable]],
<mask> #: <mask> #: This data structure is internal. It should not be modified <mask> #: directly and its format may change at any time. <mask> self.error_handler_spec: t.Dict[ <mask> AppOrBlueprintKey, <mask> t.Dict[t.Optional[int], t.Dict[t.Type[Exception]...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
ft.AppOrBlueprintKey, t.List[ft.BeforeRequestCallable]
<mask> #: <mask> #: This data structure is internal. It should not be modified <mask> #: directly and its format may change at any time. <mask> self.before_request_funcs: t.Dict[ <mask> AppOrBlueprintKey, t.List[BeforeRequestCallable] <mask> ] = defaultdict(list...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
ft.AppOrBlueprintKey, t.List[ft.AfterRequestCallable]
<mask> #: <mask> #: This data structure is internal. It should not be modified <mask> #: directly and its format may change at any time. <mask> self.after_request_funcs: t.Dict[ <mask> AppOrBlueprintKey, t.List[AfterRequestCallable] <mask> ] = defaultdict(list) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
ft.AppOrBlueprintKey, t.List[ft.TeardownCallable]
<mask> #: <mask> #: This data structure is internal. It should not be modified <mask> #: directly and its format may change at any time. <mask> self.teardown_request_funcs: t.Dict[ <mask> AppOrBlueprintKey, t.List[TeardownCallable] <mask> ] = defaultdict(list) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
ft.AppOrBlueprintKey, t.List[ft.TemplateContextProcessorCallable]
<mask> #: <mask> #: This data structure is internal. It should not be modified <mask> #: directly and its format may change at any time. <mask> self.template_context_processors: t.Dict[ <mask> AppOrBlueprintKey, t.List[TemplateContextProcessorCallable] <mask> ] ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
ft.AppOrBlueprintKey, t.List[ft.URLValuePreprocessorCallable],
<mask> #: <mask> #: This data structure is internal. It should not be modified <mask> #: directly and its format may change at any time. <mask> self.url_value_preprocessors: t.Dict[ <mask> AppOrBlueprintKey, <mask> t.List[URLValuePreprocessorCallable], <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
ft.AppOrBlueprintKey, t.List[ft.URLDefaultCallable]
<mask> #: <mask> #: This data structure is internal. It should not be modified <mask> #: directly and its format may change at any time. <mask> self.url_default_functions: t.Dict[ <mask> AppOrBlueprintKey, t.List[URLDefaultCallable] <mask> ] = defaultdict(list) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
def before_request(self, f: ft.BeforeRequestCallable) -> ft.BeforeRequestCallable:
<mask> <mask> return decorator <mask> <mask> @setupmethod <mask> def before_request(self, f: BeforeRequestCallable) -> BeforeRequestCallable: <mask> """Register a function to run before each request. <mask> <mask> For example, this can be used to open a database connection, or...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
def after_request(self, f: ft.AfterRequestCallable) -> ft.AfterRequestCallable:
<mask> self.before_request_funcs.setdefault(None, []).append(f) <mask> return f <mask> <mask> @setupmethod <mask> def after_request(self, f: AfterRequestCallable) -> AfterRequestCallable: <mask> """Register a function to run after each request to this object. <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
def teardown_request(self, f: ft.TeardownCallable) -> ft.TeardownCallable:
<mask> self.after_request_funcs.setdefault(None, []).append(f) <mask> return f <mask> <mask> @setupmethod <mask> def teardown_request(self, f: TeardownCallable) -> TeardownCallable: <mask> """Register a function to be run at the end of each request, <mask> regardless of w...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
self, f: ft.TemplateContextProcessorCallable ) -> ft.TemplateContextProcessorCallable:
<mask> return f <mask> <mask> @setupmethod <mask> def context_processor( <mask> self, f: TemplateContextProcessorCallable <mask> ) -> TemplateContextProcessorCallable: <mask> """Registers a template context processor function.""" <mask> self.template_context_processo...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
self, f: ft.URLValuePreprocessorCallable ) -> ft.URLValuePreprocessorCallable:
<mask> return f <mask> <mask> @setupmethod <mask> def url_value_preprocessor( <mask> self, f: URLValuePreprocessorCallable <mask> ) -> URLValuePreprocessorCallable: <mask> """Register a URL value preprocessor function for all view <mask> functions in the application....
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
def url_defaults(self, f: ft.URLDefaultCallable) -> ft.URLDefaultCallable:
<mask> self.url_value_preprocessors[None].append(f) <mask> return f <mask> <mask> @setupmethod <mask> def url_defaults(self, f: URLDefaultCallable) -> URLDefaultCallable: <mask> """Callback function for URL defaults for all view functions of the <mask> application. It's ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
) -> t.Callable[[ft.ErrorHandlerCallable], ft.ErrorHandlerCallable]:
<mask> <mask> @setupmethod <mask> def errorhandler( <mask> self, code_or_exception: t.Union[t.Type[Exception], int] <mask> ) -> t.Callable[["ErrorHandlerCallable"], "ErrorHandlerCallable"]: <mask> """Register a function to handle errors by code or exception class. <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
def decorator(f: ft.ErrorHandlerCallable) -> ft.ErrorHandlerCallable:
<mask> :param code_or_exception: the code as integer for the handler, or <mask> an arbitrary exception <mask> """ <mask> <mask> def decorator(f: "ErrorHandlerCallable") -> "ErrorHandlerCallable": <mask> self.register_error_handler(code_or_exce...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
f: ft.ErrorHandlerCallable,
<mask> @setupmethod <mask> def register_error_handler( <mask> self, <mask> code_or_exception: t.Union[t.Type[Exception], int], <mask> f: "ErrorHandlerCallable", <mask> ) -> None: <mask> """Alternative error attach function to the :meth:`errorhandler` <mask> de...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/scaffold.py
from . import typing as ft
<mask> import typing as t <mask> <mask> from .globals import current_app <mask> from .globals import request <mask> <mask> <mask> http_method_funcs = frozenset( </s> access flask types through namespace alias </s> remove from .typing import ResponseReturnValue </s> add </s> remove from .typing import After...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/views.py
<mask> import typing as t <mask> <mask> from .globals import current_app <mask> from .globals import request <mask> from .typing import ResponseReturnValue <mask> <mask> <mask> http_method_funcs = frozenset( <mask> ["get", "post", "head", "options", "delete", "put", "trace", "patch"] <mask> ) </s> acc...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/views.py
def dispatch_request(self) -> ft.ResponseReturnValue:
<mask> #: <mask> #: .. versionadded:: 0.8 <mask> decorators: t.List[t.Callable] = [] <mask> <mask> def dispatch_request(self) -> ResponseReturnValue: <mask> """Subclasses have to override this method to implement the <mask> actual view function code. This method is called with a...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/views.py
def view(*args: t.Any, **kwargs: t.Any) -> ft.ResponseReturnValue:
<mask> The arguments passed to :meth:`as_view` are forwarded to the <mask> constructor of the class. <mask> """ <mask> <mask> def view(*args: t.Any, **kwargs: t.Any) -> ResponseReturnValue: <mask> self = view.view_class(*class_args, **class_kwargs) # type: ignore <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/views.py
def dispatch_request(self, *args: t.Any, **kwargs: t.Any) -> ft.ResponseReturnValue:
<mask> <mask> app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter')) <mask> """ <mask> <mask> def dispatch_request(self, *args: t.Any, **kwargs: t.Any) -> ResponseReturnValue: <mask> meth = getattr(self, request.method.lower(), None) <mask> <mask> # If the reque...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/61f62e6005f72c44a90026e2589b6bc5234f2f24
src/flask/views.py
def make_test_environ_builder(app, path='/', base_url=None, *args, **kwargs):
<mask> except ImportError: <mask> from urlparse import urlsplit as url_parse <mask> <mask> <mask> def make_test_environ_builder(app, path='/', base_url=None, json=None, *args, **kwargs): <mask> """Creates a new test builder with some application defaults thrown in.""" <mask> http_host = app.config....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/62b0b6652aab03fcf7c411de4d2cbd242ed05ec9
flask/testing.py
if 'json' in kwargs:
<mask> path = url.path <mask> if url.query: <mask> path += '?' + url.query <mask> <mask> if json is not None: <mask> if 'data' in kwargs: <mask> raise ValueError('Client cannot provide both `json` and `data`') <mask> kwargs['data'] = json_...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/62b0b6652aab03fcf7c411de4d2cbd242ed05ec9
flask/testing.py
kwargs['data'] = json_dumps(kwargs['json'])
<mask> <mask> if json is not None: <mask> if 'data' in kwargs: <mask> raise ValueError('Client cannot provide both `json` and `data`') <mask> kwargs['data'] = json_dumps(json) <mask> <mask> # Only set Content-Type when not explicitly provided <mask> if 'content_...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/62b0b6652aab03fcf7c411de4d2cbd242ed05ec9
flask/testing.py
- The builtin run method now takes the ``SERVER_NAME`` into account when picking the default port to run on.
<mask> - Added the ``JSONIFY_PRETTYPRINT_REGULAR`` configuration variable. <mask> - Flask now orders JSON keys by default to not trash HTTP caches due to <mask> different hash seeds between different workers. <mask> - Added `appcontext_pushed` and `appcontext_popped` signals. <mask> <mask> Version 0.9 <mask> ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/62dbe0e1ca8b0fc4a0d5384948db6112cfaf91d2
CHANGES
.. versionchanged:: 0.10 The default port is now picked from the ``SEVER_NAME`` variable.
<mask> Setting ``use_debugger`` to `True` without being in debug mode <mask> won't catch any exceptions because there won't be any to <mask> catch. <mask> <mask> :param host: the hostname to listen on. Set this to ``'0.0.0.0'`` to <mask> have the serv...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/62dbe0e1ca8b0fc4a0d5384948db6112cfaf91d2
flask/app.py
:param port: the port of the webserver. Defaults to ``5000`` or the port defined in the ``SERVER_NAME`` config variable if present.
<mask> <mask> :param host: the hostname to listen on. Set this to ``'0.0.0.0'`` to <mask> have the server available externally as well. Defaults to <mask> ``'127.0.0.1'``. <mask> :param port: the port of the webserver. Defaults to ``5000``. <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/62dbe0e1ca8b0fc4a0d5384948db6112cfaf91d2
flask/app.py
server_name = self.config['SERVER_NAME'] if server_name and ':' in server_name: port = int(server_name.rsplit(':', 1)[1]) else: port = 5000
<mask> from werkzeug.serving import run_simple <mask> if host is None: <mask> host = '127.0.0.1' <mask> if port is None: <mask> port = 5000 <mask> if debug is not None: <mask> self.debug = bool(debug) <mask> options.setdefault('use_relo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/62dbe0e1ca8b0fc4a0d5384948db6112cfaf91d2
flask/app.py
folder in the root path of the application. Defaults to None.
<mask> at `static_url_path`. Defaults to the ``'static'`` <mask> folder in the root path of the application. <mask> :param host_matching: sets the app's ``url_map.host_matching`` to the given <mask> given value. Defaults to False. <...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/637eae548935ad1434459c1afac286c8686abeed
flask/app.py
# check for any in blueprint or app for name, c in ((request.blueprint, code), (None, code), (request.blueprint, None), (None, None)): handler = find_handler(self.error_handler_spec.get(name, {}).get(c))
<mask> # cache for next time exc_class is raised <mask> handler_map[exc_class] = handler <mask> return handler <mask> <mask> # try blueprint handlers <mask> handler = find_handler(self.error_handler_spec <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "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/637eae548935ad1434459c1afac286c8686abeed
flask/app.py
if handler: return handler
<mask> handler = find_handler(self.error_handler_spec[None][None]) <mask> except KeyError: <mask> handler = None <mask> <mask> return handler <mask> <mask> def handle_http_exception(self, e): <mask> """Handles an HTTP exception. By default this will invoke ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/637eae548935ad1434459c1afac286c8686abeed
flask/app.py
from werkzeug.exceptions import ( Forbidden, InternalServerError, HTTPException, NotFound )
<mask> # -*- coding: utf-8 -*- <mask> from werkzeug.exceptions import Forbidden, InternalServerError, HTTPException, NotFound <mask> import flask <mask> <mask> <mask> def test_error_handler_no_match(): <mask> app = flask.Flask(__name__) </s> Added support for generic HTTPException handlers on app and blue...
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/637eae548935ad1434459c1afac286c8686abeed
tests/test_user_error_handler.py
<mask> assert c.get('/custom').data == b'custom' <mask> assert c.get('/keyerror').data == b'KeyError' <mask> <mask> <mask> def test_default_error_handler(): <mask> app = flask.Flask(__name__) <mask> <mask> @app.errorhandler(HTTPException) <mask> def catchall_errorhandler(e): <mask> ...
[ "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/637eae548935ad1434459c1afac286c8686abeed
tests/test_user_error_handler.py
- Nested blueprints are registered with their dotted name. This allows different blueprints with the same name to be nested at different locations. :issue:`4069` - ``register_blueprint`` takes a ``name`` option to change the (pre-dotted) name the blueprint is registered with. This allows the same bl...
<mask> - Re-add deprecated ``Config.from_json``, which was accidentally <mask> removed early. :issue:`4078` <mask> - Improve typing for some functions using ``Callable`` in their type <mask> signatures, focusing on decorator factories. :issue:`4060` <mask> <mask> <mask> Version 2.0.0 <mask> ------...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/63b306743fccdd52079034e82cbbeee182a4361d
CHANGES.rst
.. versionchanged:: 2.0.1 The ``name`` option can be used to change the (pre-dotted) name the blueprint is registered with. This allows the same blueprint to be registered multiple times with unique names for ``url_for``.
<mask> :class:`~flask.blueprints.BlueprintSetupState`. They can be <mask> accessed in :meth:`~flask.Blueprint.record` callbacks. <mask> <mask> .. versionadded:: 0.7 <mask> """ <mask> blueprint.register(self, options) <mask> <mask> def iter_blueprints(self) -...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/63b306743fccdd52079034e82cbbeee182a4361d
src/flask/app.py
.. versionchanged:: 2.0.1 The ``name`` option can be used to change the (pre-dotted) name the blueprint is registered with. This allows the same blueprint to be registered multiple times with unique names for ``url_for``.
<mask> arguments passed to this method will override the defaults set <mask> on the blueprint. <mask> <mask> .. versionadded:: 2.0 <mask> """ <mask> self._blueprints.append((blueprint, options)) <mask> </s> changelog for blueprint registered name
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/63b306743fccdd52079034e82cbbeee182a4361d
src/flask/blueprints.py
.. versionchanged:: 2.0.1 Nested blueprints are registered with their dotted name. This allows different blueprints with the same name to be nested at different locations. .. versionchanged:: 2.0.1 The ``name`` option can be used to change the (pre-dotted...
<mask> :param app: The application this blueprint is being registered <mask> with. <mask> :param options: Keyword arguments forwarded from <mask> :meth:`~Flask.register_blueprint`. <mask> """ <mask> first_registration = True <mask> <mask> for blue...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/63b306743fccdd52079034e82cbbeee182a4361d
src/flask/blueprints.py
usedevelop=true
<mask> <mask> <mask> <mask> [testenv] <mask> commands = <mask> py.test [] --cov=flask --cov-report html <mask> deps= <mask> pytest <mask> pytest-cov </s> Adding coverage generation to tox (#2071) * Adding coverage generation to tox * Removing test directory from coverage command * Adding...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6478d7bb99ef7dcdda19ce3e58c00500ff72e60b
tox.ini
py.test [] --cov=flask --cov-report html
<mask> <mask> <mask> [testenv] <mask> commands = <mask> py.test [] <mask> <mask> deps= <mask> pytest <mask> greenlet <mask> <mask> lowest: Werkzeug==0.7 </s> Adding coverage generation to tox (#2071) * Adding coverage generation to tox * Removing test directory from coverage command ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6478d7bb99ef7dcdda19ce3e58c00500ff72e60b
tox.ini
pytest-cov
<mask> commands = <mask> py.test [] --cov=flask --cov-report html <mask> deps= <mask> pytest <mask> greenlet <mask> <mask> lowest: Werkzeug==0.7 <mask> lowest: Jinja2==2.4 </s> Adding coverage generation to tox (#2071) * Adding coverage generation to tox * Removing test directory from ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6478d7bb99ef7dcdda19ce3e58c00500ff72e60b
tox.ini
- ``MethodView`` can inherit method handlers from base classes. (`#1936`_)
<mask> - Add support for ``provide_automatic_options`` in ``add_url_rule`` to disable <mask> adding OPTIONS method when the ``view_func`` argument is not a class. <mask> (`#1489`_). <mask> <mask> .. _#1489: https://github.com/pallets/flask/pull/1489 <mask> .. _#1936: https://github.com/pallets/flask/pull/193...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
CHANGES
.. _#1936: https://github.com/pallets/flask/pull/1936
<mask> (`#1489`_). <mask> - ``MethodView`` can inherit method handlers from base classes. (`#1936`_) <mask> <mask> .. _#1489: https://github.com/pallets/flask/pull/1489 <mask> .. _#2017: https://github.com/pallets/flask/pull/2017 <mask> .. _#2223: https://github.com/pallets/flask/pull/2223 <mask> <mask> Ver...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
CHANGES
<mask> view.methods = cls.methods <mask> return view <mask> <mask> <mask> def get_methods(cls): <mask> return getattr(cls, 'methods', []) or [] <mask> <mask> <mask> class MethodViewType(type): <mask> <mask> def __new__(cls, name, bases, d): <mask> rv = type.__new__(cls, ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
flask/views.py
"""Metaclass for :class:`MethodView` that determines what methods the view defines. """ def __init__(cls, name, bases, d): super(MethodViewType, cls).__init__(name, bases, d)
<mask> <mask> class MethodViewType(type): <mask> <mask> if 'methods' not in d: <mask> methods = set() <mask> <mask> for key in http_method_funcs: <mask> if hasattr(cls, key): </s> use mro to collect methods ignore methods attr unless explicitly set add changel...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
flask/views.py
<mask> <mask> <mask> class MethodViewType(type): <mask> <mask> def __new__(cls, name, bases, d): <mask> rv = type.__new__(cls, name, bases, d) <mask> if 'methods' not in d: <mask> methods = set(m for b in bases for m in get_methods(b)) <mask> for key in d: <mask>...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
flask/views.py
methods = set() for key in http_method_funcs: if hasattr(cls, key):
<mask> <mask> def __new__(cls, name, bases, d): <mask> rv = type.__new__(cls, name, bases, d) <mask> if 'methods' not in d: <mask> methods = set(m for b in bases for m in get_methods(b)) <mask> for key in d: <mask> if key in http_method_funcs: <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
flask/views.py
# If we have no method at all in there we don't want to add a # method list. This is for instance the case for the base class # or another subclass of a base method view that does not introduce # new methods.
<mask> methods = set(m for b in bases for m in get_methods(b)) <mask> for key in d: <mask> if key in http_method_funcs: <mask> methods.add(key.upper()) <mask> # If we have no method at all in there we don't want to <mask> # add a ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
flask/views.py
cls.methods = methods
<mask> # add a method list. (This is for instance the case for <mask> # the base class or another subclass of a base method view <mask> # that does not introduce new methods). <mask> if methods: <mask> rv.methods = sorted(methods) <mask> ret...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
flask/views.py
"""A class-based view that dispatches request methods to the corresponding class methods. For example, if you implement a ``get`` method, it will be used to handle ``GET`` requests. ::
<mask> return rv <mask> <mask> <mask> class MethodView(with_metaclass(MethodViewType, View)): <mask> """Like a regular class-based view but that dispatches requests to <mask> particular methods. For instance if you implement a method called <mask> :meth:`get` it means it will respond to ``...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/648344d4e8878e4aafcc5413f984b21b86173246
flask/views.py
import os import sys
<mask> # <mask> from __future__ import absolute_import, print_function <mask> <mask> import click <mask> import pytest <mask> from click.testing import CliRunner </s> Test side effect (#1889) Function `prepare_exec_for_file` has a side effect where a path is added to `sys.path` list. This commit enhances an ...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/64a37bb9b758630c0f2c649d82e10e849c095d48
tests/test_cli.py
"""Expect the correct path to be set and the correct module name to be returned. :func:`prepare_exec_for_file` has a side effect, where the parent directory of given file is added to `sys.path`. """ realpath = os.path.realpath('/tmp/share/test.py') dirname = os.path.dirname(realpath) assert...
<mask> pytest.raises(NoAppException, find_best_app, mod) <mask> <mask> <mask> def test_prepare_exec_for_file(test_apps): <mask> assert prepare_exec_for_file('test.py') == 'test' <mask> assert prepare_exec_for_file('/usr/share/__init__.py') == 'share' <mask> with pytest.raises(NoAppException): ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/64a37bb9b758630c0f2c649d82e10e849c095d48
tests/test_cli.py
prepare_exec_for_file('/tmp/share/test.txt')
<mask> def test_prepare_exec_for_file(test_apps): <mask> assert prepare_exec_for_file('test.py') == 'test' <mask> assert prepare_exec_for_file('/usr/share/__init__.py') == 'share' <mask> with pytest.raises(NoAppException): <mask> prepare_exec_for_file('test.txt') <mask> <mask> <mask> def t...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/64a37bb9b758630c0f2c649d82e10e849c095d48
tests/test_cli.py
<mask> from .globals import current_app <mask> from .helpers import _split_blueprint_path <mask> <mask> if t.TYPE_CHECKING: <mask> import typing_extensions as te <mask> from werkzeug.routing import Rule <mask> <mask> <mask> class Request(RequestBase): <mask> """The request object used by defaul...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6578b493c8c8d5d9b4135cb964dbbc43318cfb12
src/flask/wrappers.py
def on_json_loading_failed(self, e: ValueError) -> t.Any: try: return super().on_json_loading_failed(e) except BadRequest as e: if current_app and current_app.debug: raise
<mask> from .debughelpers import attach_enctype_error_multidict <mask> <mask> attach_enctype_error_multidict(self) <mask> <mask> def on_json_loading_failed(self, e: Exception) -> "te.NoReturn": <mask> if current_app and current_app.debug: <mask> raise BadRequest(...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6578b493c8c8d5d9b4135cb964dbbc43318cfb12
src/flask/wrappers.py
raise BadRequest() from e
<mask> def on_json_loading_failed(self, e: Exception) -> "te.NoReturn": <mask> if current_app and current_app.debug: <mask> raise BadRequest(f"Failed to decode JSON object: {e}") <mask> <mask> raise BadRequest() <mask> <mask> <mask> class Response(ResponseBase): <mask> ""...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/6578b493c8c8d5d9b4135cb964dbbc43318cfb12
src/flask/wrappers.py
<mask> sudo: false <mask> language: python <mask> <mask> python: <mask> - "2.6" <mask> - "2.7" <mask> - "pypy" <mask> - "3.3" <mask> - "3.4" <mask> - "3.5" <mask> - "3.6" <mask> <mask> env: <mask> - REQUIREMENTS=lowest <mask> - REQUIREMENTS=lowest-simplejson <mask> - REQUIREMENTS=r...
[ "keep", "keep", "keep", "replace", "replace", "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/65b22926f7673b419a9da82f3213d7243c968af1
.travis.yml
include: - python: 3.6 env: TOXENV=py-release,codecov - python: 3.5 env: TOXENV=py-release,codecov - python: 3.4 env: TOXENV=py-release,codecov - python: 3.3 env: TOXENV=py-release,codecov - python: 2.7 env: TOXENV=py-release,codecov - python: 2.6 env: TOXEN...
<mask> - REQUIREMENTS=devel <mask> - REQUIREMENTS=devel-simplejson <mask> <mask> matrix: <mask> exclude: <mask> # Python 3 support currently does not work with lowest requirements <mask> - python: "3.3" <mask> env: REQUIREMENTS=lowest <mask> - python: "3.3" <mask> env: REQUIREME...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "k...
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
.travis.yml
- pip install tox
<mask> - python: "3.6" <mask> env: REQUIREMENTS=lowest-simplejson <mask> <mask> install: <mask> - pip install tox <mask> <mask> script: <mask> - tox -e py-$REQUIREMENTS <mask> <mask> branches: </s> reduce number of tox and travis envs bump minimum werkzeug version to fix tests cache pip ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
.travis.yml
- tox
<mask> install: <mask> - pip install tox <mask> <mask> script: <mask> - tox -e py-$REQUIREMENTS <mask> <mask> branches: <mask> except: <mask> - website <mask> </s> reduce number of tox and travis envs bump minimum werkzeug version to fix tests cache pip pacakges on travis collect branch cove...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
.travis.yml
cache: - pip
<mask> <mask> script: <mask> - tox -e py-$REQUIREMENTS <mask> <mask> branches: <mask> except: <mask> - website <mask> <mask> notifications: <mask> email: false <mask> irc: <mask> channels: </s> reduce number of tox and travis envs bump minimum werkzeug version to fix tests cache pip pa...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
.travis.yml
minversion = 3.0 testpaths = tests
<mask> [metadata] <mask> license_file = LICENSE <mask> <mask> [tool:pytest] <mask> norecursedirs = .* *.egg *.egg-info env* artwork docs </s> reduce number of tox and travis envs bump minimum werkzeug version to fix tests cache pip pacakges on travis collect branch coverage collect coverage of test code report c...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
setup.cfg
'Werkzeug>=0.9',
<mask> include_package_data=True, <mask> zip_safe=False, <mask> platforms='any', <mask> install_requires=[ <mask> 'Werkzeug>=0.7', <mask> 'Jinja2>=2.4', <mask> 'itsdangerous>=0.21', <mask> 'click>=4.0', <mask> ], <mask> classifiers=[ </s> reduce number ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
setup.py
envlist = py{36,35,34,33,27,26,py}-release py{36,27,py}-release-simplejson py{36,33,27,26,py}-devel py{36,33,27,26,py}-lowest docs-html coverage-report
<mask> [tox] <mask> envlist = {py26,py27,pypy}-{lowest,release,devel}{,-simplejson}, {py33,py34,py35,py36}-{release,devel}{,-simplejson} <mask> <mask> [testenv] <mask> passenv = LANG <mask> usedevelop=true <mask> commands = </s> reduce number of tox and travis envs bump minimum werkzeug version to fix tests ca...
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
tox.ini
usedevelop = true deps = pytest>=3 coverage
<mask> envlist = {py26,py27,pypy}-{lowest,release,devel}{,-simplejson}, {py33,py34,py35,py36}-{release,devel}{,-simplejson} <mask> <mask> [testenv] <mask> passenv = LANG <mask> usedevelop=true <mask> commands = <mask> # We need to install those after Flask is installed. <mask> pip install -e examples/f...
[ "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/65b22926f7673b419a9da82f3213d7243c968af1
tox.ini
blinker
<mask> deps = <mask> pytest>=3 <mask> coverage <mask> greenlet <mask> <mask> lowest: Werkzeug==0.9 <mask> lowest: Jinja2==2.4 <mask> lowest: itsdangerous==0.21 <mask> lowest: Click==4.0 <mask> </s> reduce number of tox and travis envs bump minimum werkzeug version to fix tests c...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
tox.ini
lowest: Werkzeug==0.9
<mask> pytest <mask> pytest-cov <mask> greenlet <mask> <mask> lowest: Werkzeug==0.7 <mask> lowest: Jinja2==2.4 <mask> lowest: itsdangerous==0.21 <mask> lowest: Click==4.0 <mask> lowest: blinker==1.0 <mask> </s> reduce number of tox and travis envs bump minimum werkzeug versi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
tox.ini
<mask> lowest: Werkzeug==0.7 <mask> lowest: Jinja2==2.4 <mask> lowest: itsdangerous==0.21 <mask> lowest: Click==4.0 <mask> lowest: blinker==1.0 <mask> <mask> release: blinker <mask> <mask> devel: git+https://github.com/pallets/werkzeug.git <mask> devel: git+https://github.com...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
tox.ini
devel: https://github.com/pallets/werkzeug/archive/master.tar.gz devel: https://github.com/pallets/markupsafe/archive/master.tar.gz devel: https://github.com/pallets/jinja/archive/master.tar.gz devel: https://github.com/pallets/itsdangerous/archive/master.tar.gz devel: https://github.com/pallets/cli...
<mask> lowest: blinker==1.0 <mask> <mask> release: blinker <mask> <mask> devel: git+https://github.com/pallets/werkzeug.git <mask> devel: git+https://github.com/pallets/markupsafe.git <mask> devel: git+https://github.com/pallets/jinja.git <mask> devel: git+https://github.com/pallets/it...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
tox.ini
commands = # the examples need to be installed to test successfully pip install -e examples/flaskr -q pip install -e examples/minitwit -q pip install -e examples/patterns/largerapp -q # pytest-cov doesn't seem to play nice with -p coverage run -p -m pytest [testenv:docs-html] deps = sphinx...
<mask> devel: https://github.com/pallets/itsdangerous/archive/master.tar.gz <mask> devel: https://github.com/pallets/click/archive/master.tar.gz <mask> <mask> simplejson: simplejson <mask> <mask> [testenv:docs-linkcheck] <mask> deps = sphinx <mask> commands = sphinx-build -W -b linkcheck -d {envtm...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
tox.ini
[testenv:docs-linkcheck]
<mask> devel: git+https://github.com/jek/blinker.git <mask> <mask> simplejson: simplejson <mask> <mask> [testenv:docs] <mask> deps = sphinx <mask> commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck </s> reduce number of tox and travis envs bump minimum werkzeug ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep" ]
https://github.com/pallets/flask/commit/65b22926f7673b419a9da82f3213d7243c968af1
tox.ini