Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config-system] Validator rewrite: Use jsonschema #576

Merged
merged 17 commits into from
Jun 2, 2016
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
1f22f03
Add a JSON schema for the convergence_strategy property.
ftsamis Apr 26, 2016
a072b78
Add an example json schema for the quantity_range_sampled type.
ftsamis May 7, 2016
b6467b5
Add the complete JSON schema equivalent to tardis_config_definition.yml
ftsamis May 16, 2016
1ae9996
Split the config schema to multiple sub-schemas.
ftsamis May 20, 2016
8ee81b4
Allow integers in exponential/decimal format. Disallow additional pro…
ftsamis May 24, 2016
1573fe4
Allow additional properties in model.abundances.uniform, so it is pos…
ftsamis May 24, 2016
58c9258
Add exponent as a property for exponential density (adapt #571).
ftsamis May 24, 2016
0519f4f
Add default empty values to non-mandatory objects
ftsamis May 31, 2016
1a1520b
setup.py: Add tardis/io/schemas in package data.
ftsamis May 31, 2016
da2d387
io/tests/test_config_reader.py: Remove test_custom_yaml_loader
ftsamis May 31, 2016
cd812e5
io/tests/test_configuration_namespace.py: Remove the unused config_va…
ftsamis May 31, 2016
2c8fc4c
io/config_validator.py: Rewrite the entire module to use jsonschema
ftsamis May 31, 2016
f2abb1c
Convert no_of_packets and last_no_of_packets to int
ftsamis Jun 1, 2016
2cd9832
Use ducktyping instead of checking if spectrum_list is a dict.
ftsamis Jun 1, 2016
001abe7
Make validate_dict/validate_yaml have a default argument value for sc…
ftsamis Jun 2, 2016
d59c357
Add 'damped' as the default value for convergence_strategy in the sch…
ftsamis Jun 2, 2016
60d1d1d
Remove 'tardis/data/tardis_config_definition.yml' and all the referen…
ftsamis Jun 2, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tardis/io/config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ def parse_spectrum_list2dict(spectrum_list):
"""
Parse the spectrum list [start, stop, num] to a list
"""
if isinstance(spectrum_list, dict):
if 'start' in spectrum_list and 'stop' in spectrum_list \
and 'num' in spectrum_list:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks complicated, why not try/except?

spectrum_list = [spectrum_list['start'], spectrum_list['stop'],
spectrum_list['num']]
if spectrum_list[0].unit.physical_type != 'length' and \
Expand Down