Skip to content

Commit

Permalink
Remove __set_event_loop()
Browse files Browse the repository at this point in the history
Per the Python documentation, `asyncio.ProactorEventLoop` is used by
default on Windows as of Python 3.8. Python 3.8 is the minimum
supported version for this repository.
  • Loading branch information
PSalant726 committed Oct 31, 2022
1 parent 93ee966 commit fb90bdd
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions fideslog/sdk/python/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# pylint: disable=import-outside-toplevel, too-many-arguments

from asyncio import run
from sys import platform, version_info
from typing import Dict, Optional, Union

from aiohttp import (
Expand All @@ -24,25 +23,6 @@
REQUIRED_HEADERS = {"X-Fideslog-Version": __version__}


def __set_event_loop() -> None:
"""
Helps to work around a bug in the default Windows event loop for Python 3.8+
by changing the default event loop in Windows processes.
"""

if (
version_info[0] == 3
and version_info[1] >= 8
and platform.lower().startswith("win")
):
from asyncio import ( # type: ignore[attr-defined]
WindowsSelectorEventLoopPolicy,
set_event_loop_policy,
)

set_event_loop_policy(WindowsSelectorEventLoopPolicy())


class AnalyticsClient:
"""
An instance of a fides tool that wishes to send
Expand Down Expand Up @@ -91,7 +71,6 @@ def register(self, registration: Registration) -> None:
Register a new user.
"""

__set_event_loop()
run(self.send_async(registration))

async def register_async(self, registration: Registration) -> None:
Expand All @@ -106,7 +85,6 @@ def send(self, event: AnalyticsEvent) -> None:
Record a new analytics event.
"""

__set_event_loop()
run(self.send_async(event))

async def send_async(
Expand Down

0 comments on commit fb90bdd

Please sign in to comment.