mirror of
https://github.com/katanemo/plano.git
synced 2026-04-25 00:36:34 +02:00
Update black hook for Python 3.14 (#857)
* Update pre-commit black to latest release * Reformat Python files for new black version
This commit is contained in:
parent
f019f05738
commit
82f34f82f2
13 changed files with 38 additions and 34 deletions
|
|
@ -37,7 +37,7 @@ repos:
|
||||||
- id: gitleaks
|
- id: gitleaks
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 23.1.0
|
rev: 26.3.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
language_version: python3
|
language_version: python3
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ from planoai.docker_cli import (
|
||||||
stream_gateway_logs,
|
stream_gateway_logs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,26 +189,26 @@ def get_function_parameters(node: ast.FunctionDef, tree: ast.AST) -> list:
|
||||||
if isinstance(
|
if isinstance(
|
||||||
arg.annotation.value, ast.Name
|
arg.annotation.value, ast.Name
|
||||||
) and arg.annotation.value.id in ["list", "tuple", "set", "dict"]:
|
) and arg.annotation.value.id in ["list", "tuple", "set", "dict"]:
|
||||||
param_info[
|
param_info["type"] = (
|
||||||
"type"
|
f"{arg.annotation.value.id}" # e.g., "List", "Tuple", etc.
|
||||||
] = f"{arg.annotation.value.id}" # e.g., "List", "Tuple", etc.
|
)
|
||||||
else:
|
else:
|
||||||
param_info["type"] = "[UNKNOWN - PLEASE FIX]"
|
param_info["type"] = "[UNKNOWN - PLEASE FIX]"
|
||||||
|
|
||||||
# Default for unknown types
|
# Default for unknown types
|
||||||
else:
|
else:
|
||||||
param_info[
|
param_info["type"] = (
|
||||||
"type"
|
"[UNKNOWN - PLEASE FIX]" # If unable to detect type
|
||||||
] = "[UNKNOWN - PLEASE FIX]" # If unable to detect type
|
)
|
||||||
|
|
||||||
# Handle default values
|
# Handle default values
|
||||||
if default is not None:
|
if default is not None:
|
||||||
if isinstance(default, ast.Constant) or isinstance(
|
if isinstance(default, ast.Constant) or isinstance(
|
||||||
default, ast.NameConstant
|
default, ast.NameConstant
|
||||||
):
|
):
|
||||||
param_info[
|
param_info["default"] = (
|
||||||
"default"
|
default.value
|
||||||
] = default.value # Use the default value directly
|
) # Use the default value directly
|
||||||
else:
|
else:
|
||||||
param_info["default"] = "[UNKNOWN DEFAULT]" # Unknown default type
|
param_info["default"] = "[UNKNOWN DEFAULT]" # Unknown default type
|
||||||
param_info["required"] = False # Optional since it has a default value
|
param_info["required"] = False # Optional since it has a default value
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import yaml
|
||||||
import logging
|
import logging
|
||||||
from planoai.consts import PLANO_DOCKER_NAME
|
from planoai.consts import PLANO_DOCKER_NAME
|
||||||
|
|
||||||
|
|
||||||
# Standard env var for log level across all Plano components
|
# Standard env var for log level across all Plano components
|
||||||
LOG_LEVEL_ENV = "LOG_LEVEL"
|
LOG_LEVEL_ENV = "LOG_LEVEL"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,12 +287,16 @@ async def fetch_flights(
|
||||||
"flight_number": flight.get("ident_iata") or flight.get("ident"),
|
"flight_number": flight.get("ident_iata") or flight.get("ident"),
|
||||||
"departure_time": flight.get("scheduled_out"),
|
"departure_time": flight.get("scheduled_out"),
|
||||||
"arrival_time": flight.get("scheduled_in"),
|
"arrival_time": flight.get("scheduled_in"),
|
||||||
"origin": flight["origin"].get("code_iata")
|
"origin": (
|
||||||
if isinstance(flight.get("origin"), dict)
|
flight["origin"].get("code_iata")
|
||||||
else None,
|
if isinstance(flight.get("origin"), dict)
|
||||||
"destination": flight["destination"].get("code_iata")
|
else None
|
||||||
if isinstance(flight.get("destination"), dict)
|
),
|
||||||
else None,
|
"destination": (
|
||||||
|
flight["destination"].get("code_iata")
|
||||||
|
if isinstance(flight.get("destination"), dict)
|
||||||
|
else None
|
||||||
|
),
|
||||||
"aircraft_type": flight.get("aircraft_type"),
|
"aircraft_type": flight.get("aircraft_type"),
|
||||||
"status": flight.get("status"),
|
"status": flight.get("status"),
|
||||||
"terminal_origin": flight.get("terminal_origin"),
|
"terminal_origin": flight.get("terminal_origin"),
|
||||||
|
|
|
||||||
|
|
@ -197,12 +197,16 @@ async def fetch_flights(
|
||||||
"flight_number": flight.get("ident_iata") or flight.get("ident"),
|
"flight_number": flight.get("ident_iata") or flight.get("ident"),
|
||||||
"departure_time": flight.get("scheduled_out"),
|
"departure_time": flight.get("scheduled_out"),
|
||||||
"arrival_time": flight.get("scheduled_in"),
|
"arrival_time": flight.get("scheduled_in"),
|
||||||
"origin": flight["origin"].get("code_iata")
|
"origin": (
|
||||||
if isinstance(flight.get("origin"), dict)
|
flight["origin"].get("code_iata")
|
||||||
else None,
|
if isinstance(flight.get("origin"), dict)
|
||||||
"destination": flight["destination"].get("code_iata")
|
else None
|
||||||
if isinstance(flight.get("destination"), dict)
|
),
|
||||||
else None,
|
"destination": (
|
||||||
|
flight["destination"].get("code_iata")
|
||||||
|
if isinstance(flight.get("destination"), dict)
|
||||||
|
else None
|
||||||
|
),
|
||||||
"aircraft_type": flight.get("aircraft_type"),
|
"aircraft_type": flight.get("aircraft_type"),
|
||||||
"status": flight.get("status"),
|
"status": flight.get("status"),
|
||||||
"terminal_origin": flight.get("terminal_origin"),
|
"terminal_origin": flight.get("terminal_origin"),
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExport
|
||||||
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
||||||
from opentelemetry.sdk.resources import Resource
|
from opentelemetry.sdk.resources import Resource
|
||||||
|
|
||||||
|
|
||||||
resource = Resource.create(
|
resource = Resource.create(
|
||||||
{
|
{
|
||||||
"service.name": "weather-forecast-service",
|
"service.name": "weather-forecast-service",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ Exposes two endpoints:
|
||||||
GET /metrics — Prometheus text format, P95 latency per model (scraped by Prometheus)
|
GET /metrics — Prometheus text format, P95 latency per model (scraped by Prometheus)
|
||||||
GET /costs — JSON cost data per model, compatible with cost_metrics source
|
GET /costs — JSON cost data per model, compatible with cost_metrics source
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
ARCH_STATE_HEADER = "x-arch-state"
|
ARCH_STATE_HEADER = "x-arch-state"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
"""Sphinx extension to copy provider_models.yaml to build output."""
|
"""Sphinx extension to copy provider_models.yaml to build output."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
|
||||||
|
|
@ -230,12 +230,12 @@ async def get_weather_data(request: Request, messages: list, days: int = 1):
|
||||||
"day_name": date_obj.strftime("%A"),
|
"day_name": date_obj.strftime("%A"),
|
||||||
"temperature_c": round(temp_c, 1) if temp_c is not None else None,
|
"temperature_c": round(temp_c, 1) if temp_c is not None else None,
|
||||||
"temperature_f": celsius_to_fahrenheit(temp_c),
|
"temperature_f": celsius_to_fahrenheit(temp_c),
|
||||||
"temperature_max_c": round(temp_max, 1)
|
"temperature_max_c": (
|
||||||
if temp_max is not None
|
round(temp_max, 1) if temp_max is not None else None
|
||||||
else None,
|
),
|
||||||
"temperature_min_c": round(temp_min, 1)
|
"temperature_min_c": (
|
||||||
if temp_min is not None
|
round(temp_min, 1) if temp_min is not None else None
|
||||||
else None,
|
),
|
||||||
"weather_code": weather_code,
|
"weather_code": weather_code,
|
||||||
"sunrise": sunrise.split("T")[1] if sunrise else None,
|
"sunrise": sunrise.split("T")[1] if sunrise else None,
|
||||||
"sunset": sunset.split("T")[1] if sunset else None,
|
"sunset": sunset.split("T")[1] if sunset else None,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
PROMPT_GATEWAY_ENDPOINT = os.getenv(
|
PROMPT_GATEWAY_ENDPOINT = os.getenv(
|
||||||
"PROMPT_GATEWAY_ENDPOINT", "http://localhost:10000/v1/chat/completions"
|
"PROMPT_GATEWAY_ENDPOINT", "http://localhost:10000/v1/chat/completions"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
PROMPT_GATEWAY_ENDPOINT = os.getenv(
|
PROMPT_GATEWAY_ENDPOINT = os.getenv(
|
||||||
"PROMPT_GATEWAY_ENDPOINT", "http://localhost:10000/v1/chat/completions"
|
"PROMPT_GATEWAY_ENDPOINT", "http://localhost:10000/v1/chat/completions"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue