linkcheck.fileutil

File and path utilities.

Functions

get_mtime(filename)

Return modification time of filename or zero on errors.

get_size(filename)

Return file size in Bytes, or -1 on error.

get_temp_file([mode])

Return tuple (open file object, filename) pointing to a temporary file.

has_module(name[, without_error])

Test if given module can be imported.

is_accessable_by_others(filename)

Check if file is group or world accessible.

is_readable(filename)

Check if file is readable.

is_tty(fp)

Check if is a file object pointing to a TTY.

is_valid_config_source(filename)

Check if the file is a valid config file.

is_writable_by_others(filename)

Check if file or directory is world writable.

path_safe(path)

Ensure path string is compatible with the platform file system encoding.

linkcheck.fileutil.get_mtime(filename)[source]

Return modification time of filename or zero on errors.

linkcheck.fileutil.get_size(filename)[source]

Return file size in Bytes, or -1 on error.

linkcheck.fileutil.get_temp_file(mode='r', **kwargs)[source]

Return tuple (open file object, filename) pointing to a temporary file.

linkcheck.fileutil.has_module(name, without_error=True)[source]

Test if given module can be imported. :param without_error: True if module must not throw any errors when importing :return: flag if import is successful :rtype: bool

linkcheck.fileutil.is_accessable_by_others(filename)[source]

Check if file is group or world accessible.

linkcheck.fileutil.is_readable(filename)[source]

Check if file is readable.

linkcheck.fileutil.is_tty(fp)[source]

Check if is a file object pointing to a TTY.

linkcheck.fileutil.is_valid_config_source(filename)[source]

Check if the file is a valid config file.

linkcheck.fileutil.is_writable_by_others(filename)[source]

Check if file or directory is world writable.

linkcheck.fileutil.path_safe(path)[source]

Ensure path string is compatible with the platform file system encoding.