snakeoil.osutils.native_readdir module

Wrapper for readdir which grabs file type from d_type.

snakeoil.osutils.native_readdir.listdir_dirs(path, followSymlinks=True)[source]

Return a list of all subdirectories within a directory

Parameters:
  • path – directory to scan

  • followSymlinks – this controls if symlinks are resolved. If True and the symlink resolves to a directory, it is returned, else if False it isn’t returned.

Returns:

list of directories within path

snakeoil.osutils.native_readdir.listdir_files(path, followSymlinks=True)[source]

Return a list of all files within a directory

Parameters:
  • path – directory to scan

  • followSymlinks – this controls if symlinks are resolved. If True and the symlink resolves to a file, it is returned, else if False it isn’t returned.

Returns:

list of files within path

snakeoil.osutils.native_readdir.readdir(path)[source]

Given a directory, return a list of (filename, filetype)

see d_type_mappings for the translation used

Parameters:

path – path of a directory to scan

Returns:

list of (filename, filetype)

snakeoil.osutils.native_readdir.stat_swallow_enoent(path, check, default=False, stat=<built-in function stat>)[source]