Flags

Details

class GLib.AsciiType(value)

Bases: GLib.Flags

ALNUM = 1
XDIGIT = 1024
PUNCT = 128
GRAPH = 16
ALPHA = 2
SPACE = 256
LOWER = 32
CNTRL = 4
UPPER = 512
PRINT = 64
DIGIT = 8
class GLib.FileTest(value)

Bases: GLib.Flags

A test to perform on a file using GLib.file_test().

IS_REGULAR = 1

True if the file is a regular file (not a directory). Note that this test will also return True if the tested file is a symlink to a regular file.

EXISTS = 16

True if the file exists. It may or may not be a regular file.

True if the file is a symlink.

IS_DIR = 4

True if the file is a directory.

IS_EXECUTABLE = 8

True if the file is executable.

class GLib.Flags(value)

Base type for all flags types

Parameters:value (int) –
class GLib.FormatSizeFlags(value)

Bases: GLib.Flags

Flags to modify the format of the string returned by GLib.format_size_full().

DEFAULT = 0

behave the same as GLib.format_size()

LONG_FORMAT = 1

include the exact number of bytes as part of the returned string. For example, “45.6 kB (45,612 bytes)”.

IEC_UNITS = 2

use IEC (base 1024) units with “KiB”-style suffixes. IEC units should only be used for reporting things with a strong “power of 2” basis, like RAM sizes or RAID stripe sizes. Network and storage sizes should be reported in the normal SI units.

BITS = 4

set the size as a quantity in bits, rather than bytes, and return units in bits. For example, ‘Mb’ rather than ‘MB’.

class GLib.HookFlagMask(value)

Bases: GLib.Flags

Flags used internally in the GLib.Hook implementation.

ACTIVE = 1

set if the hook has not been destroyed

MASK = 15

A mask covering all bits reserved for hook flags; see GLib.HOOK_FLAG_USER_SHIFT

IN_CALL = 2

set if the hook is currently being run

class GLib.IOCondition(value)

Bases: GObject.GFlags

A bitwise combination representing a condition to watch for on an event source.

IN = 1

There is data to read.

HUP = 16

Hung up (the connection has been broken, usually for pipes and sockets).

PRI = 2

There is urgent data to read.

NVAL = 32

Invalid request. The file descriptor is not open.

OUT = 4

Data can be written (without blocking).

ERR = 8

Error condition.

class GLib.IOFlags(value)

Bases: GLib.Flags

Specifies properties of a GLib.IOChannel. Some of the flags can only be read with GLib.IOChannel.get_flags(), but not changed with GLib.IOChannel.set_flags().

APPEND = 1

turns on append mode, corresponds to %O_APPEND (see the documentation of the UNIX open() syscall)

IS_SEEKABLE = 16

indicates that the io channel is seekable, i.e. that GLib.IOChannel.seek_position() can be used on it. This flag cannot be changed.

NONBLOCK = 2

turns on nonblocking mode, corresponds to %O_NONBLOCK/%O_NDELAY (see the documentation of the UNIX open() syscall)

SET_MASK = 3

the mask of the flags that the user can modify with GLib.IOChannel.set_flags()

GET_MASK = 31

the mask of the flags that are returned from GLib.IOChannel.get_flags()

MASK = 31

the mask that specifies all the valid flags.

IS_READABLE = 4

indicates that the io channel is readable. This flag cannot be changed.

IS_WRITABLE = 8

indicates that the io channel is writable. This flag cannot be changed.

IS_WRITEABLE = 8

a misspelled version of GLib.IOFlags.IS_WRITABLE that existed before the spelling was fixed in GLib 2.30. It is kept here for compatibility reasons. Deprecated since 2.30

class GLib.KeyFileFlags(value)

Bases: GLib.Flags

Flags which influence the parsing.

NONE = 0

No flags, default behaviour

KEEP_COMMENTS = 1

Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise all comments will be lost when the key file is written back.

KEEP_TRANSLATIONS = 2

Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise only the translations for the current language will be written back.

class GLib.LogLevelFlags(value)

Bases: GLib.Flags

Flags specifying the level of log messages.

It is possible to change how GLib treats messages of the various levels using GLib.log_set_handler() and GLib.log_set_fatal_mask().

LEVEL_MASK = -4

a mask including all log levels

FLAG_RECURSION = 1

internal flag

LEVEL_DEBUG = 128

log level for debug messages, see g_debug()

LEVEL_WARNING = 16

log level for warnings, see g_warning()

FLAG_FATAL = 2

internal flag

LEVEL_MESSAGE = 32

log level for messages, see g_message()

LEVEL_ERROR = 4

log level for errors, see g_error(). This level is also used for messages produced by g_assert().

LEVEL_INFO = 64

log level for informational messages, see g_info()

LEVEL_CRITICAL = 8

log level for critical warning messages, see g_critical(). This level is also used for messages produced by g_return_if_fail() and g_return_val_if_fail().

class GLib.MarkupCollectType(value)

Bases: GLib.Flags

A mixed enumerated type and flags field. You must specify one type (string, strdup, boolean, tristate). Additionally, you may optionally bitwise OR the type with the flag GLib.MarkupCollectType.OPTIONAL.

It is likely that this enum will be extended in the future to support other types.

INVALID = 0

used to terminate the list of attributes to collect

STRING = 1

collect the string pointer directly from the attribute_values[] array. Expects a parameter of type (const str **). If GLib.MarkupCollectType.OPTIONAL is specified and the attribute isn’t present then the pointer will be set to None

STRDUP = 2

as with GLib.MarkupCollectType.STRING, but expects a parameter of type (str **) and GLib.strdup()s the returned pointer. The pointer must be freed with GLib.free()

BOOLEAN = 3

expects a parameter of type (bool *) and parses the attribute value as a boolean. Sets False if the attribute isn’t present. Valid boolean values consist of (case-insensitive) “false”, “f”, “no”, “n”, “0” and “true”, “t”, “yes”, “y”, “1”

TRISTATE = 4

as with GLib.MarkupCollectType.BOOLEAN, but in the case of a missing attribute a value is set that compares equal to neither False nor True GLib.MarkupCollectType.OPTIONAL is implied

OPTIONAL = 65536

can be bitwise ORed with the other fields. If present, allows the attribute not to appear. A default value is set depending on what value type is used

class GLib.MarkupParseFlags(value)

Bases: GLib.Flags

Flags that affect the behaviour of the parser.

DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1

flag you should not use

TREAT_CDATA_AS_TEXT = 2

When this flag is set, CDATA marked sections are not passed literally to the passthrough function of the parser. Instead, the content of the section (without the </literal> and <literal>) is passed to the text function. This flag was added in GLib 2.12

PREFIX_ERROR_POSITION = 4

Normally errors caught by GMarkup itself have line/column information prefixed to them to let the caller know the location of the error. When this flag is set the location information is also prefixed to errors generated by the GLib.MarkupParser implementation functions

IGNORE_QUALIFIED = 8

Ignore (don’t report) qualified attributes and tags, along with their contents. A qualified attribute or tag is one that contains ‘:’ in its name (ie: is in another namespace).

New in version 2.40.

class GLib.OptionFlags(value)

Bases: GLib.Flags

Flags which modify individual options.

NONE = 0

No flags.

New in version 2.42.

HIDDEN = 1

The option doesn’t appear in --help output.

FILENAME = 16

For options of the GLib.OptionArg.CALLBACK kind, this flag indicates that the argument should be passed to the callback in the GLib filename encoding rather than UTF-8.

New in version 2.8.

IN_MAIN = 2

The option appears in the main section of the --help output, even if it is defined in a group.

OPTIONAL_ARG = 32

For options of the GLib.OptionArg.CALLBACK kind, this flag indicates that the argument supply is optional. If no argument is given then data of GLib.OptionParseFunc will be set to None.

New in version 2.8.

REVERSE = 4

For options of the GLib.OptionArg.NONE kind, this flag indicates that the sense of the option is reversed.

NOALIAS = 64

This flag turns off the automatic conflict resolution which prefixes long option names with groupname- if there is a conflict. This option should only be used in situations where aliasing is necessary to model some legacy commandline interface. It is not safe to use this option, unless all option groups are under your direct control.

New in version 2.8.

NO_ARG = 8

For options of the GLib.OptionArg.CALLBACK kind, this flag indicates that the callback does not take any argument (like a GLib.OptionArg.NONE option).

New in version 2.8.

class GLib.RegexCompileFlags(value)

Bases: GLib.Flags

Flags specifying compile-time options.

New in version 2.14.

CASELESS = 1

Letters in the pattern match both upper- and lowercase letters. This option can be changed within a pattern by a “(?i)” option setting.

NEWLINE_CR = 1048576

Usually any newline character or character sequence is recognized. If this option is set, the only recognized newline character is ‘\r’.

ANCHORED = 16

The pattern is forced to be “anchored”, that is, it is constrained to match only at the first matching point in the string that is being searched. This effect can also be achieved by appropriate constructs in the pattern itself such as the “^” metacharacter.

MULTILINE = 2

By default, GLib.Regex treats the strings as consisting of a single line of characters (even if it actually contains newlines). The “start of line” metacharacter (“^”) matches only at the start of the string, while the “end of line” metacharacter (“$”) matches only at the end of the string, or before a terminating newline (unless GLib.RegexCompileFlags.DOLLAR_ENDONLY is set). When GLib.RegexCompileFlags.MULTILINE is set, the “start of line” and “end of line” constructs match immediately following or immediately before any newline in the string, respectively, as well as at the very start and end. This can be changed within a pattern by a “(?m)” option setting.

RAW = 2048

Usually strings must be valid UTF-8 strings, using this flag they are considered as a raw sequence of bytes.

NEWLINE_LF = 2097152

Usually any newline character or character sequence is recognized. If this option is set, the only recognized newline character is ‘\n’.

FIRSTLINE = 262144

Limits an unanchored pattern to match before (or at) the first newline.

New in version 2.34.

NEWLINE_CRLF = 3145728

Usually any newline character or character sequence is recognized. If this option is set, the only recognized newline character sequence is ‘\r\n’.

DOLLAR_ENDONLY = 32

A dollar metacharacter (“$”) in the pattern matches only at the end of the string. Without this option, a dollar also matches immediately before the final character if it is a newline (but not before any other newlines). This option is ignored if GLib.RegexCompileFlags.MULTILINE is set.

JAVASCRIPT_COMPAT = 33554432

Changes behaviour so that it is compatible with JavaScript rather than PCRE.

New in version 2.34.

DOTALL = 4

A dot metacharacter (“.”) in the pattern matches all characters, including newlines. Without it, newlines are excluded. This option can be changed within a pattern by a (“?s”) option setting.

NO_AUTO_CAPTURE = 4096

Disables the use of numbered capturing parentheses in the pattern. Any opening parenthesis that is not followed by “?” behaves as if it were followed by “?:” but named parentheses can still be used for capturing (and they acquire numbers in the usual way).

UNGREEDY = 512

Inverts the “greediness” of the quantifiers so that they are not greedy by default, but become greedy if followed by “?”. It can also be set by a “(?U)” option setting within the pattern.

DUPNAMES = 524288

Names used to identify capturing subpatterns need not be unique. This can be helpful for certain types of pattern when it is known that only one instance of the named subpattern can ever be matched.

NEWLINE_ANYCRLF = 5242880

Usually any newline character or character sequence is recognized. If this option is set, the only recognized newline character sequences are ‘\r’, ‘\n’, and ‘\r\n’.

New in version 2.34.

EXTENDED = 8

Whitespace data characters in the pattern are totally ignored except when escaped or inside a character class. Whitespace does not include the VT character (code 11). In addition, characters between an unescaped “#” outside a character class and the next newline character, inclusive, are also ignored. This can be changed within a pattern by a “(?x)” option setting.

OPTIMIZE = 8192

Optimize the regular expression. If the pattern will be used many times, then it may be worth the effort to optimize it to improve the speed of matches.

BSR_ANYCRLF = 8388608

Usually any newline character or character sequence is recognised. If this option is set, then “\R” only recognizes the newline characters ‘\r’, ‘\n’ and ‘\r\n’.

New in version 2.34.

class GLib.RegexMatchFlags(value)

Bases: GLib.Flags

Flags specifying match-time options.

New in version 2.14.

NOTEMPTY = 1024

An empty string is not considered to be a valid match if this option is set. If there are alternatives in the pattern, they are tried. If all the alternatives match the empty string, the entire match fails. For example, if the pattern “a?b?” is applied to a string not beginning with “a” or “b”, it matches the empty string at the start of the string. With this flag set, this match is not valid, so GLib.Regex searches further into the string for occurrences of “a” or “b”.

NEWLINE_CR = 1048576

Overrides the newline definition set when creating a new GLib.Regex, setting the ‘\r’ character as line terminator.

NOTBOL = 128

Specifies that first character of the string is not the beginning of a line, so the circumflex metacharacter should not match before it. Setting this without GLib.RegexCompileFlags.MULTILINE (at compile time) causes circumflex never to match. This option affects only the behaviour of the circumflex metacharacter, it does not affect “\A”.

PARTIAL_HARD = 134217728

Turns on the partial matching feature. In contrast to to GLib.RegexMatchFlags.PARTIAL_SOFT, this stops matching as soon as a partial match is found, without continuing to search for a possible complete match. See GLib.MatchInfo.is_partial_match() for more information.

New in version 2.34.

ANCHORED = 16

The pattern is forced to be “anchored”, that is, it is constrained to match only at the first matching point in the string that is being searched. This effect can also be achieved by appropriate constructs in the pattern itself such as the “^” metacharacter.

BSR_ANY = 16777216

Overrides the newline definition for “\R” set when creating a new GLib.Regex; any Unicode newline character or character sequence are recognized as a newline by “\R”. These are ‘\r’, ‘\n’ and ‘\rn’, and the single characters U+000B LINE TABULATION, U+000C FORM FEED (FF), U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR.

New in version 2.34.

NEWLINE_LF = 2097152

Overrides the newline definition set when creating a new GLib.Regex, setting the ‘\n’ character as line terminator.

NOTEOL = 256

Specifies that the end of the subject string is not the end of a line, so the dollar metacharacter should not match it nor (except in multiline mode) a newline immediately before it. Setting this without GLib.RegexCompileFlags.MULTILINE (at compile time) causes dollar never to match. This option affects only the behaviour of the dollar metacharacter, it does not affect “\Z” or “\z”.

NOTEMPTY_ATSTART = 268435456

Like GLib.RegexMatchFlags.NOTEMPTY, but only applied to the start of the matched string. For anchored patterns this can only happen for pattern containing “\K”.

New in version 2.34.

NEWLINE_CRLF = 3145728

Overrides the newline definition set when creating a new GLib.Regex, setting the ‘\r\n’ characters sequence as line terminator.

PARTIAL = 32768

Turns on the partial matching feature, for more documentation on partial matching see GLib.MatchInfo.is_partial_match().

PARTIAL_SOFT = 32768

An alias for GLib.RegexMatchFlags.PARTIAL.

New in version 2.34.

NEWLINE_ANY = 4194304

Overrides the newline definition set when creating a new GLib.Regex, any Unicode newline sequence is recognised as a newline. These are ‘\r’, ‘\n’ and ‘\rn’, and the single characters U+000B LINE TABULATION, U+000C FORM FEED (FF), U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR.

NEWLINE_ANYCRLF = 5242880

Overrides the newline definition set when creating a new GLib.Regex; any ‘\r’, ‘\n’, or ‘\r\n’ character sequence is recognized as a newline.

New in version 2.34.

BSR_ANYCRLF = 8388608

Overrides the newline definition for “\R” set when creating a new GLib.Regex; only ‘\r’, ‘\n’, or ‘\r\n’ character sequences are recognized as a newline by “\R”.

New in version 2.34.

class GLib.SpawnFlags(value)

Bases: GLib.Flags

Flags passed to GLib.spawn_sync(), GLib.spawn_async() and GLib.spawn_async_with_pipes().

DEFAULT = 0

no flags, default behaviour

LEAVE_DESCRIPTORS_OPEN = 1

the parent’s open file descriptors will be inherited by the child; otherwise all descriptors except stdin, stdout and stderr will be closed before calling exec() in the child.

SEARCH_PATH_FROM_ENVP = 128

if argv[0] is not an abolute path, it will be looked for in the PATH from the passed child environment.

New in version 2.34.

STDERR_TO_DEV_NULL = 16

the child’s standard error will be discarded.

DO_NOT_REAP_CHILD = 2

the child will not be automatically reaped; you must use GLib.child_watch_add() yourself (or call waitpid() or handle SIGCHLD yourself), or the child will become a zombie.

CLOEXEC_PIPES = 256

create all pipes with the O_CLOEXEC flag set.

New in version 2.40.

CHILD_INHERITS_STDIN = 32

the child will inherit the parent’s standard input (by default, the child’s standard input is attached to /dev/null).

SEARCH_PATH = 4

argv[0] need not be an absolute path, it will be looked for in the user’s PATH.

FILE_AND_ARGV_ZERO = 64

the first element of argv is the file to execute, while the remaining elements are the actual argument vector to pass to the file. Normally GLib.spawn_async_with_pipes() uses argv[0] as the file to execute, and passes all of argv to the child.

STDOUT_TO_DEV_NULL = 8

the child’s standard output will be discarded, instead of going to the same location as the parent’s standard output.

class GLib.TestSubprocessFlags(value)

Bases: GLib.Flags

Flags to pass to GLib.test_trap_subprocess() to control input and output.

Note that in contrast with GLib.test_trap_fork(), the default is to not show stdout and stderr.

STDIN = 1

If this flag is given, the child process will inherit the parent’s stdin. Otherwise, the child’s stdin is redirected to /dev/null.

STDOUT = 2

If this flag is given, the child process will inherit the parent’s stdout. Otherwise, the child’s stdout will not be visible, but it will be captured to allow later tests with g_test_trap_assert_stdout().

STDERR = 4

If this flag is given, the child process will inherit the parent’s stderr. Otherwise, the child’s stderr will not be visible, but it will be captured to allow later tests with g_test_trap_assert_stderr().

class GLib.TestTrapFlags(value)

Bases: GLib.Flags

Test traps are guards around forked tests. These flags determine what traps to set.

Deprecated since version ???: GLib.TestTrapFlags is used only with GLib.test_trap_fork(), which is deprecated. GLib.test_trap_subprocess() uses GLib.TestSubprocessFlags.

SILENCE_STDOUT = 128

Redirect stdout of the test child to /dev/null so it cannot be observed on the console during test runs. The actual output is still captured though to allow later tests with g_test_trap_assert_stdout().

SILENCE_STDERR = 256

Redirect stderr of the test child to /dev/null so it cannot be observed on the console during test runs. The actual output is still captured though to allow later tests with g_test_trap_assert_stderr().

INHERIT_STDIN = 512

If this flag is given, stdin of the child process is shared with stdin of its parent process. It is redirected to /dev/null otherwise.

class GLib.TraverseFlags(value)

Bases: GLib.Flags

Specifies which nodes are visited during several of the tree functions, including g_node_traverse() and g_node_find().

LEAFS = 1

identical to GLib.TraverseFlags.LEAVES.

LEAVES = 1

only leaf nodes should be visited. This name has been introduced in 2.6, for older version use GLib.TraverseFlags.LEAFS.

NON_LEAFS = 2

identical to GLib.TraverseFlags.NON_LEAVES.

NON_LEAVES = 2

only non-leaf nodes should be visited. This name has been introduced in 2.6, for older version use GLib.TraverseFlags.NON_LEAFS.

ALL = 3

all nodes should be visited.

MASK = 3

a mask of all traverse flags.