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
client.post('/foo', data={})
<mask> return 'success' <mask> <mask> with app.test_client() as c: <mask> with pytest.raises(AssertionError) as e: <mask> c.post('/foo', data={}) <mask> assert 'http://localhost/foo/' in str(e) <mask> assert ('Make sure to directly send ' <mask> '...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_basic.py
rv = client.get('/foo', data={}, follow_redirects=True)
<mask> assert 'http://localhost/foo/' in str(e) <mask> assert ('Make sure to directly send ' <mask> 'your POST-request to this URL') in str(e) <mask> <mask> rv = c.get('/foo', data={}, follow_redirects=True) <mask> assert rv.data == b'success' <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_basic.py
with client: rv = client.post('/foo', data={}, follow_redirects=True)
<mask> rv = c.get('/foo', data={}, follow_redirects=True) <mask> assert rv.data == b'success' <mask> <mask> app.debug = False <mask> with app.test_client() as c: <mask> rv = c.post('/foo', data={}, follow_redirects=True) <mask> assert rv.data == b'success' <mask> <mask...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_basic.py
def test_route_decorator_custom_endpoint(app, client):
<mask> rv = c.post('/foo', data={}, follow_redirects=True) <mask> assert rv.data == b'success' <mask> <mask> <mask> def test_route_decorator_custom_endpoint(): <mask> app = flask.Flask(__name__) <mask> app.debug = True <mask> <mask> @app.route('/foo/') <mask> def foo(): <ma...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_basic.py
assert client.get('/foo/').data == b'foo' assert client.get('/bar/').data == b'bar' assert client.get('/bar/123').data == b'123'
<mask> assert flask.url_for('foo') == '/foo/' <mask> assert flask.url_for('bar') == '/bar/' <mask> assert flask.url_for('123') == '/bar/123' <mask> <mask> c = app.test_client() <mask> assert c.get('/foo/').data == b'foo' <mask> assert c.get('/bar/').data == b'bar' <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_basic.py
def test_preserve_only_once(app, client):
<mask> assert c.get('/bar/').data == b'bar' <mask> assert c.get('/bar/123').data == b'123' <mask> <mask> <mask> def test_preserve_only_once(): <mask> app = flask.Flask(__name__) <mask> app.debug = True <mask> <mask> @app.route('/fail') <mask> def fail_func(): <mask> 1 // 0 ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_basic.py
<mask> @app.route('/fail') <mask> def fail_func(): <mask> 1 // 0 <mask> <mask> c = app.test_client() <mask> for x in range(3): <mask> with pytest.raises(ZeroDivisionError): <mask> c.get('/fail') <mask> <mask> assert flask._request_ctx_stack.top is not None </...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_basic.py
client.get('/fail')
<mask> <mask> c = app.test_client() <mask> for x in range(3): <mask> with pytest.raises(ZeroDivisionError): <mask> c.get('/fail') <mask> <mask> assert flask._request_ctx_stack.top is not None <mask> assert flask._app_ctx_stack.top is not None <mask> # implicit appctx d...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_basic.py
<mask> <mask> class TestRequestDeprecation(object): <mask> def test_request_json(self, recwarn, app, client): <mask> """Request.json is deprecated""" <mask> app.testing = True <mask> <mask> @app.route('/', methods=['POST']) <mask> def index(): <mask> assert fla...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_deprecations.py
<mask> recwarn.pop(DeprecationWarning) <mask> <mask> def test_request_module(self, recwarn, app, client): <mask> """Request.module is deprecated""" <mask> app.testing = True <mask> <mask> @app.route('/') <mask> def index(): <mask> assert flask.request.m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_deprecations.py
<mask> rv = client.post('/json', data='"foo"', content_type='application/x+json') <mask> assert rv.data == b'foo' <mask> <mask> def test_json_body_encoding(self, app, client): <mask> app.testing = True <mask> <mask> @app.route('/') <mask> def index(): <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> if len(obj) == 1 and '_foo' in obj: <mask> return X(obj['_foo']) <mask> return obj <mask> <mask> app.testing = True <mask> app.json_encoder = MyEncoder <mask> app.json_decoder = MyDecoder <mask> <mask> @app.route('/', ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> @bp.route('/bp', methods=['POST']) <mask> def index(): <mask> return flask.json.dumps(flask.request.get_json()['x']) <mask> <mask> app.testing = True <mask> app.register_blueprint(bp) <mask> <mask> rv = client.post('/bp', data=flask.json.dumps({ <mas...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
def test_modified_url_encoding(self, app, client):
<mask> 'x': {'_foo': 42} <mask> }), content_type='application/json') <mask> assert rv.data == b'"<42>"' <mask> <mask> def test_modified_url_encoding(self, app): <mask> class ModifiedRequest(flask.Request): <mask> url_charset = 'euc-kr' <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> def test_modified_url_encoding(self, app): <mask> class ModifiedRequest(flask.Request): <mask> url_charset = 'euc-kr' <mask> <mask> app.testing = True <mask> app.request_class = ModifiedRequest <mask> app.url_map.charset = 'euc-kr' <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> if not has_encoding('euc-kr'): <mask> test_modified_url_encoding = None <mask> <mask> def test_json_key_sorting(self, app, client): <mask> app.testing = True <mask> app.debug = True <mask> <mask> assert app.config['JSON_SORT_KEYS'] == True <mask> d = dic...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> assert rv.status_code == 200 <mask> rv.close() <mask> <mask> def test_attachment(self, app, req_ctx): <mask> app = flask.Flask(__name__) <mask> <mask> with open(os.path.join(app.root_path, 'static/index.html')) as f: <mask> rv = flask.send_file(f, as_atta...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> assert cc.max_age == 10 <mask> rv.close() <mask> <mask> def test_send_from_directory(self, app, req_ctx): <mask> app.testing = True <mask> app.root_path = os.path.join(os.path.dirname(__file__), <mask> 'test_apps', 'subdomai...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> assert rv.data.strip() == b'Hello Subdomain' <mask> rv.close() <mask> <mask> def test_send_from_directory_bad_request(self, app, req_ctx): <mask> app.testing = True <mask> app.root_path = os.path.join(os.path.dirname(__file__), <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
def test_debug_log(self, capsys, app, client):
<mask> assert logger1.name == __name__ <mask> app.logger_name = __name__ + '/test_logger_cache' <mask> assert app.logger is not logger1 <mask> <mask> def test_debug_log(self, capsys): <mask> app = flask.Flask(__name__) <mask> app.debug = True <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
with client: client.get('/')
<mask> @app.route('/exc') <mask> def exc(): <mask> 1 // 0 <mask> <mask> with app.test_client() as c: <mask> c.get('/') <mask> out, err = capsys.readouterr() <mask> assert 'WARNING in test_helpers [' in err <mask> assert os.pat...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
client.get('/exc')
<mask> assert 'the standard library is dead' in err <mask> assert 'this is a debug statement' in err <mask> <mask> with pytest.raises(ZeroDivisionError): <mask> c.get('/exc') <mask> <mask> def test_debug_log_override(self, app): <mask> app.debug ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
def test_exception_logging(self, app, client):
<mask> app.logger_name = 'flask_tests/test_debug_log_override' <mask> app.logger.level = 10 <mask> assert app.logger.level == 10 <mask> <mask> def test_exception_logging(self, app): <mask> out = StringIO() <mask> app.config['LOGGER_HANDLER_POLICY'] = 'never' <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
rv = client.get('/')
<mask> @app.route('/') <mask> def index(): <mask> 1 // 0 <mask> <mask> rv = app.test_client().get('/') <mask> assert rv.status_code == 500 <mask> assert b'Internal Server Error' in rv.data <mask> <mask> err = out.getvalue() <mask> assert 'E...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> <mask> <mask> class TestStreaming(object): <mask> def test_streaming_with_context(self, app, client): <mask> app.testing = True <mask> <mask> @app.route('/') <mask> def index(): <mask> def generate(): <mask> yield 'Hello ' </s> More DRYing up ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> rv = client.get('/?name=World') <mask> assert rv.data == b'Hello World!' <mask> <mask> def test_streaming_with_context_as_decorator(self, app, client): <mask> app.testing = True <mask> <mask> @app.route('/') <mask> def index(): <mask> @flask.stre...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
<mask> rv = client.get('/?name=World') <mask> assert rv.data == b'Hello World!' <mask> <mask> def test_streaming_with_context_and_custom_close(self, app, client): <mask> app.testing = True <mask> called = [] <mask> <mask> class Wrapper(object): <mask> d...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_helpers.py
def test_aborting(app):
<mask> with pytest.raises(NotFound): <mask> safe_join('/foo', '..') <mask> <mask> <mask> def test_aborting(): <mask> class Foo(Exception): <mask> whatever = 42 <mask> app = flask.Flask(__name__) <mask> app.testing = True <mask> </s> More DRYing up the test suite (#2325) </s...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_regression.py
def test_template_rendered(app, client):
<mask> ) <mask> <mask> <mask> @app.route('/') <mask> def index(): <mask> return flask.render_template('simple_template.html', whiskey=42) <mask> <mask> recorded = [] <mask> </s> More DRYing up the test suite (#2325) </s> remove def test_session_transactions(app): </s> add def test_ses...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_signals.py
with client: rv = client.get('/getsession')
<mask> @app.route('/getsession') <mask> def get_session(): <mask> return flask.session.get('data', '<missing>') <mask> <mask> with client as c: <mask> rv = c.get('/getsession') <mask> assert rv.data == b'<missing>' <mask> <mask> rv = c.get('/') <mask> asse...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
def test_session_transactions(app, client):
<mask> rv = c.get('/getsession') <mask> assert rv.data == b'foo' <mask> <mask> <mask> def test_session_transactions(app): <mask> app.secret_key = 'testing' <mask> <mask> @app.route('/') <mask> def index(): <mask> return text_type(flask.session['foo']) </s> More DRYing u...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
with client.session_transaction() as sess:
<mask> sess['foo'] = [42] <mask> assert len(sess) == 1 <mask> rv = c.get('/') <mask> assert rv.data == b'[42]' <mask> with c.session_transaction() as sess: <mask> assert len(sess) == 1 <mask> assert sess['foo'] == [42] <mask> <mask> <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
def test_test_client_calls_teardown_handlers(app, client):
<mask> with c: <mask> assert c.get('/').status_code == 404 <mask> <mask> <mask> def test_test_client_calls_teardown_handlers(): <mask> app = flask.Flask(__name__) <mask> called = [] <mask> <mask> @app.teardown_request <mask> def remember(error): <mask> called.append(err...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
client.get('/')
<mask> called.append(error) <mask> <mask> with app.test_client() as c: <mask> assert called == [] <mask> c.get('/') <mask> assert called == [] <mask> assert called == [None] <mask> <mask> del called[:] <mask> with app.test_client() as c: </s> More DRYing up t...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
def test_subdomain(app, client):
<mask> assert 'gin' in flask.request.form <mask> assert 'vodka' in flask.request.args <mask> <mask> <mask> def test_subdomain(): <mask> app = flask.Flask(__name__) <mask> app.config['SERVER_NAME'] = 'example.com' <mask> <mask> @app.route('/', subdomain='<company_id>') <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
with client: response = client.get(url)
<mask> <mask> with app.test_request_context(): <mask> url = flask.url_for('view', company_id='xxx') <mask> <mask> with app.test_client() as c: <mask> response = c.get(url) <mask> <mask> assert 200 == response.status_code <mask> assert b'xxx' == response.data <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
def test_nosubdomain(app, client):
<mask> assert 200 == response.status_code <mask> assert b'xxx' == response.data <mask> <mask> <mask> def test_nosubdomain(): <mask> app = flask.Flask(__name__) <mask> app.config['SERVER_NAME'] = 'example.com' <mask> <mask> @app.route('/<company_id>') <mask> def view(company_id): <m...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
with client: response = client.get(url)
<mask> <mask> with app.test_request_context(): <mask> url = flask.url_for('view', company_id='xxx') <mask> <mask> with app.test_client() as c: <mask> response = c.get(url) <mask> <mask> assert 200 == response.status_code <mask> assert b'xxx' == response.data </s> More DRYing...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_testing.py
def test_view_inheritance(app, client):
<mask> app.add_url_rule('/', view_func=view) <mask> common_test(app) <mask> <mask> <mask> def test_view_inheritance(app): <mask> class Index(flask.views.MethodView): <mask> def get(self): <mask> return 'GET' <mask> <mask> def post(self): </s> More DRYing up the test...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
<mask> def delete(self): <mask> return 'DELETE' <mask> <mask> app.add_url_rule('/', view_func=BetterIndex.as_view('index')) <mask> c = app.test_client() <mask> <mask> meths = parse_set_header(c.open('/', method='OPTIONS').headers['Allow']) <mask> assert sorted(meths) == ['D...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
meths = parse_set_header(client.open('/', method='OPTIONS').headers['Allow'])
<mask> <mask> app.add_url_rule('/', view_func=BetterIndex.as_view('index')) <mask> c = app.test_client() <mask> <mask> meths = parse_set_header(c.open('/', method='OPTIONS').headers['Allow']) <mask> assert sorted(meths) == ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST'] <mask> <mask> <mask> de...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
def test_view_decorators(app, client):
<mask> meths = parse_set_header(c.open('/', method='OPTIONS').headers['Allow']) <mask> assert sorted(meths) == ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST'] <mask> <mask> <mask> def test_view_decorators(app): <mask> def add_x_parachute(f): <mask> def new_function(*args, **kwargs): <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
rv = client.get('/')
<mask> def dispatch_request(self): <mask> return 'Awesome' <mask> <mask> app.add_url_rule('/', view_func=Index.as_view('index')) <mask> c = app.test_client() <mask> rv = c.get('/') <mask> assert rv.headers['X-Parachute'] == 'awesome' <mask> assert rv.data == b'Awesome' ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
def test_implicit_head(app, client):
<mask> rv = c.open('/', method='OPTIONS') <mask> assert 'OPTIONS' in rv.allow <mask> <mask> <mask> def test_implicit_head(app): <mask> class Index(flask.views.MethodView): <mask> def get(self): <mask> return flask.Response('Blub', headers={ <mask> 'X-Method': f...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
rv = client.get('/')
<mask> 'X-Method': flask.request.method <mask> }) <mask> <mask> app.add_url_rule('/', view_func=Index.as_view('index')) <mask> c = app.test_client() <mask> rv = c.get('/') <mask> assert rv.data == b'Blub' <mask> assert rv.headers['X-Method'] == 'GET' <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
rv = client.head('/')
<mask> c = app.test_client() <mask> rv = c.get('/') <mask> assert rv.data == b'Blub' <mask> assert rv.headers['X-Method'] == 'GET' <mask> rv = c.head('/') <mask> assert rv.data == b'' <mask> assert rv.headers['X-Method'] == 'HEAD' <mask> <mask> <mask> def test_explicit_head(app):...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
def test_explicit_head(app, client):
<mask> assert rv.data == b'' <mask> assert rv.headers['X-Method'] == 'HEAD' <mask> <mask> <mask> def test_explicit_head(app): <mask> class Index(flask.views.MethodView): <mask> def get(self): <mask> return 'GET' <mask> <mask> def head(self): </s> More DRYing up the ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
rv = client.get('/')
<mask> def head(self): <mask> return flask.Response('', headers={'X-Method': 'HEAD'}) <mask> <mask> app.add_url_rule('/', view_func=Index.as_view('index')) <mask> c = app.test_client() <mask> rv = c.get('/') <mask> assert rv.data == b'GET' <mask> rv = c.head('/') <mask>...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
rv = client.head('/')
<mask> app.add_url_rule('/', view_func=Index.as_view('index')) <mask> c = app.test_client() <mask> rv = c.get('/') <mask> assert rv.data == b'GET' <mask> rv = c.head('/') <mask> assert rv.data == b'' <mask> assert rv.headers['X-Method'] == 'HEAD' <mask> <mask> <mask> def test_end...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
def test_multiple_inheritance(app, client):
<mask> # But these tests should still pass. We just log a warning. <mask> common_test(app) <mask> <mask> <mask> def test_multiple_inheritance(app): <mask> class GetView(flask.views.MethodView): <mask> def get(self): <mask> return 'GET' <mask> <mask> class DeleteView(flas...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
assert client.get('/').data == b'GET' assert client.delete('/').data == b'DELETE'
<mask> pass <mask> <mask> app.add_url_rule('/', view_func=GetDeleteView.as_view('index')) <mask> <mask> c = app.test_client() <mask> assert c.get('/').data == b'GET' <mask> assert c.delete('/').data == b'DELETE' <mask> assert sorted(GetDeleteView.methods) == ['DELETE', 'GET'] <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
def test_remove_method_from_parent(app, client):
<mask> assert c.delete('/').data == b'DELETE' <mask> assert sorted(GetDeleteView.methods) == ['DELETE', 'GET'] <mask> <mask> <mask> def test_remove_method_from_parent(app): <mask> class GetView(flask.views.MethodView): <mask> def get(self): <mask> return 'GET' <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
assert client.get('/').data == b'GET' assert client.post('/').status_code == 405
<mask> methods = ['GET'] <mask> <mask> app.add_url_rule('/', view_func=View.as_view('index')) <mask> <mask> c = app.test_client() <mask> assert c.get('/').data == b'GET' <mask> assert c.post('/').status_code == 405 <mask> assert sorted(View.methods) == ['GET'] </s> More DRYing up ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep" ]
https://github.com/pallets/flask/commit/4ec1fbc9f52b4b3997a1978ab3390a5a1157ad6a
tests/test_views.py
#: the debug flag. Set this to `True` to enable debugging of #: the application. In debug mode the debugger will kick in #: when an unhandled exception ocurrs and the integrated server #: will automatically reload the application if changes in the #: code are detected.
<mask> extensions=['jinja2.ext.autoescape', 'jinja2.ext.with_'] <mask> ) <mask> <mask> def __init__(self, package_name): <mask> self.debug = False <mask> <mask> #: the name of the package or module. Do not change this once <mask> #: it was set by the constructor. <mas...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec7d2a0d8eac4f915dc0d38a886cd57045bb0c4
flask.py
#: a list of functions that should be called at the beginning #: of the request before request dispatching kicks in. This #: can for example be used to open database connections or #: getting hold of the currently logged in user. #: To register a function here, use the :meth:`re...
<mask> #: To register a error handler, use the :meth:`errorhandler` <mask> #: decorator. <mask> self.error_handlers = {} <mask> self.request_init_funcs = [] <mask> <mask> #: a list of functions that are called at the end of the <mask> #: request. Tha function is ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec7d2a0d8eac4f915dc0d38a886cd57045bb0c4
flask.py
"""Runs the application on a local development server. If the :attr:`debug` flag is set the server will automatically reload for code changes and show a debugger in case an exception happened. """
<mask> """ <mask> return PackageLoader(self.package_name) <mask> <mask> def run(self, host='localhost', port=5000, **options): <mask> """Runs the application on a local development server""" <mask> from werkzeug import run_simple <mask> if 'debug' in options: <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec7d2a0d8eac4f915dc0d38a886cd57045bb0c4
flask.py
"""Saves the session if it needs updates. For the default implementation, check :meth:`open_session`. """
<mask> return SecureCookie.load_cookie(request, self.session_cookie_name, <mask> secret_key=key) <mask> <mask> def save_session(self, session, response): <mask> """Saves the session if it needs updates.""" <mask> if session is not None: ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ec7d2a0d8eac4f915dc0d38a886cd57045bb0c4
flask.py
"sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinxcontrib.log_cabinet", "pallets_sphinx_themes", "sphinx_issues",
<mask> <mask> master_doc = 'index' <mask> <mask> extensions = [ <mask> 'sphinx.ext.autodoc', <mask> 'sphinx.ext.intersphinx', <mask> 'sphinxcontrib.log_cabinet', <mask> ] <mask> <mask> intersphinx_mapping = { <mask> 'python': ('https://docs.python.org/3/', None), <mask> 'werkzeug': ('...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ed20657c61c3e64aba4652e1f053bae65ebc821
docs/conf.py
"project_links": [ ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"), ProjectLink("Flask Website", "https://palletsprojects.com/p/flask/"), ProjectLink("PyPI releases", "https://pypi.org/project/Flask/"), ProjectLink("Source Code", "https://github.com/pallets/fla...
<mask> # HTML ----------------------------------------------------------------- <mask> <mask> html_theme = 'flask' <mask> html_context = { <mask> 'project_links': [ <mask> ProjectLink('Donate to Pallets', 'https://psfmember.org/civicrm/contribute/transact?reset=1&id=20'), <mask> ProjectLink(...
[ "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/4ed20657c61c3e64aba4652e1f053bae65ebc821
docs/conf.py
singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]} html_static_path = ["_static"] html_favicon = "_static/flask-icon.png" html_logo = "_static/flask-icon.png" html_title = "Flask Documentation ({})".format(version)
<mask> html_sidebars = { <mask> "index": ["project.html", "localtoc.html", "searchbox.html"], <mask> "**": ["localtoc.html", "relations.html", "searchbox.html"], <mask> } <mask> html_show_sourcelink = False <mask> <mask> # LaTeX ---------------------------------------------------------------- <mask> ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ed20657c61c3e64aba4652e1f053bae65ebc821
docs/conf.py
<mask> linkcheck_anchors = False <mask> <mask> # Local Extensions ----------------------------------------------------- <mask> <mask> def unwrap_decorators(): <mask> import sphinx.util.inspect as inspect <mask> import functools <mask> <mask> old_getargspec = inspect.getargspec <mask> def ge...
[ "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/4ed20657c61c3e64aba4652e1f053bae65ebc821
docs/conf.py
def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):
<mask> return rv <mask> functools.update_wrapper = update_wrapper <mask> <mask> <mask> unwrap_decorators() <mask> del unwrap_decorators <mask> <mask> <mask> _internal_mark_re = re.compile(r'^\s*:internal:\s*$(?m)', re.M) <mask> <mask> <mask> def skip_internal(app, what, name, obj, skip, op...
[ "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/4ed20657c61c3e64aba4652e1f053bae65ebc821
docs/conf.py
url = "{0}{1}/{2}".format(base_url, release, text)
<mask> <mask> if release.endswith('dev'): <mask> url = '{0}master/{1}'.format(base_url, text) <mask> else: <mask> url = '{0}{1}/{2}'.format(base_url, release, text) <mask> <mask> if words is None: <mask> words = url <mask> <mask> from docutils.nodes import reference ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ed20657c61c3e64aba4652e1f053bae65ebc821
docs/conf.py
.. image:: _static/flask-logo.png :alt: Flask: web development, one drop at a time :align: center :target: https://palletsprojects.com/p/flask/
<mask> <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> :align: right <mask> <mask> Welcome to Flask's documentation. This documentation is divided into <mask...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ed20657c61c3e64aba4652e1f053bae65ebc821
docs/index.rst
In Flask you can implement the opening of database connections at the beginning of the request and closing at the end with the
<mask> <mask> Using SQLite 3 with Flask <mask> ========================= <mask> <mask> In Flask you can implement opening of database connections at the beginning <mask> of the request and closing at the end with the <mask> :meth:`~flask.Flask.before_request` and :meth:`~flask.Flask.after_request` <mask> deco...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ed7a923f53c71339251dd1ccd681f424b061bd1
docs/patterns/sqlite3.rst
So here is a simple example of how you can use SQLite 3 with Flask::
<mask> of the request and closing at the end with the <mask> :meth:`~flask.Flask.before_request` and :meth:`~flask.Flask.after_request` <mask> decorators in combination with the special :class:`~flask.g` object. <mask> <mask> So here a simple example of how you can use SQLite 3 with Flask:: <mask> <mask> i...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ed7a923f53c71339251dd1ccd681f424b061bd1
docs/patterns/sqlite3.rst
current open database connection. To simplify working with SQLite, a
<mask> Easy Querying <mask> ------------- <mask> <mask> Now in each request handling function you can access `g.db` to get the <mask> current open database connection. To simplify working with SQLite a <mask> helper function can be useful:: <mask> <mask> def query_db(query, args=(), one=False): <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4ed7a923f53c71339251dd1ccd681f424b061bd1
docs/patterns/sqlite3.rst
import click
<mask> from threading import Lock <mask> from types import TracebackType <mask> <mask> from werkzeug.datastructures import Headers <mask> from werkzeug.datastructures import ImmutableDict <mask> from werkzeug.exceptions import Aborter <mask> from werkzeug.exceptions import BadRequest <mask> from werkzeug.excep...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/app.py
from werkzeug.serving import is_running_from_reloader
<mask> from werkzeug.routing import MapAdapter <mask> from werkzeug.routing import RequestRedirect <mask> from werkzeug.routing import RoutingException <mask> from werkzeug.routing import Rule <mask> from werkzeug.urls import url_quote <mask> from werkzeug.utils import redirect as _wz_redirect <mask> from werkze...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/app.py
# Ignore this call so that it doesn't start another server if # the 'flask run' command is used.
<mask> .. versionchanged:: 0.10 <mask> The default port is now picked from the ``SERVER_NAME`` <mask> variable. <mask> """ <mask> # Change this into a no-op if the server is invoked from the <mask> # command line. Have a look at cli.py for more information. ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/app.py
if not is_running_from_reloader(): click.secho( " * Ignoring a call to 'app.run()', the server is" " already being run with the 'flask run' command.\n" " Only call 'app.run()' in an 'if __name__ ==" ' "__main__...
<mask> """ <mask> # Change this into a no-op if the server is invoked from the <mask> # command line. Have a look at cli.py for more information. <mask> if os.environ.get("FLASK_RUN_FROM_CLI") == "true": <mask> from .debughelpers import explain_ignored_app_run <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/app.py
<mask> # command line. Have a look at cli.py for more information. <mask> if os.environ.get("FLASK_RUN_FROM_CLI") == "true": <mask> from .debughelpers import explain_ignored_app_run <mask> <mask> explain_ignored_app_run() <mask> return <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/app.py
from werkzeug.serving import is_running_from_reloader
<mask> from threading import Thread <mask> <mask> import click <mask> from werkzeug.utils import import_string <mask> <mask> from .globals import current_app <mask> from .helpers import get_debug_flag </s> edit some cli messages dev server message doesn't show one of the lines in grey app.run message uses cl...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/cli.py
use_eager_loading = not is_running_from_reloader()
<mask> self._lock = Lock() <mask> self._bg_loading_exc = None <mask> <mask> if use_eager_loading is None: <mask> use_eager_loading = os.environ.get("WERKZEUG_RUN_MAIN") != "true" <mask> <mask> if use_eager_loading: <mask> self._load_unlocked() <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/cli.py
<mask> <mask> return sorted(rv) <mask> <mask> def main(self, *args, **kwargs): <mask> # Set a global flag that indicates that we were invoked from the <mask> # command line interface. This is detected by Flask.run to make the <mask> # call into a no-op. This is necessary to ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/cli.py
if is_running_from_reloader():
<mask> def show_server_banner(env, debug, app_import_path, eager_loading): <mask> """Show extra startup messages the first time the server is run, <mask> ignoring the reloader. <mask> """ <mask> if os.environ.get("WERKZEUG_RUN_MAIN") == "true": <mask> return <mask> <mask> if app_imp...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/cli.py
" a production deployment.\n Use a production WSGI server" " instead.",
<mask> <mask> if env == "production": <mask> click.secho( <mask> " WARNING: This is a development server. Do not use it in" <mask> " a production deployment.", <mask> fg="red", <mask> ) <mask> click.secho(" Use a production WSGI server instead...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/cli.py
<mask> " WARNING: This is a development server. Do not use it in" <mask> " a production deployment.", <mask> fg="red", <mask> ) <mask> click.secho(" Use a production WSGI server instead.", dim=True) <mask> <mask> if debug is not None: <mask> c...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/cli.py
<mask> import os <mask> import typing as t <mask> from warnings import warn <mask> <mask> from .app import Flask <mask> from .blueprints import Blueprint </s> edit some cli messages dev server message doesn't show one of the lines in grey app.run message uses click.secho instead of warning </s> remove from war...
[ "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/debughelpers.py
<mask> import os <mask> import typing as t <mask> from warnings import warn <mask> <mask> from .app import Flask <mask> from .blueprints import Blueprint <mask> from .globals import _request_ctx_stack <mask> </s> edit some cli messages dev server message doesn't show one of the lines in grey app.run message...
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/debughelpers.py
<mask> info.append(" Maybe you did not place a template in the right folder?") <mask> info.append(" See https://flask.palletsprojects.com/blueprints/#templates") <mask> <mask> app.logger.info("\n".join(info)) <mask> <mask> <mask> def explain_ignored_app_run() -> None: <mask> if os.e...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace" ]
https://github.com/pallets/flask/commit/4f03a769d44f6740490dd4ddf70e094c12a6090c
src/flask/debughelpers.py
from urlparse import urlparse
<mask> <mask> from contextlib import contextmanager <mask> from werkzeug.test import Client, EnvironBuilder <mask> from flask import _request_ctx_stack <mask> <mask> <mask> def make_test_environ_builder(app, path='/', base_url=None, *args, **kwargs): <mask> """Creates a new test builder with some applica...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f1cb4212376acbbe7ab14fb8caa8a5025b4659e
flask/testing.py
url = urlparse(path) base_url = 'http://%s/' % (url.netloc or http_host or 'localhost')
<mask> """Creates a new test builder with some application defaults thrown in.""" <mask> http_host = app.config.get('SERVER_NAME') <mask> app_root = app.config.get('APPLICATION_ROOT') <mask> if base_url is None: <mask> base_url = 'http://%s/' % (http_host or 'localhost') <mask> if ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f1cb4212376acbbe7ab14fb8caa8a5025b4659e
flask/testing.py
if url.netloc: path = url.path
<mask> url = urlparse(path) <mask> base_url = 'http://%s/' % (url.netloc or http_host or 'localhost') <mask> if app_root: <mask> base_url += app_root.lstrip('/') <mask> return EnvironBuilder(path, base_url, *args, **kwargs) <mask> <mask> <mask> class FlaskClient(Client)...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f1cb4212376acbbe7ab14fb8caa8a5025b4659e
flask/testing.py
suite.addTest(unittest.makeSuite(SubdomainTestCase))
<mask> def suite(): <mask> suite = unittest.TestSuite() <mask> suite.addTest(unittest.makeSuite(TestToolsTestCase)) <mask> return suite </s> make_test_environ_builder when used with subdomains was not working correctly, now it uses urlparse module for detecting full URL and changing path and base_url c...
[ "keep", "keep", "add", "keep" ]
https://github.com/pallets/flask/commit/4f1cb4212376acbbe7ab14fb8caa8a5025b4659e
flask/testsuite/testing.py
folder in the root path of the application. Defaults to None.
<mask> of the `static_folder` folder. <mask> :param static_folder: the folder with static files that should be served <mask> at `static_url_path`. Defaults to the ``'static'`` <mask> folder in the root path of the application. <ma...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f815015b803a146ddc24a2dfadd9ed9b22d7de7
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/4f815015b803a146ddc24a2dfadd9ed9b22d7de7
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/4f815015b803a146ddc24a2dfadd9ed9b22d7de7
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/4f815015b803a146ddc24a2dfadd9ed9b22d7de7
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/4f815015b803a146ddc24a2dfadd9ed9b22d7de7
tests/test_user_error_handler.py
from flask.config import Config
<mask> <mask> from flask.app import Flask <mask> from flask.helpers import url_for, jsonify, json_available, flash, send_file, \ <mask> get_flashed_messages, render_template, render_template, render_template_string, \ <mask> get_template_attribute, json <mask> from flask.globals import current_app, g, re...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f8ee8f12946b224e5003405be99aa4e454bdeee
flask/__init__.py
from flask.config import ConfigAttribute, Config
<mask> <mask> from flask.helpers import _PackageBoundObject, url_for, get_flashed_messages, \ <mask> _tojson_filter, get_pkg_resources <mask> from flask.wrappers import Request, Response <mask> from flask.conf import ConfigAttribute, Config <mask> from flask.ctx import _default_template_ctx_processor, _Reque...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f8ee8f12946b224e5003405be99aa4e454bdeee
flask/app.py
<mask> from werkzeug.exceptions import HTTPException <mask> <mask> from flask.wrappers import _RequestGlobals <mask> from flask.globals import _request_ctx_stack <mask> from flask.session import _NullSession <mask> <mask> <mask> class _RequestContext(object): </s> Added missing comments, fixed setup.py and ...
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f8ee8f12946b224e5003405be99aa4e454bdeee
flask/ctx.py
class _RequestGlobals(object): pass
<mask> from flask.globals import _request_ctx_stack <mask> from flask.session import _NullSession <mask> <mask> <mask> class _RequestContext(object): <mask> """The request context contains all request relevant information. It is <mask> created at the beginning of the request and pushed to the <mask> ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f8ee8f12946b224e5003405be99aa4e454bdeee
flask/ctx.py
<mask> _request_ctx_stack = LocalStack() <mask> current_app = LocalProxy(lambda: _request_ctx_stack.top.app) <mask> request = LocalProxy(lambda: _request_ctx_stack.top.request) <mask> session = LocalProxy(lambda: _request_ctx_stack.top.session) <mask> g = LocalProxy(lambda: _request_ctx_stack.top.g) </s> Added mis...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/pallets/flask/commit/4f8ee8f12946b224e5003405be99aa4e454bdeee
flask/globals.py
g = LocalProxy(lambda: _request_ctx_stack.top.g)
<mask> current_app = LocalProxy(lambda: _request_ctx_stack.top.app) <mask> request = LocalProxy(lambda: _request_ctx_stack.top.request) <mask> session = LocalProxy(lambda: _request_ctx_stack.top.session) <mask> g = LocalProxy(lambda: _request_ctx_stack.top.g) </s> Added missing comments, fixed setup.py and made te...
[ "keep", "keep", "keep", "add" ]
https://github.com/pallets/flask/commit/4f8ee8f12946b224e5003405be99aa4e454bdeee
flask/globals.py
<mask> If you want to replace the response object used you can subclass this and <mask> set :attr:`~flask.Flask.response_class` to your subclass. <mask> """ <mask> default_mimetype = 'text/html' <mask> <mask> <mask> class _RequestGlobals(object): <mask> pass <mask> </s> Added missing co...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace" ]
https://github.com/pallets/flask/commit/4f8ee8f12946b224e5003405be99aa4e454bdeee
flask/wrappers.py
packages=['flask'],
<mask> author_email='armin.ronacher@active-4.com', <mask> description='A microframework based on Werkzeug, Jinja2 ' <mask> 'and good intentions', <mask> long_description=__doc__, <mask> py_modules=['flask'], <mask> zip_safe=False, <mask> platforms='any', <mask> instal...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4f8ee8f12946b224e5003405be99aa4e454bdeee
setup.py
- Template auto reloading will honor the ``run`` command's ``debug`` flag even if ``app.jinja_env`` was already accessed. (`#2373`_)
<mask> the response to make testing JSON response much easier. (`#2358`_) <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`_) <ma...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4fc48200a58907ffdf136961b84ef7d19192e6ef
CHANGES
.. _#2373: https://github.com/pallets/flask/pull/2373
<mask> .. _#2354: https://github.com/pallets/flask/pull/2354 <mask> .. _#2358: https://github.com/pallets/flask/pull/2358 <mask> .. _#2362: https://github.com/pallets/flask/pull/2362 <mask> <mask> Version 0.12.2 <mask> -------------- <mask> <mask> Released on May 16 2017 <mask> </s> reconfigure the app fro...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/4fc48200a58907ffdf136961b84ef7d19192e6ef
CHANGES