(extensions, function, extra_args)
Checks what gets registered as an unpacker.
Checks what gets registered as an unpacker.
Checks what gets registered as an unpacker .
def _check_unpack_options(extensions, function, extra_args):
    """Checks what gets registered as an unpacker."""
    # first make sure no other unpacker is registered for this extension
    existing_extensions = {}
    for name, info in _UNPACK_FORMATS.items():
        for ext in info[0]:
            existing_extensions[ext] = name

    for extension in extensions:
        if extension in existing_extensions:
            msg = '%s is already registered for "%s"'
            raise RegistryError(msg % (extension,
                                       existing_extensions[extension]))

    if not isinstance(function, collections.Callable):
        raise TypeError('The registered function must be a callable')
def _check_unpack_options ( extensions , function , extra_args ) : # first make sure no other unpacker is registered for this extension existing_extensions = { } for name , info in _UNPACK_FORMATS . items ( ) : for ext in info [ 0 ] : existing_extensions [ ext ] = name for extension in extensions : if extension in existing_extensions : msg = '%s is already registered for "%s"' raise RegistryError ( msg % ( extension , existing_extensions [ extension ] ) ) if not isinstance ( function , collections . Callable ) : raise TypeError ( 'The registered function must be a callable' )