fix(lint): suppress ruff F823 false positive in create_event handler
Ruff 0.15.7 incorrectly flags datetime.fromisoformat() as a "local variable referenced before assignment" inside a try block within execute_tool(). datetime is imported at module level and is not a local variable. Added noqa comment at the specific line. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1234,21 +1234,19 @@ async def execute_tool(user_id: int, tool_name: str, arguments: dict) -> dict:
|
||||
end_str = arguments.get("end")
|
||||
all_day = arguments.get("all_day", False)
|
||||
# Parse start — accept date-only (YYYY-MM-DD) or full ISO datetime
|
||||
if "T" not in start_str and " " not in start_str:
|
||||
all_day = True
|
||||
start_str = f"{start_str}T00:00:00"
|
||||
try:
|
||||
if "T" in start_str or " " in start_str:
|
||||
start_dt = datetime.fromisoformat(start_str)
|
||||
else:
|
||||
start_dt = datetime.fromisoformat(f"{start_str}T00:00:00")
|
||||
all_day = True
|
||||
start_dt = datetime.fromisoformat(start_str) # noqa: F823 (false positive — datetime is imported at module level)
|
||||
except (ValueError, TypeError):
|
||||
return {"success": False, "error": f"Invalid start datetime: {start_str!r}"}
|
||||
end_dt = None
|
||||
if end_str:
|
||||
if "T" not in end_str and " " not in end_str:
|
||||
end_str = f"{end_str}T00:00:00"
|
||||
try:
|
||||
if "T" in end_str or " " in end_str:
|
||||
end_dt = datetime.fromisoformat(end_str)
|
||||
else:
|
||||
end_dt = datetime.fromisoformat(f"{end_str}T00:00:00")
|
||||
end_dt = datetime.fromisoformat(end_str)
|
||||
except (ValueError, TypeError):
|
||||
return {"success": False, "error": f"Invalid end datetime: {end_str!r}"}
|
||||
project_id = None
|
||||
|
||||
Reference in New Issue
Block a user