Create an autosummary for Jedi's API

This commit is contained in:
Dave Halter
2020-03-18 09:55:58 +01:00
parent 7de475318a
commit e53acb4150
4 changed files with 38 additions and 12 deletions

View File

@@ -28,7 +28,7 @@ sys.path.insert(0, os.path.abspath('..'))
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.todo', extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.todo',
'sphinx.ext.intersphinx', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.intersphinx', 'sphinx.ext.inheritance_diagram',
'sphinx_rtd_theme'] 'sphinx_rtd_theme', 'sphinx.ext.autosummary']
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']

View File

@@ -19,6 +19,32 @@ The API consists of a few different parts:
- A way to work with different :ref:`Folders / Projects <projects>` - A way to work with different :ref:`Folders / Projects <projects>`
- Helpful functions: :func:`.preload_module` and :func:`.set_debug_function` - Helpful functions: :func:`.preload_module` and :func:`.set_debug_function`
The methods that you are most likely going to use to work with Jedi are the
following ones:
.. currentmodule:: jedi
.. autosummary::
:nosignatures:
Script.complete
Script.goto
Script.infer
Script.help
Script.get_signatures
Script.get_references
Script.get_context
Script.get_names
Script.get_syntax_errors
Script.rename
Script.inline
Script.extract_variable
Script.extract_function
Script.search
Script.complete_search
Project.search
Project.complete_search
Script Script
------ ------

View File

@@ -260,7 +260,7 @@ class Script(object):
@validate_line_column @validate_line_column
def complete(self, line=None, column=None, **kwargs): def complete(self, line=None, column=None, **kwargs):
""" """
Return :class:`.Completion` objects. Completes objects under the cursor.
Those objects contain information about the completions, more than just Those objects contain information about the completions, more than just
names. names.
@@ -428,9 +428,9 @@ class Script(object):
def complete_search(self, string, **kwargs): def complete_search(self, string, **kwargs):
""" """
Like :meth:`.Script.search`, but returns completions for the current Like :meth:`.Script.search`, but completes that string. If you want to
string. If you want to have all possible definitions in a file you can have all possible definitions in a file you can also provide an empty
also provide an empty string. string.
:param bool all_scopes: Default False; searches not only for :param bool all_scopes: Default False; searches not only for
definitions on the top level of a module level, but also in definitions on the top level of a module level, but also in
@@ -653,8 +653,7 @@ class Script(object):
@_no_python2_support @_no_python2_support
def rename(self, line=None, column=None, **kwargs): def rename(self, line=None, column=None, **kwargs):
""" """
Returns an object that you can use to rename the variable under the Renames all references of the variable under the cursor.
cursor and its references to a different name.
:param new_name: The variable under the cursor will be renamed to this :param new_name: The variable under the cursor will be renamed to this
string. string.
@@ -671,7 +670,8 @@ class Script(object):
@validate_line_column @validate_line_column
def extract_variable(self, line=None, column=None, **kwargs): def extract_variable(self, line=None, column=None, **kwargs):
""" """
Moves an expression of a selected range to a new statemenet. Moves an expression to a new statemenet.
For example if you have the cursor on ``foo`` and provide a For example if you have the cursor on ``foo`` and provide a
``new_name`` called ``bar``:: ``new_name`` called ``bar``::
@@ -712,7 +712,8 @@ class Script(object):
@_no_python2_support @_no_python2_support
def extract_function(self, line, column, **kwargs): def extract_function(self, line, column, **kwargs):
""" """
Moves an expression of a selected range to a new function. Moves an expression to a new function.
For example if you have the cursor on ``foo`` and provide a For example if you have the cursor on ``foo`` and provide a
``new_name`` called ``bar``:: ``new_name`` called ``bar``::

View File

@@ -236,9 +236,8 @@ class Project(object):
def complete_search(self, string, **kwargs): def complete_search(self, string, **kwargs):
""" """
Like :meth:`.Project.search`, but returns completions for the current Like :meth:`.Script.search`, but completes that string. An empty string
string. An empty string lists all definitions in a project, so be lists all definitions in a project, so be careful with that.
careful with that.
:param bool all_scopes: Default False; searches not only for :param bool all_scopes: Default False; searches not only for
definitions on the top level of a module level, but also in definitions on the top level of a module level, but also in