(abs_path, stat_res=None)
return False
Is a file hidden?

    This only checks the file itself; it should be called in combination with
    checking the directory containing the file.

    Use is_hidden() instead to check the file and its parent directories.

    Parameters
    ----------
    abs_path : unicode
        The absolute path to check.
    stat_res : os.stat_result, optional
        The result of calling stat() on abs_path. If not passed, this function
        will call stat() internally.
Is a file hidden?
Is a file hidden?
def is_file_hidden_posix(abs_path, stat_res=None):
    """Is a file hidden?

    This only checks the file itself; it should be called in combination with
    checking the directory containing the file.

    Use is_hidden() instead to check the file and its parent directories.

    Parameters
    ----------
    abs_path : unicode
        The absolute path to check.
    stat_res : os.stat_result, optional
        The result of calling stat() on abs_path. If not passed, this function
        will call stat() internally.
    """
    if os.path.basename(abs_path).startswith('.'):
        return True

    if stat_res is None or stat.S_ISLNK(stat_res.st_mode):
        try:
            stat_res = os.stat(abs_path)
        except OSError as e:
            if e.errno == errno.ENOENT:
                return False
            raise

    # check that dirs can be listed
    if stat.S_ISDIR(stat_res.st_mode):
        # use x-access, not actual listing, in case of slow/large listings
        if not os.access(abs_path, os.X_OK | os.R_OK):
            return True

    # check UF_HIDDEN
    if getattr(stat_res, 'st_flags', 0) & UF_HIDDEN:
        return True

    return False
def is_file_hidden_posix ( abs_path , stat_res = None ) : if os . path . basename ( abs_path ) . startswith ( '.' ) : return True if stat_res is None or stat . S_ISLNK ( stat_res . st_mode ) : try : stat_res = os . stat ( abs_path ) except OSError as e : if e . errno == errno . ENOENT : return False raise # check that dirs can be listed if stat . S_ISDIR ( stat_res . st_mode ) : # use x-access, not actual listing, in case of slow/large listings if not os . access ( abs_path , os . X_OK | os . R_OK ) : return True # check UF_HIDDEN if getattr ( stat_res , 'st_flags' , 0 ) & UF_HIDDEN : return True return False