Skip to content

Commit

Permalink
import formatting imporvements
Browse files Browse the repository at this point in the history
  • Loading branch information
thatmattlove committed Oct 11, 2020
1 parent 6841cb6 commit 6b188e4
Show file tree
Hide file tree
Showing 28 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions hyperglass/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# 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
Expand Down
1 change: 1 addition & 0 deletions hyperglass/execution/drivers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Individual transport driver classes & subclasses."""

# Local
from .agent import AgentConnection
from .ssh_netmiko import NetmikoConnection
from .ssh_scrapli import ScrapliConnection
1 change: 1 addition & 0 deletions hyperglass/execution/drivers/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from hyperglass.parsing.common import parsers
from hyperglass.models.config.devices import Device

# Local
from ._construct import Construct


Expand Down
1 change: 1 addition & 0 deletions hyperglass/execution/drivers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from hyperglass.exceptions import RestError, ResponseEmpty
from hyperglass.configuration import params

# Local
from ._common import Connection


Expand Down
1 change: 1 addition & 0 deletions hyperglass/execution/drivers/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from hyperglass.configuration import params
from hyperglass.compat._sshtunnel import BaseSSHTunnelForwarderError, open_tunnel

# Local
from ._common import Connection


Expand Down
1 change: 1 addition & 0 deletions hyperglass/execution/drivers/ssh_netmiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from hyperglass.exceptions import AuthError, ScrapeError, DeviceTimeout
from hyperglass.configuration import params

# Local
from .ssh import SSHConnection

netmiko_nos_globals = {
Expand Down
1 change: 1 addition & 0 deletions hyperglass/execution/drivers/ssh_scrapli.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
)
from hyperglass.configuration import params

# Local
from .ssh import SSHConnection

SCRAPLI_DRIVER_MAP = {
Expand Down
1 change: 1 addition & 0 deletions hyperglass/execution/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from hyperglass.models.api import Query
from hyperglass.configuration import params

# Local
from .drivers import AgentConnection, NetmikoConnection, ScrapliConnection

DRIVER_MAP = {
Expand Down
1 change: 1 addition & 0 deletions hyperglass/external/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions & handlers for external data."""

# Local
from .ripestat import RIPEStat # noqa: F401
from .webhooks import Webhook # noqa: F401
1 change: 1 addition & 0 deletions hyperglass/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""All Data Models used by hyperglass."""

# Local
from .main import HyperglassModel, HyperglassModelExtra
1 change: 1 addition & 0 deletions hyperglass/models/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Query & Response Validation Models."""
# Local
from .query import Query
from .response import (
QueryError,
Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/api/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from hyperglass.exceptions import InputInvalid
from hyperglass.configuration import params, devices

# Local
from .types import SupportedQuery
from .validators import (
validate_ip,
Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Validate command configuration variables."""

# Local
from .vyos import VyosCommands
from ..main import HyperglassModelExtra
from .arista import AristaCommands
Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/_mikrotik_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from .common import CommandSet, CommandGroup


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/arista.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from .common import CommandSet, CommandGroup


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/cisco_ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from .common import CommandSet, CommandGroup


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/cisco_nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from .common import CommandSet, CommandGroup


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/cisco_xr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from .common import CommandSet, CommandGroup


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from ..main import HyperglassModel, HyperglassModelExtra


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/huawei.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from .common import CommandSet, CommandGroup


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/juniper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from .common import CommandSet, CommandGroup


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/mikrotik_routeros.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mikrotik RouterOS Commands Model."""
# Local
from ._mikrotik_base import MikrotikCommands


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/mikrotik_switchos.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mikrotik SwitchOS Commands Model."""
# Local
from ._mikrotik_base import MikrotikCommands


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/commands/vyos.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Third Party
from pydantic import StrictStr

# Local
from .common import CommandSet, CommandGroup


Expand Down
1 change: 1 addition & 0 deletions hyperglass/models/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# Project
from hyperglass.log import log

# Local
from .main import HyperglassModel, HyperglassModelExtra

_WEBHOOK_TITLE = "hyperglass received a valid query with the following data"
Expand Down
1 change: 1 addition & 0 deletions hyperglass/parsing/nos.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Map NOS and Commands to Parsing Functions."""

# Local
from .juniper import parse_juniper
from .mikrotik import parse_mikrotik

Expand Down
8 changes: 4 additions & 4 deletions hyperglass/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6b188e4

Please sign in to comment.