mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
import formatting imporvements
This commit is contained in:
@@ -10,4 +10,5 @@ force_single_line = False
|
||||
import_heading_stdlib = Standard Library
|
||||
import_heading_thirdparty = Third Party
|
||||
import_heading_firstparty = Project
|
||||
import_heading_localfolder = Local
|
||||
known_third_party = starlette,fastapi,inquirer
|
@@ -12,6 +12,7 @@ from click import group, option, confirm, help_option
|
||||
# Project
|
||||
from hyperglass.util import cpu_count
|
||||
|
||||
# Local
|
||||
from .echo import error, label, success, cmd_help
|
||||
from .util import build_ui
|
||||
from .static import LABEL, CLI_HELP, E
|
||||
|
@@ -1,5 +1,6 @@
|
||||
"""Individual transport driver classes & subclasses."""
|
||||
|
||||
# Local
|
||||
from .agent import AgentConnection
|
||||
from .ssh_netmiko import NetmikoConnection
|
||||
from .ssh_scrapli import ScrapliConnection
|
||||
|
@@ -10,6 +10,7 @@ from hyperglass.parsing.nos import scrape_parsers, structured_parsers
|
||||
from hyperglass.parsing.common import parsers
|
||||
from hyperglass.models.config.devices import Device
|
||||
|
||||
# Local
|
||||
from ._construct import Construct
|
||||
|
||||
|
||||
|
@@ -20,6 +20,7 @@ from hyperglass.encode import jwt_decode, jwt_encode
|
||||
from hyperglass.exceptions import RestError, ResponseEmpty
|
||||
from hyperglass.configuration import params
|
||||
|
||||
# Local
|
||||
from ._common import Connection
|
||||
|
||||
|
||||
|
@@ -9,6 +9,7 @@ from hyperglass.exceptions import ScrapeError
|
||||
from hyperglass.configuration import params
|
||||
from hyperglass.compat._sshtunnel import BaseSSHTunnelForwarderError, open_tunnel
|
||||
|
||||
# Local
|
||||
from ._common import Connection
|
||||
|
||||
|
||||
|
@@ -19,6 +19,7 @@ from hyperglass.log import log
|
||||
from hyperglass.exceptions import AuthError, ScrapeError, DeviceTimeout
|
||||
from hyperglass.configuration import params
|
||||
|
||||
# Local
|
||||
from .ssh import SSHConnection
|
||||
|
||||
netmiko_nos_globals = {
|
||||
|
@@ -33,6 +33,7 @@ from hyperglass.exceptions import (
|
||||
)
|
||||
from hyperglass.configuration import params
|
||||
|
||||
# Local
|
||||
from .ssh import SSHConnection
|
||||
|
||||
SCRAPLI_DRIVER_MAP = {
|
||||
|
@@ -17,6 +17,7 @@ from hyperglass.exceptions import DeviceTimeout, ResponseEmpty
|
||||
from hyperglass.models.api import Query
|
||||
from hyperglass.configuration import params
|
||||
|
||||
# Local
|
||||
from .drivers import AgentConnection, NetmikoConnection, ScrapliConnection
|
||||
|
||||
DRIVER_MAP = {
|
||||
|
1
hyperglass/external/__init__.py
vendored
1
hyperglass/external/__init__.py
vendored
@@ -1,4 +1,5 @@
|
||||
"""Functions & handlers for external data."""
|
||||
|
||||
# Local
|
||||
from .ripestat import RIPEStat # noqa: F401
|
||||
from .webhooks import Webhook # noqa: F401
|
||||
|
@@ -1,3 +1,4 @@
|
||||
"""All Data Models used by hyperglass."""
|
||||
|
||||
# Local
|
||||
from .main import HyperglassModel, HyperglassModelExtra
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Query & Response Validation Models."""
|
||||
# Local
|
||||
from .query import Query
|
||||
from .response import (
|
||||
QueryError,
|
||||
|
@@ -13,6 +13,7 @@ from pydantic import BaseModel, StrictStr, constr, validator
|
||||
from hyperglass.exceptions import InputInvalid
|
||||
from hyperglass.configuration import params, devices
|
||||
|
||||
# Local
|
||||
from .types import SupportedQuery
|
||||
from .validators import (
|
||||
validate_ip,
|
||||
|
@@ -1,5 +1,6 @@
|
||||
"""Validate command configuration variables."""
|
||||
|
||||
# Local
|
||||
from .vyos import VyosCommands
|
||||
from ..main import HyperglassModelExtra
|
||||
from .arista import AristaCommands
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from ..main import HyperglassModel, HyperglassModelExtra
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Mikrotik RouterOS Commands Model."""
|
||||
# Local
|
||||
from ._mikrotik_base import MikrotikCommands
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Mikrotik SwitchOS Commands Model."""
|
||||
# Local
|
||||
from ._mikrotik_base import MikrotikCommands
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
|
@@ -10,6 +10,7 @@ from pydantic import StrictStr, root_validator
|
||||
# Project
|
||||
from hyperglass.log import log
|
||||
|
||||
# Local
|
||||
from .main import HyperglassModel, HyperglassModelExtra
|
||||
|
||||
_WEBHOOK_TITLE = "hyperglass received a valid query with the following data"
|
||||
|
@@ -1,5 +1,6 @@
|
||||
"""Map NOS and Commands to Parsing Functions."""
|
||||
|
||||
# Local
|
||||
from .juniper import parse_juniper
|
||||
from .mikrotik import parse_mikrotik
|
||||
|
||||
|
@@ -682,7 +682,7 @@ async def build_frontend( # noqa: C901
|
||||
return True
|
||||
|
||||
|
||||
def set_app_path(required=False):
|
||||
def set_app_path(required: bool = False) -> Path:
|
||||
"""Find app directory and set value to environment variable."""
|
||||
|
||||
# Standard Library
|
||||
@@ -711,15 +711,15 @@ def set_app_path(required=False):
|
||||
No configuration directories were determined to both exist and be readable
|
||||
by hyperglass. hyperglass is running as user '{un}' (UID '{uid}'), and tried
|
||||
to access the following directories:
|
||||
{dir}""".format(
|
||||
{dir}""".format(
|
||||
un=getuser(),
|
||||
uid=os.getuid(),
|
||||
dir="\n".join([" - " + str(p) for p in config_paths]),
|
||||
dir="\n".join(["\t - " + str(p) for p in config_paths]),
|
||||
)
|
||||
)
|
||||
|
||||
os.environ["hyperglass_directory"] = str(matched_path)
|
||||
return True
|
||||
return matched_path
|
||||
|
||||
|
||||
def format_listen_address(listen_address: Union[IPv4Address, IPv6Address, str]) -> str:
|
||||
|
Reference in New Issue
Block a user