Merge "clean up lints for automated_steps doc plugin"

This commit is contained in:
Zuul 2024-12-06 13:50:23 +00:00 committed by Gerrit Code Review
commit afd59e3da9

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']),