fix: resolve import paths, remove async context managers, clean up CLI

- Change absolute imports to relative imports in gnmi module
- Remove async context manager methods (pygnmi is synchronous)
- Remove unimplemented --depth option from CLI
- Update documentation to reflect sync-only usage
This commit is contained in:
darnodo
2025-12-31 17:44:21 +01:00
parent 8e460225c2
commit 5b3517c355
3 changed files with 4 additions and 19 deletions

View File

@@ -7,17 +7,17 @@ Arista devices using pygnmi.
Usage:
from gnmi import GNMIClient
async with GNMIClient(
with GNMIClient(
host="leaf1",
port=6030,
username="admin",
password="admin",
insecure=True
) as client:
caps = await client.capabilities()
caps = client.capabilities()
print(caps)
"""
from src.gnmi.client import GNMIClient, GNMIConnectionError, GNMIError, GNMIPathError
from .client import GNMIClient, GNMIConnectionError, GNMIError, GNMIPathError
__all__ = ["GNMIClient", "GNMIError", "GNMIConnectionError", "GNMIPathError"]

View File

@@ -159,14 +159,6 @@ class GNMIClient:
pass # Ignore cleanup errors
self._client = None
async def __aenter__(self) -> GNMIClient:
"""Enter async context manager."""
return self.__enter__()
async def __aexit__(self, exc_type, exc_val, exc_tb) -> None:
"""Exit async context manager."""
self.__exit__(exc_type, exc_val, exc_tb)
# =========================================================================
# gNMI Operations
# =========================================================================
@@ -288,7 +280,7 @@ class GNMIClient:
try:
value = json.loads(value)
except json.JSONDecodeError:
pass # Keep as string if not valid JSON
pass # Keep as string - not valid JSON, will be set as string value
try:
if operation == "delete":