mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-08-07 09:23:06 +02:00
refactor: clean up import statements and whitespace in local_cli, base, and update_endpoints modules
This commit is contained in:
@@ -8,7 +8,6 @@ import sys
|
||||
from typing import Optional
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
||||
CONFIG_PATHS = [
|
||||
"/etc/pymc_repeater/config.yaml",
|
||||
"config.yaml",
|
||||
@@ -25,9 +24,10 @@ def _validate_http_url(url: str) -> None:
|
||||
|
||||
def _load_config(config_path=None):
|
||||
"""Load repeater config.yaml, trying common paths."""
|
||||
import yaml
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
paths = [config_path] if config_path else CONFIG_PATHS
|
||||
for p in paths:
|
||||
path = Path(p)
|
||||
@@ -41,9 +41,9 @@ def run_client_cli(host: str = "127.0.0.1", port: int = 8000, password: Optional
|
||||
"""
|
||||
Standalone CLI client that connects to a running repeater's HTTP API.
|
||||
"""
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
import json
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
base_url = f"http://{host}:{port}"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ from abc import ABC, abstractmethod
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any, Dict, Iterable, Optional, Tuple
|
||||
|
||||
|
||||
_PIP_PACKAGE_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]*$")
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ from typing import List, Optional
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import cherrypy
|
||||
|
||||
from repeater.service_utils import get_container_restart_message, is_buildroot, is_container
|
||||
|
||||
logger = logging.getLogger("HTTPServer")
|
||||
@@ -192,9 +193,10 @@ def _get_installed_version(force_refresh: bool = False) -> str:
|
||||
# If the running process is already on a higher version than anything found
|
||||
# on disk, the dist-info dirs are stale leftovers and __version__ is truth.
|
||||
try:
|
||||
from repeater import __version__ as _running
|
||||
from packaging.version import Version
|
||||
|
||||
from repeater import __version__ as _running
|
||||
|
||||
if Version(_running) > Version(disk_version):
|
||||
# status() polls can call this frequently; throttle mismatch logs.
|
||||
global _disk_version_mismatch_logged
|
||||
|
||||
Reference in New Issue
Block a user