python/qemu: use isort to lay out imports

Borrowed from the QAPI cleanup series, use the same configuration to
standardize the way we write and sort imports.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20201006235817.3280413-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
John Snow 2020-10-06 19:57:58 -04:00
parent b8eaee96e4
commit 932ca4bbde
6 changed files with 19 additions and 11 deletions

7
python/qemu/.isort.cfg Normal file
View File

@ -0,0 +1,7 @@
[settings]
force_grid_wrap=4
force_sort_within_sections=True
include_trailing_comma=True
line_length=72
lines_after_imports=2
multi_line_output=3

View File

@ -18,6 +18,7 @@ import logging
import os import os
import subprocess import subprocess
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
# Mapping host architecture to any additional architectures it can # Mapping host architecture to any additional architectures it can

View File

@ -13,9 +13,9 @@ which can drain a socket and optionally dump the bytes to file.
# the COPYING file in the top-level directory. # the COPYING file in the top-level directory.
# #
from collections import deque
import socket import socket
import threading import threading
from collections import deque
import time import time

View File

@ -20,15 +20,15 @@ which provides facilities for managing the lifetime of a QEMU VM.
import errno import errno
import logging import logging
import os import os
import subprocess
import shutil import shutil
import signal import signal
import subprocess
import tempfile import tempfile
from typing import Optional, Type
from types import TracebackType from types import TracebackType
from . import console_socket from typing import Optional, Type
from . import console_socket, qmp
from . import qmp
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -7,21 +7,21 @@
# This work is licensed under the terms of the GNU GPL, version 2. See # This work is licensed under the terms of the GNU GPL, version 2. See
# the COPYING file in the top-level directory. # the COPYING file in the top-level directory.
import json
import errno import errno
import socket import json
import logging import logging
import socket
from types import TracebackType
from typing import ( from typing import (
Any, Any,
cast,
Dict, Dict,
Optional, Optional,
TextIO, TextIO,
Type,
Tuple, Tuple,
Type,
Union, Union,
cast,
) )
from types import TracebackType
# QMPMessage is a QMP Message of any kind. # QMPMessage is a QMP Message of any kind.

View File

@ -17,8 +17,8 @@ subclass of QEMUMachine, respectively.
# Based on qmp.py. # Based on qmp.py.
# #
import socket
import os import os
import socket
from typing import Optional, TextIO from typing import Optional, TextIO
from .machine import QEMUMachine from .machine import QEMUMachine