Move the stdlib executions into a plugin

This commit is contained in:
Dave Halter
2018-07-22 03:38:12 +02:00
parent df55f62ad8
commit 061489ec9a
5 changed files with 48 additions and 41 deletions

18
jedi/plugins/stdlib.py Normal file
View File

@@ -0,0 +1,18 @@
from jedi import debug
from jedi.plugins.base import BasePlugin
class StdlibPlugin(BasePlugin):
def execute(self, callback):
def wrapper(context, arguments):
debug.dbg('execute: %s %s', context, arguments)
from jedi.evaluate import stdlib
try:
# Some stdlib functions like super(), namedtuple(), etc. have been
# hard-coded in Jedi to support them.
return stdlib.execute(self._evaluator, context, arguments)
except stdlib.NotInStdLib:
pass
return callback(context, arguments)
return wrapper