Skip to content

Commit

Permalink
Update stubs after deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
jtojnar committed Feb 25, 2024
1 parent fe1c3cf commit 26cce52
Show file tree
Hide file tree
Showing 45 changed files with 481,588 additions and 78,781 deletions.
28,242 changes: 21,917 additions & 6,325 deletions src/gi-stubs/repository/Adw.pyi

Large diffs are not rendered by default.

566 changes: 525 additions & 41 deletions src/gi-stubs/repository/AppIndicator3.pyi

Large diffs are not rendered by default.

12,837 changes: 11,247 additions & 1,590 deletions src/gi-stubs/repository/AppStream.pyi

Large diffs are not rendered by default.

6,466 changes: 6,063 additions & 403 deletions src/gi-stubs/repository/Atk.pyi

Large diffs are not rendered by default.

560 changes: 518 additions & 42 deletions src/gi-stubs/repository/AyatanaAppIndicator3.pyi

Large diffs are not rendered by default.

2,322 changes: 2,180 additions & 142 deletions src/gi-stubs/repository/Farstream.pyi

Large diffs are not rendered by default.

4,095 changes: 3,735 additions & 360 deletions src/gi-stubs/repository/Flatpak.pyi

Large diffs are not rendered by default.

3,547 changes: 3,281 additions & 266 deletions src/gi-stubs/repository/GIRepository.pyi

Large diffs are not rendered by default.

35,828 changes: 33,469 additions & 2,359 deletions src/gi-stubs/repository/GLib.pyi

Large diffs are not rendered by default.

224 changes: 206 additions & 18 deletions src/gi-stubs/repository/GModule.pyi
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
"""
Loading

0 comments on commit 26cce52

Please sign in to comment.