mirror of https://github.com/m-labs/artiq.git
import_cache: read files only once
This commit is contained in:
parent
1ea3cf48d6
commit
95eb218112
|
@ -24,6 +24,7 @@ linecache_getlines = None
|
||||||
def add_module_to_cache(module):
|
def add_module_to_cache(module):
|
||||||
if hasattr(module, "__file__"):
|
if hasattr(module, "__file__"):
|
||||||
fn = module.__file__
|
fn = module.__file__
|
||||||
|
if fn not in cache:
|
||||||
try:
|
try:
|
||||||
with tokenize.open(fn) as fp:
|
with tokenize.open(fn) as fp:
|
||||||
lines = fp.readlines()
|
lines = fp.readlines()
|
||||||
|
|
Loading…
Reference in New Issue