Skip to content

Commit

Permalink
Add isort to flake8 linting (#26)
Browse files Browse the repository at this point in the history
(DIS-1789)
  • Loading branch information
pyrco committed Feb 7, 2023
1 parent 728bfdc commit f57fe5c
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 45 deletions.
40 changes: 16 additions & 24 deletions dissect/cstruct/__init__.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
from dissect.cstruct.bitbuffer import BitBuffer
from dissect.cstruct.compiler import Compiler
from dissect.cstruct.cstruct import cstruct, ctypes, ctypes_type
from dissect.cstruct.exceptions import (
Error,
NullPointerDereference,
ParserError,
ResolveError,
)
from dissect.cstruct.expression import Expression
from dissect.cstruct.types.base import Array, BaseType, RawType
from dissect.cstruct.types.bytesinteger import BytesInteger
from dissect.cstruct.types.chartype import CharType
from dissect.cstruct.types.enum import Enum, EnumInstance
from dissect.cstruct.types.flag import Flag, FlagInstance
from dissect.cstruct.types.instance import Instance
from dissect.cstruct.types.structure import Structure, Field, Union
from dissect.cstruct.types.voidtype import VoidType
from dissect.cstruct.types.wchartype import WcharType
from dissect.cstruct.types.packedtype import PackedType
from dissect.cstruct.types.flag import Flag, FlagInstance
from dissect.cstruct.types.enum import Enum, EnumInstance
from dissect.cstruct.types.bytesinteger import BytesInteger
from dissect.cstruct.types.pointer import Pointer, PointerInstance

from dissect.cstruct.exceptions import (
Error,
ParserError,
ResolveError,
NullPointerDereference,
)

from dissect.cstruct.cstruct import (
cstruct,
ctypes,
ctypes_type,
)

from dissect.cstruct.types.structure import Field, Structure, Union
from dissect.cstruct.types.voidtype import VoidType
from dissect.cstruct.types.wchartype import WcharType
from dissect.cstruct.utils import (
dumpstruct,
hexdump,
pack,
p8,
p16,
p32,
p64,
pack,
swap,
swap16,
swap32,
swap64,
unpack,
u8,
u16,
u32,
u64,
unpack,
)

from dissect.cstruct.bitbuffer import BitBuffer

__all__ = [
"Compiler",
"Array",
Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/bitbuffer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import BinaryIO, TYPE_CHECKING, Union
from typing import TYPE_CHECKING, BinaryIO, Union

if TYPE_CHECKING:
from dissect.cstruct.types import RawType
Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/cstruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
BaseType,
BytesInteger,
CharType,
Structure,
PackedType,
Pointer,
Structure,
VoidType,
WcharType,
)
Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/types/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from io import BytesIO
from typing import Any, BinaryIO, List, TYPE_CHECKING
from typing import TYPE_CHECKING, Any, BinaryIO, List

from dissect.cstruct.exceptions import ArraySizeError
from dissect.cstruct.expression import Expression
Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/types/chartype.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Any, BinaryIO, TYPE_CHECKING
from typing import TYPE_CHECKING, Any, BinaryIO

from dissect.cstruct.types import RawType

Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/types/enum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Any, BinaryIO, Dict, List, Union, TYPE_CHECKING
from typing import TYPE_CHECKING, Any, BinaryIO, Dict, List, Union

from dissect.cstruct.types import BaseType, RawType

Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/types/packedtype.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import struct
from typing import Any, BinaryIO, List, TYPE_CHECKING
from typing import TYPE_CHECKING, Any, BinaryIO, List

from dissect.cstruct.types import RawType

Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/types/pointer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import operator
from typing import Any, BinaryIO, Callable, Dict, Union, TYPE_CHECKING
from typing import TYPE_CHECKING, Any, BinaryIO, Callable, Dict, Union

from dissect.cstruct.exceptions import NullPointerDereference
from dissect.cstruct.types import BaseType, CharType, RawType
Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/types/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import io
from collections import OrderedDict
from typing import Any, BinaryIO, List, TYPE_CHECKING
from typing import TYPE_CHECKING, Any, BinaryIO, List

from dissect.cstruct.bitbuffer import BitBuffer
from dissect.cstruct.types import BaseType, Enum, Instance
Expand Down
2 changes: 1 addition & 1 deletion dissect/cstruct/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import string
import pprint
import string
from typing import List, Tuple

from dissect.cstruct.types import Instance, Structure
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bitbuffer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from io import BytesIO

import pytest

from dissect import cstruct

from dissect.cstruct.bitbuffer import BitBuffer


Expand Down
1 change: 0 additions & 1 deletion tests/test_bitfield.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest

from dissect import cstruct

from .utils import verify_compiled
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bytesinteger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from dissect import cstruct

from dissect.cstruct.types import BytesInteger

from .utils import verify_compiled
Expand Down
3 changes: 1 addition & 2 deletions tests/test_ctypes_type.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import pytest
import ctypes as _ctypes

import pytest
from dissect import cstruct


DUMMY_CSTRUCT = cstruct.cstruct()
PACKED_TYPE_INT8 = cstruct.PackedType(DUMMY_CSTRUCT, "int8", 1, "b")

Expand Down
1 change: 0 additions & 1 deletion tests/test_enum.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest

from dissect import cstruct

from .utils import verify_compiled
Expand Down
3 changes: 1 addition & 2 deletions tests/test_expression.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import pytest

from dissect import cstruct
from dissect.cstruct.expression import Expression

from dissect.cstruct.expression import Expression

testdata = [
("1 * 0", 0),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_packedtype.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from dissect import cstruct

from dissect.cstruct.types import PackedType

from .utils import verify_compiled
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pointer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from dissect import cstruct

from dissect.cstruct.types.pointer import PointerInstance

from .utils import verify_compiled
Expand Down
1 change: 0 additions & 1 deletion tests/test_struct.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from io import BytesIO

import pytest

from dissect import cstruct

from .utils import verify_compiled
Expand Down
2 changes: 1 addition & 1 deletion tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from dissect import cstruct

from dissect.cstruct.utils import dumpstruct, hexdump

from .utils import verify_compiled
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ deps =
black==23.1.0
flake8
flake8-black
flake8-isort
vermin
commands =
flake8 dissect tests setup.py
Expand Down

0 comments on commit f57fe5c

Please sign in to comment.