Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/jedi/__init__.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-20 06:09 +0000

1""" 

2Jedi is a static analysis tool for Python that is typically used in 

3IDEs/editors plugins. Jedi has a focus on autocompletion and goto 

4functionality. Other features include refactoring, code search and finding 

5references. 

6 

7Jedi has a simple API to work with. There is a reference implementation as a 

8`VIM-Plugin <https://github.com/davidhalter/jedi-vim>`_. Autocompletion in your 

9REPL is also possible, IPython uses it natively and for the CPython REPL you 

10can install it. Jedi is well tested and bugs should be rare. 

11 

12Here's a simple example of the autocompletion feature: 

13 

14>>> import jedi 

15>>> source = ''' 

16... import json 

17... json.lo''' 

18>>> script = jedi.Script(source, path='example.py') 

19>>> script 

20<Script: 'example.py' ...> 

21>>> completions = script.complete(3, len('json.lo')) 

22>>> completions 

23[<Completion: load>, <Completion: loads>] 

24>>> print(completions[0].complete) 

25ad 

26>>> print(completions[0].name) 

27load 

28""" 

29 

30__version__ = '0.19.1' 

31 

32from jedi.api import Script, Interpreter, set_debug_function, preload_module 

33from jedi import settings 

34from jedi.api.environment import find_virtualenvs, find_system_environments, \ 

35 get_default_environment, InvalidPythonEnvironment, create_environment, \ 

36 get_system_environment, InterpreterEnvironment 

37from jedi.api.project import Project, get_default_project 

38from jedi.api.exceptions import InternalError, RefactoringError 

39 

40# Finally load the internal plugins. This is only internal. 

41from jedi.plugins import registry 

42del registry