Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isort to dev dependencies #874

Merged
merged 7 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pytest:
.PHONY: black
black:
poetry run black --check ${NORNIR_DIRS}
poetry run isort --profile black --check ${NORNIR_DIRS}

.PHONY: sphinx
sphinx:
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import sys
from typing import Dict

from nornir import __version__

from sphinx.application import Sphinx

from nornir import __version__

sys.path.insert(0, os.path.abspath("../"))


Expand Down
2 changes: 0 additions & 2 deletions docs/highlighter.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from IPython.core.magic import register_line_magic
from IPython.display import HTML

from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_for_filename


HTML_TEMPLATE = """<style>
{}
</style>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/failed_tasks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
"\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31m---- Greeting is the polite thing to do ** changed : False --------------------- ERROR\u001b[0m\n",
"\u001b[0mTraceback (most recent call last):\n",
" File \"/nornir/core/task.py\", line 99, in start\n",
" File \"/nornir/core/task.py\", line 98, in start\n",
" r = self.task(self, **self.params)\n",
" File \"/tmp/ipykernel_8235/676894166.py\", line 20, in say\n",
" raise Exception(\"I can't say anything right now\")\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial/task_results.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31m---- Greeting is the polite thing to do ** changed : False --------------------- ERROR\u001b[0m\n",
"\u001b[0mTraceback (most recent call last):\n",
" File \"/nornir/core/task.py\", line 99, in start\n",
" File \"/nornir/core/task.py\", line 98, in start\n",
" r = self.task(self, **self.params)\n",
" File \"/tmp/ipykernel_8460/3588580986.py\", line 19, in say\n",
" raise Exception(\"I can't say anything right now\")\n",
Expand Down Expand Up @@ -244,7 +244,7 @@
"\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31m---- Greeting is the polite thing to do ** changed : False --------------------- ERROR\u001b[0m\n",
"\u001b[0mTraceback (most recent call last):\n",
" File \"/nornir/core/task.py\", line 99, in start\n",
" File \"/nornir/core/task.py\", line 98, in start\n",
" r = self.task(self, **self.params)\n",
" File \"/tmp/ipykernel_8460/3588580986.py\", line 19, in say\n",
" raise Exception(\"I can't say anything right now\")\n",
Expand Down
2 changes: 1 addition & 1 deletion nornir/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import logging.config
import types
from typing import Any, Dict, Callable, Generator, List, Optional, Type, TYPE_CHECKING
from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Type

from nornir.core.configuration import Config
from nornir.core.inventory import Inventory
Expand Down
6 changes: 3 additions & 3 deletions nornir/core/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import sys
import warnings
from pathlib import Path
from typing import Any, Dict, Optional, Type, TYPE_CHECKING, List, TypeVar

from nornir.core.exceptions import ConflictingConfigurationWarning
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, TypeVar

import ruamel.yaml

from nornir.core.exceptions import ConflictingConfigurationWarning

if TYPE_CHECKING:
from nornir.core.deserializer.inventory import Inventory # noqa

Expand Down
2 changes: 1 addition & 1 deletion nornir/core/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, TYPE_CHECKING
from typing import TYPE_CHECKING, Dict

if TYPE_CHECKING:
from nornir.core.connection import Connection
Expand Down
16 changes: 6 additions & 10 deletions nornir/core/inventory.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
from typing import (
Any,
Dict,
ItemsView,
Iterator,
KeysView,
List,
Optional,
Protocol,
Set,
TypeVar,
Union,
KeysView,
ValuesView,
ItemsView,
Iterator,
TypeVar,
Protocol,
)

from nornir.core.configuration import Config
from nornir.core.plugins.connections import (
ConnectionPlugin,
ConnectionPluginRegister,
)
from nornir.core.exceptions import ConnectionAlreadyOpen, ConnectionNotOpen

from nornir.core.plugins.connections import ConnectionPlugin, ConnectionPluginRegister

HostOrGroup = TypeVar("HostOrGroup", "Host", "Group")

Expand Down
3 changes: 1 addition & 2 deletions nornir/core/plugins/connections.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import Any, Dict, Type, Optional, Protocol
from typing import Any, Dict, Optional, Protocol, Type

from nornir.core.configuration import Config
from nornir.core.plugins.register import PluginRegister


CONNECTIONS_PLUGIN_PATH = "nornir.plugins.connections"


Expand Down
3 changes: 1 addition & 2 deletions nornir/core/plugins/inventory.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import Any, Type, Protocol
from typing import Any, Protocol, Type

from nornir.core.inventory import Inventory, TransformFunction
from nornir.core.plugins.register import PluginRegister


INVENTORY_PLUGIN_PATH = "nornir.plugins.inventory"
TRANSFORM_FUNCTION_PLUGIN_PATH = "nornir.plugins.transform_function"

Expand Down
7 changes: 2 additions & 5 deletions nornir/core/plugins/register.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import sys
from typing import Dict, TypeVar, Generic
from typing import Dict, Generic, TypeVar

from nornir.core.exceptions import (
PluginAlreadyRegistered,
PluginNotRegistered,
)
from nornir.core.exceptions import PluginAlreadyRegistered, PluginNotRegistered

if sys.version_info >= (3, 10):
from importlib import metadata
Expand Down
5 changes: 2 additions & 3 deletions nornir/core/plugins/runners.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import Any, List, Type, Protocol
from typing import Any, List, Protocol, Type

from nornir.core.task import AggregatedResult, Task
from nornir.core.inventory import Host
from nornir.core.plugins.register import PluginRegister

from nornir.core.task import AggregatedResult, Task

RUNNERS_PLUGIN_PATH = "nornir.plugins.runners"

Expand Down
2 changes: 1 addition & 1 deletion nornir/core/state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, Set, Optional
from typing import Any, Dict, Optional, Set


class GlobalState(object):
Expand Down
5 changes: 2 additions & 3 deletions nornir/core/task.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import logging
import traceback
from typing import Any, Callable, Dict, List, Optional, TYPE_CHECKING, Union, cast
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union, cast

from nornir.core.exceptions import NornirExecutionError
from nornir.core.exceptions import NornirSubTaskError
from nornir.core.exceptions import NornirExecutionError, NornirSubTaskError

if TYPE_CHECKING:
from nornir.core import Nornir
Expand Down
2 changes: 1 addition & 1 deletion nornir/init_nornir.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from nornir.core import Nornir
from nornir.core.configuration import Config
from nornir.core.inventory import Inventory
from nornir.core.plugins.connections import ConnectionPluginRegister
from nornir.core.plugins.inventory import (
InventoryPluginRegister,
TransformFunctionRegister,
)
from nornir.core.plugins.connections import ConnectionPluginRegister
from nornir.core.plugins.runners import RunnerPlugin, RunnersPluginRegister
from nornir.core.state import GlobalState

Expand Down
12 changes: 6 additions & 6 deletions nornir/plugins/inventory/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
import pathlib
from typing import Any, Dict, Type

import ruamel.yaml

from nornir.core.inventory import (
Inventory,
ConnectionOptions,
Defaults,
Group,
Groups,
Host,
Hosts,
Defaults,
ConnectionOptions,
HostOrGroup,
Hosts,
Inventory,
ParentGroups,
)

import ruamel.yaml

logger = logging.getLogger(__name__)


Expand Down
4 changes: 2 additions & 2 deletions nornir/plugins/runners/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import List
from concurrent.futures import ThreadPoolExecutor
from typing import List

from nornir.core.task import AggregatedResult, Task
from nornir.core.inventory import Host
from nornir.core.task import AggregatedResult, Task


class SerialRunner:
Expand Down
Loading
Loading