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 _parse_json_param(value: Any, param_name: str = "parameter") -> Any:
|
||||
"""Parse a parameter that may be a JSON string or already a native type."""
|
||||
if value is None:
|
||||
@@ -27,6 +28,7 @@ def _parse_json_param(value: Any, param_name: str = "parameter") -> Any:
|
||||
raise ValueError(f"Invalid JSON in '{param_name}': {e}")
|
||||
return value
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (10 tools)"""
|
||||
return [
|
||||
@@ -211,10 +213,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# =====================
|
||||
# HANDLER FUNCTIONS
|
||||
# =====================
|
||||
|
||||
|
||||
async def list_revisions(
|
||||
client: DirectusClient,
|
||||
filter: dict | None = None,
|
||||
@@ -237,6 +241,7 @@ async def list_revisions(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def get_revision(client: DirectusClient, id: str) -> str:
|
||||
"""Get revision by ID."""
|
||||
try:
|
||||
@@ -247,6 +252,7 @@ async def get_revision(client: DirectusClient, id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def list_versions(
|
||||
client: DirectusClient,
|
||||
filter: dict | None = None,
|
||||
@@ -269,6 +275,7 @@ async def list_versions(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def get_version(client: DirectusClient, id: str) -> str:
|
||||
"""Get version by ID."""
|
||||
try:
|
||||
@@ -279,6 +286,7 @@ async def get_version(client: DirectusClient, id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def create_version(
|
||||
client: DirectusClient, name: str, collection: str, item: str, key: str
|
||||
) -> str:
|
||||
@@ -297,6 +305,7 @@ async def create_version(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def update_version(client: DirectusClient, id: str, data: dict[str, Any]) -> str:
|
||||
"""Update version."""
|
||||
try:
|
||||
@@ -311,6 +320,7 @@ async def update_version(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_version(client: DirectusClient, id: str) -> str:
|
||||
"""Delete a version."""
|
||||
try:
|
||||
@@ -319,6 +329,7 @@ async def delete_version(client: DirectusClient, id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def promote_version(client: DirectusClient, id: str, mainHash: str | None = None) -> str:
|
||||
"""Promote version to main."""
|
||||
try:
|
||||
@@ -335,6 +346,7 @@ async def promote_version(client: DirectusClient, id: str, mainHash: str | None
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def list_comments(
|
||||
client: DirectusClient,
|
||||
filter: dict | None = None,
|
||||
@@ -357,6 +369,7 @@ async def list_comments(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def create_comment(client: DirectusClient, collection: str, item: str, comment: str) -> str:
|
||||
"""Create a comment."""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user