From cdf5e1f2e3af3300d5b3dff15333acbdd949e6a4 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 4 Dec 2024 15:47:47 -0600 Subject: [PATCH] clean up lints for automated_steps doc plugin Cleaned up lint warnings for the automated_steps sphinx doc plugin. Removed unused imports. Fixed using .format() in a logging message. Fixed using an ambiguous variable name. Fix line length. Change-Id: Ic171103f7e7d21a08e330552f2588bf69ada4837 Signed-off-by: Doug Goldstein --- doc/source/_exts/automated_steps.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/doc/source/_exts/automated_steps.py b/doc/source/_exts/automated_steps.py index db5da406b7..261eab8909 100644 --- a/doc/source/_exts/automated_steps.py +++ b/doc/source/_exts/automated_steps.py @@ -12,11 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from collections import defaultdict import inspect -import itertools -import operator -import os.path from docutils import nodes from docutils.parsers import rst @@ -58,8 +54,8 @@ def _list_table(add, headers, data, title='', columns=None): else: # potentially multi-line string add(' * %s' % lines[0]) - for l in lines[1:]: - add(' %s' % l) + for line in lines[1:]: + add(' %s' % line) add('') @@ -88,8 +84,8 @@ def _init_steps_by_driver(): for interface_name in sorted(driver_factory.driver_base.ALL_INTERFACES): if DEBUG: - LOG.info('[{}] probing available plugins for interface {}'.format( - __name__, interface_name)) + LOG.info('[%s] probing available plugins for interface %s', + __name__, interface_name) loader = stevedore.ExtensionManager( 'ironic.hardware.interfaces.{}'.format(interface_name), @@ -114,8 +110,8 @@ def _init_steps_by_driver(): 'doc': _format_doc(inspect.getdoc(method)), } if DEBUG: - LOG.info('[{}] interface {!r} driver {!r} STEP {}'.format( - __name__, interface_name, plugin.name, step)) + LOG.info('[%s] interface %r driver %r STEP %r', + __name__, interface_name, plugin.name, step) steps.append(step) if steps: @@ -168,7 +164,8 @@ class AutomatedStepsDirective(rst.Directive): _list_table( title='{} cleaning steps'.format(driver_name), add=lambda x: result.append(x, source_name), - headers=['Name', 'Details', 'Priority', 'Stoppable', 'Arguments'], + headers=['Name', 'Details', 'Priority', + 'Stoppable', 'Arguments'], columns=[20, 30, 10, 10, 30], data=( ('``{}``'.format(s['step']),