Coverage for /Users/sebastiana/Documents/Sugarpills/confidence/spotify_confidence/options.py: 86%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
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.
15from collections import OrderedDict
18class ConfidenceOptions(object):
19 def __init__(self):
20 self._options = OrderedDict(
21 {
22 "randomization_seed": OptionValue(None),
23 }
24 )
26 def get_option(self, option_name):
27 """Return the value of the given option"""
28 return self._options[option_name].value
30 def set_option(self, option_name, option_value):
31 """Set the default value of the specified option.
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
40class OptionValue(object):
41 def __init__(self, value):
42 self.value = value
44 def __repr__(self):
45 return "%s" % self.value
48options = ConfidenceOptions()