fix linter
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sat, 10 Oct 2020 21:34:35 +0000 (23:34 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Sat, 10 Oct 2020 21:34:35 +0000 (23:34 +0200)
music_assistant/mass.py

index 3b290dcca223ff951d1cff98b15da281065985e0..0c0b589149e3ea1d309b4c26cffe21a81e46abb9 100644 (file)
@@ -63,7 +63,7 @@ class MusicAssistant:
         """Start running the music assistant server."""
         # initialize loop
         self._loop = asyncio.get_event_loop()
-        self._loop.set_exception_handler(self.__handle_exception)
+        self._loop.set_exception_handler(__handle_exception)
         self._loop.set_debug(self._debug)
         # create shared aiohttp ClientSession
         self._http_session = aiohttp.ClientSession(
@@ -284,15 +284,6 @@ class MusicAssistant:
                 task = self.loop.run_in_executor(None, target, *args, *kwargs)  # type: ignore
         return task
 
-    def __handle_exception(
-        self, loop: asyncio.AbstractEventLoop, context: Dict
-    ) -> None:
-        """Global exception handler."""
-        LOGGER.exception(
-            "Caught exception: %s", context.get("exception", context["message"])
-        )
-        loop.default_exception_handler(context)
-
     async def __async_setup_discovery(self) -> None:
         """Make this Music Assistant instance discoverable on the network."""
         zeroconf_type = "_music-assistant._tcp.local."
@@ -343,3 +334,11 @@ class MusicAssistant:
                     LOGGER.exception("Error preloading module %s: %s", module_name, exc)
                 else:
                     LOGGER.debug("Successfully preloaded module %s", module_name)
+
+
+def __handle_exception(loop: asyncio.AbstractEventLoop, context: Dict) -> None:
+    """Global exception handler."""
+    LOGGER.exception(
+        "Caught exception: %s", context.get("exception", context["message"])
+    )
+    loop.default_exception_handler(context)