Gio.FileAttributeMatcher¶
Fields¶
None
Methods¶
| class | new(attributes) | 
| enumerate_namespace(ns) | |
| enumerate_next() | |
| matches(attribute) | |
| matches_only(attribute) | |
| ref() | |
| subtract(subtract) | |
| to_string() | |
| unref() | 
Details¶
- 
class Gio.FileAttributeMatcher¶
- Determines if a string matches a file attribute. - 
classmethod new(attributes)[source]¶
- Parameters: - attributes ( - str) – an attribute string to match.- Returns: - a - Gio.FileAttributeMatcher- Return type: - Gio.FileAttributeMatcher- Creates a new file attribute matcher, which matches attributes against a given string. - Gio.FileAttributeMatchersare reference counted structures, and are created with a reference count of 1. If the number of references falls to 0, the- Gio.FileAttributeMatcheris automatically destroyed.- The attributes string should be formatted with specific keys separated from namespaces with a double colon. Several “namespace::key” strings may be concatenated with a single comma (e.g. “standard::type,standard::is-hidden”). The wildcard “*” may be used to match all keys and namespaces, or “namespace::*” will match all keys in a given namespace. - Examples of file attribute matcher strings and results
 - "*": matches all attributes.
- "standard::is-hidden": matches only the key is-hidden in the standard namespace.
- "standard::type,unix::*": matches the type key in the standard namespace and all keys in the unix namespace.
 
 - 
enumerate_namespace(ns)[source]¶
- Parameters: - ns ( - str) – a string containing a file attribute namespace.- Returns: - Trueif the matcher matches all of the entries in the given ns,- Falseotherwise.- Return type: - bool- Checks if the matcher will match all of the keys in a given namespace. This will always return - Trueif a wildcard character is in use (e.g. if matcher was created with “standard::*” and ns is “standard”, or if matcher was created using “*” and namespace is anything.)- TODO: this is awkwardly worded. 
 - 
enumerate_next()[source]¶
- Returns: - a string containing the next attribute or, - Noneif no more attribute exist.- Return type: - stror- None- Gets the next matched attribute from a - Gio.FileAttributeMatcher.
 - 
matches(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - Trueif attribute matches self.- Falseotherwise.- Return type: - bool- Checks if an attribute will be matched by an attribute matcher. If the matcher was created with the “*” matching string, this function will always return - True.
 - 
matches_only(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - Trueif the matcher only matches attribute.- Falseotherwise.- Return type: - bool- Checks if a attribute matcher only matches a given attribute. Always returns - Falseif “*” was used when creating the matcher.
 - 
ref()[source]¶
- Returns: - a - Gio.FileAttributeMatcher.- Return type: - Gio.FileAttributeMatcher- References a file attribute matcher. 
 - 
subtract(subtract)[source]¶
- Parameters: - subtract ( - Gio.FileAttributeMatcher) – The matcher to subtract- Returns: - A file attribute matcher matching all attributes of self that are not matched by subtract - Return type: - Gio.FileAttributeMatcher- Subtracts all attributes of subtract from self and returns a matcher that supports those attributes. - Note that currently it is not possible to remove a single attribute when the self matches the whole namespace - or remove a namespace or attribute when the matcher matches everything. This is a limitation of the current implementation, but may be fixed in the future. 
 - 
to_string()[source]¶
- Returns: - a string describing the attributes the matcher matches against or - Noneif self was- None.- Return type: - str- Prints what the matcher is matching against. The format will be equal to the format passed to - Gio.FileAttributeMatcher.new(). The output however, might not be identical, as the matcher may decide to use a different order or omit needless parts.- New in version 2.32. 
 
- 
classmethod