From 8b925f852d287e6e927e25b5ff01476e09afc9fc Mon Sep 17 00:00:00 2001 From: retoor Date: Sun, 1 Dec 2024 10:21:20 +0100 Subject: [PATCH] Code style optimizations --- src/rupload/app.py | 13 ++++++------- src/rupload/cli.py | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/rupload/app.py b/src/rupload/app.py index 20413fe..8e34f13 100644 --- a/src/rupload/app.py +++ b/src/rupload/app.py @@ -1,8 +1,7 @@ -import aiohttp -from aiohttp import web -import asyncio import pathlib +from aiohttp import web + class Rupload(web.Application): def __init__( @@ -247,9 +246,7 @@ async def handle_upload(request: web.Request): print(f"File {filename} deleted.") return web.Response( status=413, - text="File is too large. Maximum file size is {} bytes.".format( - app.max_file_size - ), + text=f"File is too large. Maximum file size is {app.max_file_size} bytes.", ) f.write(chunk) print(f"File {filename} uploaded successfully.") @@ -281,7 +278,9 @@ async def handle_index(request: web.Request): message += f'' message += f"{url}" if not message: - message = "Any file type is allowed thus also binary/executable or source files." + message = ( + "Any file type is allowed thus also binary/executable or source files." + ) if message: message += "

" html_content = html_content.replace("[message]", message) diff --git a/src/rupload/cli.py b/src/rupload/cli.py index 080f258..1c425b6 100644 --- a/src/rupload/cli.py +++ b/src/rupload/cli.py @@ -1,5 +1,7 @@ import argparse + from aiohttp import web + from rupload.app import create_app