init
This commit is contained in:
commit
30a9eef102
2999 changed files with 1898721 additions and 0 deletions
27
optifik/utils.py
Normal file
27
optifik/utils.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
class OptimizeResult(dict):
|
||||
""" Represents the optimization result.
|
||||
|
||||
Notes
|
||||
-----
|
||||
This class has been copied from scipy.optimize
|
||||
|
||||
"""
|
||||
def __getattr__(self, name):
|
||||
try:
|
||||
return self[name]
|
||||
except KeyError:
|
||||
raise AttributeError(name)
|
||||
|
||||
__setattr__ = dict.__setitem__
|
||||
__delattr__ = dict.__delitem__
|
||||
|
||||
def __repr__(self):
|
||||
if self.keys():
|
||||
m = max(map(len, list(self.keys()))) + 1
|
||||
return '\n'.join([k.rjust(m) + ': ' + repr(v)
|
||||
for k, v in sorted(self.items())])
|
||||
else:
|
||||
return self.__class__.__name__ + "()"
|
||||
|
||||
def __dir__(self):
|
||||
return list(self.keys())
|
Loading…
Add table
Add a link
Reference in a new issue