[pygobject] Prefix __module__ attribute of function objects with gi.repository
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Prefix __module__ attribute of function objects with gi.repository
- Date: Sat, 16 Feb 2013 05:42:19 +0000 (UTC)
commit 84103dfabd05742d1a18729663a609e9bf7c45f8
Author: Niklas Koep <niklas koep gmail com>
Date: Fri Feb 15 21:23:01 2013 -0800
Prefix __module__ attribute of function objects with gi.repository
This allows gi module methods to work with pydoc and help().
Additionally correct typo in two docstrings of the same module.
Co-authored-by: Simon Feltman <sfeltman src gnome org>
https://bugzilla.gnome.org/show_bug.cgi?id=693839
gi/overrides/__init__.py | 3 ++-
gi/types.py | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gi/overrides/__init__.py b/gi/overrides/__init__.py
index b7d365c..0bd94b8 100644
--- a/gi/overrides/__init__.py
+++ b/gi/overrides/__init__.py
@@ -55,7 +55,8 @@ class overridefunc(object):
if not hasattr(func, '__info__'):
raise TypeError("func must be an gi function")
from ..importer import modules
- self.module = modules[func.__module__]._introspection_module
+ module_name = func.__module__.rsplit('.', 1)[-1]
+ self.module = modules[module_name]._introspection_module
def __call__(self, func):
def wrapper(*args, **kwargs):
diff --git a/gi/types.py b/gi/types.py
index f049da7..c44833d 100644
--- a/gi/types.py
+++ b/gi/types.py
@@ -100,14 +100,14 @@ def wraps_callable_info(info):
def update_func(func):
func.__info__ = info
func.__name__ = info.get_name()
- func.__module__ = info.get_namespace()
+ func.__module__ = 'gi.repository.' + info.get_namespace()
func.__doc__ = get_callable_info_doc_string(info)
return func
return update_func
def Function(info):
- """Warps GIFunctionInfo"""
+ """Wraps GIFunctionInfo"""
@wraps_callable_info(info)
def function(*args, **kwargs):
return info.invoke(*args, **kwargs)
@@ -128,7 +128,7 @@ class NativeVFunc(object):
def Constructor(info):
- """Warps GIFunctionInfo with get_constructor() == True"""
+ """Wraps GIFunctionInfo with get_constructor() == True"""
@wraps_callable_info(info)
def constructor(cls, *args, **kwargs):
cls_name = info.get_container().get_name()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]