lint: apply manual ruff cleanup (non-preview files)

This commit is contained in:
Leo Vasanko
2026-04-26 06:16:42 +00:00
parent 9321961a11
commit 3767fb0cec
29 changed files with 169 additions and 223 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
import base64
import hashlib
import hmac
import re
import struct
from pathlib import Path
from time import time
@@ -94,7 +93,7 @@ def _session_cookie_header(username: str) -> dict[str, str]:
return {"Cookie": f"s={token}"}
@pytest.fixture()
@pytest.fixture
def setup_storage(tmp_path: Path):
user = config.User()
auth.set_password(user, "secret")
+3 -3
View File
@@ -10,7 +10,7 @@ from cista import config, watching
from cista.fileserver import bp as fileserver_bp
@pytest.fixture()
@pytest.fixture
def setup_storage(tmp_path: Path):
config.config = config.Config(path=tmp_path, listen=":0", public=True)
watching.state.root = []
@@ -33,7 +33,7 @@ async def client(setup_storage: Path):
@pytest.mark.asyncio
async def test_get_percent2F_decoded_as_path_separator(client, setup_storage: Path):
async def test_get_percent2f_decoded_as_path_separator(client, setup_storage: Path):
"""%2F in the URL path is decoded to '/' and treated as a path separator."""
(setup_storage / "sub").mkdir()
(setup_storage / "sub" / "file.txt").write_text("hello", encoding="utf-8")
@@ -45,7 +45,7 @@ async def test_get_percent2F_decoded_as_path_separator(client, setup_storage: Pa
@pytest.mark.asyncio
async def test_mkcol_percent2F_creates_nested_directory(client, setup_storage: Path):
async def test_mkcol_percent2f_creates_nested_directory(client, setup_storage: Path):
"""%2F in MKCOL path is decoded as a separator, creating nested dirs."""
_, res = await client.request("MKCOL", "/files/parent%2Fchild")
+1 -1
View File
@@ -10,7 +10,7 @@ from cista.fileserver import bp as fileserver_bp
from cista.protocol import FileEntry
@pytest.fixture()
@pytest.fixture
def setup_storage(tmp_path: Path):
config.config = config.Config(path=tmp_path, listen=":0", public=True)
watching.state.root = []
+1 -1
View File
@@ -9,7 +9,7 @@ from cista import config, watching
from cista.fileserver import bp as fileserver_bp
@pytest.fixture()
@pytest.fixture
def setup_storage(tmp_path: Path):
config.config = config.Config(path=tmp_path, listen=":0", public=True)
watching.state.root = []
+1 -2
View File
@@ -9,13 +9,12 @@ from sanic import Sanic
from cista import config, watching
from cista.fileserver import bp as fileserver_bp
from cista.protocol import FileEntry
_DAV_NS = "DAV:"
_METHODS = ("MKCOL", "MOVE", "COPY", "PROPFIND")
@pytest.fixture()
@pytest.fixture
def setup_storage(tmp_path: Path):
config.config = config.Config(path=tmp_path, listen=":0", public=True)
watching.state.root = []
+5 -6
View File
@@ -1,8 +1,6 @@
from pathlib import Path
from time import time
from uuid import uuid4
import os
from pathlib import Path
from uuid import uuid4
import pytest
import pytest_asyncio
@@ -13,9 +11,10 @@ from cista.auth import bp as auth_bp
def _persist_config():
import msgspec
from pathlib import PurePath
import msgspec
def enc_hook(obj):
if isinstance(obj, PurePath):
return obj.as_posix()
@@ -25,7 +24,7 @@ def _persist_config():
config.conffile.write_bytes(msgspec.toml.encode(raw))
@pytest.fixture()
@pytest.fixture
def setup_storage(tmp_path: Path):
os.environ["CISTA_HOME"] = str(tmp_path)
config.init_confdir()