/usr/share/pyshared/openopt/kernel/check.py is in python-openopt 0.38+svn1589-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | __docformat__ = "restructuredtext en"
from numpy import array, isfinite, any, asarray
def check(p):
"""
this func is called from runProbSolver(), you don't need to call the one
"""
nErrors = 0
if p.allowedGoals is not None and p.goal is not None and p.goal not in p.allowedGoals:
# p.goal is None in EIG
p.err('goal '+ p.goal+' is not available for the '+ p.probType + ' class (at least not implemented yet)')
for fn in p._optionalData:
attr = getattr(p, fn, None)
if (attr is None or isinstance(attr, (list,tuple)) and len(attr)==0) or fn in p.solver.__optionalDataThatCanBeHandled__: continue
if fn == 'Qc' or \
(callable(attr) and getattr(p.userProvided, fn)) or \
(type(attr) in (set, dict, list, tuple) and len(attr) != 0) or \
(not callable(attr) and asarray(attr).size>0 and any(isfinite(attr))):
p.err('the solver ' + p.solver.__name__ + ' cannot handle ' + "'" + fn + "' data")
return nErrors
|