def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") if hasattr(self.bot_config, 'BOT_IDENTITY') and 'username' in self.bot_config.BOT_IDENTITY: self.bot_identifier = self.build_identifier(self.bot_config.BOT_IDENTITY['username']) else: # Just a default identity for the bot if nothing has been specified. self.bot_identifier = self.build_identifier('@errbot') log.debug('Bot username set at %s.', self.bot_identifier) self._inroom = False self._rooms = [] self._multiline = False self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark') self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0]) self._register_identifiers_pickling()
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") try: # Load readline for better editing/history behaviour import readline except ImportError: # Readline is Unix-only log.debug("Python readline module is not available") pass self.bot_identifier = self.build_identifier('Err') self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False self._rooms = set() if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark') self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0])
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") if 'username' in self.bot_config.BOT_IDENTITY: self.bot_identifier = self.build_identifier(self.bot_config.BOT_IDENTITY['username']) else: # Just a default identity for the bot if nothing has been specified. self.bot_identifier = self.build_identifier('@errbot') log.debug('Bot username set at %s.', self.bot_identifier) self._inroom = False self._rooms = [] self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark') self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0]) self._register_identifiers_pickling()
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") self.bot_identifier = self.build_identifier('Err') self.rooms = set() self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_ansi = ansi() self.md_lexer = get_lexer_by_name("md", stripall=True) self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") self.bot_identifier = self.build_identifier('Err') self.rooms = set() self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_ansi = ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") self.bot_identifier = self.build_identifier('Err') self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False self._rooms = set() if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") self.bot_identifier = self.build_identifier('Err') self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr( self.bot_config, 'TEXT_DEMO_MODE') else False self._rooms = set() if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
def test_ansi(self): mdc = ansi() self.assertEquals(mdc.convert("*woot*"), "\x1b[4mwoot\x1b[24m\x1b[0m")
def test_ansi(): mdc = rendering.ansi() assert mdc.convert("*woot*") == "\x1b[4mwoot\x1b[24m\x1b[0m"