Skip to content

__init__.py

Command (tuple)

Command(regex, category, usage, function)

__getnewargs__(self) special

Return self as a plain tuple. Used by copy and pickle.

Source code in mps_youtube/commands/__init__.py
def __getnewargs__(self):
    'Return self as a plain tuple.  Used by copy and pickle.'
    return _tuple(self)

__new__(_cls, regex, category, usage, function) special staticmethod

Create new instance of Command(regex, category, usage, function)

__repr__(self) special

Return a nicely formatted representation string

Source code in mps_youtube/commands/__init__.py
def __repr__(self):
    'Return a nicely formatted representation string'
    return self.__class__.__name__ + repr_fmt % self

command(regex, *commands)

Decorator to register an mps-youtube command.

Source code in mps_youtube/commands/__init__.py
def command(regex, *commands):
    """ Decorator to register an mps-youtube command. """
    for command in commands:
        completer.add_cmd(command)
    def decorator(function):
        cmd = Command(re.compile(regex), None, None, function)
        g.commands.append(cmd)
        return function
    return decorator