DeferredImportIndicator

(class from pyomo.common.dependencies)

class pyomo.common.dependencies.DeferredImportIndicator(name, error_message, catch_exceptions, minimum_version, original_globals, callback, importer, deferred_submodules)[source]

Bases: _DeferredImportIndicatorBase

Placeholder indicating if an import was successful.

This object serves as a placeholder for the Boolean indicator if a deferred module import was successful. Casting this instance to bool will cause the import to be attempted. The actual import logic is here and not in the DeferredImportModule to reduce the number of attributes on the DeferredImportModule.

DeferredImportIndicator supports limited logical expressions using the & (and) and | (or) binary operators. Creating these expressions does not trigger the import of the corresponding DeferredImportModule instances, although casting the resulting expression to bool() will trigger any relevant imports.

__init__(name, error_message, catch_exceptions, minimum_version, original_globals, callback, importer, deferred_submodules)[source]

Methods

__init__(name, error_message, ...)

replace_self_in_globals(_globals)

resolve()

Member Documentation