Repository: sdwilsh/aiotruenas-client (language: python)

Issue:
Integrate isort for developer enjoyment



Discussion / hints:

Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5bbd075..2175e76 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,3 +10,7 @@ repos:
     rev: "3.8.3"
     hooks:
       - id: flake8
+  - repo: https://github.com/pycqa/isort
+    rev: 5.6.4
+    hooks:
+      - id: isort
diff --git a/aiotruenas_client/disk.py b/aiotruenas_client/disk.py
index 125cb0d..ab4f37b 100644
--- a/aiotruenas_client/disk.py
+++ b/aiotruenas_client/disk.py
@@ -1,6 +1,6 @@
-from abc import abstractmethod, ABC
+from abc import ABC, abstractmethod
 from enum import Enum, unique
-from typing import TypeVar, Optional
+from typing import Optional, TypeVar
 
 TType = TypeVar("TType", bound="DiskType")
 
diff --git a/aiotruenas_client/machine.py b/aiotruenas_client/machine.py
index 2d0ad01..593be40 100644
--- a/aiotruenas_client/machine.py
+++ b/aiotruenas_client/machine.py
@@ -1,9 +1,6 @@
-from abc import abstractmethod, ABC
-from typing import (
-    Any,
-    Dict,
-    List,
-)
+from abc import ABC, abstractmethod
+from typing import Any, Dict, List
+
 from .disk import Disk
 from .pool import Pool
 from .virtualmachine import VirtualMachine
diff --git a/aiotruenas_client/pool.py b/aiotruenas_client/pool.py
index d1438e7..a1181f4 100644
--- a/aiotruenas_client/pool.py
+++ b/aiotruenas_client/pool.py
@@ -1,4 +1,4 @@
-from abc import abstractmethod, ABC
+from abc import ABC, abstractmethod
 from enum import Enum, unique
 from typing import TypeVar
 
diff --git a/aiotruenas_client/virtualmachine.py b/aiotruenas_client/virtualmachine.py
index d67b71e..797c3e3 100644
--- a/aiotruenas_client/virtualmachine.py
+++ b/aiotruenas_client/virtualmachine.py
@@ -1,4 +1,4 @@
-from abc import abstractmethod, ABC
+from abc import ABC, abstractmethod
 from enum import Enum, unique
 from typing import TypeVar
 
diff --git a/aiotruenas_client/websockets/disk.py b/aiotruenas_client/websockets/disk.py
index 62d5c1b..df39a5d 100644
--- a/aiotruenas_client/websockets/disk.py
+++ b/aiotruenas_client/websockets/disk.py
@@ -1,12 +1,6 @@
-from typing import (
-    Any,
-    Dict,
-    List,
-    TypeVar,
-    Optional,
-)
-from ..disk import Disk, DiskType
+from typing import Any, Dict, List, Optional, TypeVar
 
+from ..disk import Disk, DiskType
 
 TCachingMachine = TypeVar("TCachingMachine", bound="TCachingMachine")
 TCachingDiskStateFetcher = TypeVar(
diff --git a/aiotruenas_client/websockets/machine.py b/aiotruenas_client/websockets/machine.py
index 51e469c..e004c3c 100644
--- a/aiotruenas_client/websockets/machine.py
+++ b/aiotruenas_client/websockets/machine.py
@@ -1,21 +1,17 @@
 import ssl
+from typing import Any, Dict, List, Optional, TypeVar
+
 import websockets
-from typing import (
-    Any,
-    Dict,
-    List,
-    Optional,
-    TypeVar,
-)
+
 from ..machine import Machine
-from .disk import CachingDiskStateFetcher, CachingDisk
-from .pool import CachingPoolStateFetcher, CachingPool
-from .virtualmachine import CachingVirtualMachineStateFetcher, CachingVirtualMachine
+from .disk import CachingDisk, CachingDiskStateFetcher
+from .pool import CachingPool, CachingPoolStateFetcher
 from .protocol import (
     TrueNASWebSocketClientProtocol,
-    truenas_password_auth_protocol_factory,
     truenas_api_key_auth_protocol_factory,
+    truenas_password_auth_protocol_factory,
 )
+from .virtualmachine import CachingVirtualMachine, CachingVirtualMachineStateFetcher
 
 TCachingMachine = TypeVar("TCachingMachine", bound="CachingMachine")
 
diff --git a/aiotruenas_client/websockets/pool.py b/aiotruenas_client/websockets/pool.py
index 33b0e82..dc0e106 100644
--- a/aiotruenas_client/websockets/pool.py
+++ b/aiotruenas_client/websockets/pool.py
@@ -1,9 +1,5 @@
-from typing import (
-    Any,
-    Dict,
-    List,
-    TypeVar,
-)
+from typing import Any, Dict, List, TypeVar
+
 from ..pool import Pool, PoolStatus
 
 TCachingMachine = TypeVar("TCachingMachine", bound="TCachingMachine")
diff --git a/aiotruenas_client/websockets/protocol.py b/aiotruenas_client/websockets/protocol.py
index 21c2477..60bbd22 100644
--- a/aiotruenas_client/websockets/protocol.py
+++ b/aiotruenas_client/websockets/protocol.py
@@ -1,18 +1,14 @@
 import asyncio
-import ejson
 import functools
 import logging
 import pprint
 import uuid
-import websockets
-
 from abc import abstractmethod
-from typing import (
-    Any,
-    Callable,
-    Dict,
-    List,
-)
+from typing import Any, Callable, Dict, List
+
+import ejson
+
+import websockets
 from websockets.client import WebSocketClientProtocol
 
 logger = logging.getLogger(__name__)
diff --git a/aiotruenas_client/websockets/virtualmachine.py b/aiotruenas_client/websockets/virtualmachine.py
index 7bccd5f..b678496 100644
--- a/aiotruenas_client/websockets/virtualmachine.py
+++ b/aiotruenas_client/websockets/virtualmachine.py
@@ -1,8 +1,5 @@
-from typing import (
-    Dict,
-    List,
-    TypeVar,
-)
+from typing import Dict, List, TypeVar
+
 from ..virtualmachine import VirtualMachine, VirtualMachineState
 
 TCachingDiskStateFetcher = TypeVar("TCachingDiskStateFetcher", bound="CachingMachine")
diff --git a/pyproject.toml b/pyproject.toml
index 121a39f..4fb6a88 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,7 @@
 [build-system]
 requires = ["setuptools >= 40.6.0", "wheel"]
 build-backend = "setuptools.build_meta"
+
+[tool.isort]
+profile = "black"
+src_paths = ["aiotruenas_client", "scripts", "tests"]
\ No newline at end of file
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 6f97495..e4f7c65 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,3 +1,4 @@
-pre-commit==2.9.3
 black==20.8b1
+isort==5.6.4
+pre-commit==2.9.3
 pytest==6.2.1
diff --git a/scripts/invoke_method.py b/scripts/invoke_method.py
index ba08ded..a16c177 100644
--- a/scripts/invoke_method.py
+++ b/scripts/invoke_method.py
@@ -3,13 +3,11 @@
 import json
 import logging
 import pprint
+from typing import Any, List
+
 import yaml
 
 from aiotruenas_client.websockets import CachingMachine as Machine
-from typing import (
-    Any,
-    List,
-)
 
 
 def init_argparse() -> argparse.ArgumentParser:
diff --git a/scripts/subscribe.py b/scripts/subscribe.py
index 451e07a..09a197d 100644
--- a/scripts/subscribe.py
+++ b/scripts/subscribe.py
@@ -3,6 +3,7 @@
 import json
 import logging
 import pprint
+
 import yaml
 
 from aiotruenas_client.websockets import CachingMachine as Machine
diff --git a/scripts/version_bump.py b/scripts/version_bump.py
index f2791b9..4fa554f 100644
--- a/scripts/version_bump.py
+++ b/scripts/version_bump.py
@@ -2,6 +2,7 @@
 import configparser
 import os
 import subprocess
+
 from packaging.version import Version
 
 CONFIG_FILE = os.path.join(


Test patch:
diff --git a/tests/fakes/fakeserver.py b/tests/fakes/fakeserver.py
index a608459..8ab3957 100644
--- a/tests/fakes/fakeserver.py
+++ b/tests/fakes/fakeserver.py
@@ -1,19 +1,13 @@
 import asyncio
 import datetime
-import ejson
 import random
 import string
 import uuid
-import websockets
+from typing import Any, Callable, Dict, List, TypeVar, Union
 
-from typing import (
-    Any,
-    Callable,
-    Dict,
-    List,
-    TypeVar,
-    Union,
-)
+import ejson
+
+import websockets
 
 TServer = TypeVar("TServer", bound="TrueNASServer")
 
diff --git a/tests/websockets/test_disk.py b/tests/websockets/test_disk.py
index d78ba64..3fe5b2c 100644
--- a/tests/websockets/test_disk.py
+++ b/tests/websockets/test_disk.py
@@ -1,22 +1,17 @@
 import unittest
-
+from typing import Any, Dict, List, Union
 from unittest import IsolatedAsyncioTestCase
 from unittest.mock import Mock
+
 from aiotruenas_client.disk import DiskType
 from aiotruenas_client.websockets.disk import CachingDisk
 from aiotruenas_client.websockets.machine import CachingMachine
 from tests.fakes.fakeserver import (
-    TrueNASServer,
     TDiskQueryResult,
     TDiskTemperaturesResult,
+    TrueNASServer,
     TVmQueryResult,
 )
-from typing import (
-    Any,
-    Dict,
-    List,
-    Union,
-)
 
 
 class TestDisk(IsolatedAsyncioTestCase):
diff --git a/tests/websockets/test_machine.py b/tests/websockets/test_machine.py
index 015a7c0..ebb3fc9 100644
--- a/tests/websockets/test_machine.py
+++ b/tests/websockets/test_machine.py
@@ -1,12 +1,9 @@
 import unittest
-import websockets
-
 from unittest import IsolatedAsyncioTestCase
+
+import websockets
 from aiotruenas_client.websockets import CachingMachine
-from tests.fakes.fakeserver import (
-    CommonQueries,
-    TrueNASServer,
-)
+from tests.fakes.fakeserver import CommonQueries, TrueNASServer
 
 
 class TestCachingMachineAuth(IsolatedAsyncioTestCase):
diff --git a/tests/websockets/test_pool.py b/tests/websockets/test_pool.py
index ef675c9..46e266d 100644
--- a/tests/websockets/test_pool.py
+++ b/tests/websockets/test_pool.py
@@ -1,25 +1,19 @@
 import datetime
 import unittest
-
+from typing import Any, Dict, List, Union
 from unittest import IsolatedAsyncioTestCase
 from unittest.mock import Mock
-from aiotruenas_client.websockets import CachingMachine
 
 from aiotruenas_client.pool import PoolStatus
+from aiotruenas_client.websockets import CachingMachine
 from aiotruenas_client.websockets.pool import CachingPool
 from tests.fakes.fakeserver import (
-    TrueNASServer,
     TDiskQueryResult,
     TDiskTemperaturesResult,
     TPoolQueryResult,
+    TrueNASServer,
     TVmQueryResult,
 )
-from typing import (
-    Any,
-    Dict,
-    List,
-    Union,
-)
 
 
 class TestPool(IsolatedAsyncioTestCase):
diff --git a/tests/websockets/test_virtualmachine.py b/tests/websockets/test_virtualmachine.py
index 1463b6b..a9bdc06 100644
--- a/tests/websockets/test_virtualmachine.py
+++ b/tests/websockets/test_virtualmachine.py
@@ -1,6 +1,6 @@
 import unittest
-
 from unittest import IsolatedAsyncioTestCase
+
 from aiotruenas_client.virtualmachine import VirtualMachineState
 from aiotruenas_client.websockets import CachingMachine
 from aiotruenas_client.websockets.virtualmachine import CachingVirtualMachine