From dfca1a5bc16a6de5667aba69d39a311a583bb91c Mon Sep 17 00:00:00 2001 From: thatmattlove Date: Wed, 22 Dec 2021 22:22:01 -0700 Subject: [PATCH] Move isort configuration to pyproject.toml --- .isort.cfg | 14 -------------- hyperglass/configuration/__init__.py | 8 +------- hyperglass/configuration/load.py | 6 +----- hyperglass/execution/drivers/http_client.py | 7 +------ hyperglass/main.py | 7 +------ hyperglass/models/api/query.py | 6 +----- hyperglass/models/directive.py | 10 +--------- hyperglass/models/system.py | 9 +-------- pyproject.toml | 15 +++++++++++++++ 9 files changed, 22 insertions(+), 60 deletions(-) delete mode 100644 .isort.cfg diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index 536022e..0000000 --- a/.isort.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[settings] -skip_glob = hyperglass/api/examples/*.py -line_length = 88 -indent = ' ' -include_trailing_comma = True -multi_line_output = 3 -balanced_wrapping = True -length_sort = True -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 \ No newline at end of file diff --git a/hyperglass/configuration/__init__.py b/hyperglass/configuration/__init__.py index 8ee7825..0d52baa 100644 --- a/hyperglass/configuration/__init__.py +++ b/hyperglass/configuration/__init__.py @@ -5,13 +5,7 @@ from hyperglass.state import use_state from hyperglass.defaults.directives import init_builtin_directives # Local -from .validate import ( - init_files, - init_params, - init_devices, - init_ui_params, - init_directives, -) +from .validate import init_files, init_params, init_devices, init_ui_params, init_directives __all__ = ("init_user_config",) diff --git a/hyperglass/configuration/load.py b/hyperglass/configuration/load.py index f30dc5f..af44d9e 100644 --- a/hyperglass/configuration/load.py +++ b/hyperglass/configuration/load.py @@ -9,11 +9,7 @@ from hyperglass.log import log from hyperglass.util import run_coroutine_in_new_thread from hyperglass.settings import Settings from hyperglass.constants import CONFIG_EXTENSIONS -from hyperglass.exceptions.private import ( - ConfigError, - ConfigMissing, - ConfigLoaderMissing, -) +from hyperglass.exceptions.private import ConfigError, ConfigMissing, ConfigLoaderMissing LoadedConfig = t.Union[t.Dict[str, t.Any], t.List[t.Any], t.Tuple[t.Any, ...]] diff --git a/hyperglass/execution/drivers/http_client.py b/hyperglass/execution/drivers/http_client.py index 79072a8..f303efb 100644 --- a/hyperglass/execution/drivers/http_client.py +++ b/hyperglass/execution/drivers/http_client.py @@ -8,12 +8,7 @@ import httpx # Project from hyperglass.util import get_fmt_keys -from hyperglass.exceptions.public import ( - AuthError, - RestError, - DeviceTimeout, - ResponseEmpty, -) +from hyperglass.exceptions.public import AuthError, RestError, DeviceTimeout, ResponseEmpty # Local from ._common import Connection diff --git a/hyperglass/main.py b/hyperglass/main.py index 5af75be..1f3f9dd 100644 --- a/hyperglass/main.py +++ b/hyperglass/main.py @@ -14,12 +14,7 @@ from gunicorn.app.base import BaseApplication # type: ignore # Local from .log import CustomGunicornLogger, log, setup_lib_logging from .util import get_node_version -from .plugins import ( - InputPluginManager, - OutputPluginManager, - register_plugin, - init_builtin_plugins, -) +from .plugins import InputPluginManager, OutputPluginManager, register_plugin, init_builtin_plugins from .constants import MIN_NODE_VERSION, MIN_PYTHON_VERSION, __version__ # Ensure the Python version meets the minimum requirements. diff --git a/hyperglass/models/api/query.py b/hyperglass/models/api/query.py index ccb25c4..fd8e880 100644 --- a/hyperglass/models/api/query.py +++ b/hyperglass/models/api/query.py @@ -14,11 +14,7 @@ from hyperglass.log import log from hyperglass.util import snake_to_camel, repr_from_attrs from hyperglass.state import use_state from hyperglass.plugins import InputPluginManager -from hyperglass.exceptions.public import ( - InputInvalid, - QueryTypeNotFound, - QueryLocationNotFound, -) +from hyperglass.exceptions.public import InputInvalid, QueryTypeNotFound, QueryLocationNotFound from hyperglass.exceptions.private import InputValidationError # Local diff --git a/hyperglass/models/directive.py b/hyperglass/models/directive.py index 4c1b980..e3a967a 100644 --- a/hyperglass/models/directive.py +++ b/hyperglass/models/directive.py @@ -6,15 +6,7 @@ import typing as t from ipaddress import IPv4Network, IPv6Network, ip_network # Third Party -from pydantic import ( - Field, - FilePath, - StrictStr, - StrictBool, - PrivateAttr, - conint, - validator, -) +from pydantic import Field, FilePath, StrictStr, StrictBool, PrivateAttr, conint, validator # Project from hyperglass.log import log diff --git a/hyperglass/models/system.py b/hyperglass/models/system.py index 63c72b2..c963889 100644 --- a/hyperglass/models/system.py +++ b/hyperglass/models/system.py @@ -6,14 +6,7 @@ from pathlib import Path from ipaddress import ip_address # Third Party -from pydantic import ( - RedisDsn, - SecretStr, - BaseSettings, - DirectoryPath, - IPvAnyAddress, - validator, -) +from pydantic import RedisDsn, SecretStr, BaseSettings, DirectoryPath, IPvAnyAddress, validator # Project from hyperglass.util import at_least, cpu_count diff --git a/pyproject.toml b/pyproject.toml index ffb1002..3a6806e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,6 +82,21 @@ taskipy = "^1.8.2" [tool.black] line-length = 100 +[tool.isort] +balanced_wrapping = true +force_single_line = false +import_heading_firstparty = "Project" +import_heading_localfolder = "Local" +import_heading_stdlib = "Standard Library" +import_heading_thirdparty = "Third Party" +include_trailing_comma = true +indent = ' ' +known_third_party = ["starlette", "fastapi", "inquirer"] +length_sort = true +line_length = 100 +multi_line_output = 3 +skip_glob = "hyperglass/api/examples/*.py" + [tool.pyright] exclude = ["**/node_modules", "**/ui", "**/__pycache__"] include = ["hyperglass"]