(mode: T.List[T.Union[str, bool, int]])
return None
Validate the `install_mode` keyword argument.

    This is a rather odd thing, it's a scalar, or an array of 3 values in the form:
    [(str | False), (str | int | False) = False, (str | int | False) = False]
    where the second and third components are not required and default to False.
Validate the `install_mode` keyword argument.
Validate the install_mode keyword argument .
def _install_mode_validator(mode: T.List[T.Union[str, bool, int]]) -> T.Optional[str]:
    """Validate the `install_mode` keyword argument.

    This is a rather odd thing, it's a scalar, or an array of 3 values in the form:
    [(str | False), (str | int | False) = False, (str | int | False) = False]
    where the second and third components are not required and default to False.
    """
    if not mode:
        return None
    if True in mode:
        return 'components can only be permission strings, numbers, or False'
    if len(mode) > 3:
        return 'may have at most 3 elements'

    perms = mode[0]
    if not isinstance(perms, (str, bool)):
        return 'first component must be a permissions string or False'

    if isinstance(perms, str):
        if not len(perms) == 9:
            return ('permissions string must be exactly 9 characters in the form rwxr-xr-x,'
                    f' got {len(perms)}')
        for i in [0, 3, 6]:
            if perms[i] not in {'-', 'r'}:
                return f'permissions character {i+1} must be "-" or "r", not {perms[i]}'
        for i in [1, 4, 7]:
            if perms[i] not in {'-', 'w'}:
                return f'permissions character {i+1} must be "-" or "w", not {perms[i]}'
        for i in [2, 5]:
            if perms[i] not in {'-', 'x', 's', 'S'}:
                return f'permissions character {i+1} must be "-", "s", "S", or "x", not {perms[i]}'
        if perms[8] not in {'-', 'x', 't', 'T'}:
            return f'permission character 9 must be "-", "t", "T", or "x", not {perms[8]}'

        if len(mode) >= 2 and not isinstance(mode[1], (int, str, bool)):
            return 'second componenent can only be a string, number, or False'
        if len(mode) >= 3 and not isinstance(mode[2], (int, str, bool)):
            return 'third componenent can only be a string, number, or False'

    return None
def _install_mode_validator ( mode : T . List [ T . Union [ str , bool , int ] ] ) -> T . Optional [ str ] : if not mode : return None if True in mode : return 'components can only be permission strings, numbers, or False' if len ( mode ) > 3 : return 'may have at most 3 elements' perms = mode [ 0 ] if not isinstance ( perms , ( str , bool ) ) : return 'first component must be a permissions string or False' if isinstance ( perms , str ) : if not len ( perms ) == 9 : return ( 'permissions string must be exactly 9 characters in the form rwxr-xr-x,' f' got {len(perms)}' ) for i in [ 0 , 3 , 6 ] : if perms [ i ] not in { '-' , 'r' } : return f'permissions character {i+1} must be "-" or "r", not {perms[i]}' for i in [ 1 , 4 , 7 ] : if perms [ i ] not in { '-' , 'w' } : return f'permissions character {i+1} must be "-" or "w", not {perms[i]}' for i in [ 2 , 5 ] : if perms [ i ] not in { '-' , 'x' , 's' , 'S' } : return f'permissions character {i+1} must be "-", "s", "S", or "x", not {perms[i]}' if perms [ 8 ] not in { '-' , 'x' , 't' , 'T' } : return f'permission character 9 must be "-", "t", "T", or "x", not {perms[8]}' if len ( mode ) >= 2 and not isinstance ( mode [ 1 ] , ( int , str , bool ) ) : return 'second componenent can only be a string, number, or False' if len ( mode ) >= 3 and not isinstance ( mode [ 2 ] , ( int , str , bool ) ) : return 'third componenent can only be a string, number, or False' return None