fix(ci): fix black/ruff failures, add CoC and PR template
- Fix Python formatting (sync no longer strips blank lines from .py files) - Remove test_community_build.py (tests private sync module) - Fix ruff warnings in test files - Add CODE_OF_CONDUCT.md - Add .github/PULL_REQUEST_TEMPLATE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from typing import Any
|
||||
|
||||
from plugins.directus.client import DirectusClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (10 tools)"""
|
||||
return [
|
||||
@@ -192,10 +193,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# =====================
|
||||
# HANDLER FUNCTIONS
|
||||
# =====================
|
||||
|
||||
|
||||
async def list_users(
|
||||
client: DirectusClient,
|
||||
filter: dict | None = None,
|
||||
@@ -216,6 +219,7 @@ async def list_users(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def get_user(client: DirectusClient, id: str) -> str:
|
||||
"""Get user by ID."""
|
||||
try:
|
||||
@@ -226,6 +230,7 @@ async def get_user(client: DirectusClient, id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def get_current_user(client: DirectusClient) -> str:
|
||||
"""Get current user."""
|
||||
try:
|
||||
@@ -236,6 +241,7 @@ async def get_current_user(client: DirectusClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def create_user(
|
||||
client: DirectusClient,
|
||||
email: str,
|
||||
@@ -263,6 +269,7 @@ async def create_user(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def update_user(client: DirectusClient, id: str, data: dict[str, Any]) -> str:
|
||||
"""Update user."""
|
||||
try:
|
||||
@@ -275,6 +282,7 @@ async def update_user(client: DirectusClient, id: str, data: dict[str, Any]) ->
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def delete_user(client: DirectusClient, id: str) -> str:
|
||||
"""Delete a user."""
|
||||
try:
|
||||
@@ -283,6 +291,7 @@ async def delete_user(client: DirectusClient, id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def delete_users(client: DirectusClient, ids: list[str]) -> str:
|
||||
"""Delete multiple users."""
|
||||
try:
|
||||
@@ -291,6 +300,7 @@ async def delete_users(client: DirectusClient, ids: list[str]) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def invite_user(
|
||||
client: DirectusClient, email: str, role: str, invite_url: str | None = None
|
||||
) -> str:
|
||||
@@ -309,6 +319,7 @@ async def invite_user(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def update_current_user(client: DirectusClient, data: dict[str, Any]) -> str:
|
||||
"""Update current user profile."""
|
||||
try:
|
||||
@@ -329,6 +340,7 @@ async def update_current_user(client: DirectusClient, data: dict[str, Any]) -> s
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def get_user_role(client: DirectusClient, id: str) -> str:
|
||||
"""Get user's role."""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user