augur.validate moduleļ
Validate files related to augur consumption or export.
- augur.validate.auspice_config_v2(config_json, **kwargs)ļ
- augur.validate.elide_path(path)ļ
Elide recursive
.children[N]
selectors from path after formatting withformat_path()
.Our tree JSONs are highly nested and the exact path to a node in the tree is often more noisy than useful in error messages.
- Return type:
>>> format_path(("tree", "children", 1, "children", 0, "children", 1, "children", 0, "node_attrs", "x")) '.tree.children[1].children[0].children[1].children[0].node_attrs.x' >>> elide_path(("tree", "children", 1, "children", 0, "children", 1, "children", 0, "node_attrs", "x")) '.tree.children[ā¦].node_attrs.x'
Elision is only used with more than a single level of
.children[N]
.>>> elide_path(("tree", "children", 1, "node_attrs", "x")) '.tree.children[1].node_attrs.x'
- augur.validate.export_v1(meta_json, tree_json, **kwargs)ļ
- augur.validate.export_v2(main_json, **kwargs)ļ
- augur.validate.fatal(message)ļ
- augur.validate.format_path(path)ļ
Format an iterable of path segments, which index into a JSON document, into a more human-readable string.
Intended for folks who arenāt necessarily programmers, so this doesnāt try to construct a valid JS property accessor chain or valid JSON Path selector.
- Return type:
>>> format_path(("a", "b", "c")) '.a.b.c' >>> format_path(("l", "m-n-o", "p")) ".l.'m-n-o'.p" >>> format_path(("x", "y", 42, "z")) '.x.y[42].z'
- augur.validate.get_unique_keys(list_of_dicts)ļ
Returns a set of unique keys from a list of dicts
Examples
>>> list_of_dicts = [{"key1": "val1", "key2": "val2"}, {"key1": "val1", "key3": "val3"}] >>> sorted(get_unique_keys(list_of_dicts)) ['key1', 'key2', 'key3']
- augur.validate.grouped(iterable, key)ļ
Version of
itertools.groupby()
which doesnāt require the caller to remember to sort first.
- augur.validate.load_json(path)ļ
- augur.validate.load_json_schema(path, refs=None)ļ
Load a JSON schema from the augur included set of schemas (located in augur/data)
- augur.validate.measurements(measurements_json, **kwargs)ļ
- augur.validate.measurements_collection_config(collection_config_json, **kwargs)ļ
- augur.validate.register_parser(parent_subparsers)ļ
- augur.validate.run(args)ļ
- augur.validate.validate(jsonToValidate, schema, filename)ļ
- augur.validate.validate_collection_config_fields(collection, index=None)ļ
Validates a single collectionās config field keys provided in fields, groupings, and filters are valid fields that exist in measurementsā fields.
Prints any validation errors to stderr.
- Parameters:
- Returns:
True if collectionās config is valid
- Return type:
- augur.validate.validate_collection_display_defaults(collection, index=None)ļ
Validates a single collectionās display defaults. If a default group-by field is provided, the field must be included in groupings.
Prints validation errors to stderr.
- Parameters:
- Returns:
True if collectionās display defaults are valid
- Return type:
- augur.validate.validate_json(jsonToValidate, schema, filename)ļ
- augur.validate.validate_measurements_config(measurements)ļ
Validate measurementsā config values meet expectations described in the measurements JSON schema descriptions that cannot be verified via validate_json: 1. Individual collections have valid config values 2. All collections have unique keys 3. If a default collection is provided, it matches one of the collections
Prints any validation errors to stderr.