-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(anta): Add timestamps option to asynceapi client and update typi…
…ng (#1035)
- Loading branch information
1 parent
9ba0284
commit 5a1e2a0
Showing
9 changed files
with
280 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright (c) 2024-2025 Arista Networks, Inc. | ||
# Use of this source code is governed by the Apache License 2.0 | ||
# that can be found in the LICENSE file. | ||
"""Type definitions used for the asynceapi package.""" | ||
|
||
from __future__ import annotations | ||
|
||
import sys | ||
from typing import Any, Literal | ||
|
||
if sys.version_info >= (3, 11): | ||
from typing import NotRequired, TypedDict | ||
else: | ||
from typing_extensions import NotRequired, TypedDict | ||
|
||
EapiJsonOutput = dict[str, Any] | ||
"""Type definition of an eAPI JSON output response.""" | ||
EapiTextOutput = str | ||
"""Type definition of an eAPI text output response.""" | ||
EapiSimpleCommand = str | ||
"""Type definition of an eAPI simple command.""" | ||
|
||
|
||
class EapiComplexCommand(TypedDict): | ||
"""Type definition of an eAPI complex command.""" | ||
|
||
cmd: str | ||
input: NotRequired[str] | ||
revision: NotRequired[int] | ||
|
||
|
||
class JsonRpc(TypedDict): | ||
"""Type definition of a JSON-RPC payload.""" | ||
|
||
jsonrpc: Literal["2.0"] | ||
method: Literal["runCmds"] | ||
params: JsonRpcParams | ||
id: NotRequired[int | str] | ||
|
||
|
||
class JsonRpcParams(TypedDict): | ||
"""Type definition of JSON-RPC parameters.""" | ||
|
||
version: NotRequired[int | Literal["latest"]] | ||
cmds: list[EapiSimpleCommand | EapiComplexCommand] | ||
format: NotRequired[Literal["json", "text"]] | ||
autoComplete: NotRequired[bool] | ||
expandAliases: NotRequired[bool] | ||
timestamps: NotRequired[bool] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.