barectf: update copyright years
[deliverable/barectf.git] / barectf / config.py
1 # The MIT License (MIT)
2 #
3 # Copyright (c) 2015-2020 Philippe Proulx <pproulx@efficios.com>
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 # THE SOFTWARE.
22
23 from barectf import config_parse
24
25
26 ConfigParseError = config_parse.ConfigParseError
27
28
29 class Config:
30 def __init__(self, metadata, prefix=None, options=None):
31 self._metadata = metadata
32
33 if prefix is None:
34 self._prefix = 'barectf_'
35 else:
36 self._prefix = prefix
37
38 if options is None:
39 self._options = ConfigOptions()
40 else:
41 self._options = options
42
43 @property
44 def metadata(self):
45 return self._metadata
46
47 @property
48 def prefix(self):
49 return self._prefix
50
51 @property
52 def options(self):
53 return self._options
54
55
56 class ConfigOptions:
57 def __init__(self, gen_prefix_def=False, gen_default_stream_def=False):
58 self._gen_prefix_def = False
59 self._gen_default_stream_def = False
60
61 @property
62 def gen_prefix_def(self):
63 return self._gen_prefix_def
64
65 @property
66 def gen_default_stream_def(self):
67 return self._gen_default_stream_def
68
69
70 def from_file(path, include_dirs, ignore_include_not_found, dump_config):
71 return config_parse._from_file(path, include_dirs, ignore_include_not_found,
72 dump_config)
73
74
75 # deprecated
76 from_yaml_file = from_file
This page took 0.032583 seconds and 5 git commands to generate.