From 18d919982ae039a076be786e32c191f3be974720 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sat, 10 Oct 2020 23:34:35 +0200 Subject: [PATCH] fix linter --- music_assistant/mass.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/music_assistant/mass.py b/music_assistant/mass.py index 3b290dcc..0c0b5891 100644 --- a/music_assistant/mass.py +++ b/music_assistant/mass.py @@ -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) -- 2.34.1