Skip to content

Commit

Permalink
Add setters
Browse files Browse the repository at this point in the history
  • Loading branch information
leoetlino committed Aug 19, 2018
1 parent b0d8ed2 commit db48692
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions aamp/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def __init__(self) -> None:
def param(self, name: str):
return self.params[zlib.crc32(name.encode())]

def set_param(self, name: str, v) -> None:
"""Add or update an existing parameter."""
self.params[zlib.crc32(name.encode())] = v

def __repr__(self) -> str:
return f'ParameterObject(params={repr(self.params)})'

Expand All @@ -53,6 +57,14 @@ def object(self, name: str) -> ParameterObject:
def list(self, name: str):
return self.lists[zlib.crc32(name.encode())]

def set_object(self, name: str, pobj: ParameterObject) -> None:
"""Add or update an existing object."""
self.objects[zlib.crc32(name.encode())] = pobj

def set_list(self, name: str, plist: ParameterList) -> None:
"""Add or update an existing list."""
self.lists[zlib.crc32(name.encode())] = plist

def __repr__(self) -> str:
return f'ParameterList(objects={repr(self.objects)}, lists={repr(self.lists)})'

Expand Down

0 comments on commit db48692

Please sign in to comment.