mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-21 18:52:36 +10:00
Trunk and semgrep fixes
This commit is contained in:
@@ -208,6 +208,7 @@ def set_config(path: str, value: Any, port: str | None = None) -> dict[str, Any]
|
||||
set_config("device.role", "ROUTER")
|
||||
set_config("mqtt.enabled", True)
|
||||
set_config("mqtt.address", "mqtt.example.com")
|
||||
|
||||
"""
|
||||
segments = [s for s in path.split(".") if s]
|
||||
if not segments:
|
||||
|
||||
@@ -46,6 +46,7 @@ class FirmwareLogTailer(threading.Thread):
|
||||
wait_s:
|
||||
How long to poll for the file's creation before giving up. Default
|
||||
30 s; pytest collection on a cold cache can be slow.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -18,7 +18,7 @@ class ConfigError(RuntimeError):
|
||||
|
||||
|
||||
def firmware_root() -> Path:
|
||||
"""The root of the Meshtastic firmware repo.
|
||||
"""Resolve the root of the Meshtastic firmware repo.
|
||||
|
||||
Resolution order:
|
||||
1. `MESHTASTIC_FIRMWARE_ROOT` env var.
|
||||
|
||||
@@ -19,7 +19,7 @@ import uuid
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
from . import boards, config, pio
|
||||
from . import boards, config
|
||||
|
||||
_BUFFER_MAX_LINES = 10_000
|
||||
_POLL_NEW_PORT_TIMEOUT_S = 3.0
|
||||
|
||||
@@ -205,7 +205,7 @@ def userprefs_get() -> dict[str, Any]:
|
||||
|
||||
@app.tool()
|
||||
def userprefs_set(prefs: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Persistently merge `prefs` into userPrefs.jsonc (uncommenting keys).
|
||||
"""Merge `prefs` into userPrefs.jsonc persistently (uncommenting keys).
|
||||
|
||||
Existing active values not in `prefs` are kept. To remove a key from the
|
||||
active set, call `userprefs_reset` (restores the MCP backup if present)
|
||||
@@ -275,6 +275,7 @@ def userprefs_testing_profile(
|
||||
long_name: optional owner long name stamped into the build.
|
||||
disable_mqtt: disable MQTT module + uplink/downlink (default True).
|
||||
disable_position: disable GPS + smart-position broadcasts (default False).
|
||||
|
||||
"""
|
||||
return userprefs_mod.build_testing_profile(
|
||||
psk_seed=psk_seed,
|
||||
|
||||
@@ -69,6 +69,7 @@ def _parse_jsonc_state(text: str) -> dict[str, Any]:
|
||||
"commented": {key: string_value, ...}, # commented examples
|
||||
"order": [key, ...] # source order for round-trip
|
||||
}
|
||||
|
||||
"""
|
||||
active: dict[str, str] = {}
|
||||
commented: dict[str, str] = {}
|
||||
@@ -415,12 +416,14 @@ def build_testing_profile(
|
||||
isolation).
|
||||
region: short code from `KNOWN_REGIONS`.
|
||||
modem_preset: short code from `KNOWN_MODEM_PRESETS`.
|
||||
short_name / long_name: optional owner identity stamps.
|
||||
short_name: optional owner short-name stamp (≤4 chars). None = unset.
|
||||
long_name: optional owner long-name stamp. None = unset.
|
||||
disable_mqtt: if True (default), disables the MQTT module and the
|
||||
uplink/downlink bridge on the primary channel — so private test
|
||||
traffic never leaks to a public broker.
|
||||
disable_position: if True, disables GPS + position broadcasts — useful
|
||||
when test devices sit on a bench without antennas.
|
||||
|
||||
"""
|
||||
if region not in KNOWN_REGIONS:
|
||||
raise ValueError(
|
||||
|
||||
Reference in New Issue
Block a user