From f52721082c5ed4bf6f02cfccb97dfe5c01e6c183 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 9 Dec 2024 11:18:49 -0500 Subject: [PATCH] Sort Python imports with isort 5.13.2 Add isort 5.13.2 (the current version) as a dev dependency and run it on all files. Change-Id: If1b65c91ec05bb0fccad46c8d5e84adaad09d6cf Signed-off-by: Simon Marchi --- .../ansible/scripts/manage_jenkins_node.py | 2 +- automation/kernel-seed.py | 6 +++--- automation/update_standalone.py | 7 ++++--- lava/rootfs/vmdeboostrap/generate-root.py | 1 - poetry.lock | 16 +++++++++++++++- pyproject.toml | 4 ++++ scripts/babeltrace-benchmark/benchmark.py | 18 +++++++----------- scripts/babeltrace-benchmark/time.py | 2 +- scripts/jenkins_job_env.py | 1 - scripts/system-tests/lava2-submit.py | 1 + scripts/system-tests/parse-results.py | 7 ++++--- 11 files changed, 40 insertions(+), 25 deletions(-) diff --git a/automation/ansible/scripts/manage_jenkins_node.py b/automation/ansible/scripts/manage_jenkins_node.py index 50e25bc..f1f7acc 100755 --- a/automation/ansible/scripts/manage_jenkins_node.py +++ b/automation/ansible/scripts/manage_jenkins_node.py @@ -7,13 +7,13 @@ import json import logging import pathlib import pprint -import requests import re import sys import time import xml.etree.ElementTree import jenkins +import requests class OutputFormat(enum.Enum): diff --git a/automation/kernel-seed.py b/automation/kernel-seed.py index 394508c..5520396 100644 --- a/automation/kernel-seed.py +++ b/automation/kernel-seed.py @@ -19,12 +19,12 @@ """ This script is used to generate a yaml list of kernel version tag """ +import argparse import os import re -import yaml -import argparse - from distutils.version import Version + +import yaml from git import Repo diff --git a/automation/update_standalone.py b/automation/update_standalone.py index ab99af4..9371c1e 100644 --- a/automation/update_standalone.py +++ b/automation/update_standalone.py @@ -44,12 +44,13 @@ SNAPSHOTXML = ( ) import argparse +import select import sys -import libvirt -from jenkinsapi.jenkins import Jenkins from time import sleep + +import libvirt import paramiko -import select +from jenkinsapi.jenkins import Jenkins def main(): diff --git a/lava/rootfs/vmdeboostrap/generate-root.py b/lava/rootfs/vmdeboostrap/generate-root.py index 6aa65cb..5bcd4ee 100755 --- a/lava/rootfs/vmdeboostrap/generate-root.py +++ b/lava/rootfs/vmdeboostrap/generate-root.py @@ -20,7 +20,6 @@ import os import shutil import subprocess import sys - from datetime import datetime diff --git a/poetry.lock b/poetry.lock index fce10a3..8c5795c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -219,6 +219,20 @@ files = [ [package.extras] all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] +[[package]] +name = "isort" +version = "5.13.2" +description = "A Python utility / library to sort Python imports." +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, +] + +[package.extras] +colors = ["colorama (>=0.4.6)"] + [[package]] name = "jenkins-job-builder" version = "6.4.2" @@ -564,4 +578,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "4498a7b62020dadd3af79e5f3d729e79299e10c0077f53b3c1baf39c05316571" +content-hash = "3f98c0b3cf08e147f75ba3f0e5a10dc85caf796814b27ecc97931899ab476f71" diff --git a/pyproject.toml b/pyproject.toml index 51a6159..d09110f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,9 +16,13 @@ jenkins-job-builder = "^6.4.2" [tool.poetry.group.dev.dependencies] black = "^24.10.0" +isort = "^5.13.2" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.black] + +[tool.isort] +profile = "black" diff --git a/scripts/babeltrace-benchmark/benchmark.py b/scripts/babeltrace-benchmark/benchmark.py index 034b68c..8d0948d 100644 --- a/scripts/babeltrace-benchmark/benchmark.py +++ b/scripts/babeltrace-benchmark/benchmark.py @@ -14,26 +14,22 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import argparse import json import os -import tempfile -from statistics import mean -import argparse import sys +import tempfile from operator import add +from statistics import mean +import git +import lava_submit import matplotlib.pyplot as plt +import numpy from matplotlib.backends.backend_pdf import PdfPages from matplotlib.ticker import PercentFormatter - -import git -import numpy -import lava_submit - from minio import Minio -from minio.error import NoSuchKey -from minio.error import ResponseError - +from minio.error import NoSuchKey, ResponseError BENCHMARK_TYPES = ["dummy", "text"] DEFAULT_BUCKET = "lava" diff --git a/scripts/babeltrace-benchmark/time.py b/scripts/babeltrace-benchmark/time.py index cddc6fc..ddb15c0 100644 --- a/scripts/babeltrace-benchmark/time.py +++ b/scripts/babeltrace-benchmark/time.py @@ -15,10 +15,10 @@ # along with this program. If not, see . import argparse +import json import os import subprocess import tempfile -import json from collections import defaultdict diff --git a/scripts/jenkins_job_env.py b/scripts/jenkins_job_env.py index 0607f38..b132682 100755 --- a/scripts/jenkins_job_env.py +++ b/scripts/jenkins_job_env.py @@ -16,7 +16,6 @@ import sys import tempfile import urllib - _ENV_VARS = [ "BABELTRACE_PLUGIN_PATH", "CPPFLAGS", diff --git a/scripts/system-tests/lava2-submit.py b/scripts/system-tests/lava2-submit.py index 737b394..4b658b1 100644 --- a/scripts/system-tests/lava2-submit.py +++ b/scripts/system-tests/lava2-submit.py @@ -24,6 +24,7 @@ import time import xmlrpc.client from urllib.parse import urljoin from urllib.request import urlretrieve + import yaml from jinja2 import Environment, FileSystemLoader diff --git a/scripts/system-tests/parse-results.py b/scripts/system-tests/parse-results.py index 8efd1df..ef8e15c 100755 --- a/scripts/system-tests/parse-results.py +++ b/scripts/system-tests/parse-results.py @@ -1,10 +1,11 @@ #! /usr/bin/python3 -from subprocess import call -from collections import defaultdict import csv +import sys +from collections import defaultdict +from subprocess import call + import numpy as np import pandas as pd -import sys def test_case(df): -- 2.39.5