Skip to content

Commit

Permalink
✨ fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Guerteltier committed Mar 30, 2024
1 parent 27042d0 commit 777ca5c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions an_website/update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
from __future__ import annotations

import asyncio
import io
import logging
import os
import sys
from asyncio import Future
from queue import SimpleQueue
from tempfile import NamedTemporaryFile, TemporaryDirectory
from typing import TYPE_CHECKING, Any, ClassVar, Final
from typing import TYPE_CHECKING, IO, Any, ClassVar, Final
from urllib.parse import unquote

from tornado.web import stream_request_body
Expand All @@ -50,11 +49,10 @@ def get_module_info() -> ModuleInfo:
)


def write_from_queue(file: io.IOBase, queue: SimpleQueue[None | bytes]) -> None:
def write_from_queue(file: IO[bytes], queue: SimpleQueue[None | bytes]) -> None:
"""Read from a queue and write to a file."""
while True: # pylint: disable=while-used
if (chunk := queue.get()) is None:
file.close()
break
file.write(chunk)

Expand Down Expand Up @@ -116,6 +114,7 @@ async def put(self, filename: str) -> None:
"""Handle PUT requests to the update API."""
self.queue.put(None)
await self.future
self.file.close()

filepath = os.path.join(self.dir.name, unquote(filename))
os.rename(self.file.name, filepath)
Expand Down
2 changes: 1 addition & 1 deletion pip-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pillow==10.2.0
pillow-jxl-plugin==1.1.0.post1
pycares==4.4.0
pycryptodome==3.20.0
pycurl==7.45.3
pycurl==7.45.2
pyjwt==2.8.0
pysocks==1.7.1
python-geoip-geolite2-yplan==2019.1224
Expand Down
2 changes: 1 addition & 1 deletion pip-dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pillow==10.2.0; python_version >= '3.8'
pillow-jxl-plugin==1.1.0.post1; python_version >= '3.8'
pycares==4.4.0; python_version >= '3.8'
pycryptodome==3.20.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
pycurl==7.45.3; python_version >= '3.5'
pycurl==7.45.2; python_version >= '3.5'
pyjwt==2.8.0; python_version >= '3.7'
pysocks==1.7.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
python-geoip-geolite2-yplan==2019.1224
Expand Down
2 changes: 1 addition & 1 deletion pip-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pillow-jxl-plugin==1.1.0.post1; python_version >= '3.8'
pycares==4.4.0; python_version >= '3.8'
pycparser==2.21
pycryptodome==3.20.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
pycurl==7.45.3; python_version >= '3.5'
pycurl==7.45.2; python_version >= '3.5'
pyjwt==2.8.0; python_version >= '3.7'
pysocks==1.7.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
Expand Down

0 comments on commit 777ca5c

Please sign in to comment.