This website works better with JavaScript.
Home
Explore
Help
Sign In
brettlangdon
/
qw
mirror of
https://github.com/brettlangdon/qw.git
Watch
1
Star
0
Fork
0
Code
Issues
0
Projects
0
Releases
2
Wiki
Activity
Browse Source
add utils and dynamic_import function
pull/1/head
Brett Langdon
11 years ago
parent
02832e1397
commit
aafb04bb14
1 changed files
with
7 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+7
-0
qw/utils.py
+ 7
- 0
qw/utils.py
View File
@ -0,0 +1,7 @@
def
dynamic_import
(
name
)
:
module
,
_
,
function
=
name
.
rpartition
(
"
.
"
)
mod
=
__import__
(
module
,
fromlist
=
[
function
]
)
components
=
name
.
split
(
"
.
"
)
for
comp
in
components
[
1
:
]
:
mod
=
getattr
(
mod
,
comp
)
return
mod
Write
Preview
Loading…
Cancel
Save