AppStream.Validator¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class AppStream.Validator(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Returns:
- Return type:
Creates a new
AppStream.Validator
.
- add_override(tag, severity_override)¶
- Parameters:
tag (
str
) – the issue tag to override, e.g. “release-time-missing”severity_override (
AppStream.IssueSeverity
) – the new severity for the tag.
- Raises:
- Return type:
Override the severity of a selected tag. For most tags, the severity can not be lowered to a value that makes a validation that would otherwise fail pass (so e.g. an ERROR can not become an INFO). Some tags are explicitly allowed to have their severity lowered to enable validation of e.g. incomplete metadata during development. Increasing the severity of any tag is always allowed.
New in version 0.15.4.
- add_release_bytes(release_fname, release_metadata)¶
- Parameters:
release_fname (
str
) – File basename of the release metadata file to add.release_metadata (
GLib.Bytes
) – Data of the release metadata file.
- Raises:
- Return type:
Add release metadata explicitly from bytes.
New in version 0.16.0.
- add_release_file(release_file)¶
- Parameters:
release_file (
Gio.File
) – Release metadata file to add.- Raises:
- Return type:
Add a release metadata file to the validation process.
New in version 0.16.0.
- check_success()¶
-
Check the current registered values again and return
True
if no issues were found that would make the previously validated files fail validation.Usually you do not need to call this function explicitly, as the as_validator_validate_* functions will already return whether data was valid as return value.
- clear_release_data()¶
Clear all release information that was explicitly added to the validation process.
New in version 0.16.0.
- get_issue_files_count()¶
- Returns:
The number of files that have issues.
- Return type:
Get the number of files for which issues have been found.
New in version 0.16.0.
- get_issues()¶
- Returns:
a list of
AppStream.ValidatorIssue
instances, free with g_list_free()- Return type:
Get a list of found metadata format issues.
- get_issues_per_file()¶
- Returns:
a file to issue list mapping
- Return type:
Get a hash table of filenames mapped to lists of issues. This is useful if validation was requested for multiple files and a list of issues per-file is desired without prior explicit sorting.
New in version 0.12.8.
- get_report_yaml()¶
- Raises:
- Return type:
- get_strict()¶
-
New in version 0.15.4.
- get_tag_explanation(tag)¶
-
Get the explanatory text for a given issue tag.
- get_tag_severity(tag)¶
- Parameters:
tag (
str
) –- Returns:
- Return type:
Get the severity for a given issue tag.
- get_tags()¶
- Returns:
A string array of tags
- Return type:
[
str
]
Get an array of all tags known to the validator.
- set_allow_net(value)¶
-
If set to
True
, the validator will be allowed to connect to the internet to e.g. check URLs for validity.
- set_strict(is_strict)¶
-
Enable or disable strict mode. In strict mode, any found issue will result in a failed validation (except for issues of “pedantic” severity). Otherwise, only a “warning” or “error” will cause the validation to fail.
New in version 0.15.4.
- validate_bytes(metadata)¶
- Parameters:
metadata (
GLib.Bytes
) – XML metadata asGLib.Bytes
.- Returns:
True
if bytes validated successfully.- Return type:
Validate AppStream XML data from a byte array. Remember to run %as_validator_clear_issues if you do not want previous validation runs to affect the outcome of this validation.
New in version 0.14.0.
- validate_data(metadata)¶
- Parameters:
metadata (
str
) – XML metadata.- Returns:
True
if data validated successfully.- Return type:
Validate AppStream XML data.