diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14024de73..766d801bb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,12 @@ repos: hooks: - id: remove-tabs exclude: '.*\.(svg)$' + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.12.1 + hooks: + - id: ruff-check + args: ['--fix', '--unsafe-fixes'] + - id: ruff-format - repo: https://opendev.org/openstack/hacking rev: 7.0.0 hooks: @@ -40,16 +46,6 @@ repos: hooks: - id: bandit args: ['-c', 'pyproject.toml'] - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.1 - hooks: - - id: ruff-check - args: ['--fix', '--unsafe-fixes'] - - repo: https://github.com/hhatto/autopep8 - rev: v2.3.2 - hooks: - - id: autopep8 - files: '^.*\.py$' - repo: https://github.com/codespell-project/codespell rev: v2.4.1 hooks: diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index 177107174..e98853c99 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -22,10 +22,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. -extensions = [ - 'openstackdocstheme', - 'os_api_ref', -] +extensions = ['openstackdocstheme', 'os_api_ref'] # -- General configuration ---------------------------------------------------- @@ -60,9 +57,7 @@ html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -html_theme_options = { - "sidebar_mode": "toc", -} +html_theme_options = {"sidebar_mode": "toc"} # -- Options for LaTeX output ------------------------------------------------- @@ -70,6 +65,11 @@ html_theme_options = { # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ - ('index', 'Watcher.tex', 'Infrastructure Optimization API Reference', - 'OpenStack Foundation', 'manual'), + ( + 'index', + 'Watcher.tex', + 'Infrastructure Optimization API Reference', + 'OpenStack Foundation', + 'manual', + ) ] diff --git a/doc/ext/term.py b/doc/ext/term.py index a882d59d5..f157774bf 100644 --- a/doc/ext/term.py +++ b/doc/ext/term.py @@ -24,12 +24,29 @@ from watcher.version import version_string class BaseWatcherDirective(rst.Directive): - - def __init__(self, name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): + def __init__( + self, + name, + arguments, + options, + content, + lineno, + content_offset, + block_text, + state, + state_machine, + ): super().__init__( - name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine) + name, + arguments, + options, + content, + lineno, + content_offset, + block_text, + state, + state_machine, + ) self.result = statemachine.ViewList() def run(self): @@ -143,7 +160,8 @@ class WatcherFunc(BaseWatcherDirective): error = self.state_machine.reporter.error( f'The "{self.name}" directive is empty; content required.', nodes.literal_block(self.block_text, self.block_text), - line=self.lineno) + line=self.lineno, + ) return [error] func_path = self.content[0] @@ -164,8 +182,9 @@ class WatcherFunc(BaseWatcherDirective): self.add_textblock(textblock) try: - node_class = getattr(nodes, - self.options.get('format', 'paragraph')) + node_class = getattr( + nodes, self.options.get('format', 'paragraph') + ) except Exception as exc: raise self.error(exc) diff --git a/doc/ext/versioned_notifications.py b/doc/ext/versioned_notifications.py index 96633efcf..73d456ebd 100644 --- a/doc/ext/versioned_notifications.py +++ b/doc/ext/versioned_notifications.py @@ -28,7 +28,6 @@ from watcher.objects import base class VersionedNotificationDirective(Directive): - SAMPLE_ROOT = 'doc/notification_samples/' TOGGLE_SCRIPT = """