From e19327e780c06fb6e4bc80b7ef54632cb3acc818 Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Fri, 20 Mar 2026 19:31:34 +0000 Subject: [PATCH] adopt ruff-format autopep8 is now replaced by ruff-format as the code formatter Assisted-By: claude-code sonnet 4.6 Change-Id: If237599df59552d7aff9726be8af5d780f077e9a Signed-off-by: Sean Mooney --- .pre-commit-config.yaml | 16 +- api-ref/source/conf.py | 18 +- doc/ext/term.py | 35 +- doc/ext/versioned_notifications.py | 35 +- doc/source/conf.py | 47 +- releasenotes/source/conf.py | 29 +- setup.py | 4 +- tox.ini | 3 +- watcher/api/acl.py | 8 +- watcher/api/app.py | 2 +- watcher/api/app.wsgi | 1 - watcher/api/config.py | 20 +- watcher/api/controllers/base.py | 20 +- watcher/api/controllers/link.py | 23 +- watcher/api/controllers/root.py | 18 +- watcher/api/controllers/v1/__init__.py | 187 +- watcher/api/controllers/v1/action.py | 278 ++- watcher/api/controllers/v1/action_plan.py | 354 ++-- watcher/api/controllers/v1/audit.py | 395 ++-- watcher/api/controllers/v1/audit_template.py | 384 ++-- watcher/api/controllers/v1/collection.py | 6 +- watcher/api/controllers/v1/data_model.py | 17 +- watcher/api/controllers/v1/goal.py | 106 +- watcher/api/controllers/v1/scoring_engine.py | 107 +- watcher/api/controllers/v1/service.py | 120 +- watcher/api/controllers/v1/strategy.py | 176 +- watcher/api/controllers/v1/types.py | 33 +- watcher/api/controllers/v1/utils.py | 58 +- watcher/api/controllers/v1/webhooks.py | 7 +- watcher/api/hooks.py | 12 +- watcher/api/middleware/auth_token.py | 14 +- watcher/api/middleware/parsable_error.py | 37 +- watcher/api/wsgi.py | 8 +- watcher/applier/action_plan/default.py | 67 +- .../actions/change_node_power_state.py | 33 +- .../actions/change_nova_service_state.py | 55 +- watcher/applier/actions/factory.py | 5 +- watcher/applier/actions/migration.py | 157 +- watcher/applier/actions/nop.py | 28 +- watcher/applier/actions/resize.py | 47 +- watcher/applier/actions/sleep.py | 11 +- watcher/applier/actions/stop.py | 65 +- watcher/applier/actions/volume_migration.py | 108 +- watcher/applier/default.py | 8 +- watcher/applier/loading/default.py | 6 +- watcher/applier/manager.py | 1 - watcher/applier/messaging/trigger.py | 17 +- watcher/applier/rpcapi.py | 5 +- watcher/applier/service_monitor.py | 33 +- watcher/applier/sync.py | 54 +- watcher/applier/workflow_engine/base.py | 148 +- watcher/applier/workflow_engine/default.py | 96 +- watcher/cmd/dbmanage.py | 118 +- watcher/cmd/eventlet/api.py | 14 +- watcher/cmd/eventlet/decisionengine.py | 3 +- watcher/cmd/status.py | 14 +- watcher/common/cinder_helper.py | 115 +- watcher/common/clients.py | 135 +- watcher/common/config.py | 54 +- watcher/common/context.py | 35 +- watcher/common/exception.py | 108 +- watcher/common/executor.py | 15 +- watcher/common/ironic_helper.py | 1 - watcher/common/keystone_helper.py | 29 +- watcher/common/loader/base.py | 1 - watcher/common/loader/default.py | 12 +- watcher/common/loader/loadable.py | 3 +- watcher/common/metal_helper/base.py | 3 +- watcher/common/metal_helper/ironic.py | 11 +- watcher/common/metal_helper/maas.py | 49 +- watcher/common/nova_helper.py | 165 +- watcher/common/oslo_service_helper.py | 6 +- watcher/common/placement_helper.py | 33 +- watcher/common/policies/action.py | 30 +- watcher/common/policies/action_plan.py | 41 +- watcher/common/policies/audit.py | 44 +- watcher/common/policies/audit_template.py | 35 +- watcher/common/policies/base.py | 8 +- watcher/common/policies/data_model.py | 9 +- watcher/common/policies/goal.py | 23 +- watcher/common/policies/scoring_engine.py | 20 +- watcher/common/policies/service.py | 21 +- watcher/common/policies/strategy.py | 30 +- watcher/common/policy.py | 96 +- watcher/common/rpc.py | 28 +- watcher/common/scheduling.py | 12 +- watcher/common/service.py | 168 +- watcher/common/service_manager.py | 1 - watcher/common/utils.py | 17 +- watcher/conf/aetos_client.py | 58 +- watcher/conf/api.py | 82 +- watcher/conf/applier.py | 73 +- watcher/conf/cinder_client.py | 40 +- watcher/conf/clients_auth.py | 9 +- watcher/conf/collector.py | 65 +- watcher/conf/datasources.py | 53 +- watcher/conf/db.py | 12 +- watcher/conf/decision_engine.py | 143 +- watcher/conf/exception.py | 8 +- watcher/conf/gnocchi_client.py | 39 +- watcher/conf/grafana_client.py | 248 +-- watcher/conf/grafana_translators.py | 33 +- watcher/conf/ironic_client.py | 40 +- watcher/conf/keystone_client.py | 24 +- watcher/conf/maas_client.py | 18 +- watcher/conf/models.py | 15 +- watcher/conf/nova.py | 109 +- watcher/conf/nova_client.py | 80 +- watcher/conf/opts.py | 8 +- watcher/conf/paths.py | 31 +- watcher/conf/placement_client.py | 31 +- watcher/conf/planner.py | 16 +- watcher/conf/plugins.py | 14 +- watcher/conf/prometheus_client.py | 66 +- watcher/conf/service.py | 57 +- watcher/db/api.py | 161 +- watcher/db/migration.py | 5 +- watcher/db/purge.py | 181 +- watcher/db/sqlalchemy/alembic/env.py | 5 +- .../sqlalchemy/alembic/versions/001_ocata.py | 124 +- .../0f6042416884_add_apscheduler_jobs.py | 7 +- ...737_change_efficiacy_indicator_decimals.py | 13 +- .../3cfc94cecf4e_add_name_for_audit.py | 4 +- .../4b16194c56bc_add_start_end_time.py | 8 +- .../versions/52804f2498c4_add_hostname.py | 4 +- ...d8f228_add_status_message_to_actionplan.py | 23 +- .../alembic/versions/a86240e89a29_.py | 35 +- .../d098df6021e2_cron_support_for_audit.py | 16 +- ...9a5945e4a0_add_action_description_table.py | 12 +- watcher/db/sqlalchemy/api.py | 649 ++++--- watcher/db/sqlalchemy/job_store.py | 70 +- watcher/db/sqlalchemy/migration.py | 12 +- watcher/db/sqlalchemy/models.py | 69 +- watcher/decision_engine/audit/base.py | 37 +- watcher/decision_engine/audit/continuous.py | 130 +- watcher/decision_engine/audit/event.py | 4 +- watcher/decision_engine/audit/oneshot.py | 4 +- watcher/decision_engine/datasources/aetos.py | 8 +- watcher/decision_engine/datasources/base.py | 114 +- .../decision_engine/datasources/gnocchi.py | 271 ++- .../decision_engine/datasources/grafana.py | 281 ++- .../datasources/grafana_translator/base.py | 33 +- .../grafana_translator/influxdb.py | 45 +- .../decision_engine/datasources/manager.py | 57 +- .../decision_engine/datasources/prometheus.py | 29 +- .../datasources/prometheus_base.py | 267 ++- watcher/decision_engine/goal/__init__.py | 14 +- watcher/decision_engine/goal/base.py | 1 - watcher/decision_engine/goal/efficacy/base.py | 10 +- .../goal/efficacy/indicators.py | 92 +- .../decision_engine/goal/efficacy/specs.py | 148 +- watcher/decision_engine/loading/default.py | 18 +- watcher/decision_engine/manager.py | 9 +- .../messaging/audit_endpoint.py | 10 +- .../messaging/data_model_endpoint.py | 20 +- watcher/decision_engine/model/base.py | 1 - .../decision_engine/model/collector/base.py | 20 +- .../decision_engine/model/collector/cinder.py | 122 +- .../decision_engine/model/collector/ironic.py | 15 +- .../model/collector/manager.py | 4 +- .../decision_engine/model/collector/nova.py | 214 +- .../decision_engine/model/element/__init__.py | 20 +- .../model/element/baremetal_resource.py | 1 - watcher/decision_engine/model/element/base.py | 24 +- .../model/element/compute_resource.py | 5 +- .../decision_engine/model/element/instance.py | 1 - watcher/decision_engine/model/element/node.py | 14 +- .../model/element/storage_resource.py | 1 - .../decision_engine/model/element/volume.py | 3 +- watcher/decision_engine/model/model_root.py | 140 +- .../model/notification/base.py | 1 - .../model/notification/cinder.py | 174 +- .../model/notification/filtering.py | 8 +- .../model/notification/nova.py | 108 +- watcher/decision_engine/planner/base.py | 1 - .../planner/node_resource_consolidation.py | 33 +- watcher/decision_engine/planner/weight.py | 55 +- .../planner/workload_stabilization.py | 128 +- watcher/decision_engine/rpcapi.py | 15 +- watcher/decision_engine/scheduling.py | 47 +- watcher/decision_engine/scope/baremetal.py | 7 +- watcher/decision_engine/scope/compute.py | 114 +- watcher/decision_engine/scope/storage.py | 41 +- .../decision_engine/scoring/dummy_scorer.py | 21 +- .../scoring/dummy_scoring_container.py | 9 +- .../scoring/scoring_factory.py | 16 +- watcher/decision_engine/service_monitor.py | 34 +- watcher/decision_engine/solution/default.py | 14 +- watcher/decision_engine/solution/efficacy.py | 22 +- .../decision_engine/strategy/context/base.py | 19 +- .../strategy/context/default.py | 17 +- .../strategy/selection/base.py | 1 - .../strategy/selection/default.py | 13 +- .../strategy/strategies/__init__.py | 27 +- .../strategy/strategies/actuation.py | 24 +- .../strategy/strategies/base.py | 128 +- .../strategies/basic_consolidation.py | 257 ++- .../strategy/strategies/dummy_strategy.py | 25 +- .../strategy/strategies/dummy_with_resize.py | 34 +- .../strategy/strategies/dummy_with_scorer.py | 76 +- .../strategy/strategies/host_maintenance.py | 95 +- .../strategies/node_resource_consolidation.py | 86 +- .../strategy/strategies/noisy_neighbor.py | 163 +- .../strategies/outlet_temp_control.py | 85 +- .../strategy/strategies/saving_energy.py | 98 +- .../strategies/storage_capacity_balance.py | 192 +- .../strategy/strategies/uniform_airflow.py | 153 +- .../strategies/vm_workload_consolidation.py | 353 ++-- .../strategy/strategies/workload_balance.py | 187 +- .../strategies/workload_stabilization.py | 344 ++-- .../strategy/strategies/zone_migration.py | 349 ++-- watcher/decision_engine/sync.py | 244 ++- watcher/decision_engine/threading.py | 24 +- watcher/eventlet.py | 6 +- watcher/hacking/checks.py | 109 +- watcher/notifications/action.py | 180 +- watcher/notifications/action_plan.py | 181 +- watcher/notifications/audit.py | 140 +- watcher/notifications/base.py | 18 +- watcher/notifications/exception.py | 9 +- watcher/notifications/goal.py | 2 - watcher/notifications/service.py | 41 +- watcher/notifications/strategy.py | 2 - watcher/objects/action.py | 50 +- watcher/objects/action_description.py | 37 +- watcher/objects/action_plan.py | 91 +- watcher/objects/audit.py | 75 +- watcher/objects/audit_template.py | 51 +- watcher/objects/base.py | 28 +- watcher/objects/efficacy_indicator.py | 39 +- watcher/objects/fields.py | 14 +- watcher/objects/goal.py | 24 +- watcher/objects/scoring_engine.py | 57 +- watcher/objects/service.py | 34 +- watcher/objects/strategy.py | 47 +- watcher/tests/fixtures/db_lock.py | 16 +- watcher/tests/fixtures/fakes.py | 50 +- watcher/tests/fixtures/policy_fixture.py | 9 +- watcher/tests/fixtures/watcher.py | 29 +- watcher/tests/unit/__init__.py | 1 + watcher/tests/unit/api/base.py | 180 +- watcher/tests/unit/api/test_base.py | 9 +- watcher/tests/unit/api/test_config.py | 11 +- watcher/tests/unit/api/test_hooks.py | 118 +- watcher/tests/unit/api/test_root.py | 50 +- watcher/tests/unit/api/test_utils.py | 30 +- watcher/tests/unit/api/utils.py | 41 +- watcher/tests/unit/api/v1/test_actions.py | 548 ++++-- .../tests/unit/api/v1/test_actions_plans.py | 501 +++-- .../tests/unit/api/v1/test_audit_templates.py | 771 +++++--- watcher/tests/unit/api/v1/test_audits.py | 1002 ++++++---- watcher/tests/unit/api/v1/test_data_model.py | 64 +- watcher/tests/unit/api/v1/test_goals.py | 119 +- .../tests/unit/api/v1/test_microversions.py | 108 +- .../tests/unit/api/v1/test_scoring_engines.py | 138 +- watcher/tests/unit/api/v1/test_services.py | 122 +- watcher/tests/unit/api/v1/test_strategies.py | 238 ++- watcher/tests/unit/api/v1/test_types.py | 58 +- watcher/tests/unit/api/v1/test_utils.py | 14 +- watcher/tests/unit/api/v1/test_webhooks.py | 35 +- .../test_default_action_handler.py | 215 +- .../actions/test_change_node_power_state.py | 87 +- .../actions/test_change_nova_service_state.py | 85 +- .../unit/applier/actions/test_migration.py | 199 +- .../tests/unit/applier/actions/test_resize.py | 60 +- .../tests/unit/applier/actions/test_sleep.py | 15 +- .../tests/unit/applier/actions/test_stop.py | 59 +- .../applier/actions/test_volume_migration.py | 133 +- .../test_trigger_action_plan_endpoint.py | 8 +- .../unit/applier/test_applier_manager.py | 3 +- watcher/tests/unit/applier/test_rpcapi.py | 15 +- watcher/tests/unit/applier/test_service.py | 31 +- .../unit/applier/test_service_monitor.py | 295 +-- watcher/tests/unit/applier/test_sync.py | 41 +- .../test_default_workflow_engine.py | 500 +++-- .../test_taskflow_action_container.py | 352 ++-- watcher/tests/unit/base.py | 30 +- watcher/tests/unit/cmd/test_api.py | 1 - watcher/tests/unit/cmd/test_applier.py | 3 +- watcher/tests/unit/cmd/test_db_manage.py | 21 +- .../tests/unit/cmd/test_decision_engine.py | 8 +- watcher/tests/unit/cmd/test_status.py | 1 - .../tests/unit/common/loader/test_loader.py | 51 +- .../unit/common/metal_helper/test_base.py | 17 +- .../unit/common/metal_helper/test_factory.py | 9 +- .../unit/common/metal_helper/test_ironic.py | 43 +- .../unit/common/metal_helper/test_maas.py | 31 +- .../tests/unit/common/test_cinder_helper.py | 278 ++- watcher/tests/unit/common/test_clients.py | 117 +- watcher/tests/unit/common/test_executor.py | 18 +- .../tests/unit/common/test_ironic_helper.py | 5 +- .../tests/unit/common/test_keystone_helper.py | 23 +- watcher/tests/unit/common/test_nova_helper.py | 586 +++--- .../unit/common/test_oslo_service_helper.py | 17 +- .../unit/common/test_placement_helper.py | 137 +- watcher/tests/unit/common/test_scheduling.py | 4 +- watcher/tests/unit/common/test_service.py | 141 +- watcher/tests/unit/common/test_utils.py | 7 +- watcher/tests/unit/common/utils.py | 7 +- watcher/tests/unit/conf/test_list_opts.py | 118 +- watcher/tests/unit/config.py | 13 +- watcher/tests/unit/db/base.py | 26 +- watcher/tests/unit/db/test_action.py | 245 ++- .../tests/unit/db/test_action_description.py | 163 +- watcher/tests/unit/db/test_action_plan.py | 275 ++- watcher/tests/unit/db/test_audit.py | 287 ++- watcher/tests/unit/db/test_audit_template.py | 249 ++- .../db/test_deadlock_decorator_validation.py | 43 +- .../tests/unit/db/test_efficacy_indicator.py | 320 ++- watcher/tests/unit/db/test_goal.py | 210 +- watcher/tests/unit/db/test_migrations.py | 113 +- watcher/tests/unit/db/test_purge.py | 398 ++-- watcher/tests/unit/db/test_scoring_engine.py | 193 +- watcher/tests/unit/db/test_service.py | 181 +- watcher/tests/unit/db/test_strategy.py | 215 +- watcher/tests/unit/db/utils.py | 21 +- .../audit/test_audit_handlers.py | 457 +++-- .../cluster/test_cinder_cdmc.py | 57 +- .../test_cluster_data_model_collector.py | 11 +- .../decision_engine/cluster/test_nova_cdmc.py | 422 ++-- .../grafana_translators/test_base.py | 35 +- .../grafana_translators/test_influxdb.py | 61 +- .../datasources/test_aetos_helper.py | 21 +- .../decision_engine/datasources/test_base.py | 16 +- .../datasources/test_gnocchi_helper.py | 91 +- .../datasources/test_grafana_helper.py | 219 ++- .../datasources/test_manager.py | 50 +- .../datasources/test_prometheus_base.py | 711 ++++--- .../datasources/test_prometheus_helper.py | 37 +- .../tests/unit/decision_engine/fake_goals.py | 13 +- .../unit/decision_engine/fake_metal_helper.py | 16 +- .../unit/decision_engine/fake_strategies.py | 5 +- .../loading/test_collector_loader.py | 31 +- .../loading/test_default_strategy_loader.py | 39 +- .../loading/test_goal_loader.py | 26 +- .../messaging/test_audit_endpoint.py | 18 +- .../messaging/test_data_model_endpoint.py | 7 +- .../model/faker_cluster_and_metrics.py | 53 +- .../model/faker_cluster_state.py | 22 +- .../decision_engine/model/gnocchi_metrics.py | 40 +- .../model/notification/fake_managers.py | 6 +- .../notification/test_cinder_notifications.py | 216 +- .../model/notification/test_notifications.py | 11 +- .../notification/test_nova_notifications.py | 182 +- .../decision_engine/model/test_element.py | 332 ++-- .../unit/decision_engine/model/test_model.py | 128 +- .../test_node_resource_consolidation.py | 197 +- .../planner/test_planner_manager.py | 5 +- .../planner/test_weight_planner.py | 1442 +++++++++----- .../test_workload_stabilization_planner.py | 299 +-- .../unit/decision_engine/scope/fake_scopes.py | 103 +- .../decision_engine/scope/test_baremetal.py | 32 +- .../decision_engine/scope/test_compute.py | 288 +-- .../decision_engine/scope/test_storage.py | 211 +- .../scoring/test_dummy_scorer.py | 6 +- .../scoring/test_dummy_scoring_container.py | 7 +- .../scoring/test_scoring_factory.py | 14 +- .../solution/test_default_solution.py | 48 +- .../strategy/context/test_strategy_context.py | 62 +- .../selector/test_strategy_selector.py | 15 +- .../strategy/strategies/test_actuator.py | 4 +- .../strategy/strategies/test_base.py | 42 +- .../strategies/test_basic_consolidation.py | 122 +- .../strategies/test_dummy_strategy.py | 1 - .../strategies/test_dummy_with_scorer.py | 1 - .../strategies/test_host_maintenance.py | 511 +++-- .../test_node_resource_consolidation.py | 365 ++-- .../strategies/test_noisy_neighbor.py | 34 +- .../strategies/test_outlet_temp_control.py | 57 +- .../strategy/strategies/test_saving_energy.py | 48 +- .../test_storage_capacity_balance.py | 156 +- .../strategies/test_strategy_endpoint.py | 47 +- .../strategies/test_uniform_airflow.py | 79 +- .../test_vm_workload_consolidation.py | 330 ++-- .../strategies/test_workload_balance.py | 152 +- .../strategies/test_workload_stabilization.py | 339 ++-- .../strategies/test_zone_migration.py | 1729 ++++++++++------- .../tests/unit/decision_engine/test_gmr.py | 5 +- .../tests/unit/decision_engine/test_rpcapi.py | 30 +- .../unit/decision_engine/test_scheduling.py | 37 +- .../unit/decision_engine/test_service.py | 70 +- .../decision_engine/test_service_monitor.py | 353 ++-- .../tests/unit/decision_engine/test_sync.py | 683 +++++-- .../notifications/test_action_notification.py | 290 +-- .../test_action_plan_notification.py | 278 ++- .../notifications/test_audit_notification.py | 215 +- .../unit/notifications/test_notification.py | 163 +- .../test_service_notifications.py | 50 +- watcher/tests/unit/objects/test_action.py | 154 +- .../unit/objects/test_action_description.py | 34 +- .../tests/unit/objects/test_action_plan.py | 256 ++- watcher/tests/unit/objects/test_audit.py | 195 +- .../tests/unit/objects/test_audit_template.py | 161 +- .../unit/objects/test_efficacy_indicator.py | 126 +- watcher/tests/unit/objects/test_goal.py | 25 +- watcher/tests/unit/objects/test_objects.py | 240 ++- .../tests/unit/objects/test_scoring_engine.py | 51 +- watcher/tests/unit/objects/test_service.py | 25 +- watcher/tests/unit/objects/test_strategy.py | 90 +- watcher/tests/unit/test_threading.py | 41 +- watcher/wsgi/api.py | 1 + 401 files changed, 24071 insertions(+), 15629 deletions(-) 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 = """