Cache return values to avoid repeated function calls.
This commit is contained in:
parent
0b7a74dda3
commit
9bc87d09c6
1 changed files with 3 additions and 2 deletions
|
|
@ -206,8 +206,9 @@ def prepare_import(path):
|
|||
"""
|
||||
path = os.path.realpath(path)
|
||||
|
||||
if os.path.splitext(path)[1] == '.py':
|
||||
path = os.path.splitext(path)[0]
|
||||
fname, ext = os.path.splitext(path)
|
||||
if ext == '.py':
|
||||
path = fname
|
||||
|
||||
if os.path.basename(path) == '__init__':
|
||||
path = os.path.dirname(path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue