Skip to content

Commit 409288e

Browse files
author
Troy Melhase
committed
Fixed missing reference to import_name function.
1 parent c854484 commit 409288e

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎lib/sourcetypes.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
I = ' ' * 4
2626

2727

28-
def import_item(name):
29-
""" import_item(name) -> import an item from a module by dotted name
28+
def import_name(name):
29+
""" import_name(name) -> import and return a module by name in dotted form
3030
31+
Copied from the Python lib docs.
3132
"""
32-
names = name.split('.')
33-
modname, itemname = names[0:-1], names[-1]
34-
mod = import_name(str.join('.', modname))
35-
return getattr(mod, itemname)
33+
mod = __import__(name)
34+
for comp in name.split('.')[1:]:
35+
mod = getattr(mod, comp)
36+
return mod
3637

3738

3839
def set_config(names, includeDefault=True):

0 commit comments

Comments
 (0)