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:
  • message (str)

  • validator (str)

  • path (Iterable[str | int])

  • cause (Exception | None)

  • validator_value (Any)

  • instance (Any)

  • schema (Mapping[str, Any] | bool)

  • schema_path (Iterable[str | int])

  • parent (_Error | None)

  • type_checker (_types.TypeChecker)

Return type:

None

json_pointer: str#
flexget.config_schema._inline_refs(schema, definition_path, defs)[source]#
Parameters:
Return type:

dict[str, Any] | bool | list

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.

Parameters:
  • identifier (str)

  • definition_path (str)

  • defs (dict)

Return type:

str

flexget.config_schema.deep_in(path, dictionary)[source]#
Parameters:
Return type:

bool

flexget.config_schema.deep_set(path, dictionary, value)[source]#
Parameters:
Return type:

None

flexget.config_schema.export_schema(manager, namespace)[source]#
flexget.config_schema.get_schema()[source]#
Return type:

dict[str, Any] | bool

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.

Parameters:

schema (dict[str, Any] | bool)

Return type:

dict[str, Any] | bool

flexget.config_schema.is_episode_identifier(instance)[source]#
Return type:

bool

flexget.config_schema.is_episode_or_season_id(instance)[source]#
flexget.config_schema.is_file(instance)[source]#
Return type:

bool

flexget.config_schema.is_interval(interval_string)[source]#
Return type:

bool

flexget.config_schema.is_json(instance)[source]#
Return type:

bool

flexget.config_schema.is_path(instance)[source]#
Return type:

bool

flexget.config_schema.is_percent(percent_string)[source]#
Return type:

bool

flexget.config_schema.is_quality(instance)[source]#
flexget.config_schema.is_quality_req(instance)[source]#
flexget.config_schema.is_regex(instance)[source]#
Return type:

bool | Pattern

flexget.config_schema.is_size(size_string)[source]#
Return type:

bool

flexget.config_schema.is_time(time_string)[source]#
Return type:

bool

flexget.config_schema.is_url(instance)[source]#
Return type:

None | bool | Match

flexget.config_schema.is_valid_template(instance)[source]#
Return type:

bool

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.

Parameters:
Return type:

dict[str, Any] | bool

flexget.config_schema.parse_interval(interval_string)[source]#

Take an interval string from the config and turn it into a datetime.timedelta object.

Parameters:

interval_string (str)

Return type:

timedelta

flexget.config_schema.parse_percent(percent_input)[source]#

Take a percent string from the config and turn it into a float.

Parameters:

percent_input (str)

Return type:

float

flexget.config_schema.parse_size(size_input, si=False)[source]#

Take a size string from the config and turn it into int(bytes).

Parameters:
Return type:

int

flexget.config_schema.parse_time(time_string)[source]#

Parse a time string from the config into a datetime.time object.

Parameters:

time_string (str)

Return type:

time

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.

Returns:

A list with jsonschema.ValidationError if any

Parameters:
Return type:

list[ConfigValidationError]

flexget.config_schema.register_config_key(key, schema, required=False)[source]#

Register a valid root level key for the config.

Parameters:
  • key (string) – Name of the root level key being registered.

  • schema (dict) – Schema for the key.

  • required (bool) – Specify whether this is a mandatory key.

flexget.config_schema.register_parser_arguments()[source]#
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.

Parameters:

uri (str)

Return type:

dict[str, Any] | bool

flexget.config_schema.retrieve_resource(uri)[source]#
Parameters:

uri (str)

Return type:

Resource

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.ValidationError error.

Parameters:

error (ValidationError)

Return type:

None

flexget.config_schema.validate_any_of(validator, any_of, instance, schema)[source]#
flexget.config_schema.validate_deprecated(validator, deprecated, instance, schema)[source]#
flexget.config_schema.validate_deprecation_message(validator, message, instance, schema)[source]#

Not really a validator, just warns if deprecated section of config is being used.

flexget.config_schema.validate_one_of(validator, one_of, instance, schema)[source]#
flexget.config_schema.validate_properties_w_defaults(validator, properties, instance, schema)[source]#