From 3eade77cf1055dffd755fb51817b4f26a33f7565 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 26 Jul 2018 14:36:58 +0000 Subject: [PATCH] Clean up --- yaboli/room.py | 4 +--- yaboli/utils.py | 44 +------------------------------------------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/yaboli/room.py b/yaboli/room.py index efafd49..947e0ad 100644 --- a/yaboli/room.py +++ b/yaboli/room.py @@ -1,13 +1,12 @@ import asyncio import logging -logger = logging.getLogger(__name__) - from .connection import * from .exceptions import * from .utils import * +logger = logging.getLogger(__name__) __all__ = ["Room", "Inhabitant"] @@ -155,7 +154,6 @@ class Room: async def _receive_packet(self, ptype, data, error, throttled): # Ignoring errors and throttling for now - logger.debug(f"Received packet of type: {ptype}") functions = { "bounce-event": self._event_bounce, #"disconnect-event": self._event_disconnect, # Not important, can ignore diff --git a/yaboli/utils.py b/yaboli/utils.py index b67f48c..3d5df55 100644 --- a/yaboli/utils.py +++ b/yaboli/utils.py @@ -1,55 +1,13 @@ import asyncio -#import logging import time -#logger = logging.getLogger(__name__) __all__ = [ - #"run_controller", "run_bot", "mention", "mention_reduced", "similar", "format_time", "format_time_delta", - "Session", "Listing", - "Message", + "Session", "Listing", "Message", ] - -#def run_controller(controller, room): -# """ -# Helper function to run a singular controller. -# """ -# -# async def run(): -# task, reason = await controller.connect(room) -# if task: -# await task -# else: -# logger.warn(f"Could not connect to &{room}: {reason!r}") -# -# asyncio.get_event_loop().run_until_complete(run()) -# -#def run_bot(bot_class, room, *args, **kwargs): -# """ -# Helper function to run a bot. To run Multibots, use the MultibotKeeper. -# This restarts the bot when it is explicitly restarted through Bot.restart(). -# """ -# -# async def run(): -# while True: -# logger.info(f"Creating new instance and connecting to &{room}") -# bot = bot_class(*args, **kwargs) -# task, reason = await bot.connect(room) -# if task: -# await task -# else: -# logger.warn(f"Could not connect to &{room}: {reason!r}") -# -# if bot.restarting: -# logger.info(f"Restarting in &{room}") -# else: -# break -# -# asyncio.get_event_loop().run_until_complete(run()) - def mention(nick): return "".join(c for c in nick if c not in ".!?;&<'\"" and not c.isspace())