Skip to content

Commit

Permalink
black check
Browse files Browse the repository at this point in the history
  • Loading branch information
v00g100skr committed Dec 9, 2024
1 parent e7e58fb commit 594ee09
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions deploy/update_server/update_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,34 @@ async def main(request):

async def list(request):
filenames = sorted(
[file for file in os.listdir(shared_path) if (os.path.isfile(os.path.join(shared_path, file)) and file.endswith(".bin"))])
[
file
for file in os.listdir(shared_path)
if (os.path.isfile(os.path.join(shared_path, file)) and file.endswith(".bin"))
]
)
return JSONResponse(filenames)


async def list_beta(request):
filenames = sorted(
[file for file in os.listdir(shared_beta_path) if (os.path.isfile(os.path.join(shared_beta_path, file)) and file.endswith(".bin"))]
[
file
for file in os.listdir(shared_beta_path)
if (os.path.isfile(os.path.join(shared_beta_path, file)) and file.endswith(".bin"))
]
)
return JSONResponse(filenames)


async def update(request):
if request.path_params["filename"] == "latest":
filenames = sorted(
[file for file in os.listdir(shared_path) if (os.path.isfile(os.path.join(shared_path, file)) and file.endswith(".bin"))],
[
file
for file in os.listdir(shared_path)
if (os.path.isfile(os.path.join(shared_path, file)) and file.endswith(".bin"))
],
key=bin_sort,
reverse=True,
)
Expand All @@ -104,7 +117,11 @@ async def update(request):
async def update_beta(request):
if request.path_params["filename"] == "latest_beta":
filenames = sorted(
[file for file in os.listdir(shared_beta_path) if (os.path.isfile(os.path.join(shared_beta_path, file)) and file.endswith(".bin"))],
[
file
for file in os.listdir(shared_beta_path)
if (os.path.isfile(os.path.join(shared_beta_path, file)) and file.endswith(".bin"))
],
key=bin_sort,
reverse=True,
)
Expand All @@ -124,10 +141,18 @@ async def spiffs_update_beta(request):
async def update_cache():
mc = Client(memcached_host, 11211)
filenames = sorted(
[file for file in os.listdir(shared_path) if (os.path.isfile(os.path.join(shared_path, file)) and file.endswith(".bin"))]
)
[
file
for file in os.listdir(shared_path)
if (os.path.isfile(os.path.join(shared_path, file)) and file.endswith(".bin"))
]
)
beta_filenames = sorted(
[file for file in os.listdir(shared_beta_path) if (os.path.isfile(os.path.join(shared_beta_path, file)) and file.endswith(".bin"))]
[
file
for file in os.listdir(shared_beta_path)
if (os.path.isfile(os.path.join(shared_beta_path, file)) and file.endswith(".bin"))
]
)
await mc.set(b"bins", json.dumps(filenames).encode("utf-8"))
await mc.set(b"test_bins", json.dumps(beta_filenames).encode("utf-8"))
Expand Down

0 comments on commit 594ee09

Please sign in to comment.