(dos_name)
return (
            # enforce lengths
            (len(trunk) <= 8 and len(ext) <= 3) and
            # no leading or trailing spaces
            (trunk == trunk.strip() and ext == ext.strip()) and
            # enforce allowable characters
            ((set(trunk) | set(ext)) <= ALLOWABLE_CHARS)
        )
Check if a (bytes) name is a legal DOS name.
Check if a (bytes) name is a legal DOS name.
Check if a ( bytes ) name is a legal DOS name .
def dos_is_legal_name(dos_name):
    """Check if a (bytes) name is a legal DOS name."""
    assert isinstance(dos_name, bytes), type(dos_name)
    if dos_name in (b'.', b'..'):
        return True
    trunk, ext = dos_splitext(dos_name)
    return (
            # enforce lengths
            (len(trunk) <= 8 and len(ext) <= 3) and
            # no leading or trailing spaces
            (trunk == trunk.strip() and ext == ext.strip()) and
            # enforce allowable characters
            ((set(trunk) | set(ext)) <= ALLOWABLE_CHARS)
        )
def dos_is_legal_name ( dos_name ) : assert isinstance ( dos_name , bytes ) , type ( dos_name ) if dos_name in ( b'.' , b'..' ) : return True trunk , ext = dos_splitext ( dos_name ) return ( # enforce lengths ( len ( trunk ) <= 8 and len ( ext ) <= 3 ) and # no leading or trailing spaces ( trunk == trunk . strip ( ) and ext == ext . strip ( ) ) and # enforce allowable characters ( ( set ( trunk ) | set ( ext ) ) <= ALLOWABLE_CHARS ) )