From db68a25ea7aabed8d8f7a1e0faf063dd6d0be16d Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Wed, 6 Feb 2019 10:51:39 -0600 Subject: [PATCH] Cleanup Tox multiple imports per line This unsuppresses the flake8 check H301 more than one import per line This has no functional change. It just enables the check and fixes the imports Story: 2004515 Task: 29377 Change-Id: I15e13703949c5dfe27ff6f68be5dfcf467ffbe80 Signed-off-by: Al Bailey --- .../cgcs_patch/api/controllers/root.py | 3 ++- .../cgcs-patch/cgcs_patch/patch_agent.py | 8 ++++-- .../cgcs-patch/cgcs_patch/patch_controller.py | 26 ++++++++++++++----- .../cgcs-patch/cgcs_patch/patch_functions.py | 8 ++++-- .../cgcs-patch/cgcs_patch/patch_signing.py | 4 ++- .../cgcs-patch/cgcs_patch/patch_verify.py | 3 ++- tox.ini | 5 ++-- 7 files changed, 40 insertions(+), 17 deletions(-) diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py b/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py index 2907362c..e975b229 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py @@ -6,7 +6,8 @@ SPDX-License-Identifier: Apache-2.0 """ import os -from pecan import expose, request +from pecan import expose +from pecan import request import cgi import glob diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py index 5823b048..c38e7217 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py @@ -21,14 +21,18 @@ import shutil from rpmUtils.miscutils import stringToVersion # pylint: disable=import-error -from cgcs_patch.patch_functions import (configure_logging, LOG) +from cgcs_patch.patch_functions import configure_logging +from cgcs_patch.patch_functions import LOG import cgcs_patch.config as cfg from cgcs_patch.base import PatchService import cgcs_patch.utils as utils import cgcs_patch.messages as messages import cgcs_patch.constants as constants -from tsconfig.tsconfig import (SW_VERSION, subfunctions, install_uuid, http_port) +from tsconfig.tsconfig import http_port +from tsconfig.tsconfig import install_uuid +from tsconfig.tsconfig import subfunctions +from tsconfig.tsconfig import SW_VERSION pidfile_path = "/var/run/patch_agent.pid" node_is_patched_file = "/var/run/node_is_patched" diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py index e96b87e1..eb021958 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py @@ -20,15 +20,27 @@ from rpmUtils.miscutils import stringToVersion # pylint: disable=import-error from wsgiref import simple_server from cgcs_patch.api import app from cgcs_patch.authapi import app as auth_app -from cgcs_patch.patch_functions import \ - configure_logging, BasePackageData, \ - avail_dir, applied_dir, committed_dir, \ - PatchFile, parse_rpm_filename, \ - package_dir, repo_dir, SW_VERSION, root_package_dir -from cgcs_patch.exceptions import MetadataFail, RpmFail, PatchError, PatchFail, PatchValidationFailure, PatchMismatchFailure +from cgcs_patch.patch_functions import configure_logging +from cgcs_patch.patch_functions import BasePackageData +from cgcs_patch.patch_functions import avail_dir +from cgcs_patch.patch_functions import applied_dir +from cgcs_patch.patch_functions import committed_dir +from cgcs_patch.patch_functions import PatchFile +from cgcs_patch.patch_functions import parse_rpm_filename +from cgcs_patch.patch_functions import package_dir +from cgcs_patch.patch_functions import repo_dir +from cgcs_patch.patch_functions import SW_VERSION +from cgcs_patch.patch_functions import root_package_dir +from cgcs_patch.exceptions import MetadataFail +from cgcs_patch.exceptions import RpmFail +from cgcs_patch.exceptions import PatchError +from cgcs_patch.exceptions import PatchFail +from cgcs_patch.exceptions import PatchValidationFailure +from cgcs_patch.exceptions import PatchMismatchFailure from cgcs_patch.patch_functions import LOG from cgcs_patch.patch_functions import audit_log_info -from cgcs_patch.patch_functions import patch_dir, repo_root_dir +from cgcs_patch.patch_functions import patch_dir +from cgcs_patch.patch_functions import repo_root_dir from cgcs_patch.patch_functions import PatchData from cgcs_patch.base import PatchService diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py index f93518f3..125b9c5e 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py @@ -20,9 +20,13 @@ import tempfile import xml.etree.ElementTree as ElementTree from xml.dom import minidom -from cgcs_patch.patch_verify import verify_files, cert_type_all +from cgcs_patch.patch_verify import verify_files +from cgcs_patch.patch_verify import cert_type_all from cgcs_patch.patch_signing import sign_files -from cgcs_patch.exceptions import MetadataFail, PatchFail, PatchValidationFailure, PatchMismatchFailure +from cgcs_patch.exceptions import MetadataFail +from cgcs_patch.exceptions import PatchFail +from cgcs_patch.exceptions import PatchValidationFailure +from cgcs_patch.exceptions import PatchMismatchFailure import cgcs_patch.constants as constants import rpm diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_signing.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_signing.py index 3b2dc9cd..ae90deda 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_signing.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_signing.py @@ -11,7 +11,9 @@ from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA # pylint: disable=unused-import from Crypto.Util.asn1 import DerSequence # pylint: disable=unused-import from binascii import a2b_base64 # pylint: disable=unused-import -from cgcs_patch.patch_verify import read_RSA_key, cert_type_formal_str, cert_type_dev_str +from cgcs_patch.patch_verify import read_RSA_key +from cgcs_patch.patch_verify import cert_type_formal_str +from cgcs_patch.patch_verify import cert_type_dev_str # To save memory, read and hash 1M of files at a time default_blocksize = 1 * 1024 * 1024 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_verify.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_verify.py index b089f6ee..9424180a 100644 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_verify.py +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_verify.py @@ -15,7 +15,8 @@ from Crypto.PublicKey import RSA from Crypto.Util.asn1 import DerSequence from binascii import a2b_base64 -from cgcs_patch.certificates import dev_certificate, formal_certificate +from cgcs_patch.certificates import dev_certificate +from cgcs_patch.certificates import formal_certificate # To save memory, read and hash 1M of files at a time default_blocksize = 1 * 1024 * 1024 diff --git a/tox.ini b/tox.ini index 3ab5b666..f1ad4c30 100644 --- a/tox.ini +++ b/tox.ini @@ -56,17 +56,16 @@ commands = # H105 Don't use author tags # H237 module posixfile is removed in Python 3 # H238 old style class declaration -# H301 one import per line # H306 imports not in alphabetical order # H401 docstring should not start with a space # H404 multi line docstring should start without a leading new line # H405 multi line docstring summary not separated with an empty line -# E501 skipped because some of the code files include templates +# E501 line too long. skipped because some of the code files include templates # that end up quite wide # F401 'XXXXX' imported but unused # F841 local variable 'XXXXXX' is assigned to but never used show-source = True -ignore = H101,H102,H105,H237,H238,H301,H306,H401,H404,H405,E501,F401,F841 +ignore = H101,H102,H105,H237,H238,H306,H401,H404,H405,E501,F401,F841 exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-* # TODO: H106 Don’t put vim configuration in source files (off by default). # H203 Use assertIs(Not)None to check for None (off by default).