Skip to content

Commit

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

from __future__ import annotations

import asyncio
import logging
from typing import Any
Expand Down Expand Up @@ -146,7 +144,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: 3 additions & 7 deletions extensions/eda/plugins/event_source/aws_cloudtrail.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,14 @@
"""

from __future__ import annotations

import asyncio
import json
from datetime import datetime
from typing import TYPE_CHECKING, Any
from typing import 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 @@ -135,7 +131,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: 1 addition & 3 deletions extensions/eda/plugins/event_source/aws_sqs_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
"""

from __future__ import annotations

import asyncio
import json
import logging
Expand Down Expand Up @@ -111,7 +109,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: 1 addition & 3 deletions extensions/eda/plugins/event_source/azure_service_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
"""

from __future__ import annotations

import asyncio
import concurrent.futures
import contextlib
Expand Down Expand Up @@ -71,7 +69,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: 6 additions & 8 deletions extensions/eda/plugins/event_source/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"""

from __future__ import annotations

import pathlib

import yaml
Expand Down Expand Up @@ -62,21 +60,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 @@ -100,7 +98,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: 1 addition & 3 deletions extensions/eda/plugins/event_source/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
# 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 @@ -130,7 +128,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: 0 additions & 2 deletions extensions/eda/plugins/event_source/journald.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
"""

from __future__ import annotations

import asyncio
from typing import Any

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

from __future__ import annotations

import asyncio
import json
import logging
Expand Down Expand Up @@ -105,7 +103,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: 1 addition & 3 deletions extensions/eda/plugins/event_source/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
"""

from __future__ import annotations

import asyncio
from typing import Any

Expand All @@ -35,7 +33,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: 1 addition & 4 deletions extensions/eda/plugins/event_source/tick.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
delay: 5
"""

from __future__ import annotations

import asyncio
import itertools
from typing import Any
Expand All @@ -36,7 +33,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: 1 addition & 3 deletions extensions/eda/plugins/event_source/url_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
"""

from __future__ import annotations

import asyncio
from typing import Any

Expand Down Expand Up @@ -74,7 +72,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: 3 additions & 6 deletions extensions/eda/plugins/event_source/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
Defaults to hex
"""
from __future__ import annotations

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

from aiohttp import web

if TYPE_CHECKING:
from collections.abc import Callable

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

Expand Down Expand Up @@ -194,7 +191,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 e0e2798

Please sign in to comment.