diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c3c44f34..4e57abdb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,7 +62,7 @@ repos: - xxhash - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.5.7" + rev: "v0.6.0" hooks: - id: ruff args: [ diff --git a/extensions/eda/plugins/event_source/aws_cloudtrail.py b/extensions/eda/plugins/event_source/aws_cloudtrail.py index 5f9bcb00..6f6b680e 100644 --- a/extensions/eda/plugins/event_source/aws_cloudtrail.py +++ b/extensions/eda/plugins/event_source/aws_cloudtrail.py @@ -36,8 +36,8 @@ from datetime import datetime from typing import Any -from aiobotocore.client import BaseClient from aiobotocore.session import get_session +from botocore.client import BaseClient def _cloudtrail_event_to_dict(event: dict) -> dict: diff --git a/extensions/eda/plugins/event_source/azure_service_bus.py b/extensions/eda/plugins/event_source/azure_service_bus.py index dcd51d98..f00d14c5 100644 --- a/extensions/eda/plugins/event_source/azure_service_bus.py +++ b/extensions/eda/plugins/event_source/azure_service_bus.py @@ -69,7 +69,7 @@ async def main( class MockQueue(asyncio.Queue[Any]): """A fake queue.""" - async def put_nowait(self: "MockQueue", event: dict) -> None: + def put_nowait(self: "MockQueue", event: dict) -> None: """Print the event.""" print(event) # noqa: T201 diff --git a/extensions/eda/plugins/event_source/file.py b/extensions/eda/plugins/event_source/file.py index 09403d98..df5809e9 100644 --- a/extensions/eda/plugins/event_source/file.py +++ b/extensions/eda/plugins/event_source/file.py @@ -18,7 +18,7 @@ import pathlib import yaml -from watchdog.events import RegexMatchingEventHandler +from watchdog.events import FileSystemEvent, RegexMatchingEventHandler from watchdog.observers import Observer @@ -63,18 +63,18 @@ class Handler(RegexMatchingEventHandler): def __init__(self: "Handler", **kwargs) -> None: # noqa: ANN003 RegexMatchingEventHandler.__init__(self, **kwargs) - def on_created(self: "Handler", event: dict) -> None: + def on_created(self: "Handler", event: FileSystemEvent) -> None: if event.src_path in files: send_facts(queue, event.src_path) - def on_deleted(self: "Handler", event: dict) -> None: + def on_deleted(self: "Handler", event: FileSystemEvent) -> None: pass - def on_modified(self: "Handler", event: dict) -> None: + def on_modified(self: "Handler", event: FileSystemEvent) -> None: if event.src_path in files: send_facts(queue, event.src_path) - def on_moved(self: "Handler", event: dict) -> None: + def on_moved(self: "Handler", event: FileSystemEvent) -> None: pass observer = Observer() diff --git a/extensions/eda/plugins/event_source/file_watch.py b/extensions/eda/plugins/event_source/file_watch.py index aa2b09aa..2c28306e 100644 --- a/extensions/eda/plugins/event_source/file_watch.py +++ b/extensions/eda/plugins/event_source/file_watch.py @@ -22,7 +22,7 @@ import concurrent.futures from typing import Any -from watchdog.events import RegexMatchingEventHandler +from watchdog.events import FileSystemEvent, RegexMatchingEventHandler from watchdog.observers import Observer @@ -37,10 +37,10 @@ def watch( class Handler(RegexMatchingEventHandler): """A handler for file system events.""" - def __init__(self: "Handler", **kwargs: dict) -> None: + def __init__(self: "Handler", **kwargs: FileSystemEvent) -> None: RegexMatchingEventHandler.__init__(self, **kwargs) - def on_created(self: "Handler", event: dict) -> None: + def on_created(self: "Handler", event: FileSystemEvent) -> None: loop.call_soon_threadsafe( queue.put_nowait, { @@ -51,7 +51,7 @@ def on_created(self: "Handler", event: dict) -> None: }, ) - def on_deleted(self: "Handler", event: dict) -> None: + def on_deleted(self: "Handler", event: FileSystemEvent) -> None: loop.call_soon_threadsafe( queue.put_nowait, { @@ -62,7 +62,7 @@ def on_deleted(self: "Handler", event: dict) -> None: }, ) - def on_modified(self: "Handler", event: dict) -> None: + def on_modified(self: "Handler", event: FileSystemEvent) -> None: loop.call_soon_threadsafe( queue.put_nowait, { @@ -73,7 +73,7 @@ def on_modified(self: "Handler", event: dict) -> None: }, ) - def on_moved(self: "Handler", event: dict) -> None: + def on_moved(self: "Handler", event: FileSystemEvent) -> None: loop.call_soon_threadsafe( queue.put_nowait, { @@ -110,7 +110,7 @@ async def main(queue: asyncio.Queue, args: dict) -> None: class MockQueue(asyncio.Queue[Any]): """A fake queue.""" - async def put_nowait(self: "MockQueue", event: dict) -> None: + def put_nowait(self: "MockQueue", event: dict) -> None: """Print the event.""" print(event) # noqa: T201 diff --git a/extensions/eda/plugins/event_source/journald.py b/extensions/eda/plugins/event_source/journald.py index 2de64c50..67087e0e 100644 --- a/extensions/eda/plugins/event_source/journald.py +++ b/extensions/eda/plugins/event_source/journald.py @@ -79,9 +79,8 @@ async def main(queue: asyncio.Queue, args: dict[str, Any]) -> None: # noqa: D41 class MockQueue(asyncio.Queue[Any]): """A mock implementation of a queue that prints the event.""" - async def put(self, event: str) -> str: + async def put(self, event: str) -> None: """Add the event to the queue and print it.""" print(event) # noqa: T201 - return "" asyncio.run(main(MockQueue(), {"match": "ALL"})) diff --git a/plugins/modules/project_info.py b/plugins/modules/project_info.py index 0a1ba8c4..858d45a9 100644 --- a/plugins/modules/project_info.py +++ b/plugins/modules/project_info.py @@ -72,8 +72,10 @@ ] """ # NOQA +# pylint: disable=wrong-import-position, from ansible.module_utils.basic import AnsibleModule +# pylint: disable=relative-beyond-top-level from ..module_utils.arguments import AUTH_ARGSPEC from ..module_utils.client import Client from ..module_utils.controller import Controller diff --git a/pyproject.toml b/pyproject.toml index 2a7da5e9..23018d44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,10 +39,6 @@ color_output = true error_summary = true # TODO: Remove temporary skips and close https://github.com/ansible/event-driven-ansible/issues/258 -disable_error_code = [ - "attr-defined", - "override", -] # strict = true # disallow_untyped_calls = true # disallow_untyped_defs = true @@ -65,7 +61,6 @@ module = [ "aiokafka.*", # https://github.com/aio-libs/aiokafka/issues/980 "ansible.*", # https://github.com/ansible/ansible/issues/83801 "asyncmock", # https://github.com/timsavage/asyncmock/issues/8 - # "botocore.*", # https://github.com/boto/botocore/issues/2297 "kafka.*", # https://github.com/dpkp/kafka-python/issues/2446 ] ignore_missing_imports = true