mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Disable the star import cache.
This commit is contained in:
@@ -717,7 +717,10 @@ class ModuleWrapper(use_metaclass(CachedMetaClass, pr.Module, Wrapper)):
|
|||||||
yield dict((str(n), [GlobalName(n)]) for n in self.base.global_names)
|
yield dict((str(n), [GlobalName(n)]) for n in self.base.global_names)
|
||||||
yield self._sub_modules_dict()
|
yield self._sub_modules_dict()
|
||||||
|
|
||||||
@cache_star_import
|
# I'm not sure if the star import cache is really that effective anymore
|
||||||
|
# with all the other really fast import caches. Recheck. Also we would need
|
||||||
|
# to push the star imports into Evaluator.modules, if we reenable this.
|
||||||
|
#@cache_star_import
|
||||||
@memoize_default([])
|
@memoize_default([])
|
||||||
def star_imports(self):
|
def star_imports(self):
|
||||||
modules = []
|
modules = []
|
||||||
|
|||||||
@@ -42,15 +42,17 @@ def main(mods):
|
|||||||
for mod in mods:
|
for mod in mods:
|
||||||
elapsed, used = profile_preload(mod)
|
elapsed, used = profile_preload(mod)
|
||||||
if used > 0:
|
if used > 0:
|
||||||
print('%8.1f | %8d | %s' % (elapsed, used, mod))
|
print('%8.2f | %8d | %s' % (elapsed, used, mod))
|
||||||
print('------------------------------')
|
print('------------------------------')
|
||||||
elapsed = time.time() - t0
|
elapsed = time.time() - t0
|
||||||
used = used_memory() - baseline
|
used = used_memory() - baseline
|
||||||
print('%8.1f | %8d | %s' % (elapsed, used, 'Total'))
|
print('%8.2f | %8d | %s' % (elapsed, used, 'Total'))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
if sys.argv[1:]:
|
||||||
|
mods = sys.argv[1:]
|
||||||
|
else:
|
||||||
mods = ['re', 'numpy', 'scipy', 'scipy.sparse', 'scipy.stats',
|
mods = ['re', 'numpy', 'scipy', 'scipy.sparse', 'scipy.stats',
|
||||||
'wx', 'decimal', 'PyQt4.QtGui', 'PySide.QtGui', 'Tkinter']
|
'wx', 'decimal', 'PyQt4.QtGui', 'PySide.QtGui', 'Tkinter']
|
||||||
mods += sys.argv[1:]
|
|
||||||
main(mods)
|
main(mods)
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ a = ''
|
|||||||
|
|
||||||
from . import invisible_pkg
|
from . import invisible_pkg
|
||||||
|
|
||||||
|
the_pkg = invisible_pkg
|
||||||
|
|
||||||
invisible_pkg = 1
|
invisible_pkg = 1
|
||||||
|
|||||||
@@ -121,6 +121,14 @@ def test_import_priorities():
|
|||||||
from import_tree import the_pkg, invisible_pkg
|
from import_tree import the_pkg, invisible_pkg
|
||||||
#? int()
|
#? int()
|
||||||
invisible_pkg
|
invisible_pkg
|
||||||
|
# In real Python, this would be the module, but it's not, because Jedi
|
||||||
|
# doesn't care about most stateful issues such as __dict__, which it would
|
||||||
|
# need to, to do this in a correct way.
|
||||||
|
#? int()
|
||||||
|
the_pkg
|
||||||
|
# Importing foo is still possible, even though inivisible_pkg got changed.
|
||||||
|
#? float()
|
||||||
|
from import_tree.invisible_pkg import foo
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user