-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
481,588 additions
and
78,781 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,230 @@ | ||
from typing import Any | ||
from typing import Callable | ||
from typing import Literal | ||
from typing import Optional | ||
from typing import Sequence | ||
from typing import Tuple | ||
from typing import Type | ||
from typing import TypeVar | ||
from typing import Any, Callable, Literal, Optional, Tuple, Type, TypeVar, Sequence | ||
|
||
try: | ||
from warnings import deprecated | ||
except ImportError: | ||
from typing_extensions import deprecated | ||
|
||
from gi.repository import GObject | ||
|
||
_lock = ... # FIXME Constant | ||
_namespace: str = "GModule" | ||
_version: str = "2.0" | ||
|
||
def module_build_path(directory: Optional[str], module_name: str) -> str: ... | ||
def module_error() -> str: ... | ||
@deprecated( | ||
"Use g_module_open() instead with @module_name as the basename of the file_name argument. See %G_MODULE_SUFFIX for why." | ||
) | ||
def module_build_path(directory: Optional[str], module_name: str) -> str: | ||
""" | ||
A portable way to build the filename of a module. The platform-specific | ||
prefix and suffix are added to the filename, if needed, and the result | ||
is added to the directory, using the correct separator character. | ||
The directory should specify the directory where the module can be found. | ||
It can be %NULL or an empty string to indicate that the module is in a | ||
standard platform-specific directory, though this is not recommended | ||
since the wrong module may be found. | ||
For example, calling g_module_build_path() on a Linux system with a | ||
@directory of `/lib` and a @module_name of \"mylibrary\" will return | ||
`/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the | ||
directory it will return `\Windows\mylibrary.dll`. | ||
Parameters: | ||
directory: the directory where the module is. This can be | ||
%NULL or the empty string to indicate that the standard platform-specific | ||
directories will be used, though that is not recommended | ||
module_name: the name of the module | ||
Returns: | ||
str: the complete path of the module, including the standard library | ||
prefix and suffix. This should be freed when no longer needed | ||
""" | ||
... | ||
|
||
def module_error() -> str: | ||
""" | ||
Gets a string describing the last module error. | ||
Parameters: | ||
Returns: | ||
str: a string describing the last module error | ||
""" | ||
... | ||
|
||
def module_error_quark() -> int: ... | ||
def module_supported() -> bool: ... | ||
def module_supported() -> bool: | ||
""" | ||
Checks if modules are supported on the current platform. | ||
Parameters: | ||
Returns: | ||
bool: %TRUE if modules are supported | ||
""" | ||
... | ||
|
||
class Module(GObject.GPointer): | ||
""" | ||
The #GModule struct is an opaque data structure to represent a | ||
[dynamically-loaded module][glib-Dynamic-Loading-of-Modules]. | ||
It should only be accessed via the following functions. | ||
""" | ||
|
||
class Props(GObject.GPointer.Props): ... | ||
|
||
@deprecated( | ||
"Use g_module_open() instead with @module_name as the basename of the file_name argument. See %G_MODULE_SUFFIX for why." | ||
) | ||
@staticmethod | ||
def build_path(directory: Optional[str], module_name: str) -> str: ... | ||
def close(self) -> bool: ... | ||
def build_path(directory: Optional[str], module_name: str) -> str: | ||
""" | ||
A portable way to build the filename of a module. The platform-specific | ||
prefix and suffix are added to the filename, if needed, and the result | ||
is added to the directory, using the correct separator character. | ||
The directory should specify the directory where the module can be found. | ||
It can be %NULL or an empty string to indicate that the module is in a | ||
standard platform-specific directory, though this is not recommended | ||
since the wrong module may be found. | ||
For example, calling g_module_build_path() on a Linux system with a | ||
@directory of `/lib` and a @module_name of \"mylibrary\" will return | ||
`/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the | ||
directory it will return `\Windows\mylibrary.dll`. | ||
Parameters: | ||
directory: the directory where the module is. This can be | ||
%NULL or the empty string to indicate that the standard platform-specific | ||
directories will be used, though that is not recommended | ||
module_name: the name of the module | ||
Returns: | ||
str: the complete path of the module, including the standard library | ||
prefix and suffix. This should be freed when no longer needed | ||
""" | ||
... | ||
def close(self) -> bool: | ||
""" | ||
Closes a module. | ||
Parameters: | ||
Returns: | ||
bool: %TRUE on success | ||
""" | ||
... | ||
@staticmethod | ||
def error() -> str: ... | ||
def error() -> str: | ||
""" | ||
Gets a string describing the last module error. | ||
Parameters: | ||
Returns: | ||
str: a string describing the last module error | ||
""" | ||
... | ||
@staticmethod | ||
def error_quark() -> int: ... | ||
def make_resident(self) -> None: ... | ||
def name(self) -> str: ... | ||
def make_resident(self) -> None: | ||
""" | ||
Ensures that a module will never be unloaded. | ||
Any future g_module_close() calls on the module will be ignored. | ||
Parameters: | ||
Returns: | ||
""" | ||
... | ||
def name(self) -> str: | ||
""" | ||
Returns the filename that the module was opened with. | ||
If @module refers to the application itself, \"main\" is returned. | ||
Parameters: | ||
Returns: | ||
str: the filename of the module | ||
""" | ||
... | ||
@staticmethod | ||
def supported() -> bool: ... | ||
def symbol(self, symbol_name: str) -> Tuple[bool, None]: ... | ||
def supported() -> bool: | ||
""" | ||
Checks if modules are supported on the current platform. | ||
Parameters: | ||
Returns: | ||
bool: %TRUE if modules are supported | ||
""" | ||
... | ||
def symbol(self, symbol_name: str) -> Tuple[bool, None]: | ||
""" | ||
Gets a symbol pointer from a module, such as one exported | ||
by %G_MODULE_EXPORT. Note that a valid symbol can be %NULL. | ||
Parameters: | ||
symbol_name: the name of the symbol to find | ||
Returns: | ||
bool: %TRUE on success | ||
None: returns the pointer to the symbol value | ||
""" | ||
... | ||
|
||
class ModuleFlags(GObject.GFlags): | ||
""" | ||
Flags passed to g_module_open(). | ||
Note that these flags are not supported on all platforms. | ||
""" | ||
|
||
LAZY = 1 | ||
""" | ||
specifies that symbols are only resolved when | ||
needed. The default action is to bind all symbols when the module | ||
is loaded. | ||
""" | ||
LOCAL = 2 | ||
""" | ||
specifies that symbols in the module should | ||
not be added to the global name space. The default action on most | ||
platforms is to place symbols in the module in the global name space, | ||
which may cause conflicts with existing symbols. | ||
""" | ||
MASK = 3 | ||
""" | ||
mask for all flags. | ||
""" | ||
|
||
class ModuleError(GObject.GEnum): | ||
""" | ||
Errors returned by g_module_open_full(). | ||
""" | ||
|
||
CHECK_FAILED = 1 | ||
""" | ||
a module returned an error from its `g_module_check_init()` function | ||
""" | ||
FAILED = 0 | ||
""" | ||
there was an error loading or opening a module file | ||
""" |
Oops, something went wrong.