コード例 #1
0
ファイル: text.py プロジェクト: apophys/errbot
    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()
コード例 #2
0
ファイル: text.py プロジェクト: garmann/errbot
    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])
コード例 #3
0
ファイル: text.py プロジェクト: rkrambovitis/errbot
    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()
コード例 #4
0
ファイル: text.py プロジェクト: rroemhild/err
 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')
コード例 #5
0
ファイル: text.py プロジェクト: preoctopus/err
 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')
コード例 #6
0
ファイル: text.py プロジェクト: dev-zero/errbot
    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')
コード例 #7
0
    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')
コード例 #8
0
 def test_ansi(self):
     mdc = ansi()
     self.assertEquals(mdc.convert("*woot*"), "\x1b[4mwoot\x1b[24m\x1b[0m")
コード例 #9
0
def test_ansi():
    mdc = rendering.ansi()
    assert mdc.convert("*woot*") == "\x1b[4mwoot\x1b[24m\x1b[0m"
コード例 #10
0
ファイル: md_rendering_test.py プロジェクト: Adman/errbot
def test_ansi():
    mdc = rendering.ansi()
    assert mdc.convert("*woot*") == "\x1b[4mwoot\x1b[24m\x1b[0m"