Runs parameter checks This includes a determination that the value is equal to or greater than zero, and a check that all required keywords for a given
(self, target_function, **kwargs)
| 83 | raise FairException('"{}" must have "{}" value between zero and one.'.format(target, key)) |
| 84 | |
| 85 | def _check_parameters(self, target_function, **kwargs): |
| 86 | """Runs parameter checks |
| 87 | |
| 88 | This includes a determination that the value is equal to or |
| 89 | greater than zero, and a check that all required keywords for a |
| 90 | given |
| 91 | |
| 92 | """ |
| 93 | # Ensure all arguments are =< 0 where relevant |
| 94 | for keyword, value in kwargs.items(): |
| 95 | # Two conditions |
| 96 | value_is_less_than_zero = value < 0 |
| 97 | keyword_is_relevant = keyword in ['mean', 'constant', 'low', 'mode', 'high'] |
| 98 | # Test conditions |
| 99 | if keyword_is_relevant and value_is_less_than_zero: |
| 100 | raise FairException('"{}" is less than zero.'.format(keyword)) |
| 101 | # Check that all required keywords are provided |
| 102 | required_keywords = self._required_keywords[target_function] |
| 103 | for required_keyword in required_keywords: |
| 104 | if required_keyword in kwargs.keys(): |
| 105 | pass |
| 106 | else: |
| 107 | raise FairException('"{}" is missing "{}".'.format(str(target_function), required_keyword)) |
| 108 | |
| 109 | def generate(self, target, count, **kwargs): |
| 110 | """Executes request, records parameters, and return random values |