(name, package, level)
Verify arguments are "sane".
Verify arguments are "sane".
Verify arguments are sane .
def _sanity_check(name, package, level):
    """Verify arguments are "sane"."""
    if not isinstance(name, str):
        raise TypeError('module name must be str, not {}'.format(type(name)))
    if level < 0:
        raise ValueError('level must be >= 0')
    if level > 0:
        if not isinstance(package, str):
            raise TypeError('__package__ not set to a string')
        elif not package:
            raise ImportError('attempted relative import with no known parent '
                              'package')
    if not name and level == 0:
        raise ValueError('Empty module name')
def _sanity_check ( name , package , level ) : if not isinstance ( name , str ) : raise TypeError ( 'module name must be str, not {}' . format ( type ( name ) ) ) if level < 0 : raise ValueError ( 'level must be >= 0' ) if level > 0 : if not isinstance ( package , str ) : raise TypeError ( '__package__ not set to a string' ) elif not package : raise ImportError ( 'attempted relative import with no known parent ' 'package' ) if not name and level == 0 : raise ValueError ( 'Empty module name' )