[pygobject/gsoc2009: 159/160] Clean Python imports and make them absolute
- From: Simon van der Linden <svdlinden src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pygobject/gsoc2009: 159/160] Clean Python imports and make them absolute
- Date: Fri, 14 Aug 2009 21:37:06 +0000 (UTC)
commit 820d0a324deb4eb0b0ff3d71dfa5b28427c75c4d
Author: Simon van der Linden <svdlinden src gnome org>
Date: Fri Aug 14 14:17:43 2009 +0200
Clean Python imports and make them absolute
gi/__init__.py | 2 ++
gi/importer.py | 2 ++
gi/module.py | 19 ++++++-------------
gi/repository/__init__.py | 2 ++
gi/types.py | 8 +++-----
5 files changed, 15 insertions(+), 18 deletions(-)
---
diff --git a/gi/__init__.py b/gi/__init__.py
index 3e2b049..3edea9f 100644
--- a/gi/__init__.py
+++ b/gi/__init__.py
@@ -18,5 +18,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
+from __future__ import absolute_import
+
from ._gi import _API
diff --git a/gi/importer.py b/gi/importer.py
index 812dced..48392b4 100644
--- a/gi/importer.py
+++ b/gi/importer.py
@@ -20,6 +20,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
+from __future__ import absolute_import
+
import sys
import gobject
diff --git a/gi/module.py b/gi/module.py
index 7824258..2983d18 100644
--- a/gi/module.py
+++ b/gi/module.py
@@ -20,27 +20,20 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
-import os
+from __future__ import absolute_import
+import os
import gobject
-from gobject import \
- GObject, \
- GInterface, \
- GBoxed
from ._gi import \
Repository, \
- UnresolvedInfo, \
FunctionInfo, \
RegisteredTypeInfo, \
EnumInfo, \
ObjectInfo, \
InterfaceInfo, \
StructInfo
-from .types import \
- GObjectMeta, \
- StructMeta, \
- Function
+from .types import GObjectMeta, StructMeta, Function
repository = Repository.get_default()
@@ -56,7 +49,7 @@ def get_parent_for_object(object_info):
# Workaround for GObject.Object and GObject.InitiallyUnowned.
if namespace == 'GObject' and name == 'Object' or name == 'InitiallyUnowned':
- return GObject
+ return gobject.GObject
module = __import__('gi.repository.%s' % namespace, fromlist=[name])
return getattr(module, name)
@@ -115,10 +108,10 @@ class DynamicModule(object):
bases = (parent,) + interfaces
metaclass = GObjectMeta
elif isinstance(info, InterfaceInfo):
- bases = (GInterface,)
+ bases = (gobject.GInterface,)
metaclass = GObjectMeta
elif isinstance(info, StructInfo):
- bases = (GBoxed,)
+ bases = (gobject.GBoxed,)
metaclass = StructMeta
else:
raise NotImplementedError(info)
diff --git a/gi/repository/__init__.py b/gi/repository/__init__.py
index 640fc8e..5c5552a 100644
--- a/gi/repository/__init__.py
+++ b/gi/repository/__init__.py
@@ -18,6 +18,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
+from __future__ import absolute_import
+
import sys
from ..importer import DynamicImporter
diff --git a/gi/types.py b/gi/types.py
index 4e47302..5319550 100644
--- a/gi/types.py
+++ b/gi/types.py
@@ -20,14 +20,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
-from new import instancemethod
+from __future__ import absolute_import
import gobject
+from new import instancemethod
-from ._gi import \
- InterfaceInfo, \
- ObjectInfo, \
- StructInfo
+from ._gi import InterfaceInfo, ObjectInfo, StructInfo
def Function(info):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]