Add isort
This commit is contained in:
parent
ce1abd76d0
commit
a34c08c9ce
|
@ -29,3 +29,7 @@ repos:
|
||||||
rev: 0.8.1
|
rev: 0.8.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: doc8
|
- id: doc8
|
||||||
|
- repo: https://github.com/PyCQA/isort
|
||||||
|
rev: 5.6.4
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath('..'))
|
sys.path.insert(0, os.path.abspath('..'))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from pathlib import Path
|
|
||||||
from typing import Optional, Dict, Any
|
|
||||||
from pylspci.command import CommandBuilder, IDResolveOption
|
|
||||||
from pylspci.filters import SlotFilter, DeviceFilter
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
|
from pylspci.command import CommandBuilder, IDResolveOption
|
||||||
|
from pylspci.filters import DeviceFilter, SlotFilter
|
||||||
|
|
||||||
|
|
||||||
def get_parser() -> argparse.ArgumentParser:
|
def get_parser() -> argparse.ArgumentParser:
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
|
import subprocess
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import \
|
|
||||||
Optional, Union, List, Mapping, MutableMapping, Any, Iterator
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import (
|
||||||
|
Any, Iterator, List, Mapping, MutableMapping, Optional, Union
|
||||||
|
)
|
||||||
|
|
||||||
from pylspci.device import Device
|
from pylspci.device import Device
|
||||||
from pylspci.fields import PCIAccessParameter
|
from pylspci.fields import PCIAccessParameter
|
||||||
from pylspci.filters import SlotFilter, DeviceFilter
|
from pylspci.filters import DeviceFilter, SlotFilter
|
||||||
from pylspci.parsers.base import Parser
|
from pylspci.parsers.base import Parser
|
||||||
import subprocess
|
|
||||||
|
|
||||||
OptionalPath = Optional[Union[str, Path]]
|
OptionalPath = Optional[Union[str, Path]]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import NamedTuple, Optional, List
|
from typing import List, NamedTuple, Optional
|
||||||
from pylspci.fields import Slot, NameWithID
|
|
||||||
|
from pylspci.fields import NameWithID, Slot
|
||||||
|
|
||||||
|
|
||||||
class Device(NamedTuple):
|
class Device(NamedTuple):
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from functools import partial
|
|
||||||
from typing import Optional, Any
|
|
||||||
import re
|
import re
|
||||||
|
from functools import partial
|
||||||
|
from typing import Any, Optional
|
||||||
|
|
||||||
hexstring = partial(int, base=16)
|
hexstring = partial(int, base=16)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
from typing import Optional, Pattern, ClassVar, Dict, Type, TypeVar, Any
|
|
||||||
from pylspci.fields import hexstring
|
|
||||||
import re
|
import re
|
||||||
|
from abc import ABC, abstractmethod
|
||||||
|
from typing import Any, ClassVar, Dict, Optional, Pattern, Type, TypeVar
|
||||||
|
|
||||||
|
from pylspci.fields import hexstring
|
||||||
|
|
||||||
T = TypeVar('T', bound='Filter')
|
T = TypeVar('T', bound='Filter')
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Union, Iterable, List, Dict, Any
|
from typing import Any, Dict, Iterable, List, Union
|
||||||
|
|
||||||
from pylspci.device import Device
|
from pylspci.device import Device
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
from typing import Union, List, Iterable
|
|
||||||
from cached_property import cached_property
|
|
||||||
from pylspci.parsers.base import Parser
|
|
||||||
from pylspci.fields import hexstring, Slot, NameWithID
|
|
||||||
from pylspci.device import Device
|
|
||||||
import argparse
|
import argparse
|
||||||
import shlex
|
import shlex
|
||||||
|
from typing import Iterable, List, Union
|
||||||
|
|
||||||
|
from cached_property import cached_property
|
||||||
|
|
||||||
|
from pylspci.device import Device
|
||||||
|
from pylspci.fields import NameWithID, Slot, hexstring
|
||||||
|
from pylspci.parsers.base import Parser
|
||||||
|
|
||||||
|
|
||||||
class SimpleParser(Parser):
|
class SimpleParser(Parser):
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
from typing import Union, List, Dict, Iterable, NamedTuple, Callable, Any
|
|
||||||
from pylspci.parsers.base import Parser
|
|
||||||
from pylspci.device import Device
|
|
||||||
from pylspci.fields import hexstring, Slot, NameWithID
|
|
||||||
import warnings
|
import warnings
|
||||||
|
from typing import Any, Callable, Dict, Iterable, List, NamedTuple, Union
|
||||||
|
|
||||||
|
from pylspci.device import Device
|
||||||
|
from pylspci.fields import NameWithID, Slot, hexstring
|
||||||
|
from pylspci.parsers.base import Parser
|
||||||
|
|
||||||
UNKNOWN_FIELD_WARNING = (
|
UNKNOWN_FIELD_WARNING = (
|
||||||
'Unsupported device field {!r} with value {!r}\n'
|
'Unsupported device field {!r} with value {!r}\n'
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from unittest import TestCase
|
|
||||||
from unittest.mock import patch, call, MagicMock
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from pylspci.command import CommandBuilder, IDResolveOption
|
from pylspci.command import CommandBuilder, IDResolveOption
|
||||||
from pylspci.parsers import SimpleParser, VerboseParser
|
from pylspci.parsers import SimpleParser, VerboseParser
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from unittest.mock import patch, call, MagicMock
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
|
from pylspci.command import (
|
||||||
|
IDResolveOption, list_access_methods, list_pcilib_params, lspci
|
||||||
|
)
|
||||||
from pylspci.fields import PCIAccessParameter
|
from pylspci.fields import PCIAccessParameter
|
||||||
from pylspci.command import \
|
|
||||||
lspci, list_access_methods, list_pcilib_params, IDResolveOption
|
|
||||||
|
|
||||||
|
|
||||||
class TestCommand(TestCase):
|
class TestCommand(TestCase):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from unittest import TestCase
|
|
||||||
from unittest.mock import patch, call, MagicMock
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from pylspci.device import Device
|
from pylspci.device import Device
|
||||||
from pylspci.parsers import SimpleParser
|
from pylspci.parsers import SimpleParser
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from unittest import TestCase
|
|
||||||
from unittest.mock import patch, call, MagicMock
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from pylspci.device import Device
|
from pylspci.device import Device
|
||||||
from pylspci.parsers import VerboseParser
|
from pylspci.parsers import VerboseParser
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from pylspci.fields import Slot, NameWithID, PCIAccessParameter
|
|
||||||
|
from pylspci.fields import NameWithID, PCIAccessParameter, Slot
|
||||||
|
|
||||||
|
|
||||||
class TestSlot(TestCase):
|
class TestSlot(TestCase):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from pylspci.filters import SlotFilter, DeviceFilter
|
|
||||||
|
from pylspci.filters import DeviceFilter, SlotFilter
|
||||||
|
|
||||||
|
|
||||||
class TestSlotFilter(TestCase):
|
class TestSlotFilter(TestCase):
|
||||||
|
|
|
@ -10,3 +10,6 @@ disallow_incomplete_defs=True
|
||||||
disallow_untyped_defs=True
|
disallow_untyped_defs=True
|
||||||
check_untyped_defs=True
|
check_untyped_defs=True
|
||||||
no_implicit_optional=True
|
no_implicit_optional=True
|
||||||
|
|
||||||
|
[isort]
|
||||||
|
multi_line_output=5
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -1,7 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from setuptools import setup, find_packages
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
|
|
||||||
def read_requirements(filename: str) -> List[str]:
|
def read_requirements(filename: str) -> List[str]:
|
||||||
return [req.strip() for req in open(filename)]
|
return [req.strip() for req in open(filename)]
|
||||||
|
|
Loading…
Reference in New Issue