Skip to content

The agent that grows with you

refactor(photon): AST-neutral closer/string joins (-8)

Tekniumb57411e33217
diff --git a/plugins/platforms/photon/adapter.py b/plugins/platforms/photon/adapter.py
index c1522b3a2d1..3013fe9ba51 100644
--- a/plugins/platforms/photon/adapter.py
+++ b/plugins/platforms/photon/adapter.py
@@ -257,8 +257,7 @@ def _reinstall_sidecar_deps() -> None:
def _run(verb: str) -> subprocess.CompletedProcess:
return subprocess.run( # noqa: S603
[npm, verb], cwd=str(_sidecar_dir()), capture_output=True, text=True, encoding="utf-8",
- errors="replace", check=False, timeout=_NPM_REINSTALL_TIMEOUT, creationflags=windows_hide_flags(),
- )
+ errors="replace", check=False, timeout=_NPM_REINSTALL_TIMEOUT, creationflags=windows_hide_flags())
try:
result = _run("ci")
if result.returncode != 0:
@@ -501,8 +500,7 @@ class PhotonAdapter(BasePlatformAdapter):
self._project_secret: str = (
_get_scoped_secret("PHOTON_PROJECT_SECRET") or extra.get("project_secret") or stored_sec or "")
self._sidecar_port = _coerce_port(
- extra.get("sidecar_port") or _get_scoped_secret("PHOTON_SIDECAR_PORT"), _DEFAULT_SIDECAR_PORT,
- )
+ extra.get("sidecar_port") or _get_scoped_secret("PHOTON_SIDECAR_PORT"), _DEFAULT_SIDECAR_PORT)
self._sidecar_bind = _DEFAULT_SIDECAR_BIND
self._sidecar_token = _get_scoped_secret("PHOTON_SIDECAR_TOKEN") or secrets.token_hex(16)
autostart = str(_get_scoped_secret("PHOTON_SIDECAR_AUTOSTART", "true")).lower()
@@ -584,8 +582,7 @@ class PhotonAdapter(BasePlatformAdapter):
if not self._project_id or not self._project_secret:
self._set_fatal_error(
"MISSING_CREDENTIALS",
- "PHOTON_PROJECT_ID and PHOTON_PROJECT_SECRET are required. "
- "Run: hermes photon setup",
+ "PHOTON_PROJECT_ID and PHOTON_PROJECT_SECRET are required. Run: hermes photon setup",
retryable=False)
return False
client = httpx.AsyncClient(timeout=30.0, trust_env=False)
@@ -954,8 +951,7 @@ class PhotonAdapter(BasePlatformAdapter):
"PHOTON_SIDECAR_PORT": str(self._sidecar_port), "PHOTON_SIDECAR_BIND": self._sidecar_bind,
"PHOTON_SIDECAR_TOKEN": self._sidecar_token,
# Exit on stdin EOF so ANY gateway death (incl. SIGKILL) can't orphan it on the port.
- "PHOTON_SIDECAR_WATCH_STDIN": "1",
- })
+ "PHOTON_SIDECAR_WATCH_STDIN": "1"})
from hermes_cli._subprocess_compat import windows_hide_flags # hide child console on Windows
await self._apply_spectrum_patch(windows_hide_flags())
try:
diff --git a/plugins/platforms/photon/auth.py b/plugins/platforms/photon/auth.py
index 9e6cb595c3c..cc18c0a2dcc 100644
--- a/plugins/platforms/photon/auth.py
+++ b/plugins/platforms/photon/auth.py
@@ -531,8 +531,7 @@ def find_project_by_name(token: str, name: str) -> Optional[Dict[str, Any]]:
def create_project(
- token: str, *, name: str = DEFAULT_PROJECT_NAME, location: str = "United States",
-) -> Dict[str, Any]:
+ token: str, *, name: str = DEFAULT_PROJECT_NAME, location: str = "United States") -> Dict[str, Any]:
"""POST ``/api/projects`` and return the project (Spectrum is always provisioned;
the request carries no ``spectrum`` flag)."""
body: Dict[str, Any] = {"name": name, "location": location, "template": False, "observability": False}
@@ -587,8 +586,7 @@ def find_user_by_phone(project_id: str, project_secret: str, phone_number: str)
def create_user(
project_id: str, project_secret: str, *, phone_number: str, first_name: Optional[str] = None,
- last_name: Optional[str] = None, email: Optional[str] = None, send_invite: bool = False,
-) -> Dict[str, Any]:
+ last_name: Optional[str] = None, email: Optional[str] = None, send_invite: bool = False) -> Dict[str, Any]:
"""POST Spectrum Cloud ``/projects/{id}/users/`` and return the user."""
_require_httpx(" user creation")
if not E164_RE.match(phone_number):
@@ -737,6 +735,5 @@ def print_credential_summary(emit: Any = print) -> None:
" project id : " + (sid if sid else "✗ missing"),
" project secret : " + ("✓ stored" if sec else "✗ missing"),
" my number : " + (phone if phone else "✗ missing (run `hermes photon setup --phone ...`)"),
- " assigned number : " + (assigned if assigned else "✗ missing (run `hermes photon setup`)"),
- ]
+ " assigned number : " + (assigned if assigned else "✗ missing (run `hermes photon setup`)")]
emit("\n".join(rows))
diff --git a/plugins/platforms/photon/cli.py b/plugins/platforms/photon/cli.py
index 2843b02816f..7a21871d553 100644
--- a/plugins/platforms/photon/cli.py
+++ b/plugins/platforms/photon/cli.py
@@ -339,8 +339,7 @@ def _install_sidecar() -> int:
_COMMANDS = {
"setup": _cmd_setup, "status": _cmd_status, "install-sidecar": lambda _args: _install_sidecar(),
- "telemetry": _cmd_telemetry,
-}
+ "telemetry": _cmd_telemetry}
def gateway_setup() -> None: