Debian Codegraph @

ml_collections/config_flags/tests/mock_config.py

raw symbols SCIP
1 # Copyright 2024 The ML Collections Authors.
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 """Placeholder Config file."""
16
17 import copy
18
19 from ml_collections.config_flags.tests import spork
20
21
22 class TestConfig(object):
23 """Default Test config value."""
24
25 def __init__(self):
26 self.integer = 23
27 self.float = 2.34
28 self.string = 'james'
29 self.bool = True
30 self.dict = {
31 'integer': 1,
32 'float': 3.14,
33 'string': 'mark',
34 'bool': False,
35 'dict': {
36 'float': 5.
37 },
38 'list': [1, 2, [3]]
39 }
40 self.list = [1, 2, [3]]
41 self.tuple = (1, 2, (3,))
42 self.tuple_with_spaces = (1, 2, (3,))
43 self.enum = spork.SporkType.SPOON
44
45 @property
46 def readonly_field(self):
47 return 42
48
49 def __repr__(self):
50 return str(self.__dict__)
51
52
53 def get_config():
54
55 config = TestConfig()
56 config.object = TestConfig()
57 config.object_reference = config.object
58 config.object_copy = copy.deepcopy(config.object)
59
60 return config