forked from VimPlug/jedi
Merge with master
This commit is contained in:
10
README.rst
10
README.rst
@@ -45,7 +45,7 @@ Jedi can currently be used with the following editors/projects:
|
|||||||
- Gedit (gedi_)
|
- Gedit (gedi_)
|
||||||
- wdb_ - Web Debugger
|
- wdb_ - Web Debugger
|
||||||
- `Eric IDE`_ (Available as a plugin)
|
- `Eric IDE`_ (Available as a plugin)
|
||||||
- `Ipython 6.0.0+ <http://ipython.readthedocs.io/en/stable/whatsnew/version6.html>`_
|
- `Ipython 6.0.0+ <https://ipython.readthedocs.io/en/stable/whatsnew/version6.html>`_
|
||||||
|
|
||||||
and many more!
|
and many more!
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ Get the latest version from `github <https://github.com/davidhalter/jedi>`_
|
|||||||
Docs are available at `https://jedi.readthedocs.org/en/latest/
|
Docs are available at `https://jedi.readthedocs.org/en/latest/
|
||||||
<https://jedi.readthedocs.org/en/latest/>`_. Pull requests with documentation
|
<https://jedi.readthedocs.org/en/latest/>`_. Pull requests with documentation
|
||||||
enhancements and/or fixes are awesome and most welcome. Jedi uses `semantic
|
enhancements and/or fixes are awesome and most welcome. Jedi uses `semantic
|
||||||
versioning <http://semver.org/>`_.
|
versioning <https://semver.org/>`_.
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
@@ -193,7 +193,7 @@ Acknowledgements
|
|||||||
|
|
||||||
|
|
||||||
.. _jedi-vim: https://github.com/davidhalter/jedi-vim
|
.. _jedi-vim: https://github.com/davidhalter/jedi-vim
|
||||||
.. _youcompleteme: http://valloric.github.io/YouCompleteMe/
|
.. _youcompleteme: https://valloric.github.io/YouCompleteMe/
|
||||||
.. _deoplete-jedi: https://github.com/zchee/deoplete-jedi
|
.. _deoplete-jedi: https://github.com/zchee/deoplete-jedi
|
||||||
.. _completor.vim: https://github.com/maralla/completor.vim
|
.. _completor.vim: https://github.com/maralla/completor.vim
|
||||||
.. _Jedi.el: https://github.com/tkf/emacs-jedi
|
.. _Jedi.el: https://github.com/tkf/emacs-jedi
|
||||||
@@ -205,11 +205,11 @@ Acknowledgements
|
|||||||
.. _anaconda: https://github.com/DamnWidget/anaconda
|
.. _anaconda: https://github.com/DamnWidget/anaconda
|
||||||
.. _wdb: https://github.com/Kozea/wdb
|
.. _wdb: https://github.com/Kozea/wdb
|
||||||
.. _TextMate: https://github.com/lawrenceakka/python-jedi.tmbundle
|
.. _TextMate: https://github.com/lawrenceakka/python-jedi.tmbundle
|
||||||
.. _Kate: http://kate-editor.org
|
.. _Kate: https://kate-editor.org
|
||||||
.. _Atom: https://atom.io/
|
.. _Atom: https://atom.io/
|
||||||
.. _autocomplete-python-jedi: https://atom.io/packages/autocomplete-python-jedi
|
.. _autocomplete-python-jedi: https://atom.io/packages/autocomplete-python-jedi
|
||||||
.. _SourceLair: https://www.sourcelair.com
|
.. _SourceLair: https://www.sourcelair.com
|
||||||
.. _GNOME Builder: https://wiki.gnome.org/Apps/Builder
|
.. _GNOME Builder: https://wiki.gnome.org/Apps/Builder
|
||||||
.. _Visual Studio Code: https://code.visualstudio.com/
|
.. _Visual Studio Code: https://code.visualstudio.com/
|
||||||
.. _gedi: https://github.com/isamert/gedi
|
.. _gedi: https://github.com/isamert/gedi
|
||||||
.. _Eric IDE: http://eric-ide.python-projects.org
|
.. _Eric IDE: https://eric-ide.python-projects.org
|
||||||
|
|||||||
2
docs/_templates/ghbuttons.html
vendored
2
docs/_templates/ghbuttons.html
vendored
@@ -1,4 +1,4 @@
|
|||||||
<h3>Github</h3>
|
<h3>Github</h3>
|
||||||
<iframe src="http://ghbtns.com/github-btn.html?user=davidhalter&repo=jedi&type=watch&count=true&size=large"
|
<iframe src="https://ghbtns.com/github-btn.html?user=davidhalter&repo=jedi&type=watch&count=true&size=large"
|
||||||
frameborder="0" scrolling="0" width="170" height="30" allowtransparency="true"></iframe>
|
frameborder="0" scrolling="0" width="170" height="30" allowtransparency="true"></iframe>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ autodoc_default_flags = []
|
|||||||
# -- Options for intersphinx module --------------------------------------------
|
# -- Options for intersphinx module --------------------------------------------
|
||||||
|
|
||||||
intersphinx_mapping = {
|
intersphinx_mapping = {
|
||||||
'http://docs.python.org/': None,
|
'https://docs.python.org/': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ are planned, others might be hard to implement and provide little worth):
|
|||||||
|
|
||||||
**Sphinx style**
|
**Sphinx style**
|
||||||
|
|
||||||
http://sphinx-doc.org/domains.html#info-field-lists
|
http://www.sphinx-doc.org/en/stable/domains.html#info-field-lists
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ Debian
|
|||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
Debian packages are available in the `unstable repository
|
Debian packages are available in the `unstable repository
|
||||||
<http://packages.debian.org/search?keywords=python%20jedi>`__.
|
<https://packages.debian.org/search?keywords=python%20jedi>`__.
|
||||||
|
|
||||||
Others
|
Others
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ Using a custom ``$HOME/.pythonrc.py``
|
|||||||
.. autofunction:: jedi.utils.setup_readline
|
.. autofunction:: jedi.utils.setup_readline
|
||||||
|
|
||||||
.. _jedi-vim: https://github.com/davidhalter/jedi-vim
|
.. _jedi-vim: https://github.com/davidhalter/jedi-vim
|
||||||
.. _youcompleteme: http://valloric.github.io/YouCompleteMe/
|
.. _youcompleteme: https://valloric.github.io/YouCompleteMe/
|
||||||
.. _deoplete-jedi: https://github.com/zchee/deoplete-jedi
|
.. _deoplete-jedi: https://github.com/zchee/deoplete-jedi
|
||||||
.. _Jedi.el: https://github.com/tkf/emacs-jedi
|
.. _Jedi.el: https://github.com/tkf/emacs-jedi
|
||||||
.. _elpy: https://github.com/jorgenschaefer/elpy
|
.. _elpy: https://github.com/jorgenschaefer/elpy
|
||||||
@@ -113,10 +113,10 @@ Using a custom ``$HOME/.pythonrc.py``
|
|||||||
.. _SynJedi: http://uvviewsoft.com/synjedi/
|
.. _SynJedi: http://uvviewsoft.com/synjedi/
|
||||||
.. _wdb: https://github.com/Kozea/wdb
|
.. _wdb: https://github.com/Kozea/wdb
|
||||||
.. _TextMate: https://github.com/lawrenceakka/python-jedi.tmbundle
|
.. _TextMate: https://github.com/lawrenceakka/python-jedi.tmbundle
|
||||||
.. _kate: http://kate-editor.org/
|
.. _kate: https://kate-editor.org/
|
||||||
.. _autocomplete-python-jedi: https://atom.io/packages/autocomplete-python-jedi
|
.. _autocomplete-python-jedi: https://atom.io/packages/autocomplete-python-jedi
|
||||||
.. _SourceLair: https://www.sourcelair.com
|
.. _SourceLair: https://www.sourcelair.com
|
||||||
.. _GNOME Builder: https://wiki.gnome.org/Apps/Builder/
|
.. _GNOME Builder: https://wiki.gnome.org/Apps/Builder/
|
||||||
.. _gedi: https://github.com/isamert/gedi
|
.. _gedi: https://github.com/isamert/gedi
|
||||||
.. _Eric IDE: http://eric-ide.python-projects.org
|
.. _Eric IDE: https://eric-ide.python-projects.org
|
||||||
.. _Python Extension: https://marketplace.visualstudio.com/items?itemName=donjayamanne.python
|
.. _Python Extension: https://marketplace.visualstudio.com/items?itemName=donjayamanne.python
|
||||||
|
|||||||
@@ -37,4 +37,4 @@ Resources
|
|||||||
|
|
||||||
- `Source Code on Github <https://github.com/davidhalter/jedi>`_
|
- `Source Code on Github <https://github.com/davidhalter/jedi>`_
|
||||||
- `Travis Testing <https://travis-ci.org/davidhalter/jedi>`_
|
- `Travis Testing <https://travis-ci.org/davidhalter/jedi>`_
|
||||||
- `Python Package Index <http://pypi.python.org/pypi/jedi/>`_
|
- `Python Package Index <https://pypi.python.org/pypi/jedi/>`_
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ class Importer(object):
|
|||||||
# Since we know nothing about the call location of the sys.path,
|
# Since we know nothing about the call location of the sys.path,
|
||||||
# it's a possibility that the current directory is the origin of
|
# it's a possibility that the current directory is the origin of
|
||||||
# the Python execution.
|
# the Python execution.
|
||||||
sys_path_mod.insert(0, force_unicode(os.path.dirname(self.file_path)))
|
sys_path_mod.append(force_unicode(os.path.dirname(self.file_path)))
|
||||||
|
|
||||||
return in_path + sys_path_mod
|
return in_path + sys_path_mod
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,8 @@ class Refactoring(object):
|
|||||||
|
|
||||||
def rename(script, new_name):
|
def rename(script, new_name):
|
||||||
""" The `args` / `kwargs` params are the same as in `api.Script`.
|
""" The `args` / `kwargs` params are the same as in `api.Script`.
|
||||||
:param operation: The refactoring operation to execute.
|
:param new_name: The new name of the script.
|
||||||
:type operation: str
|
:param script: The source Script object.
|
||||||
:type source: str
|
|
||||||
:return: list of changed lines/changed files
|
:return: list of changed lines/changed files
|
||||||
"""
|
"""
|
||||||
return Refactoring(_rename(script.usages(), new_name))
|
return Refactoring(_rename(script.usages(), new_name))
|
||||||
@@ -108,11 +107,12 @@ def extract(script, new_name):
|
|||||||
|
|
||||||
user_stmt = script._parser.user_stmt()
|
user_stmt = script._parser.user_stmt()
|
||||||
|
|
||||||
# TODO care for multiline extracts
|
# TODO care for multi-line extracts
|
||||||
dct = {}
|
dct = {}
|
||||||
if user_stmt:
|
if user_stmt:
|
||||||
pos = script._pos
|
pos = script._pos
|
||||||
line_index = pos[0] - 1
|
line_index = pos[0] - 1
|
||||||
|
# Be careful here. 'array_for_pos' does not exist in 'helpers'.
|
||||||
arr, index = helpers.array_for_pos(user_stmt, pos)
|
arr, index = helpers.array_for_pos(user_stmt, pos)
|
||||||
if arr is not None:
|
if arr is not None:
|
||||||
start_pos = arr[index].start_pos
|
start_pos = arr[index].start_pos
|
||||||
@@ -123,7 +123,7 @@ def extract(script, new_name):
|
|||||||
start_line = new_lines[start_pos[0] - 1]
|
start_line = new_lines[start_pos[0] - 1]
|
||||||
text = start_line[start_pos[1]:e]
|
text = start_line[start_pos[1]:e]
|
||||||
for l in range(start_pos[0], end_pos[0] - 1):
|
for l in range(start_pos[0], end_pos[0] - 1):
|
||||||
text += '\n' + l
|
text += '\n' + str(l)
|
||||||
if e is None:
|
if e is None:
|
||||||
end_line = new_lines[end_pos[0] - 1]
|
end_line = new_lines[end_pos[0] - 1]
|
||||||
text += '\n' + end_line[:end_pos[1]]
|
text += '\n' + end_line[:end_pos[1]]
|
||||||
@@ -143,7 +143,7 @@ def extract(script, new_name):
|
|||||||
new_lines[start_pos[0] - 1] = start_line
|
new_lines[start_pos[0] - 1] = start_line
|
||||||
new_lines[start_pos[0]:end_pos[0] - 1] = []
|
new_lines[start_pos[0]:end_pos[0] - 1] = []
|
||||||
|
|
||||||
# add parentheses in multiline case
|
# add parentheses in multi-line case
|
||||||
open_brackets = ['(', '[', '{']
|
open_brackets = ['(', '[', '{']
|
||||||
close_brackets = [')', ']', '}']
|
close_brackets = [')', ']', '}']
|
||||||
if '\n' in text and not (text[0] in open_brackets and text[-1] ==
|
if '\n' in text and not (text[0] in open_brackets and text[-1] ==
|
||||||
@@ -175,7 +175,7 @@ def inline(script):
|
|||||||
inlines = sorted(inlines, key=lambda x: (x.module_path, x.line, x.column),
|
inlines = sorted(inlines, key=lambda x: (x.module_path, x.line, x.column),
|
||||||
reverse=True)
|
reverse=True)
|
||||||
expression_list = stmt.expression_list()
|
expression_list = stmt.expression_list()
|
||||||
# don't allow multiline refactorings for now.
|
# don't allow multi-line refactorings for now.
|
||||||
assert stmt.start_pos[0] == stmt.end_pos[0]
|
assert stmt.start_pos[0] == stmt.end_pos[0]
|
||||||
index = stmt.start_pos[0] - 1
|
index = stmt.start_pos[0] - 1
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import jedi
|
|||||||
def process_memory():
|
def process_memory():
|
||||||
"""
|
"""
|
||||||
In kB according to
|
In kB according to
|
||||||
http://stackoverflow.com/questions/938733/total-memory-used-by-python-process
|
https://stackoverflow.com/questions/938733/total-memory-used-by-python-process
|
||||||
"""
|
"""
|
||||||
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
|
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user