From 53c893b646252d610e877eb9385e9e250a1ae5e1 Mon Sep 17 00:00:00 2001 From: David Lord Date: Sat, 1 Jun 2019 09:22:20 -0700 Subject: [PATCH] fix string concats left over by black --- examples/tutorial/flaskr/blog.py | 2 +- src/flask/app.py | 2 +- src/flask/cli.py | 2 +- src/flask/ctx.py | 7 ++++--- src/flask/helpers.py | 6 ++---- src/flask/testing.py | 4 ++-- tests/test_basic.py | 2 +- tests/test_config.py | 6 +++--- tests/test_instance_config.py | 2 +- tests/test_templating.py | 2 +- 10 files changed, 17 insertions(+), 18 deletions(-) diff --git a/examples/tutorial/flaskr/blog.py b/examples/tutorial/flaskr/blog.py index 86dd19c7..445fb5a1 100644 --- a/examples/tutorial/flaskr/blog.py +++ b/examples/tutorial/flaskr/blog.py @@ -74,7 +74,7 @@ def create(): else: db = get_db() db.execute( - "INSERT INTO post (title, body, author_id)" " VALUES (?, ?, ?)", + "INSERT INTO post (title, body, author_id) VALUES (?, ?, ?)", (title, body, g.user["id"]), ) db.commit() diff --git a/src/flask/app.py b/src/flask/app.py index 962a5e91..6e0647e3 100644 --- a/src/flask/app.py +++ b/src/flask/app.py @@ -1931,7 +1931,7 @@ class Flask(_PackageBoundObject): if not from_error_handler: raise self.logger.exception( - "Request finalizing failed with an " "error while handling an error" + "Request finalizing failed with an error while handling an error" ) return response diff --git a/src/flask/cli.py b/src/flask/cli.py index f57c237e..6f0866ce 100644 --- a/src/flask/cli.py +++ b/src/flask/cli.py @@ -266,7 +266,7 @@ def get_version(ctx, param, value): import werkzeug from . import __version__ - message = "Python %(python)s\n" "Flask %(flask)s\n" "Werkzeug %(werkzeug)s" + message = "Python %(python)s\nFlask %(flask)s\nWerkzeug %(werkzeug)s" click.echo( message % { diff --git a/src/flask/ctx.py b/src/flask/ctx.py index 176d9d8d..c23f7d19 100644 --- a/src/flask/ctx.py +++ b/src/flask/ctx.py @@ -437,9 +437,10 @@ class RequestContext(object): if app_ctx is not None: app_ctx.pop(exc) - assert ( - rv is self - ), "Popped wrong request context. " "(%r instead of %r)" % (rv, self) + assert rv is self, "Popped wrong request context. (%r instead of %r)" % ( + rv, + self, + ) def auto_pop(self, exc): if self.request.environ.get("flask._preserve_context") or ( diff --git a/src/flask/helpers.py b/src/flask/helpers.py index 91699042..b5ed62e0 100644 --- a/src/flask/helpers.py +++ b/src/flask/helpers.py @@ -94,7 +94,7 @@ def _endpoint_from_view_func(view_func): """Internal helper that returns the default endpoint for a given function. This always is the function name. """ - assert view_func is not None, "expected view func if endpoint " "is not provided." + assert view_func is not None, "expected view func if endpoint is not provided." return view_func.__name__ @@ -598,9 +598,7 @@ def send_file( headers = Headers() if as_attachment: if attachment_filename is None: - raise TypeError( - "filename unavailable, required for " "sending as attachment" - ) + raise TypeError("filename unavailable, required for sending as attachment") if not isinstance(attachment_filename, text_type): attachment_filename = attachment_filename.decode("utf-8") diff --git a/src/flask/testing.py b/src/flask/testing.py index 15546241..354891e3 100644 --- a/src/flask/testing.py +++ b/src/flask/testing.py @@ -156,7 +156,7 @@ class FlaskClient(Client): """ if self.cookie_jar is None: raise RuntimeError( - "Session transactions only make sense " "with cookies enabled." + "Session transactions only make sense with cookies enabled." ) app = self.application environ_overrides = kwargs.setdefault("environ_overrides", {}) @@ -167,7 +167,7 @@ class FlaskClient(Client): sess = session_interface.open_session(app, c.request) if sess is None: raise RuntimeError( - "Session backend did not open a session. " "Check the configuration" + "Session backend did not open a session. Check the configuration" ) # Since we have to open a new request context for the session diff --git a/tests/test_basic.py b/tests/test_basic.py index 410b12f2..92214272 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1726,7 +1726,7 @@ def test_routing_redirect_debugging(app, client): with pytest.raises(AssertionError) as e: client.post("/foo", data={}) assert "http://localhost/foo/" in str(e) - assert ("Make sure to directly send " "your POST-request to this URL") in str(e) + assert ("Make sure to directly send your POST-request to this URL") in str(e) rv = client.get("/foo", data={}, follow_redirects=True) assert rv.data == b"success" diff --git a/tests/test_config.py b/tests/test_config.py index 801469e7..ee3555c2 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -98,7 +98,7 @@ def test_config_from_envvar_missing(monkeypatch): app.config.from_envvar("FOO_SETTINGS") msg = str(e.value) assert msg.startswith( - "[Errno 2] Unable to load configuration " "file (No such file or directory):" + "[Errno 2] Unable to load configuration file (No such file or directory):" ) assert msg.endswith("missing.cfg'") assert not app.config.from_envvar("FOO_SETTINGS", silent=True) @@ -110,7 +110,7 @@ def test_config_missing(): app.config.from_pyfile("missing.cfg") msg = str(e.value) assert msg.startswith( - "[Errno 2] Unable to load configuration " "file (No such file or directory):" + "[Errno 2] Unable to load configuration file (No such file or directory):" ) assert msg.endswith("missing.cfg'") assert not app.config.from_pyfile("missing.cfg", silent=True) @@ -122,7 +122,7 @@ def test_config_missing_json(): app.config.from_json("missing.json") msg = str(e.value) assert msg.startswith( - "[Errno 2] Unable to load configuration " "file (No such file or directory):" + "[Errno 2] Unable to load configuration file (No such file or directory):" ) assert msg.endswith("missing.json'") assert not app.config.from_json("missing.json", silent=True) diff --git a/tests/test_instance_config.py b/tests/test_instance_config.py index e37dfde7..2499fcbb 100644 --- a/tests/test_instance_config.py +++ b/tests/test_instance_config.py @@ -69,7 +69,7 @@ def test_installed_module_paths( modules_tmpdir, modules_tmpdir_prefix, purge_module, site_packages, limit_loader ): site_packages.join("site_app.py").write( - "import flask\n" "app = flask.Flask(__name__)\n" + "import flask\napp = flask.Flask(__name__)\n" ) purge_module("site_app") diff --git a/tests/test_templating.py b/tests/test_templating.py index 068dd583..4f50905f 100644 --- a/tests/test_templating.py +++ b/tests/test_templating.py @@ -46,7 +46,7 @@ def test_request_less_rendering(app, app_ctx): def context_processor(): return dict(foo=42) - rv = flask.render_template_string("Hello {{ config.WORLD_NAME }} " "{{ foo }}") + rv = flask.render_template_string("Hello {{ config.WORLD_NAME }} {{ foo }}") assert rv == "Hello Special World 42"