Coverage for /Users/sebastiana/Documents/Sugarpills/confidence/spotify_confidence/options.py: 79%

1# Copyright 2017-2020 Spotify AB

2#

3# Licensed under the Apache License, Version 2.0 (the "License");

4# you may not use this file except in compliance with the License.

5# You may obtain a copy of the License at

6#

7# http://www.apache.org/licenses/LICENSE-2.0

8#

9# Unless required by applicable law or agreed to in writing, software

10# distributed under the License is distributed on an "AS IS" BASIS,

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

12# See the License for the specific language governing permissions and

13# limitations under the License.

14

15 from collections import OrderedDict

16

17

18 class ConfidenceOptions(object):

19 def __init__(self):

20 self._options = OrderedDict(

21 {

22 "randomization_seed": OptionValue(None),

23 }

24 )

25

26 def get_option(self, option_name):

27 """Return the value of the given option"""

28 return self._options[option_name].value

29

30 def set_option(self, option_name, option_value):

31 """Set the default value of the specified option.

32

33 Available options:

34 'randomization_seed': (int)

35 Seed to use for methods that involve monte carlo sampling.

36 """

37 self._options[option_name].value = option_value

38

39

40 class OptionValue(object):

41 def __init__(self, value):

42 self.value = value

43

44 def __repr__(self):

45 return "%s" % self.value

46

47

48 options = ConfidenceOptions()