Skip to content

Commit a8476f2

Browse files
committed
fix import sorting
1 parent 74827c0 commit a8476f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+68
-76
lines changed

hyperglass/api/error_handlers.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
"""API Error Handlers."""
22

3-
from hyperglass.log import log
4-
53
# Third Party
64
from fastapi import Request
75
from starlette.responses import JSONResponse
86

97
# Project
8+
from hyperglass.log import log
109
from hyperglass.state import use_state
1110

1211

hyperglass/cli/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def build_ui(timeout: int) -> None:
1515
"""Create a new UI build."""
1616
# Project
1717
from hyperglass.state import use_state
18-
from hyperglass.configuration import init_user_config
1918
from hyperglass.frontend import build_frontend
19+
from hyperglass.configuration import init_user_config
2020

2121
# Populate configuration to Redis prior to accessing it.
2222
init_user_config()

hyperglass/defaults/directives/arista_eos.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
# Project
44
from hyperglass.models.directive import (
5-
BuiltinDirective,
5+
Text,
66
RuleWithIPv4,
77
RuleWithIPv6,
88
RuleWithPattern,
9-
Text,
9+
BuiltinDirective,
1010
)
1111

1212
__all__ = (

hyperglass/defaults/directives/bird.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/cisco_ios.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/cisco_nxos.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/cisco_xr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/frr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/huawei.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/juniper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/mikrotik.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/nokia_sros.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/openbgpd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/tnsr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/defaults/directives/vyos.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Project
44
from hyperglass.models.directive import (
5+
Text,
56
RuleWithIPv4,
67
RuleWithIPv6,
78
RuleWithPattern,
8-
Text,
99
BuiltinDirective,
1010
)
1111

hyperglass/exceptions/_common.py

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def __init_subclass__(
120120

121121
def __init__(self, **kwargs: str) -> None:
122122
"""Format error message with keyword arguments."""
123+
# Project
123124
from hyperglass.state import use_state
124125

125126
if "error" in kwargs:

hyperglass/exceptions/public.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Standard Library
44
from typing import TYPE_CHECKING, Any, Dict, Optional
55

6-
76
# Local
87
from ._common import PublicHyperglassError
98

@@ -82,6 +81,7 @@ class QueryLocationNotFound(NotFound):
8281

8382
def __init__(self, location: Any, **kwargs: Dict[str, Any]) -> None:
8483
"""Initialize a NotFound error for a query location."""
84+
# Project
8585
from hyperglass.state import use_state
8686

8787
(text := use_state("params").web.text)
@@ -94,6 +94,7 @@ class QueryTypeNotFound(NotFound):
9494

9595
def __init__(self, query_type: Any, **kwargs: Dict[str, Any]) -> None:
9696
"""Initialize a NotFound error for a query type."""
97+
# Project
9798
from hyperglass.state import use_state
9899

99100
(text := use_state("params").web.text)

hyperglass/execution/drivers/tests/test_construct.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
# Project
1+
# Standard Library
22
import typing as t
3+
4+
# Third Party
35
import pytest
6+
7+
# Project
8+
from hyperglass.state import use_state
49
from hyperglass.models.api import Query
510
from hyperglass.configuration import init_ui_params
6-
from hyperglass.models.config.params import Params
711
from hyperglass.models.directive import Directives
12+
from hyperglass.models.config.params import Params
813
from hyperglass.models.config.devices import Devices
9-
from hyperglass.state import use_state
1014

1115
# Local
1216
from .._construct import Construct
1317

1418
if t.TYPE_CHECKING:
19+
# Project
1520
from hyperglass.state import HyperglassState
1621

1722

hyperglass/frontend/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from hyperglass.util import copyfiles, check_path, dotenv_to_dict
1515
from hyperglass.state import use_state
1616

17-
1817
if t.TYPE_CHECKING:
1918
# Project
2019
from hyperglass.models.ui import UIParameters

hyperglass/main.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
from .state import use_state
3535
from .settings import Settings
3636

37-
3837
log_level = "INFO" if Settings.debug is False else "DEBUG"
3938

4039
setup_lib_logging(log_level)
@@ -43,6 +42,7 @@
4342

4443
async def build_ui() -> bool:
4544
"""Perform a UI build prior to starting the application."""
45+
# Local
4646
from .frontend import build_frontend
4747

4848
state = use_state()
@@ -59,6 +59,7 @@ async def build_ui() -> bool:
5959
def register_all_plugins() -> None:
6060
"""Validate and register configured plugins."""
6161

62+
# Local
6263
from .plugins import register_plugin, init_builtin_plugins
6364

6465
state = use_state()
@@ -85,6 +86,7 @@ def register_all_plugins() -> None:
8586

8687
def unregister_all_plugins() -> None:
8788
"""Unregister all plugins."""
89+
# Local
8890
from .plugins import InputPluginManager, OutputPluginManager
8991

9092
for manager in (InputPluginManager, OutputPluginManager):
@@ -156,6 +158,7 @@ def load(self: "HyperglassWSGI"):
156158
def start(*, log_level: str, workers: int, **kwargs) -> None:
157159
"""Start hyperglass via gunicorn."""
158160

161+
# Local
159162
from .log import CustomGunicornLogger
160163

161164
HyperglassWSGI(
@@ -181,6 +184,7 @@ def start(*, log_level: str, workers: int, **kwargs) -> None:
181184

182185
def run(_workers: int = None):
183186
"""Run hyperglass."""
187+
# Local
184188
from .configuration import init_user_config
185189

186190
try:

hyperglass/models/api/query.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from datetime import datetime
88

99
# Third Party
10-
from pydantic import BaseModel, constr, field_validator, ConfigDict
10+
from pydantic import BaseModel, ConfigDict, constr, field_validator
1111

1212
# Project
1313
from hyperglass.log import log
@@ -20,7 +20,6 @@
2020
# Local
2121
from ..config.devices import Device
2222

23-
2423
QueryLocation = constr(strip_whitespace=True, strict=True, min_length=1)
2524
QueryTarget = constr(strip_whitespace=True, min_length=1)
2625
QueryType = constr(strip_whitespace=True, strict=True, min_length=1)

hyperglass/models/api/response.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@
44
import typing as t
55

66
# Third Party
7-
from pydantic import (
8-
BaseModel,
9-
StrictInt,
10-
StrictStr,
11-
StrictBool,
12-
field_validator,
13-
Field,
14-
ConfigDict,
15-
)
7+
from pydantic import Field, BaseModel, StrictInt, StrictStr, ConfigDict, StrictBool, field_validator
168

179
# Project
1810
from hyperglass.state import use_state

hyperglass/models/api/rfc8522.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# Standard Library
44
# flake8: noqa
55
import math
6-
import secrets
76
import typing as t
7+
import secrets
88
from datetime import datetime
99

1010
# Third Party
11-
from pydantic import BaseModel, field_validator, ConfigDict, Field
11+
from pydantic import Field, BaseModel, ConfigDict, field_validator
1212

1313
"""Patterns:
1414
GET /.well-known/looking-glass/v1/ping/2001:DB8::35?protocol=2,1

hyperglass/models/api/types.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""Custom validation types."""
22

3+
# Standard Library
34
import typing as t
45

6+
# Third Party
57
from pydantic import AfterValidator
68

79
# Project

hyperglass/models/config/devices.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ipaddress import IPv4Address, IPv6Address
88

99
# Third Party
10-
from pydantic import FilePath, field_validator, ValidationInfo
10+
from pydantic import FilePath, ValidationInfo, field_validator
1111
from netmiko.ssh_dispatcher import CLASS_MAPPER # type: ignore
1212

1313
# Project

hyperglass/models/config/docs.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Configuration for API docs feature."""
22

3+
# Standard Library
34
import typing as t
45

56
# Third Party

hyperglass/models/config/http_client.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55

66
# Third Party
77
import httpx
8-
from pydantic import (
9-
FilePath,
10-
SecretStr,
11-
PrivateAttr,
12-
IPvAnyAddress,
13-
)
8+
from pydantic import FilePath, SecretStr, PrivateAttr, IPvAnyAddress
149

1510
# Project
1611
from hyperglass.models import HyperglassModel

hyperglass/models/config/logging.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55
from pathlib import Path
66

77
# Third Party
8-
from pydantic import (
9-
ByteSize,
10-
SecretStr,
11-
AnyHttpUrl,
12-
DirectoryPath,
13-
field_validator,
14-
)
8+
from pydantic import ByteSize, SecretStr, AnyHttpUrl, DirectoryPath, field_validator
159

1610
# Project
1711
from hyperglass.constants import __version__

0 commit comments

Comments
 (0)