Skip to content

Commit

Permalink
✨ update some dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Guerteltier committed Mar 30, 2024
1 parent 070bf2b commit 27042d0
Show file tree
Hide file tree
Showing 17 changed files with 1,358 additions and 1,701 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install_dart_sass/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: 3.3.2
sdk: 3.3.3
- name: Install buf
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ jobs:
rm -f youki_${VERSION_U_005F_LL}_linux.tar.gz
chmod +x /opt/youki
env:
VERSION_U_002E_FS: 0.3.0
VERSION_U_002E_FS: 0.3.2
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ jobs:
rm -f youki_${VERSION_U_005F_LL}_linux.tar.gz
chmod +x /opt/youki
env:
VERSION_U_002E_FS: 0.3.0
VERSION_U_002E_FS: 0.3.2
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN set -eux \
&& /venv/bin/pip install Cython==3.* setuptools==68.* wheel==0.42.* \
&& CFLAGS="-DCYTHON_USE_PYLONG_INTERNALS=0" /venv/bin/pip install --no-build-isolation https://codeload.github.com/ronny-rentner/UltraDict/tar.gz/9f88a2f73e6b7faadb591971c6a17b360ebbc3bf \
&& /venv/bin/pip install git+https://github.com/pypy/pyrepl.git@502bcf766e22b7d3898ed318f4a02d575804eb6f \
&& /venv/bin/pip install -r pip-requirements.txt \
&& /venv/bin/pip install --no-binary pycurl -r pip-requirements.txt \
&& /venv/bin/pip uninstall -y Cython setuptools wheel
COPY . /usr/src/an-website
WORKDIR /usr/src/an-website
Expand Down
18 changes: 9 additions & 9 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ansi2html = "==1.*"
beautifulsoup4 = "==4.*"
# big = {version = "<2", extras = ["time"]}
blake3 = "<2"
certifi = "==2023.*"
certifi = "==2023.11.17"
# cryptography = "==42.*"
defity = "<2"
defusedxml = "<2"
Expand All @@ -32,20 +32,20 @@ pillow-jxl-plugin = "==1.*"
pycryptodome = "==3.*"
pycurl = "==7.*"
pysocks = "==1.*"
pyston-lite = {version = "==2.*", markers = "python_version < '3.11'"}
pyston-lite-autoload = {version = "==2.*", markers = "python_version < '3.11'"}
# pyston-lite = {version = "==2.*", markers = "python_version < '3.11'"}
# pyston-lite-autoload = {version = "==2.*", markers = "python_version < '3.11'"}
python-dateutil = "==2.*"
python-geoip-geolite2-yplan = "==2019.1224"
python-geoip-yplan = "==1.*"
pytz = "==2023.*"
pytz = "==2023.4"
PyYAML = "==6.*"
rapidfuzz = "==3.*"
redis = {version = "==5.*", extras = ["hiredis"]}
regex = "==2023.*"
regex = "==2023.12.25"
setproctitle = "==1.*"
tornado = "==6.*"
typed-stream = "<2"
tzdata = "==2023.*"
tzdata = "==2023.4"
UltraDict = "<2"
uvloop = "<2"

Expand Down Expand Up @@ -85,16 +85,16 @@ pytest-tornasync = "<2"
# ruff = "<2"
setuptools = "==69.*"
time-machine = "==2.*"
trove-classifiers = "==2023.*"
trove-classifiers = "==2023.11.29"
twine = "==4.*"
types-beautifulsoup4 = "==4.*"
types-emoji = "==2.*"
types-lxml = "==2023.*"
types-lxml = "==2023.10.21"
types-orjson = "==3.*"
types-Pillow = "==10.*"
types-pycurl = "==7.*"
types-python-dateutil = "==2.*"
types-PyYAML = "==6.*"
types-redis = "==4.*"
types-regex = "==2023.*"
types-regex = "==2023.12.25.*"
types-setuptools = "==69.*"
412 changes: 203 additions & 209 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion an_website/static/js/vendored/vanilla.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions an_website/static/js/vendored/vanilla.js.map

Large diffs are not rendered by default.

28 changes: 7 additions & 21 deletions an_website/update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
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 Any, ClassVar, Final, Protocol
from typing import TYPE_CHECKING, Any, ClassVar, Final
from urllib.parse import unquote

from tornado.web import stream_request_body
Expand All @@ -32,6 +33,9 @@
from ..utils.request_handler import APIRequestHandler
from ..utils.utils import ModuleInfo, Permission

if TYPE_CHECKING:
from tempfile import _TemporaryFileWrapper

LOGGER: Final = logging.getLogger(__name__)


Expand All @@ -46,25 +50,7 @@ def get_module_info() -> ModuleInfo:
)


class WriteBytesAndClose(Protocol):
"""Support write and close."""

def close(self) -> None:
"""Close."""

def write(self, s: bytes, /) -> int:
"""Write bytes."""


class NamedWriteBytesAndClose(WriteBytesAndClose, Protocol):
"""Has name and supports write and close."""

name: str


def write_from_queue(
file: WriteBytesAndClose, queue: SimpleQueue[None | bytes]
) -> None:
def write_from_queue(file: io.IOBase, 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:
Expand All @@ -81,7 +67,7 @@ class UpdateAPI(APIRequestHandler): # pragma: no cover
POSSIBLE_CONTENT_TYPES: ClassVar[tuple[str, ...]] = ("text/plain",)

dir: TemporaryDirectory[str]
file: NamedWriteBytesAndClose
file: _TemporaryFileWrapper[bytes]
queue: SimpleQueue[None | bytes]
future: Future[Any]

Expand Down
7 changes: 7 additions & 0 deletions an_website/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from datetime import datetime, timezone
from enum import IntFlag
from functools import cache, partial
from hashlib import sha1
from ipaddress import IPv4Address, IPv6Address, ip_address, ip_network
from pathlib import Path
from typing import (
Expand Down Expand Up @@ -785,6 +786,12 @@ def str_to_set(string: str) -> set[str]:
return {part.strip() for part in string.split(",") if part.strip()}


def strangle(string: str) -> float:
"""Convert a string to an angle."""
hasher = sha1(string.encode("UTF-8"), usedforsecurity=False)
return int.from_bytes(hasher.digest()[:2], "little") / (1 << 16) * 360


def time_function(function: Callable[..., T], *args: Any) -> tuple[T, float]:
"""Run the function and return the result and the time it took in seconds."""
timer = Timer()
Expand Down
Loading

0 comments on commit 27042d0

Please sign in to comment.