def access(path, mode, user=None):
    """
    Perform the equivalent of :func:`os.access` on ``path``.
    """
    scheme = parse(path)[0]
    if scheme == 'file' or hdfs_fs.default_is_local():
        return os.access(path, mode)
    if user is None:
        user = common.DEFAULT_USER
    st = stat(path)
    if st.st_uid == user:
        mode <<= 6
    else:
        try:
            groups = common.get_groups(user)
        except KeyError:
            # user isn't recognized on the system.  No group
            # information available
            groups = []
        if st.st_gid in groups:
            mode <<= 3
    return (st.st_mode & mode) == mode
def access ( path , mode , user = None ) : scheme = parse ( path ) [ 0 ] if scheme == 'file' or hdfs_fs . default_is_local ( ) : return os . access ( path , mode ) if user is None : user = common . DEFAULT_USER st = stat ( path ) if st . st_uid == user : mode <<= 6 else : try : groups = common . get_groups ( user ) except KeyError : groups = [ ] if st . st_gid in groups : mode <<= 3 return ( st . st_mode & mode ) == mode
Perform the equivalent of :func:`os.access` on ``path``.