Skip to content

Commit

Permalink
Add isort to flake8 linting (#14)
Browse files Browse the repository at this point in the history
(DIS-1789)
  • Loading branch information
pyrco authored Feb 7, 2023
1 parent eaa7554 commit 44daf17
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 24 deletions.
3 changes: 1 addition & 2 deletions dissect/hypervisor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from dissect.hypervisor.backup import vma, wim, xva
from dissect.hypervisor.descriptor import hyperv, ovf, vbox, vmx
from dissect.hypervisor.disk import qcow2, vdi, vhd, vhdx, vmdk
from dissect.hypervisor.descriptor import hyperv, ovf, vmx, vbox
from dissect.hypervisor.util import envelope, vmtar


__all__ = [
"envelope",
"hyperv",
Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/backup/c_vma.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dissect import cstruct


vma_def = """
#define VMA_BLOCK_BITS 12
#define VMA_BLOCK_SIZE (1 << VMA_BLOCK_BITS)
Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/backup/c_wim.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dissect import cstruct


wim_def = """
typedef char[16] GUID;
typedef uint64 LARGE_INTEGER;
Expand Down
2 changes: 1 addition & 1 deletion dissect/hypervisor/backup/vma.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dissect.util import ts
from dissect.util.stream import AlignedStream

from dissect.hypervisor.backup.c_vma import c_vma, VMA_MAGIC, VMA_EXTENT_MAGIC
from dissect.hypervisor.backup.c_vma import VMA_EXTENT_MAGIC, VMA_MAGIC, c_vma
from dissect.hypervisor.exceptions import InvalidHeaderError


Expand Down
2 changes: 1 addition & 1 deletion dissect/hypervisor/backup/wim.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dissect.hypervisor.backup.c_wim import c_wim, WIM_IMAGE_TAG
from dissect.hypervisor.backup.c_wim import WIM_IMAGE_TAG, c_wim
from dissect.hypervisor.exceptions import InvalidHeaderError


Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/descriptor/c_hyperv.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dissect import cstruct


hyperv_def = """
/* ======== File header ======== */
Expand Down
7 changes: 6 additions & 1 deletion dissect/hypervisor/descriptor/hyperv.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

from dissect.util.stream import RangeStream

from dissect.hypervisor.descriptor.c_hyperv import KeyDataFlag, KeyDataType, ObjectEntryType, c_hyperv
from dissect.hypervisor.descriptor.c_hyperv import (
KeyDataFlag,
KeyDataType,
ObjectEntryType,
c_hyperv,
)
from dissect.hypervisor.exceptions import InvalidSignature


Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/descriptor/vmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from typing import Dict, List
from urllib.parse import unquote


try:
import _pystandalone

Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/disk/c_qcow2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dissect import cstruct


qcow2_def = """
#define MIN_CLUSTER_BITS 9
#define MAX_CLUSTER_BITS 21
Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/disk/c_vdi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dissect import cstruct


# https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Storage/VDICore.h
# https://forums.virtualbox.org/viewtopic.php?t=8046
# 0000 3C 3C 3C 20 53 75 6E 20 78 56 4D 20 56 69 72 74 <<< Sun xVM Virt
Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/disk/c_vhd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dissect import cstruct


vhd_def = """
struct footer {
char cookie[8];
Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/disk/c_vhdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from dissect import cstruct


vhdx_def = """
#define PAYLOAD_BLOCK_NOT_PRESENT 0
#define PAYLOAD_BLOCK_UNDEFINED 1
Expand Down
2 changes: 1 addition & 1 deletion dissect/hypervisor/disk/c_vmdk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import struct
from dissect import cstruct

from dissect import cstruct

vmdk_def = """
typedef struct {
Expand Down
11 changes: 9 additions & 2 deletions dissect/hypervisor/tools/vma.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
import sys
from pathlib import Path

from dissect.hypervisor.backup.vma import VMA, _iter_mask
from dissect.hypervisor.backup.c_vma import c_vma
from dissect.hypervisor.backup.vma import VMA, _iter_mask

try:
from rich.logging import RichHandler
from rich.progress import BarColumn, DownloadColumn, Progress, TextColumn, TimeRemainingColumn, TransferSpeedColumn
from rich.progress import (
BarColumn,
DownloadColumn,
Progress,
TextColumn,
TimeRemainingColumn,
TransferSpeedColumn,
)

progress = Progress(
TextColumn("[bold blue]{task.fields[filename]}", justify="right"),
Expand Down
1 change: 0 additions & 1 deletion dissect/hypervisor/util/envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from dissect import cstruct
from dissect.util.stream import RangeStream


c_def = """
struct EnvelopeFileHeader {
char magic[21];
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup

setup(
name="dissect.hypervisor",
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import gzip
import os

import pytest

Expand Down
7 changes: 6 additions & 1 deletion tests/test_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

import pytest

from dissect.hypervisor.util.envelope import Envelope, KeyStore, HAS_PYCRYPTODOME, HAS_PYSTANDALONE
from dissect.hypervisor.util.envelope import (
HAS_PYCRYPTODOME,
HAS_PYSTANDALONE,
Envelope,
KeyStore,
)


def test_envelope_keystore(keystore):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vhd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dissect.hypervisor.disk.vhd import VHD, FixedDisk, DynamicDisk
from dissect.hypervisor.disk.vhd import VHD, DynamicDisk, FixedDisk


def test_vhd_fixed(fixed_vhd):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vhdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from dissect.hypervisor.disk.vhdx import VHDX, c_vhdx, _iter_partial_runs
from dissect.hypervisor.disk.vhdx import VHDX, _iter_partial_runs, c_vhdx


def test_vhdx_fixed(fixed_vhdx):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vmdk.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dissect.hypervisor.disk.vmdk import VMDK
from dissect.hypervisor.disk.c_vmdk import c_vmdk
from dissect.hypervisor.disk.vmdk import VMDK


def test_vmdk_sesparse(sesparse_vmdk):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vmx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from dissect.hypervisor.descriptor.vmx import VMX, HAS_PYCRYPTODOME, HAS_PYSTANDALONE
from dissect.hypervisor.descriptor.vmx import HAS_PYCRYPTODOME, HAS_PYSTANDALONE, VMX


def test_vmx():
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ deps =
black==23.1.0
flake8
flake8-black
flake8-isort
vermin
commands =
flake8 dissect tests setup.py
Expand Down

0 comments on commit 44daf17

Please sign in to comment.