refactor: upgrade code to >=python3.7 (pre-commit)
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2189>
This commit is contained in:
parent
7768ea77a4
commit
8d9946d35a
143 changed files with 454 additions and 582 deletions
|
|
@ -7,7 +7,7 @@ from funkwhale_api.users import models, serializers, tasks
|
|||
from . import base, utils
|
||||
|
||||
|
||||
class FakeRequest(object):
|
||||
class FakeRequest:
|
||||
def __init__(self, session={}):
|
||||
self.session = session
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ def handler_create_user(
|
|||
for permission in permissions:
|
||||
if permission in models.PERMISSIONS:
|
||||
utils.logger.debug("Setting %s permission to True", permission)
|
||||
setattr(user, "permission_{}".format(permission), True)
|
||||
setattr(user, f"permission_{permission}", True)
|
||||
else:
|
||||
utils.logger.warn("Unknown permission %s", permission)
|
||||
utils.logger.debug("Creating actor…")
|
||||
|
|
@ -56,7 +56,7 @@ def handler_create_user(
|
|||
@transaction.atomic
|
||||
def handler_delete_user(usernames, soft=True):
|
||||
for username in usernames:
|
||||
click.echo("Deleting {}…".format(username))
|
||||
click.echo(f"Deleting {username}…")
|
||||
actor = None
|
||||
user = None
|
||||
try:
|
||||
|
|
@ -178,9 +178,9 @@ def create(username, password, email, superuser, staff, permission, upload_quota
|
|||
permissions=permission,
|
||||
upload_quota=upload_quota,
|
||||
)
|
||||
click.echo("User {} created!".format(user.username))
|
||||
click.echo(f"User {user.username} created!")
|
||||
if generated_password:
|
||||
click.echo(" Generated password: {}".format(generated_password))
|
||||
click.echo(f" Generated password: {generated_password}")
|
||||
|
||||
|
||||
@base.delete_command(group=users, id_var="username")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue