Skip to content

Commit

Permalink
Fix tox issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomor committed Aug 13, 2023
1 parent bb22714 commit 7d65d2d
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 20 deletions.
4 changes: 3 additions & 1 deletion extensions/eda/plugins/event_source/alertmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"""

from __future__ import annotations

import asyncio
import logging
from typing import Any
Expand Down Expand Up @@ -144,7 +146,7 @@ async def main(queue: asyncio.Queue, args: dict[str, Any]) -> None:
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
10 changes: 7 additions & 3 deletions extensions/eda/plugins/event_source/aws_cloudtrail.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@
"""

from __future__ import annotations

import asyncio
import json
from datetime import datetime
from typing import Any
from typing import TYPE_CHECKING, Any

from aiobotocore.client import BaseClient
from aiobotocore.session import get_session

if TYPE_CHECKING:
from aiobotocore.client import BaseClient


def _cloudtrail_event_to_dict(event: dict) -> dict:
event["EventTime"] = event["EventTime"].isoformat()
Expand Down Expand Up @@ -131,7 +135,7 @@ def connection_args(args: dict[str, Any]) -> dict[str, Any]:
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
4 changes: 3 additions & 1 deletion extensions/eda/plugins/event_source/aws_sqs_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"""

from __future__ import annotations

import asyncio
import json
import logging
Expand Down Expand Up @@ -109,7 +111,7 @@ def connection_args(args: dict[str, Any]) -> dict[str, Any]:
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
4 changes: 3 additions & 1 deletion extensions/eda/plugins/event_source/azure_service_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"""

from __future__ import annotations

import asyncio
import concurrent.futures
import contextlib
Expand Down Expand Up @@ -69,7 +71,7 @@ async def main(
class MockQueue:
"""A fake queue."""

async def put_nowait(self: "MockQueue", event: dict) -> None:
async def put_nowait(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
14 changes: 8 additions & 6 deletions extensions/eda/plugins/event_source/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"""

from __future__ import annotations

import pathlib

import yaml
Expand Down Expand Up @@ -60,21 +62,21 @@ def _observe_files(queue, files: list[str]) -> None: # noqa: ANN001
class Handler(RegexMatchingEventHandler):
"""A handler for file events."""

def __init__(self: "Handler", **kwargs) -> None: # noqa: ANN003
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: dict) -> 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: dict) -> None:
pass

def on_modified(self: "Handler", event: dict) -> None:
def on_modified(self: Handler, event: dict) -> 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: dict) -> None:
pass

observer = Observer()
Expand All @@ -98,7 +100,7 @@ def on_moved(self: "Handler", event: dict) -> None:
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
4 changes: 3 additions & 1 deletion extensions/eda/plugins/event_source/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import asyncio
import random
import time
Expand Down Expand Up @@ -128,7 +130,7 @@ def _create_data(
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
2 changes: 2 additions & 0 deletions extensions/eda/plugins/event_source/journald.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"""

from __future__ import annotations

import asyncio
from typing import Any

Expand Down
4 changes: 3 additions & 1 deletion extensions/eda/plugins/event_source/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"""

from __future__ import annotations

import asyncio
import json
import logging
Expand Down Expand Up @@ -103,7 +105,7 @@ async def main( # pylint: disable=R0914
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
4 changes: 3 additions & 1 deletion extensions/eda/plugins/event_source/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"""

from __future__ import annotations

import asyncio
from typing import Any

Expand All @@ -33,7 +35,7 @@ async def main(queue: asyncio.Queue, args: dict[str, Any]) -> None:
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
5 changes: 4 additions & 1 deletion extensions/eda/plugins/event_source/tick.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
delay: 5
"""

from __future__ import annotations

import asyncio
import itertools
from typing import Any
Expand All @@ -33,7 +36,7 @@ async def main(queue: asyncio.Queue, args: dict[str, Any]) -> None:
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
4 changes: 3 additions & 1 deletion extensions/eda/plugins/event_source/url_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"""

from __future__ import annotations

import asyncio
from typing import Any

Expand Down Expand Up @@ -72,7 +74,7 @@ async def main(queue: asyncio.Queue, args: dict[str, Any]) -> None:
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down
9 changes: 6 additions & 3 deletions extensions/eda/plugins/event_source/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Defaults to hex
"""
from __future__ import annotations

import asyncio
import base64
Expand All @@ -31,11 +32,13 @@
import json
import logging
import ssl
from collections.abc import Callable
from typing import Any
from typing import TYPE_CHECKING, Any

from aiohttp import web

if TYPE_CHECKING:
from collections.abc import Callable

logger = logging.getLogger(__name__)
routes = web.RouteTableDef()

Expand Down Expand Up @@ -191,7 +194,7 @@ async def main(queue: asyncio.Queue, args: dict[str, Any]) -> None:
class MockQueue:
"""A fake queue."""

async def put(self: "MockQueue", event: dict) -> None:
async def put(self: MockQueue, event: dict) -> None:
"""Print the event."""
print(event) # noqa: T201

Expand Down

0 comments on commit 7d65d2d

Please sign in to comment.