Commit | Line | Data |
---|---|---|
57071907 PP |
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 | |
6 | # a copy of this software and associated documentation files (the | |
7 | # "Software"), to deal in the Software without restriction, including | |
8 | # without limitation the rights to use, copy, modify, merge, publish, | |
9 | # distribute, sublicense, and/or sell copies of the Software, and to | |
10 | # permit persons to whom the Software is furnished to do so, subject to | |
11 | # the following conditions: | |
12 | # | |
13 | # The above copyright notice and this permission notice shall be | |
14 | # included in all copies or substantial portions of the Software. | |
15 | # | |
16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
19 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
20 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
21 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
22 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
23 | ||
24 | import barectf.config_parse as barectf_config_parse | |
2d55dc7d PP |
25 | import barectf.config as barectf_config |
26 | from barectf.typing import Count, VersionNumber | |
27 | from typing import Optional, List, TextIO | |
57071907 PP |
28 | |
29 | ||
2d55dc7d PP |
30 | def effective_configuration_file(file: TextIO, with_package_inclusion_directory: bool = True, |
31 | inclusion_directories: Optional[List[str]] = None, | |
32 | ignore_inclusion_not_found: bool = False, | |
33 | indent_space_count: Count = Count(2)) -> str: | |
57071907 PP |
34 | if inclusion_directories is None: |
35 | inclusion_directories = [] | |
36 | ||
37 | return barectf_config_parse._effective_config_file(file, with_package_inclusion_directory, | |
38 | inclusion_directories, | |
39 | ignore_inclusion_not_found, | |
40 | indent_space_count) | |
41 | ||
42 | ||
2d55dc7d PP |
43 | def configuration_from_file(file: TextIO, with_package_inclusion_directory: bool = True, |
44 | inclusion_directories: Optional[List[str]] = None, | |
45 | ignore_inclusion_not_found: bool = False) -> barectf_config.Configuration: | |
57071907 PP |
46 | if inclusion_directories is None: |
47 | inclusion_directories = [] | |
48 | ||
49 | return barectf_config_parse._from_file(file, with_package_inclusion_directory, | |
50 | inclusion_directories, ignore_inclusion_not_found) | |
51 | ||
52 | ||
2d55dc7d | 53 | def configuration_file_major_version(file: TextIO) -> VersionNumber: |
57071907 | 54 | return barectf_config_parse._config_file_major_version(file) |