Skip to content

getlinearParameters does not work #248

@ondras12345

Description

@ondras12345

Description

OMPython/OMPython/__init__.py

Lines 1019 to 1030 in 2f1f3b4

def getlinearParameters(self, names=None): # 5
"""
This method returns dict. The key is parameter names and value is corresponding parameter value.
If *name is None then the function will return dict which contain all parameter names as key and value as corresponding values. eg., getParameters()
Otherwise variable number of arguments can be passed as parameter name in string format separated by commas. eg., getParameters('paraName1', 'paraName2')
"""
if (names == 0):
return self.linearparameters
elif (isinstance(names, str)):
return [self.linearparameters.get(names, "NotExist")]
else:
return ([self.linearparameters.get(x, "NotExist") for x in names])

There are several issues here:

  • the name should really be getLinearParameters to be consistent with the rest of the API,
  • the names == 0 check is wrong: should be names is None to match the default value of names
  • self.linearparameters isn't set anywhere

Expected Behavior

It should either be fully implemented, or not be part of the API at all.

Additional Context

I don't actually need to use this function at this time, I just noticed the bug while cleaning up the code.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions