summaryrefslogtreecommitdiffstats
path: root/Demo/imputil
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/imputil')
-rw-r--r--Demo/imputil/importers.py8
-rw-r--r--Demo/imputil/knee.py10
2 files changed, 9 insertions, 9 deletions
diff --git a/Demo/imputil/importers.py b/Demo/imputil/importers.py
index 864ff02..b617ba0 100644
--- a/Demo/imputil/importers.py
+++ b/Demo/imputil/importers.py
@@ -31,7 +31,7 @@ _suffix_char = __debug__ and 'c' or 'o'
_suffix = '.py' + _suffix_char
# the C_EXTENSION suffixes
-_c_suffixes = filter(lambda x: x[2] == imp.C_EXTENSION, imp.get_suffixes())
+_c_suffixes = [x for x in imp.get_suffixes() if x[2] == imp.C_EXTENSION]
def _timestamp(pathname):
"Return the file modification time as a Long."
@@ -39,7 +39,7 @@ def _timestamp(pathname):
s = os.stat(pathname)
except OSError:
return None
- return long(s[8])
+ return int(s[8])
def _fs_import(dir, modname, fqname):
"Fetch a module from the filesystem."
@@ -149,7 +149,7 @@ class PackageArchiveImporter(imputil.Importer):
Return None if the archive was not found.
"""
- raise RuntimeError, "get_archive not implemented"
+ raise RuntimeError("get_archive not implemented")
def get_subfile(self, archive, modname):
"""Get code from a subfile in the specified archive.
@@ -162,7 +162,7 @@ class PackageArchiveImporter(imputil.Importer):
Return None if the subfile was not found.
"""
- raise RuntimeError, "get_subfile not implemented"
+ raise RuntimeError("get_subfile not implemented")
class PackageArchive(PackageArchiveImporter):
diff --git a/Demo/imputil/knee.py b/Demo/imputil/knee.py
index 26119e8..49fdf2b 100644
--- a/Demo/imputil/knee.py
+++ b/Demo/imputil/knee.py
@@ -22,10 +22,10 @@ def import_hook(name, globals=None, locals=None, fromlist=None):
return m
def determine_parent(globals):
- if not globals or not globals.has_key("__name__"):
+ if not globals or "__name__" not in globals:
return None
pname = globals['__name__']
- if globals.has_key("__path__"):
+ if "__path__" in globals:
parent = sys.modules[pname]
assert globals is parent.__dict__
return parent
@@ -56,7 +56,7 @@ def find_head_package(parent, name):
parent = None
q = import_module(head, qname, parent)
if q: return q, tail
- raise ImportError, "No module named " + qname
+ raise ImportError("No module named " + qname)
def load_tail(q, tail):
m = q
@@ -67,7 +67,7 @@ def load_tail(q, tail):
mname = "%s.%s" % (m.__name__, head)
m = import_module(head, mname, m)
if not m:
- raise ImportError, "No module named " + mname
+ raise ImportError("No module named " + mname)
return m
def ensure_fromlist(m, fromlist, recursive=0):
@@ -85,7 +85,7 @@ def ensure_fromlist(m, fromlist, recursive=0):
subname = "%s.%s" % (m.__name__, sub)
submod = import_module(sub, subname, m)
if not submod:
- raise ImportError, "No module named " + subname
+ raise ImportError("No module named " + subname)
def import_module(partname, fqname, parent):
try: