Skip to content

Commit

Permalink
reconfigure: Add 'getValue()'
Browse files Browse the repository at this point in the history
  • Loading branch information
jara001 committed Apr 9, 2024
1 parent a33a2be commit 83769c7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Unreleased
### Added
- `reconfigure`
- `ParameterServer.getValue()` to obtain the parameter value.

## 0.10.3 - 2024-04-09
### Added
- Before building the project, all uncommitted changes are stashed.
Expand Down
24 changes: 24 additions & 0 deletions autopsy/reconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,30 @@ def __contains__(self, name):
return name in self._parameters


def getValue(self, name):
"""Obtain a value of parameter 'name'.
Arguments:
name -- name of the parameter, str
Returns:
value -- value of the parameter, any
Raises:
ValueError -- when parameter with name 'name' does not exist
Note: This serves as a compatibility layer with other versions
of parameter handling classes. All parameters can be still accessed
using the dot notation.
"""
if not self.__contains__(name):
raise ValueError(
"Parameter with name '%s' does not exist." % name
)

return self._parameters[name].value


def link(self, param1, param2):
"""Links two constrained parameters together so one cannot be more then the other.
Expand Down

0 comments on commit 83769c7

Please sign in to comment.