How to use the circuits.six.u function in circuits

To help you get started, we’ve selected a few circuits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github circuits / circuits / tests / protocols / test_irc.py View on Github external
def test_parsemsg():
    s = b(":foo!bar@localhost NICK foobar")
    source, command, args = parsemsg(s)
    assert source == (u("foo"), u("bar"), u("localhost"))
    assert command == "NICK"
    assert args == [u("foobar")]

    s = b("")
    source, command, args = parsemsg(s)
    assert source == (None, None, None)
    assert command is None
    assert args == []
github circuits / circuits / circuits / protocols / irc / replies.py View on Github external
def RPL_WELCOME(network):
    return _M(u("001"), u("Welcome to the {0} IRC Network").format(network))
github circuits / circuits / circuits / protocols / irc / message.py View on Github external
def __unicode__(self):
        args = self.args[:]
        if any(u(' ') in arg for arg in args[:-1]):
            raise Error("Space can only appear in the very last arg")
        if any(u('\n') in arg for arg in args):
            raise Error("No newline allowed")

        if args and u(" ") in args[-1] and not args[-1].startswith(u(":")):
            args[-1] = u(":{0:s}").format(args[-1])

        return u("{prefix:s}{command:s} {args:s}\r\n").format(
            prefix=(
                u(":{0:s} ").format(self.prefix)
                if self.prefix is not None
                else u("")
            ),
            command=text_type(self.command),
            args=u(" ").join(args)
        )
github circuits / circuits / circuits / protocols / irc / replies.py View on Github external
def RPL_WHOISOPERATOR(nick):
    return _M(u("313"), nick, u("is an IRC operator"))
github circuits / circuits / circuits / protocols / irc / utils.py View on Github external
"""

    if len(s) > 0:
        if s[0] == u(":"):
            s = s[1:]
    if color:
        s = s.replace(u("\x01"), u(""))
        s = s.replace(u("\x02"), u(""))  # bold
        s = s.replace(u("\x1d"), u(""))  # italics
        s = s.replace(u("\x1f"), u(""))  # underline
        s = s.replace(u("\x1e"), u(""))  # strikethrough
        s = s.replace(u("\x11"), u(""))  # monospace
        s = s.replace(u("\x16"), u(""))  # reverse color
        s = COLOR.sub(u(""), s)  # color codes
        s = s.replace(u("\x03"), u(""))  # color
        s = s.replace(u("\x0f"), u(""))  # reset
    return s
github circuits / circuits / circuits / protocols / irc / replies.py View on Github external
def RPL_MOTD(text):
    return _M(u("372"), u("- {0}").format(text))
github circuits / circuits / circuits / protocols / irc / replies.py View on Github external
def RPL_WHOREPLY(channel, user, host, server, nick, status, hops, name):
    return _M(
        u("352"), channel, user, host, server, nick, status, u(":{0} {1}").format(hops, name)
    )
github circuits / circuits / circuits / protocols / irc / replies.py View on Github external
def ERR_NOPRIVILEGES():
    return _M(u("481"), u("Permission Denied- You're not an IRC operator"))
github circuits / circuits / circuits / protocols / irc / replies.py View on Github external
def RPL_TOPICWHO(channel, setter, timestamp):
    return _M(u("333"), channel, setter, u("{0}".format(timestamp)))