apply pyupgrade

This commit is contained in:
David Lord 2020-04-04 09:43:06 -07:00
parent 57d628ca74
commit 524fd0bc8c
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
54 changed files with 169 additions and 230 deletions

View file

@ -2,4 +2,4 @@ from flask import Flask
app = Flask(__name__)
from js_example import views
from js_example import views # noqa: F401

View file

@ -8,7 +8,7 @@ from js_example import app
@app.route("/", defaults={"js": "plain"})
@app.route("/<any(plain, jquery, fetch):js>")
def index(js):
return render_template("{0}.html".format(js), js=js)
return render_template(f"{js}.html", js=js)
@app.route("/add", methods=["POST"])

View file

@ -1,9 +1,7 @@
import io
from setuptools import find_packages
from setuptools import setup
with io.open("README.rst", "rt", encoding="utf8") as f:
with open("README.rst", encoding="utf8") as f:
readme = f.read()
setup(

View file

@ -64,7 +64,7 @@ def register():
db.execute("SELECT id FROM user WHERE username = ?", (username,)).fetchone()
is not None
):
error = "User {0} is already registered.".format(username)
error = f"User {username} is already registered."
if error is None:
# the name is available, store it in the database and go to

View file

@ -49,7 +49,7 @@ def get_post(id, check_author=True):
)
if post is None:
abort(404, "Post id {0} doesn't exist.".format(id))
abort(404, f"Post id {id} doesn't exist.")
if check_author and post["author_id"] != g.user["id"]:
abort(403)

View file

@ -1,9 +1,7 @@
import io
from setuptools import find_packages
from setuptools import setup
with io.open("README.rst", "rt", encoding="utf8") as f:
with open("README.rst", encoding="utf8") as f:
readme = f.read()
setup(

View file

@ -44,7 +44,7 @@ def runner(app):
return app.test_cli_runner()
class AuthActions(object):
class AuthActions:
def __init__(self, client):
self._client = client

View file

@ -17,7 +17,7 @@ def test_get_close_db(app):
def test_init_db_command(runner, monkeypatch):
class Recorder(object):
class Recorder:
called = False
def fake_init_db():