Validate that the provided grouping conforms to the provided schema. If not, raise a SchemaValidationError
(grouping, schema, full_schema=None, path=())
| 212 | |
| 213 | |
| 214 | def validate_grouping(grouping, schema, full_schema=None, path=()): |
| 215 | """ |
| 216 | Validate that the provided grouping conforms to the provided schema. |
| 217 | If not, raise a SchemaValidationError |
| 218 | """ |
| 219 | if full_schema is None: |
| 220 | full_schema = schema |
| 221 | |
| 222 | if isinstance(schema, (tuple, list)): |
| 223 | SchemaTypeValidationError.check(grouping, full_schema, path, (tuple, list)) |
| 224 | SchemaLengthValidationError.check(grouping, full_schema, path, len(schema)) |
| 225 | |
| 226 | for i, (g, s) in enumerate(zip(grouping, schema)): |
| 227 | validate_grouping(g, s, full_schema=full_schema, path=path + (i,)) |
| 228 | elif isinstance(schema, dict): |
| 229 | SchemaTypeValidationError.check(grouping, full_schema, path, dict) |
| 230 | SchemaKeysValidationError.check(grouping, full_schema, path, set(schema)) |
| 231 | for k in schema: |
| 232 | validate_grouping( |
| 233 | grouping[k], schema[k], full_schema=full_schema, path=path + (k,) |
| 234 | ) |
| 235 | else: |
| 236 | pass |
| 237 | |
| 238 | |
| 239 | def update_args_group(g, triggered): |
searching dependent graphs…