Skip to content
Snippets Groups Projects
Commit 5e815a8b authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-378: processed review comment: added missing method fromString

parent ea1f6875
No related branches found
No related tags found
No related merge requests found
...@@ -161,6 +161,16 @@ class parameterset(PyParameterSet): ...@@ -161,6 +161,16 @@ class parameterset(PyParameterSet):
self.replace (str(k), str(v)) # k, v always type string self.replace (str(k), str(v)) # k, v always type string
@staticmethod
def fromString(parset_string):
'''Create a parset from a plain text string.
Splits the string in lines, and parses each '=' seperated key/value pair.
'''
lines = [l.strip() for l in parset_string.split('\n')]
kv_pairs = [tuple(l.split('=')) for l in lines if '=' in l]
parset_dict = dict(kv_pairs)
return parameterset(parset_dict)
def get(self, key): def get(self, key):
# type: (object) -> object # type: (object) -> object
"""Get the parametervalue object of a parameter.""" """Get the parametervalue object of a parameter."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment