Fix the syntax-check failures with the help of isort[1]:
289/316 libvirt:syntax-check / flake8 FAIL 5.24s exit status 2
[1]:
https://pycqa.github.io/isort/
Signed-off-by: Han Han <hhan(a)redhat.com>
---
ci/util.py | 3 +--
run.in | 2 +-
scripts/apibuild.py | 6 +++---
scripts/check-html-references.py | 4 ++--
scripts/check-pot.py | 2 +-
scripts/esx_vi_generator.py | 3 +--
scripts/hvsupport.py | 2 +-
scripts/hyperv_wmi_generator.py | 2 +-
scripts/meson-timestamp.py | 1 -
src/cpu_map/sync_qemu_models_i386.py | 3 ++-
tests/cputestdata/cpu-data.py | 1 -
tests/virsh-auth | 2 +-
tools/virt-qemu-qmp-proxy | 9 +++++----
tools/virt-qemu-sev-validate | 9 +++++----
14 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/ci/util.py b/ci/util.py
index f9f3c550db..f18da8d662 100644
--- a/ci/util.py
+++ b/ci/util.py
@@ -1,8 +1,7 @@
import json
import pathlib
-import urllib.request
import urllib.parse
-
+import urllib.request
from typing import Dict, List
diff --git a/run.in b/run.in
index c6d3411082..80a5d2dd43 100644
--- a/run.in
+++ b/run.in
@@ -44,8 +44,8 @@ import os
import os.path
import random
import signal
-import sys
import subprocess
+import sys
# Function to intelligently prepend a path to an environment variable.
diff --git a/scripts/apibuild.py b/scripts/apibuild.py
index f532dbe834..3ecc3eadf7 100755
--- a/scripts/apibuild.py
+++ b/scripts/apibuild.py
@@ -8,11 +8,11 @@
# daniel(a)veillard.com
#
-import os
-import sys
+import argparse
import glob
+import os
import re
-import argparse
+import sys
quiet = True
warnings = 0
diff --git a/scripts/check-html-references.py b/scripts/check-html-references.py
index 788622a2d0..d15f28bea7 100755
--- a/scripts/check-html-references.py
+++ b/scripts/check-html-references.py
@@ -16,10 +16,10 @@
#
# Check that external references between documentation HTML files are not broken.
-import sys
-import os
import argparse
+import os
import re
+import sys
import xml.etree.ElementTree as ET
ns = {'html': 'http://www.w3.org/1999/xhtml'}
diff --git a/scripts/check-pot.py b/scripts/check-pot.py
index f6b4fbf36d..6b6b1879fa 100755
--- a/scripts/check-pot.py
+++ b/scripts/check-pot.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
-import sys
import re
+import sys
if len(sys.argv) != 2:
print(f"usage: {sys.argv[0]} POTFILE", file=sys.stderr)
diff --git a/scripts/esx_vi_generator.py b/scripts/esx_vi_generator.py
index 31c36f42e2..0e9adeeefd 100755
--- a/scripts/esx_vi_generator.py
+++ b/scripts/esx_vi_generator.py
@@ -22,10 +22,9 @@
# <
http://www.gnu.org/licenses/>.
#
-import sys
import os
import os.path
-
+import sys
OCCURRENCE__REQUIRED_ITEM = "r"
OCCURRENCE__REQUIRED_LIST = "rl"
diff --git a/scripts/hvsupport.py b/scripts/hvsupport.py
index be6bf7b0d2..2327bdf3b8 100755
--- a/scripts/hvsupport.py
+++ b/scripts/hvsupport.py
@@ -16,9 +16,9 @@
# License along with this library. If not, see
# <
http://www.gnu.org/licenses/>.
-import sys
import os.path
import re
+import sys
if len(sys.argv) != 3:
print("syntax: %s TOP-SRCDIR TOP-BUILDDIR\n" % sys.argv[0],
file=sys.stderr)
diff --git a/scripts/hyperv_wmi_generator.py b/scripts/hyperv_wmi_generator.py
index d11dfb1809..e10f7f79a7 100755
--- a/scripts/hyperv_wmi_generator.py
+++ b/scripts/hyperv_wmi_generator.py
@@ -20,9 +20,9 @@
# <
http://www.gnu.org/licenses/>.
#
-import sys
import os
import os.path
+import sys
separator = "/*" + ("*" * 50) + "*\n"
wmi_classes_by_name = {}
diff --git a/scripts/meson-timestamp.py b/scripts/meson-timestamp.py
index f109cad66e..01dc794a5a 100755
--- a/scripts/meson-timestamp.py
+++ b/scripts/meson-timestamp.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
import os
-
from datetime import datetime, timezone
timestamp = os.environ.get('SOURCE_DATE_EPOCH', None)
diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py
index b5e738def7..65181b6f90 100755
--- a/src/cpu_map/sync_qemu_models_i386.py
+++ b/src/cpu_map/sync_qemu_models_i386.py
@@ -2,11 +2,12 @@
import argparse
import copy
-import lark
import os
import re
import xml.etree.ElementTree
+import lark
+
def translate_vendor(name):
T = {
diff --git a/tests/cputestdata/cpu-data.py b/tests/cputestdata/cpu-data.py
index b5641f7c16..37fb2e3791 100755
--- a/tests/cputestdata/cpu-data.py
+++ b/tests/cputestdata/cpu-data.py
@@ -10,7 +10,6 @@ import subprocess
import sys
import xml.etree.ElementTree
-
_KEYS = {
"cpuid": ["eax_in", "ecx_in"],
"msr": ["index"],
diff --git a/tests/virsh-auth b/tests/virsh-auth
index ce3a599107..f4ed798ec4 100755
--- a/tests/virsh-auth
+++ b/tests/virsh-auth
@@ -19,8 +19,8 @@
import os
import os.path
-import sys
import subprocess
+import sys
builddir = os.getenv("abs_top_builddir")
if builddir is None:
diff --git a/tools/virt-qemu-qmp-proxy b/tools/virt-qemu-qmp-proxy
index dfbaa1ff0c..dcdb24b9a9 100755
--- a/tools/virt-qemu-qmp-proxy
+++ b/tools/virt-qemu-qmp-proxy
@@ -2,16 +2,17 @@
import argparse
import array
-import libvirt
-import libvirt_qemu
+import fcntl
+import json
import os
import re
import socket
import sys
import traceback
-import json
-import fcntl
+import libvirt
+
+import libvirt_qemu
debug = False
diff --git a/tools/virt-qemu-sev-validate b/tools/virt-qemu-sev-validate
index 7a8c3205e7..209f19a4a8 100755
--- a/tools/virt-qemu-sev-validate
+++ b/tools/virt-qemu-sev-validate
@@ -36,22 +36,23 @@
import abc
import argparse
-from base64 import b64decode, b64encode
-from hashlib import sha256
import hmac
import logging
import os
import re
import socket
-from struct import pack
import sys
import traceback
+from base64 import b64decode, b64encode
+from hashlib import sha256
+from struct import pack
from uuid import UUID
+
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
+import libvirt
from lxml import etree
-import libvirt
log = logging.getLogger()
--
2.40.1