import formatting imporvements

This commit is contained in:
checktheroads 2020-10-11 13:14:57 -07:00
parent 6841cb65f5
commit 6b188e446c
28 changed files with 31 additions and 4 deletions

View file

@ -10,4 +10,5 @@ force_single_line = False
import_heading_stdlib = Standard Library import_heading_stdlib = Standard Library
import_heading_thirdparty = Third Party import_heading_thirdparty = Third Party
import_heading_firstparty = Project import_heading_firstparty = Project
import_heading_localfolder = Local
known_third_party = starlette,fastapi,inquirer known_third_party = starlette,fastapi,inquirer

View file

@ -12,6 +12,7 @@ from click import group, option, confirm, help_option
# Project # Project
from hyperglass.util import cpu_count from hyperglass.util import cpu_count
# Local
from .echo import error, label, success, cmd_help from .echo import error, label, success, cmd_help
from .util import build_ui from .util import build_ui
from .static import LABEL, CLI_HELP, E from .static import LABEL, CLI_HELP, E

View file

@ -1,5 +1,6 @@
"""Individual transport driver classes & subclasses.""" """Individual transport driver classes & subclasses."""
# Local
from .agent import AgentConnection from .agent import AgentConnection
from .ssh_netmiko import NetmikoConnection from .ssh_netmiko import NetmikoConnection
from .ssh_scrapli import ScrapliConnection from .ssh_scrapli import ScrapliConnection

View file

@ -10,6 +10,7 @@ from hyperglass.parsing.nos import scrape_parsers, structured_parsers
from hyperglass.parsing.common import parsers from hyperglass.parsing.common import parsers
from hyperglass.models.config.devices import Device from hyperglass.models.config.devices import Device
# Local
from ._construct import Construct from ._construct import Construct

View file

@ -20,6 +20,7 @@ from hyperglass.encode import jwt_decode, jwt_encode
from hyperglass.exceptions import RestError, ResponseEmpty from hyperglass.exceptions import RestError, ResponseEmpty
from hyperglass.configuration import params from hyperglass.configuration import params
# Local
from ._common import Connection from ._common import Connection

View file

@ -9,6 +9,7 @@ from hyperglass.exceptions import ScrapeError
from hyperglass.configuration import params from hyperglass.configuration import params
from hyperglass.compat._sshtunnel import BaseSSHTunnelForwarderError, open_tunnel from hyperglass.compat._sshtunnel import BaseSSHTunnelForwarderError, open_tunnel
# Local
from ._common import Connection from ._common import Connection

View file

@ -19,6 +19,7 @@ from hyperglass.log import log
from hyperglass.exceptions import AuthError, ScrapeError, DeviceTimeout from hyperglass.exceptions import AuthError, ScrapeError, DeviceTimeout
from hyperglass.configuration import params from hyperglass.configuration import params
# Local
from .ssh import SSHConnection from .ssh import SSHConnection
netmiko_nos_globals = { netmiko_nos_globals = {

View file

@ -33,6 +33,7 @@ from hyperglass.exceptions import (
) )
from hyperglass.configuration import params from hyperglass.configuration import params
# Local
from .ssh import SSHConnection from .ssh import SSHConnection
SCRAPLI_DRIVER_MAP = { SCRAPLI_DRIVER_MAP = {

View file

@ -17,6 +17,7 @@ from hyperglass.exceptions import DeviceTimeout, ResponseEmpty
from hyperglass.models.api import Query from hyperglass.models.api import Query
from hyperglass.configuration import params from hyperglass.configuration import params
# Local
from .drivers import AgentConnection, NetmikoConnection, ScrapliConnection from .drivers import AgentConnection, NetmikoConnection, ScrapliConnection
DRIVER_MAP = { DRIVER_MAP = {

View file

@ -1,4 +1,5 @@
"""Functions & handlers for external data.""" """Functions & handlers for external data."""
# Local
from .ripestat import RIPEStat # noqa: F401 from .ripestat import RIPEStat # noqa: F401
from .webhooks import Webhook # noqa: F401 from .webhooks import Webhook # noqa: F401

View file

@ -1,3 +1,4 @@
"""All Data Models used by hyperglass.""" """All Data Models used by hyperglass."""
# Local
from .main import HyperglassModel, HyperglassModelExtra from .main import HyperglassModel, HyperglassModelExtra

View file

@ -1,4 +1,5 @@
"""Query & Response Validation Models.""" """Query & Response Validation Models."""
# Local
from .query import Query from .query import Query
from .response import ( from .response import (
QueryError, QueryError,

View file

@ -13,6 +13,7 @@ from pydantic import BaseModel, StrictStr, constr, validator
from hyperglass.exceptions import InputInvalid from hyperglass.exceptions import InputInvalid
from hyperglass.configuration import params, devices from hyperglass.configuration import params, devices
# Local
from .types import SupportedQuery from .types import SupportedQuery
from .validators import ( from .validators import (
validate_ip, validate_ip,

View file

@ -1,5 +1,6 @@
"""Validate command configuration variables.""" """Validate command configuration variables."""
# Local
from .vyos import VyosCommands from .vyos import VyosCommands
from ..main import HyperglassModelExtra from ..main import HyperglassModelExtra
from .arista import AristaCommands from .arista import AristaCommands

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from .common import CommandSet, CommandGroup from .common import CommandSet, CommandGroup

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from .common import CommandSet, CommandGroup from .common import CommandSet, CommandGroup

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from .common import CommandSet, CommandGroup from .common import CommandSet, CommandGroup

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from .common import CommandSet, CommandGroup from .common import CommandSet, CommandGroup

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from .common import CommandSet, CommandGroup from .common import CommandSet, CommandGroup

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from ..main import HyperglassModel, HyperglassModelExtra from ..main import HyperglassModel, HyperglassModelExtra

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from .common import CommandSet, CommandGroup from .common import CommandSet, CommandGroup

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from .common import CommandSet, CommandGroup from .common import CommandSet, CommandGroup

View file

@ -1,4 +1,5 @@
"""Mikrotik RouterOS Commands Model.""" """Mikrotik RouterOS Commands Model."""
# Local
from ._mikrotik_base import MikrotikCommands from ._mikrotik_base import MikrotikCommands

View file

@ -1,4 +1,5 @@
"""Mikrotik SwitchOS Commands Model.""" """Mikrotik SwitchOS Commands Model."""
# Local
from ._mikrotik_base import MikrotikCommands from ._mikrotik_base import MikrotikCommands

View file

@ -3,6 +3,7 @@
# Third Party # Third Party
from pydantic import StrictStr from pydantic import StrictStr
# Local
from .common import CommandSet, CommandGroup from .common import CommandSet, CommandGroup

View file

@ -10,6 +10,7 @@ from pydantic import StrictStr, root_validator
# Project # Project
from hyperglass.log import log from hyperglass.log import log
# Local
from .main import HyperglassModel, HyperglassModelExtra from .main import HyperglassModel, HyperglassModelExtra
_WEBHOOK_TITLE = "hyperglass received a valid query with the following data" _WEBHOOK_TITLE = "hyperglass received a valid query with the following data"

View file

@ -1,5 +1,6 @@
"""Map NOS and Commands to Parsing Functions.""" """Map NOS and Commands to Parsing Functions."""
# Local
from .juniper import parse_juniper from .juniper import parse_juniper
from .mikrotik import parse_mikrotik from .mikrotik import parse_mikrotik

View file

@ -682,7 +682,7 @@ async def build_frontend( # noqa: C901
return True 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.""" """Find app directory and set value to environment variable."""
# Standard Library # Standard Library
@ -711,15 +711,15 @@ def set_app_path(required=False):
No configuration directories were determined to both exist and be readable No configuration directories were determined to both exist and be readable
by hyperglass. hyperglass is running as user '{un}' (UID '{uid}'), and tried by hyperglass. hyperglass is running as user '{un}' (UID '{uid}'), and tried
to access the following directories: to access the following directories:
{dir}""".format( {dir}""".format(
un=getuser(), un=getuser(),
uid=os.getuid(), 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) os.environ["hyperglass_directory"] = str(matched_path)
return True return matched_path
def format_listen_address(listen_address: Union[IPv4Address, IPv6Address, str]) -> str: def format_listen_address(listen_address: Union[IPv4Address, IPv6Address, str]) -> str: