flexget.config_schema module#
- exception flexget.config_schema.ConfigError[source]#
Bases:
ValueError- errors: list[ConfigValidationError]#
- exception flexget.config_schema.ConfigValidationError(message, validator=<unset>, path=(), cause=None, context=(), validator_value=<unset>, instance=<unset>, schema=<unset>, schema_path=(), parent=None, type_checker=<unset>)[source]#
Bases:
ValidationError- Parameters:
- Return type:
None
- flexget.config_schema._rewrite_ref(identifier, definition_path, defs)[source]#
Rewrite all arbitrary refs to be real urls servable by this endpoint.
The refs in the schemas are arbitrary identifiers, and cannot be used as-is as real network locations.
- flexget.config_schema.inline_refs(schema)[source]#
Include all $refs to subschemas in the $defs section of the schema, and rewrite the $refs to point to the right place.
- flexget.config_schema.one_or_more(schema, unique_items=False)[source]#
Construct a schema that validates items matching schema or an array containing items matching schema.
- flexget.config_schema.parse_interval(interval_string)[source]#
Take an interval string from the config and turn it into a
datetime.timedeltaobject.
- flexget.config_schema.parse_percent(percent_input)[source]#
Take a percent string from the config and turn it into a float.
- flexget.config_schema.parse_size(size_input, si=False)[source]#
Take a size string from the config and turn it into int(bytes).
- flexget.config_schema.parse_time(time_string)[source]#
Parse a time string from the config into a
datetime.timeobject.
- flexget.config_schema.process_config(config, schema=None, set_defaults=True)[source]#
Validate the config, and set defaults within it if set_defaults is set.
If schema is not given, uses the root config schema.
- flexget.config_schema.register_config_key(key, schema, required=False)[source]#
Register a valid root level key for the config.
- flexget.config_schema.register_schema(path, schema)[source]#
Register schema to be available at path for $refs.
- Parameters:
path (str) – Path to make schema available
schema (JsonSchema | Callable[..., JsonSchema]) – The schema, or function which returns the schema
- flexget.config_schema.resolve_ref(uri)[source]#
Find and return a schema pointed to by uri that has been registered in the register_schema function.
- flexget.config_schema.select_child_errors(validator, errors)[source]#
Look through subschema errors.
If any subschema is determined to be the intended one, (based on ‘type’ keyword errors) error from its branch will be released instead of the parent error.
- flexget.config_schema.set_error_message(error)[source]#
Create user facing error message from a
jsonschema.ValidationErrorerror.- Parameters:
error (ValidationError)
- Return type:
None