[pygobject/py3k: 10/20] Run under both Python 2.x and 3.x
- From: John Ehresman <jpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/py3k: 10/20] Run under both Python 2.x and 3.x
- Date: Thu, 15 Apr 2010 17:49:52 +0000 (UTC)
commit ef1eb49d5e29630d998517c5d1e93dde03a004ef
Author: John Ehresman <jpe wingware com>
Date: Tue Apr 13 12:15:35 2010 -0400
Run under both Python 2.x and 3.x
dsextras.py | 4 ++--
pygtk.py | 7 +++----
2 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/dsextras.py b/dsextras.py
index 9fc79c1..2f8d89a 100644
--- a/dsextras.py
+++ b/dsextras.py
@@ -66,7 +66,7 @@ def list_files(dir):
that matches *.glade. It also looks up the full path"""
if dir.find(os.sep) != -1:
parts = dir.split(os.sep)
- dir = string.join(parts[:-1], os.sep)
+ dir = os.sep.join(parts[:-1])
pattern = parts[-1]
else:
pattern = dir
@@ -421,7 +421,7 @@ class TemplateExtension(PkgConfigExtension):
if load_types:
del kwargs['load_types']
- if kwargs.has_key('output'):
+ if 'output' in kwargs:
kwargs['name'] = kwargs['output']
del kwargs['output']
diff --git a/pygtk.py b/pygtk.py
index e061b88..98c286e 100644
--- a/pygtk.py
+++ b/pygtk.py
@@ -57,8 +57,7 @@ def _get_available_versions():
# skip empty directories
if not os.listdir(pathname):
continue
-
- if not versions.has_key(filename[-3:]):
+ if filename[-3:] not in versions:
versions[filename[-3:]] = pathname
return versions
@@ -77,11 +76,11 @@ def require(version):
"a different version of gtk was already required"
return
- assert not sys.modules.has_key('gtk'), \
+ assert 'gtk' not in sys.modules, \
"pygtk.require() must be called before importing gtk"
versions = _get_available_versions()
- assert versions.has_key(version), \
+ assert version in versions, \
"required version '%s' not found on system" % version
# remove any pygtk dirs first ...
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]