linkcheck.loader

Functions to load plugin modules.

Example usage:

modules = loader.get_package_modules('plugins')
plugins = loader.get_plugins(modules, PluginClass)

Functions

check_writable_by_others(filename)

Check if file is writable by others on POSIX systems.

get_folder_modules(folder, parentpackage)

get_importable_files(folder)

Find all module files in the given folder that end with '.py' and don't start with an underscore.

get_module_plugins(module, classes)

Return all subclasses of a class in the module.

get_package_modules(packagename, packagepath)

Find all valid modules in the given package which must be a folder in the same directory as this loader.py module.

get_plugins(modules, classes)

Find all given (sub-)classes in all modules.

linkcheck.loader.check_writable_by_others(filename)[source]

Check if file is writable by others on POSIX systems. On non-POSIX systems the check is ignored.

linkcheck.loader.get_folder_modules(folder, parentpackage)[source]

.

linkcheck.loader.get_importable_files(folder)[source]

Find all module files in the given folder that end with ‘.py’ and don’t start with an underscore.

Returns:

module names

Return type:

iterator of string

linkcheck.loader.get_module_plugins(module, classes)[source]

Return all subclasses of a class in the module. If the module defines __all__, only those entries will be searched, otherwise all objects not starting with ‘_’ will be searched.

linkcheck.loader.get_package_modules(packagename, packagepath)[source]

Find all valid modules in the given package which must be a folder in the same directory as this loader.py module. A valid module has a .py extension, and is importable.

Returns:

all loaded valid modules

Return type:

iterator of module

linkcheck.loader.get_plugins(modules, classes)[source]

Find all given (sub-)classes in all modules.

Parameters:

modules (iterator of modules) – the modules to search

Returns:

found classes

Return type:

iterator of class objects