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 <cardoe@cardoe.com>
This commit is contained in:
Doug Goldstein 2024-12-04 15:47:47 -06:00
parent a5b95d56ab
commit cdf5e1f2e3
No known key found for this signature in database

View File

@ -12,11 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from collections import defaultdict
import inspect import inspect
import itertools
import operator
import os.path
from docutils import nodes from docutils import nodes
from docutils.parsers import rst from docutils.parsers import rst
@ -58,8 +54,8 @@ def _list_table(add, headers, data, title='', columns=None):
else: else:
# potentially multi-line string # potentially multi-line string
add(' * %s' % lines[0]) add(' * %s' % lines[0])
for l in lines[1:]: for line in lines[1:]:
add(' %s' % l) add(' %s' % line)
add('') add('')
@ -88,8 +84,8 @@ def _init_steps_by_driver():
for interface_name in sorted(driver_factory.driver_base.ALL_INTERFACES): for interface_name in sorted(driver_factory.driver_base.ALL_INTERFACES):
if DEBUG: if DEBUG:
LOG.info('[{}] probing available plugins for interface {}'.format( LOG.info('[%s] probing available plugins for interface %s',
__name__, interface_name)) __name__, interface_name)
loader = stevedore.ExtensionManager( loader = stevedore.ExtensionManager(
'ironic.hardware.interfaces.{}'.format(interface_name), 'ironic.hardware.interfaces.{}'.format(interface_name),
@ -114,8 +110,8 @@ def _init_steps_by_driver():
'doc': _format_doc(inspect.getdoc(method)), 'doc': _format_doc(inspect.getdoc(method)),
} }
if DEBUG: if DEBUG:
LOG.info('[{}] interface {!r} driver {!r} STEP {}'.format( LOG.info('[%s] interface %r driver %r STEP %r',
__name__, interface_name, plugin.name, step)) __name__, interface_name, plugin.name, step)
steps.append(step) steps.append(step)
if steps: if steps:
@ -168,7 +164,8 @@ class AutomatedStepsDirective(rst.Directive):
_list_table( _list_table(
title='{} cleaning steps'.format(driver_name), title='{} cleaning steps'.format(driver_name),
add=lambda x: result.append(x, source_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], columns=[20, 30, 10, 10, 30],
data=( data=(
('``{}``'.format(s['step']), ('``{}``'.format(s['step']),