Source code for schrodinger.application.bioluminate.validate_imported_modules
"""
The module will check that the psp module is loaded
Copyright Schrodinger, LLC. All rights reserved.
"""
import inspect
try:
from schrodinger.maestro import maestro
except:
maestro = None
ERROR_MSG = "Prime is not installed. This is required for the panel."
[docs]def check_module(object_list_to_inspect,
suppress_error_msg=False,
msg=ERROR_MSG):
"""
If the user wants to generate the message they can by suppressing
generic error message here, otherwise by default a message is
generated.
:param object_list_to_inspect: A list of objects which will be passed in
to be inspected.
:type object_list_to_inspect: list of objects
:param suppress_error: If True no message is printed, else print it.
:type suppress_error: bool
:param msg: The error message to be displayed to the user
:type msg: str
:return: Will return true if all objects in the list are modules
:rtype: bool
"""
for object_to_inspect in object_list_to_inspect:
if not inspect.ismodule(object_to_inspect):
if not suppress_error_msg:
if maestro:
maestro.warning(msg)
else:
print(msg)
return False
return True