fix: black formatting for CI (Python 3.12 compat)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-31 17:52:54 +02:00
parent 9905a28eb0
commit 12b06ce66f
3 changed files with 51 additions and 21 deletions

View File

@@ -483,8 +483,6 @@ async def delete_user_factor(client: SupabaseClient, user_id: str, factor_id: st
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False) return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
async def search_users( async def search_users(
client: SupabaseClient, query: str, page: int = 1, per_page: int = 50 client: SupabaseClient, query: str, page: int = 1, per_page: int = 50
) -> str: ) -> str:

View File

@@ -77,8 +77,12 @@ class WPCLIManager:
try: try:
# First, test if we have Docker socket access # First, test if we have Docker socket access
test_process = await asyncio.create_subprocess_exec( test_process = await asyncio.create_subprocess_exec(
"docker", "version", "--format", "{{.Server.Version}}", "docker",
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE "version",
"--format",
"{{.Server.Version}}",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
) )
test_stdout, test_stderr = await asyncio.wait_for( test_stdout, test_stderr = await asyncio.wait_for(
@@ -99,10 +103,15 @@ class WPCLIManager:
# Now check for our specific container using exact name match # Now check for our specific container using exact name match
process = await asyncio.create_subprocess_exec( process = await asyncio.create_subprocess_exec(
"docker", "ps", "--all", "docker",
"--filter", f"name=^{self.container_name}$", "ps",
"--format", "{{.Names}}|{{.Status}}", "--all",
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE "--filter",
f"name=^{self.container_name}$",
"--format",
"{{.Names}}|{{.Status}}",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
) )
stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=5.0) stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=5.0)
@@ -117,8 +126,13 @@ class WPCLIManager:
if not output: if not output:
# Container not found - get list of available containers for helpful error # Container not found - get list of available containers for helpful error
list_process = await asyncio.create_subprocess_exec( list_process = await asyncio.create_subprocess_exec(
"docker", "ps", "--all", "--format", "{{.Names}}", "docker",
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE "ps",
"--all",
"--format",
"{{.Names}}",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
) )
list_stdout, _ = await list_process.communicate() list_stdout, _ = await list_process.communicate()
available = list_stdout.decode().strip().split("\n") if list_stdout else [] available = list_stdout.decode().strip().split("\n") if list_stdout else []
@@ -170,9 +184,14 @@ class WPCLIManager:
try: try:
# Try to run wp --version # Try to run wp --version
process = await asyncio.create_subprocess_exec( process = await asyncio.create_subprocess_exec(
"docker", "exec", self.container_name, "docker",
"wp", "--version", "--allow-root", "exec",
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE self.container_name,
"wp",
"--version",
"--allow-root",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
) )
stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=5.0) stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=5.0)
@@ -291,7 +310,9 @@ class WPCLIManager:
) )
# 4. Build docker exec command (split command into args to prevent shell injection) # 4. Build docker exec command (split command into args to prevent shell injection)
cmd_parts = ["docker", "exec", self.container_name, "wp"] + command.split() + ["--allow-root"] cmd_parts = (
["docker", "exec", self.container_name, "wp"] + command.split() + ["--allow-root"]
)
self.logger.info(f"Executing: {' '.join(cmd_parts)}") self.logger.info(f"Executing: {' '.join(cmd_parts)}")
@@ -582,17 +603,29 @@ class WPCLIManager:
try: try:
# Try GNU stat first, fall back to BSD stat # Try GNU stat first, fall back to BSD stat
process = await asyncio.create_subprocess_exec( process = await asyncio.create_subprocess_exec(
"docker", "exec", self.container_name, "docker",
"stat", "-c", "%s", export_path, "exec",
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE self.container_name,
"stat",
"-c",
"%s",
export_path,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
) )
stdout, _ = await asyncio.wait_for(process.communicate(), timeout=5.0) stdout, _ = await asyncio.wait_for(process.communicate(), timeout=5.0)
if process.returncode != 0: if process.returncode != 0:
# BSD stat fallback # BSD stat fallback
process = await asyncio.create_subprocess_exec( process = await asyncio.create_subprocess_exec(
"docker", "exec", self.container_name, "docker",
"stat", "-f", "%z", export_path, "exec",
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE self.container_name,
"stat",
"-f",
"%z",
export_path,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
) )
stdout, _ = await asyncio.wait_for(process.communicate(), timeout=5.0) stdout, _ = await asyncio.wait_for(process.communicate(), timeout=5.0)

View File

@@ -1,6 +1,5 @@
"""Tests for Admin System Unification (F.4).""" """Tests for Admin System Unification (F.4)."""
from core.dashboard.auth import ( from core.dashboard.auth import (
DashboardSession, DashboardSession,
get_session_display_info, get_session_display_info,