| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 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 |