Mercurial > hg > dotemacs
changeset 182:c3bd84985977
upgrade elpy to 1.25
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Thu, 11 Oct 2018 15:38:33 -0400 |
parents | 5ff62f07dd47 |
children | 3de719fb264a |
files | elpa/elpy-1.18.0/NEWS.rst elpa/elpy-1.18.0/elpy-autoloads.el elpa/elpy-1.18.0/elpy-django.el elpa/elpy-1.18.0/elpy-pkg.el elpa/elpy-1.18.0/elpy-profile.el elpa/elpy-1.18.0/elpy-refactor.el elpa/elpy-1.18.0/elpy-shell.el elpa/elpy-1.18.0/elpy.el elpa/elpy-1.18.0/elpy/__init__.py elpa/elpy-1.18.0/elpy/__main__.py elpa/elpy-1.18.0/elpy/auto_pep8.py elpa/elpy-1.18.0/elpy/compat.py elpa/elpy-1.18.0/elpy/jedibackend.py elpa/elpy-1.18.0/elpy/pydocutils.py elpa/elpy-1.18.0/elpy/refactor.py elpa/elpy-1.18.0/elpy/rpc.py elpa/elpy-1.18.0/elpy/server.py elpa/elpy-1.18.0/elpy/tests/__init__.py elpa/elpy-1.18.0/elpy/tests/compat.py elpa/elpy-1.18.0/elpy/tests/support.py elpa/elpy-1.18.0/elpy/tests/test_auto_pep8.py elpa/elpy-1.18.0/elpy/tests/test_jedibackend.py elpa/elpy-1.18.0/elpy/tests/test_pydocutils.py elpa/elpy-1.18.0/elpy/tests/test_refactor.py elpa/elpy-1.18.0/elpy/tests/test_rpc.py elpa/elpy-1.18.0/elpy/tests/test_server.py elpa/elpy-1.18.0/elpy/tests/test_support.py elpa/elpy-1.18.0/elpy/tests/test_yapf.py elpa/elpy-1.18.0/elpy/yapfutil.py elpa/elpy-1.18.0/snippets/python-mode/.yas-setup.el elpa/elpy-1.18.0/snippets/python-mode/__abs__ elpa/elpy-1.18.0/snippets/python-mode/__add__ elpa/elpy-1.18.0/snippets/python-mode/__and__ elpa/elpy-1.18.0/snippets/python-mode/__bool__ elpa/elpy-1.18.0/snippets/python-mode/__call__ elpa/elpy-1.18.0/snippets/python-mode/__cmp__ elpa/elpy-1.18.0/snippets/python-mode/__coerce__ elpa/elpy-1.18.0/snippets/python-mode/__complex__ elpa/elpy-1.18.0/snippets/python-mode/__contains__ elpa/elpy-1.18.0/snippets/python-mode/__del__ elpa/elpy-1.18.0/snippets/python-mode/__delattr__ elpa/elpy-1.18.0/snippets/python-mode/__delete__ elpa/elpy-1.18.0/snippets/python-mode/__delitem__ elpa/elpy-1.18.0/snippets/python-mode/__div__ elpa/elpy-1.18.0/snippets/python-mode/__divmod__ elpa/elpy-1.18.0/snippets/python-mode/__enter__ elpa/elpy-1.18.0/snippets/python-mode/__eq__ elpa/elpy-1.18.0/snippets/python-mode/__exit__ elpa/elpy-1.18.0/snippets/python-mode/__float__ elpa/elpy-1.18.0/snippets/python-mode/__floordiv__ elpa/elpy-1.18.0/snippets/python-mode/__ge__ elpa/elpy-1.18.0/snippets/python-mode/__get__ elpa/elpy-1.18.0/snippets/python-mode/__getattr__ elpa/elpy-1.18.0/snippets/python-mode/__getattribute__ elpa/elpy-1.18.0/snippets/python-mode/__getitem__ elpa/elpy-1.18.0/snippets/python-mode/__gt__ elpa/elpy-1.18.0/snippets/python-mode/__hash__ elpa/elpy-1.18.0/snippets/python-mode/__hex__ elpa/elpy-1.18.0/snippets/python-mode/__iadd__ elpa/elpy-1.18.0/snippets/python-mode/__iand__ elpa/elpy-1.18.0/snippets/python-mode/__idiv__ elpa/elpy-1.18.0/snippets/python-mode/__ifloordiv__ elpa/elpy-1.18.0/snippets/python-mode/__ilshift__ elpa/elpy-1.18.0/snippets/python-mode/__imod__ elpa/elpy-1.18.0/snippets/python-mode/__imul__ elpa/elpy-1.18.0/snippets/python-mode/__index__ elpa/elpy-1.18.0/snippets/python-mode/__init__ elpa/elpy-1.18.0/snippets/python-mode/__instancecheck__ elpa/elpy-1.18.0/snippets/python-mode/__int__ elpa/elpy-1.18.0/snippets/python-mode/__invert__ elpa/elpy-1.18.0/snippets/python-mode/__ior__ elpa/elpy-1.18.0/snippets/python-mode/__ipow__ elpa/elpy-1.18.0/snippets/python-mode/__irshift__ elpa/elpy-1.18.0/snippets/python-mode/__isub__ elpa/elpy-1.18.0/snippets/python-mode/__iter__ elpa/elpy-1.18.0/snippets/python-mode/__itruediv__ elpa/elpy-1.18.0/snippets/python-mode/__ixor__ elpa/elpy-1.18.0/snippets/python-mode/__le__ elpa/elpy-1.18.0/snippets/python-mode/__len__ elpa/elpy-1.18.0/snippets/python-mode/__long__ elpa/elpy-1.18.0/snippets/python-mode/__lshift__ elpa/elpy-1.18.0/snippets/python-mode/__lt__ elpa/elpy-1.18.0/snippets/python-mode/__mod__ elpa/elpy-1.18.0/snippets/python-mode/__mul__ elpa/elpy-1.18.0/snippets/python-mode/__ne__ elpa/elpy-1.18.0/snippets/python-mode/__neg__ elpa/elpy-1.18.0/snippets/python-mode/__new__ elpa/elpy-1.18.0/snippets/python-mode/__nonzero__ elpa/elpy-1.18.0/snippets/python-mode/__oct__ elpa/elpy-1.18.0/snippets/python-mode/__or__ elpa/elpy-1.18.0/snippets/python-mode/__pos__ elpa/elpy-1.18.0/snippets/python-mode/__pow__ elpa/elpy-1.18.0/snippets/python-mode/__radd__ elpa/elpy-1.18.0/snippets/python-mode/__rand__ elpa/elpy-1.18.0/snippets/python-mode/__rdivmod__ elpa/elpy-1.18.0/snippets/python-mode/__repr__ elpa/elpy-1.18.0/snippets/python-mode/__reversed__ elpa/elpy-1.18.0/snippets/python-mode/__rfloordiv__ elpa/elpy-1.18.0/snippets/python-mode/__rlshift__ elpa/elpy-1.18.0/snippets/python-mode/__rmod__ elpa/elpy-1.18.0/snippets/python-mode/__rmul__ elpa/elpy-1.18.0/snippets/python-mode/__ror__ elpa/elpy-1.18.0/snippets/python-mode/__rpow__ elpa/elpy-1.18.0/snippets/python-mode/__rrshift__ elpa/elpy-1.18.0/snippets/python-mode/__rshift__ elpa/elpy-1.18.0/snippets/python-mode/__rsub__ elpa/elpy-1.18.0/snippets/python-mode/__rtruediv__ elpa/elpy-1.18.0/snippets/python-mode/__rxor__ elpa/elpy-1.18.0/snippets/python-mode/__set__ elpa/elpy-1.18.0/snippets/python-mode/__setattr__ elpa/elpy-1.18.0/snippets/python-mode/__setitem__ elpa/elpy-1.18.0/snippets/python-mode/__slots__ elpa/elpy-1.18.0/snippets/python-mode/__str__ elpa/elpy-1.18.0/snippets/python-mode/__sub__ elpa/elpy-1.18.0/snippets/python-mode/__subclasscheck__ elpa/elpy-1.18.0/snippets/python-mode/__truediv__ elpa/elpy-1.18.0/snippets/python-mode/__unicode__ elpa/elpy-1.18.0/snippets/python-mode/__xor__ elpa/elpy-1.18.0/snippets/python-mode/ase elpa/elpy-1.18.0/snippets/python-mode/asne elpa/elpy-1.18.0/snippets/python-mode/asr elpa/elpy-1.18.0/snippets/python-mode/class elpa/elpy-1.18.0/snippets/python-mode/defs elpa/elpy-1.18.0/snippets/python-mode/enc elpa/elpy-1.18.0/snippets/python-mode/env elpa/elpy-1.18.0/snippets/python-mode/from elpa/elpy-1.18.0/snippets/python-mode/pdb elpa/elpy-1.18.0/snippets/python-mode/py3 elpa/elpy-1.18.0/snippets/python-mode/super elpa/elpy-1.25.0/elpy-autoloads.el elpa/elpy-1.25.0/elpy-django.el elpa/elpy-1.25.0/elpy-pkg.el elpa/elpy-1.25.0/elpy-profile.el elpa/elpy-1.25.0/elpy-refactor.el elpa/elpy-1.25.0/elpy-shell.el elpa/elpy-1.25.0/elpy.el elpa/elpy-1.25.0/elpy/__init__.py elpa/elpy-1.25.0/elpy/__main__.py elpa/elpy-1.25.0/elpy/auto_pep8.py elpa/elpy-1.25.0/elpy/blackutil.py elpa/elpy-1.25.0/elpy/compat.py elpa/elpy-1.25.0/elpy/jedibackend.py elpa/elpy-1.25.0/elpy/pydocutils.py elpa/elpy-1.25.0/elpy/refactor.py elpa/elpy-1.25.0/elpy/rpc.py elpa/elpy-1.25.0/elpy/server.py elpa/elpy-1.25.0/elpy/tests/__init__.py elpa/elpy-1.25.0/elpy/tests/compat.py elpa/elpy-1.25.0/elpy/tests/support.py elpa/elpy-1.25.0/elpy/tests/test_auto_pep8.py elpa/elpy-1.25.0/elpy/tests/test_black.py elpa/elpy-1.25.0/elpy/tests/test_jedibackend.py elpa/elpy-1.25.0/elpy/tests/test_pydocutils.py elpa/elpy-1.25.0/elpy/tests/test_refactor.py elpa/elpy-1.25.0/elpy/tests/test_rpc.py elpa/elpy-1.25.0/elpy/tests/test_server.py elpa/elpy-1.25.0/elpy/tests/test_support.py elpa/elpy-1.25.0/elpy/tests/test_yapf.py elpa/elpy-1.25.0/elpy/yapfutil.py elpa/elpy-1.25.0/snippets/python-mode/.yas-setup.el elpa/elpy-1.25.0/snippets/python-mode/__abs__ elpa/elpy-1.25.0/snippets/python-mode/__add__ elpa/elpy-1.25.0/snippets/python-mode/__and__ elpa/elpy-1.25.0/snippets/python-mode/__bool__ elpa/elpy-1.25.0/snippets/python-mode/__call__ elpa/elpy-1.25.0/snippets/python-mode/__cmp__ elpa/elpy-1.25.0/snippets/python-mode/__coerce__ elpa/elpy-1.25.0/snippets/python-mode/__complex__ elpa/elpy-1.25.0/snippets/python-mode/__contains__ elpa/elpy-1.25.0/snippets/python-mode/__del__ elpa/elpy-1.25.0/snippets/python-mode/__delattr__ elpa/elpy-1.25.0/snippets/python-mode/__delete__ elpa/elpy-1.25.0/snippets/python-mode/__delitem__ elpa/elpy-1.25.0/snippets/python-mode/__div__ elpa/elpy-1.25.0/snippets/python-mode/__divmod__ elpa/elpy-1.25.0/snippets/python-mode/__enter__ elpa/elpy-1.25.0/snippets/python-mode/__eq__ elpa/elpy-1.25.0/snippets/python-mode/__exit__ elpa/elpy-1.25.0/snippets/python-mode/__float__ elpa/elpy-1.25.0/snippets/python-mode/__floordiv__ elpa/elpy-1.25.0/snippets/python-mode/__ge__ elpa/elpy-1.25.0/snippets/python-mode/__get__ elpa/elpy-1.25.0/snippets/python-mode/__getattr__ elpa/elpy-1.25.0/snippets/python-mode/__getattribute__ elpa/elpy-1.25.0/snippets/python-mode/__getitem__ elpa/elpy-1.25.0/snippets/python-mode/__gt__ elpa/elpy-1.25.0/snippets/python-mode/__hash__ elpa/elpy-1.25.0/snippets/python-mode/__hex__ elpa/elpy-1.25.0/snippets/python-mode/__iadd__ elpa/elpy-1.25.0/snippets/python-mode/__iand__ elpa/elpy-1.25.0/snippets/python-mode/__idiv__ elpa/elpy-1.25.0/snippets/python-mode/__ifloordiv__ elpa/elpy-1.25.0/snippets/python-mode/__ilshift__ elpa/elpy-1.25.0/snippets/python-mode/__imod__ elpa/elpy-1.25.0/snippets/python-mode/__imul__ elpa/elpy-1.25.0/snippets/python-mode/__index__ elpa/elpy-1.25.0/snippets/python-mode/__init__ elpa/elpy-1.25.0/snippets/python-mode/__instancecheck__ elpa/elpy-1.25.0/snippets/python-mode/__int__ elpa/elpy-1.25.0/snippets/python-mode/__invert__ elpa/elpy-1.25.0/snippets/python-mode/__ior__ elpa/elpy-1.25.0/snippets/python-mode/__ipow__ elpa/elpy-1.25.0/snippets/python-mode/__irshift__ elpa/elpy-1.25.0/snippets/python-mode/__isub__ elpa/elpy-1.25.0/snippets/python-mode/__iter__ elpa/elpy-1.25.0/snippets/python-mode/__itruediv__ elpa/elpy-1.25.0/snippets/python-mode/__ixor__ elpa/elpy-1.25.0/snippets/python-mode/__le__ elpa/elpy-1.25.0/snippets/python-mode/__len__ elpa/elpy-1.25.0/snippets/python-mode/__long__ elpa/elpy-1.25.0/snippets/python-mode/__lshift__ elpa/elpy-1.25.0/snippets/python-mode/__lt__ elpa/elpy-1.25.0/snippets/python-mode/__mod__ elpa/elpy-1.25.0/snippets/python-mode/__mul__ elpa/elpy-1.25.0/snippets/python-mode/__ne__ elpa/elpy-1.25.0/snippets/python-mode/__neg__ elpa/elpy-1.25.0/snippets/python-mode/__new__ elpa/elpy-1.25.0/snippets/python-mode/__nonzero__ elpa/elpy-1.25.0/snippets/python-mode/__oct__ elpa/elpy-1.25.0/snippets/python-mode/__or__ elpa/elpy-1.25.0/snippets/python-mode/__pos__ elpa/elpy-1.25.0/snippets/python-mode/__pow__ elpa/elpy-1.25.0/snippets/python-mode/__radd__ elpa/elpy-1.25.0/snippets/python-mode/__rand__ elpa/elpy-1.25.0/snippets/python-mode/__rdivmod__ elpa/elpy-1.25.0/snippets/python-mode/__repr__ elpa/elpy-1.25.0/snippets/python-mode/__reversed__ elpa/elpy-1.25.0/snippets/python-mode/__rfloordiv__ elpa/elpy-1.25.0/snippets/python-mode/__rlshift__ elpa/elpy-1.25.0/snippets/python-mode/__rmod__ elpa/elpy-1.25.0/snippets/python-mode/__rmul__ elpa/elpy-1.25.0/snippets/python-mode/__ror__ elpa/elpy-1.25.0/snippets/python-mode/__rpow__ elpa/elpy-1.25.0/snippets/python-mode/__rrshift__ elpa/elpy-1.25.0/snippets/python-mode/__rshift__ elpa/elpy-1.25.0/snippets/python-mode/__rsub__ elpa/elpy-1.25.0/snippets/python-mode/__rtruediv__ elpa/elpy-1.25.0/snippets/python-mode/__rxor__ elpa/elpy-1.25.0/snippets/python-mode/__set__ elpa/elpy-1.25.0/snippets/python-mode/__setattr__ elpa/elpy-1.25.0/snippets/python-mode/__setitem__ elpa/elpy-1.25.0/snippets/python-mode/__slots__ elpa/elpy-1.25.0/snippets/python-mode/__str__ elpa/elpy-1.25.0/snippets/python-mode/__sub__ elpa/elpy-1.25.0/snippets/python-mode/__subclasscheck__ elpa/elpy-1.25.0/snippets/python-mode/__truediv__ elpa/elpy-1.25.0/snippets/python-mode/__unicode__ elpa/elpy-1.25.0/snippets/python-mode/__xor__ elpa/elpy-1.25.0/snippets/python-mode/ase elpa/elpy-1.25.0/snippets/python-mode/asne elpa/elpy-1.25.0/snippets/python-mode/asr elpa/elpy-1.25.0/snippets/python-mode/class elpa/elpy-1.25.0/snippets/python-mode/defs elpa/elpy-1.25.0/snippets/python-mode/enc elpa/elpy-1.25.0/snippets/python-mode/env elpa/elpy-1.25.0/snippets/python-mode/from elpa/elpy-1.25.0/snippets/python-mode/pdb elpa/elpy-1.25.0/snippets/python-mode/py3 elpa/elpy-1.25.0/snippets/python-mode/super |
diffstat | 131 files changed, 691 insertions(+), 847 deletions(-) [+] |
line wrap: on
line diff
deleted file mode 100644 --- a/elpa/elpy-1.18.0/NEWS.rst +++ /dev/null @@ -1,554 +0,0 @@ -New in Elpy 1.18.0 -================== - -- Elpy is now using MELPA Stable as the official distribution point. - Please remove jorgenschaefer.github.io from your sources list if you - still use it. It will not receive further updates after 1.18. -- New commands for interacting with the Python shell, thanks to Rainer - Gemulla. Check them out at - https://elpy.readthedocs.io/en/latest/ide.html#evaluating-code-fragments -- Shells started using ``C-c C-z`` will now use the project root as - the current directory, to be in line with other code sending - functionality. -- importmagic has been removed. While this package added some nice - functionality to Elpy, the way it worked by importing every module - caused a lot of bugs. It was not an easy decision, but this is - better for most Elpy users. -- Rope is no longer supported for completions and similar - functionality. Refactoring support using Rope is still there. Sadly, - Rope has not received much of any update in a long time, and - attempts to revive it failed. Maintaining multiple code paths to - support both Jedi and Rope was complicated, so we decided to get rid - of Rope for these features. Jedi is almost always an equivalent if - not better choice. -- The Green test runner is now supported by default. -- Beyond all of this, there were numerous bugfixes. - -We are happy to report that Elpy now has more maintainers! Daniel -Gopar, Rainer Gemulla and @galaunay are now helping regularly with -this project. - -Thanks to all the contributors! - - -New in Elpy 1.17.0 -================== - -- The xref functionality in newer Emacsen is now supported for - following symbols at point. -- Elpy now supports PEP 397 for Windows executable names. -- In addition to pylint, Elpy now also supports epylint correctly. -- A number of features for working with interactive Python have been added to - Elpy; e.g., commands for sending code fragments to the Python shell and the - ability to echo their output in the message area. See the documentation for a - full list. -- Bunch of little bugfixes. - - -New in Elpy 1.16.0 -================== - -- You can now change which function is used to run test commands, - instead of the default ``compile``, using - ``elpy-test-compilation-function``. This allows using ``pdb`` to run - tests in a debugger, for example. -- Elpy now sets ``IPY_TEST_SIMPLE_PROMPT``, which should prevent a - number of problems with IPython 5. -- If you like Elpy, you can now sponsor its development using Patreon - at https://www.patreon.com/jorgenschaefer - - -New in Elpy 1.15.0 -================== - -- Elpy now supports profiling, try ``elpy-profile-buffer-or-region``! -- Do not randomly downcase completion candidates anymore. -- Work around a bug in Emacs 25.1 and before related to current - IPython shells. -- And lots of other bugfixes. - - -New in Elpy 1.14.0 -================== - -- Basic Django support. Try ``C-c C-x c`` and ``C-c C-x r``! Thanks to - Daniel Gopar for this. -- You can now use manage.py to run Django tests, instead of always - using django-admin.py. -- When called with a prefix argument ``elpy-importmagic-add-import`` - will now ask for an alias name to import as. - - -New in Elpy 1.13.0 -================== - -- Fewer surprises with syntax checks, ``C-c C-z``, reformatting -- Improved behavior for reformatting. -- Improved documentation for IPython. IPython 5 broke a lot of things - with Emacs. Use it at your own risk. - - -New in Elpy 1.12.0 -================== - -- Some symbols can now be completed with parentheses after them, - useful for functions. The heuristic for when to add parentheses and - not is not optimal, so this is not enabled by default—customize - ``elpy-company-post-completion-function`` to enable this feature. -- Support dedicated Python shells (one per Python file). You can - customized ``elpy-dedicated-shells`` to make this the default. -- Elpy now uses ``python -m pip`` instead of pip directly to improve - interaction with virtualenvs. -- Support for Python 2.6 has been officially dropped. -- Display for backend errors has been disabled by default. Jedi has - not had a release in a long while, and many bugs have been unfixed. - These errors have only caused added workload for Elpy maintainers. - The option will be reverted once Jedi has had a new release. - - -New in Elpy 1.11.0 -================== - -- Elpy now supports yapf to format your code. -- You can now adjust whether Elpy should hide modes from the mode line - or not using ``elpy-remove-modeline-lighter`` -- When the new option ``elpy-disable-backend-error-display`` is set, - Elpy will not show its error pop-up anymore. This can be useful if - you run into an annoying bug in Jedi, for example. -- New command ``elpy-goto-definition-other-window`` on ``C-x 4 M-.``. -- Expanding ``super`` now gives the short form supported in Python 3. -- All Rope errors are now caught, as the upstream maintainers did not - show interest in distinguishing between malformed input and bugs in - their library. - - -New in Elpy 1.10.0 -================== - -- Marking the current indentation level at the top level will now mark - the whole buffer. -- The region will be normalized before re-indenting it, making the - behavior more predictable for partially marked lines. -- Using autopep8 on the whole buffer will now keep point (roughly) at - the same location as it was. -- The autopep8 code now also uses the same configuration options as - the command line tool. -- Malformed JSON data from the backend is now handled better. -- RPC processes are restarted when the current virtualenv changes. -- Python 3.5 is now officially supported. -- Flymake will now not be enabled in buffers without file name, where - it can't run anyhow, or when the checker program does not exist in - the first place. -- It is now possible to ask Elpy not to remove the mode line lighter - of company mode, which can be useful if you use company in other - modes. -- Test discovery now also allows file names without "test" in them to - be tested. Classes and methods still require the substring, though. -- Spurious equals signs at the end of completions from Jedi will now - be ignored. -- Various other bug fixes. - - -New in Elpy 1.9.0 -================= - -- Elpy now supports the ``autopep8`` library for automatically - formatting Python code. All refactoring-related code is now grouped - under ``C-c C-r``. Use ``C-c C-r i`` to fix up imports using - importmagic, ``C-c C-r p`` to fix up Python code with autopep8, and - ``C-c C-r r`` to bring up the old Rope refactoring menu. -- ``C-c C-b`` will now select a region containing surrounding lines of - the current indentation or more. -- ``C-c C-z`` in a Python shell will now switch back to the last - Python buffer, allowing to use the key to cycle back and forth - between the Python buffer and shell. -- The pattern used for ``C-c C-s`` is now customizeable in - ``elpy-rgrep-file-pattern``. -- ``<C-return>`` now can be used to send the current statement to the - Python shell. Be careful, this can break with nested statements. -- The Elpy minor mode now also works in modes derived from - ``python-mode``, not just in the mode itself. - - -New in Elpy 1.8.1 -================= - -- Ignore a ``KeyError`` from Jedi 0.9.0 which occurs a lot in normal - code. - - -New in Elpy 1.8.0 -================= - -- Emacs 24.5 is now officially supported -- The new configuration option ``elpy-rpc-ignored-buffer-size`` defines a maximum buffer size to be handle completion in, to avoid laggy interaction in unusually large files -- Indentation block movement was replaced with code that just moves the marked block or the current line; this should be a lot less magical and more predictable -- Running the test at point now correctly ignores any inner methods -- Jedi docstrings now show the full name of the object -- The RPC interpreter is now chosen correctly on cygwin -- ``elpy-shell-send-region-or-buffer`` now warns of tabs in the data being sent -- Elpy now binds stdout and stderr to ``/dev/null`` to avoid being confused by spurious output from other libraries -- RPC buffers (and processes) are removed after some time to avoid them piling up endlessly -- It is not possibly anymore to use customize alone to use ipython, because of some bad interaction between custom options in Elpy and python.el -- And lots of bugfixes (50 issues closed!) - - -New in Elpy 1.7.1 -================= - -- Do not fail on errors from importmagic. -- Handle new minor mode behavior of new versions of yasnippet. -- Do use the argument to ``elpy-use-ipython`` correctly. -- Handle unexpected data from the backend more gracefully. - - -New in Elpy 1.7.0 -================= - -- Elpy now can add missing import directives automatically, by using - Alec Thomas' excellent importmagic_ library. Use ``C-c C-m`` to add - a single import statement, or ``C-c C-S-m`` to include all missing - import statements. Many thanks to Georg Brandl for doing a lot of - work to bring this feature to Elpy! -- The Jedi backend now also supports ``C-c C-d`` to display a - docstring. Thanks again to Georg Brandl for the patch. -- It is now possible to disable the display of the current function in - the echo area by setting ``elpy-eldoc-show-current-function`` to - ``nil``. -- idomenu was removed. -- Twisted's Trial test runner is now supported. Thanks to Elric Milon - for the patch! -- All test runners now use a variable to decide which command to run, - which for example allows using ``manage.py`` for the Django test - runner, or your own test script which sets up the environment - correctly. -- Emacs 24.4 is now officially supported. -- Various bugfixes. - -.. _importmagic: https://github.com/alecthomas/importmagic - -New in Elpy 1.6.0 -================= - -- When point is on a line with a flymake error, Elpy will now show the - error in the echo area. -- The movement commands (``C-<cursor>``) have been reworked again. - Going left and right will now move by indentation levels left of the - current indentation, i.e. jump four spaces, and by words right of - the current indentation. Going up and down will go to the previous - or next line with the indentation level point is at, not the - indentation the line has. Try it, it's more difficult to explain - than to use. -- Completion results are now sorted more sensibly, with - single-underscore symbols at the end, and double-underscore symbols - after normal symbols, but before single-underscore ones. -- ``M-x elpy-config`` will now point out if there are newer versions - available for packages used by Elpy. -- ``M-x elpy-config`` will now warn if ``~/.local/bin`` is not in - ``PATH`` while there is no virtualenv active. -- The ``M-x elpy-version`` command is back by popular demand. -- RPC buffers used by Elpy are now hidden by default, having a space - at the beginning of the name. -- When the Rope library throws an error, Elpy will now also attempt to - provide reproduction steps. This used to only happen for Jedi. -- Various bug fixes. - - -New in Elpy 1.5.1 -================= - -- Fix a bug where company-mode might get confused about the current - backend, leading to an error about ``Symbol's function definition is - void: nil`` -- Fix Rope so it won’t search the whole project directory. This was an - intended feature in v1.5 which did not work originally. -- Use ``yas-text`` instead of ``text`` in snippets for compatibility - with the unreleased yasnippet from MELPA (thanks to Daniel Wu!) - -New in Elpy 1.5.0 -================= - -- Elpy now has a `manual`_. Additionally, there's a menu bar now which - should make it easier to discover Elpy features. -- The Elpy Python package now ships with the Emacs Lisp package, - removing the need to install Elpy via pip. -- Python 3.4 is now officially supported. -- The new command ``elpy-config`` can be used to configure Elpy using - Emacs' built-in customize system. Elpy has been changed to make the - most of this. -- Elpy now uses company-mode instead of auto-complete for on-the-fly - auto completion. This changes a few things. There is no automatic - documentation popup anymore. Instead, you can type ``C-d`` and get - the documentation buffer. In addition, you can type ``C-w`` to see - the source of the current candidate in context. -- Elpy now uses pyvenv as the virtualenv module, enabling - virtualenvwrapper hooks. -- We now ship with a large number of YASnippet snippets. Try ``M-x - yas-insert-snippet``. -- The new unified test running interface on ``C-c C-t`` will try to - determine the current test and run it, or, failing that, run all - tests. Provide a prefix argument to just run all tests no matter - what. You can change the test runner to be used using - ``elpy-set-test-runner``. Elpy supports the default unittest - discover runner, the Django discover runner, nosetests and py.test - by default. New test runners can easily be defined. -- There's a new multi-edit functionality. ``C-c C-e`` will edit all - occurrences of the symbol under point. When using Jedi, this is - using semantic information as opposed to just syntactic one. When a - region is active, edit all occurrences of the text in region in the - current buffer. -- When sending Python code to the interactive interpreter using ``C-c - C-c``, Elpy will now not automatically pop to the interpreter - anymore. Use ``C-c C-z`` to switch to the interpreter. -- Elpy will now display the current class and function if there is no - call tip to be displayed. Removes the ``C-c C-q`` binding. -- If there is a call tip, highlight the current argument (requires Jedi). -- The documentation interface using ``C-c C-d`` is much smarter now, - falling back to pydoc when necessary and providing sensible - completion for that, too. Provide a prefix argument if you want no - smarts, just pydoc. -- ``<S-return>`` and ``<C-S-return>`` now open a line below or above - the current one. -- ``<C-cursor>`` will now navigate between Python blocks of the same - indentation level. ``<M-cursor>`` will move the current block. Try - it, it's easier to understand when you see it than to explain it. -- There's a new concept of modules. The variable - ``elpy-default-minor-modes`` is gone (use ``elpy-mode-hook`` for - minor modes). Instead, there's now ``elpy-modules`` which can be - used to enable or disable certain features of Elpy. -- ``elpy-clean-modeline`` is gone, modules now clean themselves up. -- Elpy now distinguishes between the project root, where project files - are located, and the library root, which should be part of - ``sys.path`` to import the module under development. -- ``elpy-project-ignored-directories`` replaces the old - ``elpy-rgrep-ignored-directories`` and is used by more features. -- ``elpy-doc-websearch`` has been removed as it was barely useable - as is. -- Elpy now tries to be more helpful when errors in the backend happen. - This removes ``elpy-rpc-traceback``, as that will be displayed by - default. -- Optimizations were added to handle large files, making general - interaction a lot faster. -- When Rope is being used, do not search through unusually large - directories. This should speed up interaction in those cases, - especially when editing a file in the home directory. -- And a whole lot of minor bug fixes and little improvements. - -.. _manual: https://elpy.readthedocs.io/ - - -New in Elpy 1.4.2 -================== - -- Minor bugfix to prevent an error from projectile-project-root to - interfere with Elpy’s project finding strategy. - -New in Elpy 1.4.1 -================= - -- Elpy now sets project-wide preferences for Rope, enabling completion - in the sys package, among others. -- An error is avoided in the Jedi backend when trying to go to symbols - in compiled packages. -- A compatibility alias was added for nose.el, which insists on - breaking backwards compatibility with Emacs 24.x. - -New in Elpy 1.4.0 -================= - -- Elpy has moved to its own ELPA. Make sure to update your - package-archives (as described above). -- For a file in a Projectile-managed project is opened, Elpy will now - use Projectile’s project root. -- When the user has set a valid python-check-command, elpy will now - refrain from overriding it. -- On Windows, elpy is now using the pythonw.exe interpreter for the - RPC process, as that seems to be causing fewer issues. -- And various smaller bugfixes. - -New in Elpy 1.3.0 -================= - -- virtualenv.el has been replaced by pyvenv.el, as that library offers - more features. -- elpy-rpc-restart now works globally, not just in Elpy buffers. -- Elpy does not try to complete in comments anymore. -- The new command elpy-rpc-traceback gives access to the last stack - trace in the Elpy backend, helping with debugging problems. -- The flymake check function is now run with the current directory as - / to avoid accidental imports. -- Ensure correct handling of yas-snippet-dirs by Elpy. This variable - can be a string, so ensure it’s a list before adding to it. -- The new variable elpy-show-installation-instructions can be used to - disable the installation screen. -- Fix a very nasty bug causing spurious empty lines in a buffer or - consume 100% CPU in certain situations when using the Jedi backend. - Thanks to Matthias Dahl for finding this bug. -- Various other bugfixes. - -New in Elpy 1.2.1 -================= - -Bugfix release. - -- The refactoring was not ported to the new asynchronous API, - resulting in an error when refactoring was attempted. -- The project root now always returns a directory. Too many parts of - elpy relies on this. If the project root turns out to be your home - directory, elpy will warn you about it. -- Elpy now works correctly with Emacs 24.2. There were some - compatibility functions missing. -- Blocking RPC calls now do not block for one second even if there is - process output. - -New in Elpy 1.2 -=============== - -- Elpy now uses asynchronous RPC. This means that Emacs should not - freeze anymore while eldoc or auto-complete functions run. -- ``elpy-shell-send-region-or-buffer`` will now remove common - indentation of the region, making it possible to easily send parts - of an if statement or function body without manually adjusting the - indentation. -- The Python package depends on ``flake8``, and will also try to be - smarter when detecting ``flake8`` for on-the-fly checking. -- ``elpy-check`` can be run with a prefix argument to check the whole - project, instead of only the current file. -- ``elpy-rgrep-symbol`` now ignores a few common directories - (``.tox``, ``build``, ``dist``). -- When using the rope backend, Elpy will not create the - ``.ropeproject`` folders anymore. This should keep projects a lot - cleaner. - -New in Elpy 1.1 -=============== - -- Elpy now always uses the root directory of the package as the - project root; this should avoid some confusion and improve - auto-completion suggestions -- ``elpy-shell-send-region-or-buffer`` now accepts a prefix argument - to run code wrapped behind ``if __name__ == '__main__'``, which is - ignored by default -- ``elpy-project-root`` is now a safe local variable and can be set - from file variables -- Elpy now supports project-specific RPC processes, see - ``elpy-rpc-project-specific`` for how to use this -- ``M-*`` now works to go back where you came from after a ``M-.`` -- Elpy now ships with a few dedicated snippets for YASnippet -- Support and require Jedi 0.6.0 - -New in Elpy 1.0 -=============== - -- Version 0.9 was a release candidate, so this release focused on bug - fixes instead of new features. -- ``elpy-enable`` now takes an optional argument that skips variable - initialization for those users who prefer their own defaults for - other modes. -- ``python-check.sh`` has been removed from Elpy, as the flake8 tool - from pypi does everything it does, only better. -- Elpy will now start the helper subprocess in the root directory, - avoiding accidental Python path clobbering. - -New in Elpy 0.9 -=============== - -- Elpy now officially support Python 2.6, 2.7 and 3.3 on Emacs 24.2 - and 24.3, with continuous integration tests thanks to - `Travis CI`_. -- Extended support for Pydoc. ``C-u C-c C-d`` will now prompt for an - auto-completed symbol to run Pydoc on. The pydoc output will be - formatted and placed in a help buffer for easy review. -- Refactoring support is back. ``C-c C-r`` will pop up a refactoring - wizard offering various refactoring options. Most of them depend on - the presence of Rope, though, even if Jedi is used as a completion - backend. -- The Rope backend has been extended to provide completions for - modules in an import clause. -- New refactoring option: Add missing imports. This will search for - undefined symbols in the current file and automatically add - appropriate imports. -- ``C-c C-c (elpy-rgrep-symbol)`` now prompts for a regexp when a prefix - argument is given instead of using the symbol at point. - -.. _Travis CI: https://travis-ci.org/ - -New in Elpy 0.8 -=============== - -Python Backend Rewrite ----------------------- - -- Elpy does not use Pymacs, Ropemacs and Ropemode anymore, but instead - provides its own Python interface with the elpy package on PyPI. -- This not only should improve performance, but also enables using - Jedi as an alternative backend for completion. Use ``M-x - elpy-set-backend`` to change between rope and jedi. For now, this - does disable all refactoring support, though. - -Project Support ---------------- - -- Elpy now has built-in project support. The interface is rather - simple: You can set ``elpy-project-root`` to the correct value in - ``.dir-locals.el``, or just rely on the automatic detection. If you - change your mind, you can always just ``elpy-set-project-root``. -- New dependency: Find File in Project (ffip), bound to ``C-c C-f`` by - default. This will allow you to find files anywhere in your project - using a search-as-you-type interface like ido. -- New dependency: nose, bound to ``C-c C-t`` by default. This will run - the nosetests binary in the root of your current library directory. - You can restrict the tests being run to the current test or the - current module by adding prefix arguments. -- New function: Recursive grep for symbol, bound to ``C-c C-s`` by - default. This will search for the symbol at point in the whole - project. - -New dependencies ----------------- - -- idomenu, bound to ``C-c C-j`` by default. This replaces the standard - imenu interface with an ido-based search-as-you-type interface for - definitions in the current buffer. -- virtualenv.el, replacing pyvirtualenv.el). Use ``M-x - virtualenv-workon`` to enable a virtualenv. -- iedit.el, bound to ``M-,`` by default. This highlights all occurrences - of the symbol at point or the active region in the current buffer or - narrowing. When you edit any of them, all others will be edited the - same. This allows some basic and very quick refactoring. -- New variable ``elpy-default-minor-modes`` which is run by ``elpy-mode`` - on startup. If you don’t want to use some modes, remove them from - here. - -Key Bindings and Functions --------------------------- - -- The key bindings have been reworked and cleaned up. Sorry, this - might cause confusion. -- Yasnippet is now on its own keybinding, ``C-c C-i``, instead of - sharing the auto-complete interface. This was done because some - snippets conflicted with legitimate, unsnippy completions. -- New function: Occur Definitions, bound to ``C-c C-o`` by default. This - will run the standard occur command to show definitions (classes and - functions) in your current buffer, giving you a very quick outline - and the ability to jump to different definitions quickly. -- New function: Show Defun, bound to ``C-c C-q`` by default. This will - show the current method and possibly class in the mode line, which - is helpful in long functions. -- New functions: Forward/backward definition, bound to ``M-n`` and ``M-p`` - as well as ``<M-down>`` and ``<M-up>`` by default. These will jump to - the next or previous definition (class or function), helping with - quick navigation through a file. - -Miscellaneous -------------- - -- The documentation function (``C-c C-d``) now uses pydoc when a prefix - arg is given. -- The web search function (``C-c C-w``) now searches for the current - symbol by default. The tab-completing web documentation interface - was removed and is scheduled to be replaced with a new pydoc - interface in future versions. -- The ``python-check.sh`` is now shipped with elpy. If you load elpy.el - before you load python.el, it should be the default - ``python-check-command``.
rename from elpa/elpy-1.18.0/elpy-autoloads.el rename to elpa/elpy-1.25.0/elpy-autoloads.el --- a/elpa/elpy-1.18.0/elpy-autoloads.el +++ b/elpa/elpy-1.25.0/elpy-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) -;;;### (autoloads nil "elpy" "elpy.el" (23172 38714 746030 40000)) +;;;### (autoloads nil "elpy" "elpy.el" (23487 42492 429351 415000)) ;;; Generated autoloads from elpy.el (autoload 'elpy-enable "elpy" "\ @@ -39,7 +39,7 @@ ;;;*** ;;;### (autoloads nil nil ("elpy-django.el" "elpy-pkg.el" "elpy-profile.el" -;;;;;; "elpy-refactor.el" "elpy-shell.el") (23172 38715 78030 718000)) +;;;;;; "elpy-refactor.el" "elpy-shell.el") (23487 42492 437351 994000)) ;;;***
rename from elpa/elpy-1.18.0/elpy-django.el rename to elpa/elpy-1.25.0/elpy-django.el --- a/elpa/elpy-1.18.0/elpy-django.el +++ b/elpa/elpy-1.25.0/elpy-django.el @@ -34,21 +34,21 @@ Best to set it to full path to 'manage.py' if it's available." :type 'string :safe 'stringp - :group 'elpy) + :group 'elpy-django) (make-variable-buffer-local 'elpy-django-command) (defcustom elpy-django-server-ipaddr "127.0.0.1" "What address Django will use when running the dev server." :type 'string :safe 'stringp - :group 'elpy) + :group 'elpy-django) (make-variable-buffer-local 'elpy-django-server-ipaddr) (defcustom elpy-django-server-port "8000" "What port Django will use when running the dev server." :type 'string :safe 'stringp - :group 'elpy) + :group 'elpy-django) (make-variable-buffer-local 'elpy-django-server-port) (defcustom elpy-django-server-command "runserver" @@ -56,7 +56,7 @@ command to use." :type 'string :safe 'stringp - :group 'elpy) + :group 'elpy-django) (make-variable-buffer-local 'elpy-django-server-command) (defcustom elpy-django-always-prompt nil @@ -64,7 +64,7 @@ to pass with the chosen command." :type 'boolean :safe 'booleanp - :group 'elpy) + :group 'elpy-django) (make-variable-buffer-local 'elpy-django-always-prompt) (defcustom elpy-django-commands-with-req-arg '("startapp" "startproject" @@ -75,9 +75,47 @@ require arguments in order for it to work." :type 'list :safe 'listp - :group 'elpy) + :group 'elpy-django) (make-variable-buffer-local 'elpy-django-commands-with-req-arg) +(defcustom elpy-django-test-runner-formats '(("django_nose.NoseTestSuiteRunner" . ":") + ("django.test.runner.DiscoverRunner" . ".")) + "List of test runners and their format for calling tests. + +Some tests runners are called differently. For example, Nose requires a ':' when calling specific tests, +but the default Django test runner uses '.'" + :type 'list + :safe 'listp + :group 'elpy-django) +(make-variable-buffer-local 'elpy-django-test-runner-formats) + +(defcustom elpy-django-test-runner-args '("test" "--noinput") + "Arguments to pass to the test runner when calling tests." + :type '(repeat string) + :group 'elpy-django) +(make-variable-buffer-local 'elpy-django-test-runner-args) + +(defcustom elpy-test-django-runner-command nil + "Deprecated. Please define Django command in `elpy-django-command' and +test arguments in `elpy-django-test-runner-args'" + :type '(repeat string) + :group 'elpy-django) +(make-obsolete-variable 'elpy-test-django-runner-command nil "March 2018") + +(defcustom elpy-test-django-runner-manage-command nil + "Deprecated. Please define Django command in `elpy-django-command' and +test arguments in `elpy-django-test-runner-args'." + :type '(repeat string) + :group 'elpy-django) +(make-obsolete-variable 'elpy-test-django-runner-manage-command nil "March 2018") + +(defcustom elpy-test-django-with-manage nil + "Deprecated. Please define Django command in `elpy-django-command' and +test arguments in `elpy-django-test-runner-args'." + :type 'boolean + :group 'elpy-django) +(make-obsolete-variable 'elpy-test-django-with-manage nil "March 2018") + ;;;;;;;;;;;;;;;;;;;;;; ;; Key map @@ -101,7 +139,7 @@ ;; This only affects the buffer if there's no directory ;; variable overwriting it. (setq elpy-django-command - (concat (locate-dominating-file default-directory "manage.py") "manage.py")) + (expand-file-name (concat (locate-dominating-file default-directory "manage.py") "manage.py"))) (elpy-django 1))) (defun elpy-django--get-commands () @@ -118,7 +156,8 @@ ;; cleanup [auth] and stuff (goto-char (point-min)) (save-excursion - (replace-regexp "\\[.*\\]" "")) + (while (re-search-forward "\\[.*\\]" nil t) + (replace-match "" nil nil))) (buffer-string)))) ;; get a list of commands from the output of manage.py -h ;; What would be the pattern to optimize this ? @@ -127,6 +166,37 @@ (setq dj-commands-str (mapcar (lambda (x) (s-trim x)) dj-commands-str)) (sort dj-commands-str 'string-lessp))) +(defun elpy-django--get-test-runner () + "Return the name of the django test runner. +Needs `DJANGO_SETTINGS_MODULE' to be set in order to work." + (let ((django-import-cmd "import django;django.setup();from django.conf import settings;print(settings.TEST_RUNNER)") + (django-settings-env (getenv "DJANGO_SETTINGS_MODULE")) + (default-directory (elpy-project-root))) + ;; If no Django settings has been set, then nothing will work. Warn user + (when (not django-settings-env) + (error "Please set environment variable `DJANGO_SETTINGS_MODULE' if you'd like to run the test runner")) + + ;; We have to be able to import the DJANGO_SETTINGS_MODULE to detect test + ;; runner; if python process importing settings exits with error, + ;; then warn the user that settings is not valid + (unless (= 0 (call-process elpy-rpc-python-command nil nil nil + "-c" (format "import %s" django-settings-env))) + (error (format "Unable to import DJANGO_SETTINGS_MODULE: '%s'" + django-settings-env))) + + ;; Return test runner + (s-trim (shell-command-to-string + (format "%s -c '%s'" elpy-rpc-python-command django-import-cmd))))) + +(defun elpy-django--get-test-format () + "When running a Django test, some test runners require a different format that others. +Return the correct string format here." + (let ((pair (assoc (elpy-django--get-test-runner) elpy-django-test-runner-formats))) + (if pair + ;; Return the associated test format + (cdr pair) + (error (format "Unable to find test format for `%s'" (elpy--get-django-test-runner)))))) + ;;;;;;;;;;;;;;;;;;;;;; ;;; User Functions @@ -161,9 +231,31 @@ (with-current-buffer "*compilation*" (rename-buffer buff-name)))) +(defun elpy-test-django-runner (top _file module test) + "Test the project using the Django discover runner, +or with manage.py if elpy-test-django-with-manage is true. + +This requires Django 1.6 or the django-discover-runner package." + (interactive (elpy-test-at-point)) + (if module + (apply #'elpy-test-run + top + (append + (list elpy-django-command) + elpy-django-test-runner-args + (list (if test + (format "%s%s%s" module (elpy-django--get-test-format) test) + module)))) + (apply #'elpy-test-run + top + (append + (list elpy-django-command) + elpy-django-test-runner-args)))) +(put 'elpy-test-django-runner 'elpy-test-runner-p t) + (define-minor-mode elpy-django - "Minor mode to for Django commands." - :group 'elpy) + "Minor mode for Django commands." + :group 'elpy-django) (provide 'elpy-django) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rename from elpa/elpy-1.18.0/elpy-pkg.el rename to elpa/elpy-1.25.0/elpy-pkg.el --- a/elpa/elpy-1.18.0/elpy-pkg.el +++ b/elpa/elpy-1.25.0/elpy-pkg.el @@ -1,4 +1,4 @@ -(define-package "elpy" "1.18.0" "Emacs Python Development Environment" +(define-package "elpy" "1.25.0" "Emacs Python Development Environment" '((company "0.9.2") (emacs "24.4") (find-file-in-project "3.3")
rename from elpa/elpy-1.18.0/elpy-refactor.el rename to elpa/elpy-1.25.0/elpy-refactor.el --- a/elpa/elpy-1.18.0/elpy-refactor.el +++ b/elpa/elpy-1.25.0/elpy-refactor.el @@ -130,7 +130,7 @@ boolean - A boolean question" (mapcar (lambda (arg) (let ((type (cadr arg)) - (prompt (caddr arg))) + (prompt (cl-caddr arg))) (cond ((equal type "offset") (aref pos 0))
rename from elpa/elpy-1.18.0/elpy-shell.el rename to elpa/elpy-1.25.0/elpy-shell.el --- a/elpa/elpy-1.18.0/elpy-shell.el +++ b/elpa/elpy-1.25.0/elpy-shell.el @@ -24,6 +24,10 @@ ;; ;;; Code: +(eval-when-compile (require 'subr-x)) +(require 'pyvenv) +(require 'python) + ;;;;;;;;;;;;;;;;;;;;;; ;;; User customization @@ -35,6 +39,10 @@ force the creation of dedicated shells for each buffers." :type 'boolean :group 'elpy) +(make-obsolete-variable 'elpy-dedicated-shells + "Dedicated shells are no longer supported by Elpy. +You can use `(add-hook 'elpy-mode-hook (lambda () (elpy-shell-toggle-dedicated-shell 1)))' to achieve the same result." + "1.17.0") (defcustom elpy-shell-display-buffer-after-send nil ; "Whether to display the Python shell after sending something to it." @@ -166,9 +174,6 @@ (defun elpy-shell-kill (&optional kill-buff) "Kill the current python shell. -If `elpy-dedicated-shells' is non-nil, -kill the current buffer dedicated shell. - If KILL-BUFF is non-nil, also kill the associated buffer." (interactive) (let ((shell-buffer (python-shell-get-buffer))) @@ -185,12 +190,11 @@ "Kill all active python shells. If KILL-BUFFERS is non-nil, also kill the associated buffers. -If ASK-FOR-EACH-ONE is non-nil, ask before killing each python process. -" +If ASK-FOR-EACH-ONE is non-nil, ask before killing each python process." (interactive) (let ((python-buffer-list ())) ;; Get active python shell buffers and kill inactive ones (if asked) - (loop for buffer being the buffers do + (cl-loop for buffer being the buffers do (when (and (buffer-name buffer) (string-match (rx bol "*Python" (opt "[" (* (not (any "]"))) "]") "*" eol) (buffer-name buffer))) @@ -201,15 +205,15 @@ (cond ;; Ask for each buffers and kill ((and python-buffer-list ask-for-each-one) - (loop for buffer in python-buffer-list do - (when (y-or-n-p (format "Kill %s ?" buffer)) + (cl-loop for buffer in python-buffer-list do + (when (y-or-n-p (format "Kill %s ? " buffer)) (delete-process buffer) (when kill-buffers (kill-buffer buffer))))) ;; Ask and kill every buffers (python-buffer-list - (if (y-or-n-p (format "Kill %s python shells ?" (length python-buffer-list))) - (loop for buffer in python-buffer-list do + (if (y-or-n-p (format "Kill %s python shells ? " (length python-buffer-list))) + (cl-loop for buffer in python-buffer-list do (delete-process buffer) (when kill-buffers (kill-buffer buffer))))) @@ -223,36 +227,65 @@ If SIT is non-nil, sit for that many seconds after creating a Python process. This allows the process to start up." (let* ((bufname (format "*%s*" (python-shell-get-process-name nil))) - (dedbufname (format "*%s*" (python-shell-get-process-name t))) - (proc (get-buffer-process bufname)) - (dedproc (get-buffer-process dedbufname))) - (if elpy-dedicated-shells - (if dedproc - dedproc - (let ((default-directory (or (and elpy-shell-use-project-root - (elpy-project-root)) - default-directory))) - (run-python (python-shell-parse-command) t t)) - (when sit - (sit-for sit)) - (when (elpy-project-root) - (python-shell-send-string - (format "import sys;sys.path.append('%s')" (elpy-project-root)))) - (get-buffer-process dedbufname)) - (if dedproc - dedproc - (if proc - proc - (let ((default-directory (or (and elpy-shell-use-project-root - (elpy-project-root)) - default-directory))) - (run-python (python-shell-parse-command) nil t)) - (when sit - (sit-for sit)) - (when (elpy-project-root) - (python-shell-send-string - (format "import sys;sys.path.append('%s')" (elpy-project-root)))) - (get-buffer-process bufname)))))) + (proc (get-buffer-process bufname))) + (if proc + proc + (let ((default-directory (or (and elpy-shell-use-project-root + (elpy-project-root)) + default-directory))) + (run-python (python-shell-parse-command) nil t)) + (when sit (sit-for sit)) + (when (elpy-project-root) + (python-shell-send-string + (format "import sys;sys.path.append('%s')" (elpy-project-root)))) + (get-buffer-process bufname)))) + +(defun elpy-shell-toggle-dedicated-shell (&optional arg) + "Toggle the use of a dedicated python shell for the current buffer. + +if ARG is positive, enable the use of a dedicated shell. +if ARG is negative or 0, disable the use of a dedicated shell." + (interactive) + (let ((arg (or arg + (if (local-variable-p 'python-shell-buffer-name) 0 1)))) + (if (<= arg 0) + (kill-local-variable 'python-shell-buffer-name) + (setq-local python-shell-buffer-name + (format "Python[%s]" + (file-name-sans-extension + (buffer-name))))))) + +(defun elpy-shell-set-local-shell (&optional shell-name) + "Associate the current buffer to a specific shell. + +Meaning that the code from the current buffer will be sent to this shell. + +If SHELL-NAME is not specified, ask with completion for a shell name. + +If SHELL-NAME is \"Global\", associate the current buffer to the main python +shell (often \"*Python*\" shell)." + (interactive) + (let* ((current-shell-name (if (local-variable-p 'python-shell-buffer-name) + (progn + (string-match "Python\\[\\(.*?\\)\\]" + python-shell-buffer-name) + (match-string 1 python-shell-buffer-name)) + "Global")) + (shell-names (cl-loop + for buffer in (buffer-list) + for buffer-name = (file-name-sans-extension (substring-no-properties (buffer-name buffer))) + if (string-match "\\*Python\\[\\(.*?\\)\\]\\*" buffer-name) + collect (match-string 1 buffer-name))) + (candidates (remove current-shell-name + (delete-dups + (append (list (file-name-sans-extension + (buffer-name)) "Global") + shell-names)))) + (prompt (format "Shell name (current: %s): " current-shell-name)) + (shell-name (or shell-name (completing-read prompt candidates)))) + (if (string= shell-name "Global") + (kill-local-variable 'python-shell-buffer-name) + (setq-local python-shell-buffer-name (format "Python[%s]" shell-name))))) (defun elpy-shell--ensure-shell-running () "Ensure that the Python shell for the current buffer is running. @@ -314,7 +347,8 @@ (message "Sent: %s" (string-trim (thing-at-point 'line))) (message "Sent: %s..." (string-trim (thing-at-point 'line))))) (when (bound-and-true-p eval-sexp-fu-flash-mode) - (multiple-value-bind (bounds hi unhi eflash) (eval-sexp-fu-flash (cons begin end)) + (multiple-value-bind (_bounds hi unhi _eflash) + (eval-sexp-fu-flash (cons begin end)) (eval-sexp-fu-flash-doit (lambda () t) hi unhi))))) ;;;;;;;;;;;;;;;;;;; @@ -477,8 +511,7 @@ (defun elpy-shell--string-head-lines (string n) "Extract the first N lines from STRING." - (let* ((any "\\(?:.\\|\n\\)") - (line "\\(?:\\(?:.*\n\\)\\|\\(?:.+\\'\\)\\)") + (let* ((line "\\(?:\\(?:.*\n\\)\\|\\(?:.+\\'\\)\\)") (lines (concat line "\\{" (number-to-string n) "\\}")) (regexp (concat "\\`" "\\(" lines "\\)"))) (if (string-match regexp string) @@ -487,15 +520,14 @@ (defun elpy-shell--string-tail-lines (string n) "Extract the last N lines from STRING." - (let* ((any "\\(?:.\\|\n\\)") - (line "\\(?:\\(?:.*\n\\)\\|\\(?:.+\\'\\)\\)") + (let* ((line "\\(?:\\(?:.*\n\\)\\|\\(?:.+\\'\\)\\)") (lines (concat line "\\{" (number-to-string n) "\\}")) (regexp (concat "\\(" lines "\\)" "\\'"))) (if (string-match regexp string) (match-string 1 string) string))) -(defun elpy-shell--python-shell-send-string-echo-advice (string &optional process msg) +(defun elpy-shell--python-shell-send-string-echo-advice (string &optional _process _msg) "Advice to enable echoing of input in the Python shell." (interactive) (let* ((append-string ; strip setup code from Python shell @@ -539,14 +571,14 @@ (defun elpy-shell-send-file (file-name &optional process temp-file-name delete msg) - """Like `python-shell-send-file' but evaluates last expression separately. + "Like `python-shell-send-file' but evaluates last expression separately. - See `python-shell-send-file' for a description of the - arguments. This function differs in that it breaks up the - Python code in FILE-NAME into statements. If the last statement - is a Python expression, it is evaluated separately in 'eval' - mode. This way, the interactive python shell can capture (and - print) the output of the last expression.""" +See `python-shell-send-file' for a description of the +arguments. This function differs in that it breaks up the +Python code in FILE-NAME into statements. If the last statement +is a Python expression, it is evaluated separately in 'eval' +mode. This way, the interactive python shell can capture (and +print) the output of the last expression." (interactive (list (read-file-name "File to send: ") ; file-name @@ -611,8 +643,7 @@ Assumes that the point is precisely at the beginning of a statement (e.g., after calling `elpy-shell--nav-beginning-of-statement')." - (let ((indent (current-column)) - (continue t) + (let ((continue t) (p)) (while (and (not (eq p (point))) continue) @@ -855,7 +886,7 @@ (forward-line) (if (re-search-forward elpy-shell-cell-boundary-regexp nil t) (forward-line -1) - (end-of-buffer)) + (goto-char (point-max))) (end-of-line) (point)))) (if beg @@ -937,7 +968,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Send command variations (with/without step; with/without go) -(defun elpy-shell--send-with-step-go (step-fun step go prefix-arg) +(defun elpy-shell--send-with-step-go (step-fun step go my-prefix-arg) "Run a function with STEP and/or GO. STEP-FUN should be a function that sends something to the shell @@ -946,7 +977,7 @@ When STEP is nil, keeps point position. When GO is non-nil, switches focus to Python shell buffer." (let ((orig (point))) - (setq current-prefix-arg prefix-arg) + (setq current-prefix-arg my-prefix-arg) (call-interactively step-fun) (when (not step) (goto-char orig))) @@ -986,12 +1017,12 @@ ;;;;;;;;;;;;;;;;;;;;;;; ;; Deprecated functions -(defun elpy-use-ipython (&optional ipython) +(defun elpy-use-ipython (&optional _ipython) "Deprecated; see https://elpy.readthedocs.io/en/latest/ide.html#interpreter-setup" (error "elpy-use-ipython is deprecated; see https://elpy.readthedocs.io/en/latest/ide.html#interpreter-setup")) (make-obsolete 'elpy-use-ipython nil "Jan 2017") -(defun elpy-use-cpython (&optional cpython) +(defun elpy-use-cpython (&optional _cpython) "Deprecated; see https://elpy.readthedocs.io/en/latest/ide.html#interpreter-setup" (error "elpy-use-cpython is deprecated; see https://elpy.readthedocs.io/en/latest/ide.html#interpreter-setup")) (make-obsolete 'elpy-use-cpython nil "Jan 2017")
rename from elpa/elpy-1.18.0/elpy.el rename to elpa/elpy-1.25.0/elpy.el --- a/elpa/elpy-1.18.0/elpy.el +++ b/elpa/elpy-1.25.0/elpy.el @@ -4,7 +4,7 @@ ;; Author: Jorgen Schaefer <contact@jorgenschaefer.de> ;; URL: https://github.com/jorgenschaefer/elpy -;; Version: 1.18.0 +;; Version: 1.25.0 ;; Keywords: Python, IDE, Languages, Tools ;; Package-Requires: ((company "0.9.2") (emacs "24.4") (find-file-in-project "3.3") (highlight-indentation "0.5.0") (pyvenv "1.3") (yasnippet "0.8.0") (s "1.11.0")) @@ -53,7 +53,7 @@ (require 'pyvenv) (require 'find-file-in-project) -(defconst elpy-version "1.18.0" +(defconst elpy-version "1.25.0" "The version of the Elpy lisp code.") ;;;;;;;;;;;;;;;;;;;;;; @@ -98,6 +98,8 @@ elpy-module-yasnippet) (const :tag "Django configurations (Elpy-Django)" elpy-module-django) + (const :tag "Automatically update documentation (Autodoc)." + elpy-module-autodoc) (const :tag "Configure some sane defaults for Emacs" elpy-module-sane-defaults)) :group 'elpy) @@ -169,7 +171,9 @@ elpy-project-find-svn-root)) :group 'elpy) -(make-obsolete-variable 'elpy-company-hide-modeline 'elpy-remove-modeline-lighter) +(make-obsolete-variable 'elpy-company-hide-modeline + 'elpy-remove-modeline-lighter + "1.10.0") (defcustom elpy-remove-modeline-lighter t "Non-nil if Elpy should remove most mode line display. @@ -289,6 +293,16 @@ (function :tag "Other function")) :group 'elpy) +(defcustom elpy-company-add-completion-from-shell nil + "If t, add completion candidates gathered from the shell. + +Normally elpy provides completion using static code analysis (from jedi). +With this option set to t, elpy will add the completion candidates from the +associated python shell. This allow to have decent completion candidates when +the static code analysis fails." + :type 'boolean + :group 'elpy) + (defcustom elpy-eldoc-show-current-function t "If true, show the current function if no calltip is available. @@ -319,24 +333,6 @@ :type '(repeat string) :group 'elpy) -(defcustom elpy-test-django-runner-command '("django-admin.py" "test" - "--noinput") - "The command to use for `elpy-test-django-runner'." - :type '(repeat string) - :group 'elpy) - -(defcustom elpy-test-django-runner-manage-command '("manage.py" "test" - "--noinput") - "The command to use for `elpy-test-django-runner' in case we want to use manage.py." - :type '(repeat string) - :group 'elpy) - -(defcustom elpy-test-django-with-manage nil - "Set to nil, elpy will use `elpy-test-django-runner-command', -set to t elpy will use `elpy-test-django-runner-manage-command' and set the project root accordingly." - :type 'boolean - :group 'elpy) - (defcustom elpy-test-nose-runner-command '("nosetests") "The command to use for `elpy-test-nose-runner'." :type '(repeat string) @@ -366,7 +362,7 @@ :group 'elpy) (defcustom elpy-disable-backend-error-display t - "Non-nil if Elpy should disable backed error display." + "Non-nil if Elpy should disable backend error display." :type 'boolean :group 'elpy) @@ -445,43 +441,61 @@ (define-key map (kbd "M-TAB") 'elpy-company-backend) - ;; key bindings for elpy-shell - (define-key map (kbd "C-c C-y e") 'elpy-shell-send-statement) - (define-key map (kbd "C-c C-y E") 'elpy-shell-send-statement-and-go) - (define-key map (kbd "C-c C-y s") 'elpy-shell-send-top-statement) - (define-key map (kbd "C-c C-y S") 'elpy-shell-send-top-statement-and-go) - (define-key map (kbd "C-c C-y f") 'elpy-shell-send-defun) - (define-key map (kbd "C-c C-y F") 'elpy-shell-send-defun-and-go) - (define-key map (kbd "C-c C-y c") 'elpy-shell-send-defclass) - (define-key map (kbd "C-c C-y C") 'elpy-shell-send-defclass-and-go) - (define-key map (kbd "C-c C-y g") 'elpy-shell-send-group) - (define-key map (kbd "C-c C-y G") 'elpy-shell-send-group-and-go) - (define-key map (kbd "C-c C-y w") 'elpy-shell-send-codecell) - (define-key map (kbd "C-c C-y W") 'elpy-shell-send-codecell-and-go) - (define-key map (kbd "C-c C-y r") 'elpy-shell-send-region-or-buffer) - (define-key map (kbd "C-c C-y R") 'elpy-shell-send-region-or-buffer-and-go) - (define-key map (kbd "C-c C-y b") 'elpy-shell-send-buffer) - (define-key map (kbd "C-c C-y B") 'elpy-shell-send-buffer-and-go) - (define-key map (kbd "C-c C-y C-e") 'elpy-shell-send-statement-and-step) - (define-key map (kbd "C-c C-y C-S-E") 'elpy-shell-send-statement-and-step-and-go) - (define-key map (kbd "C-c C-y C-s") 'elpy-shell-send-top-statement-and-step) - (define-key map (kbd "C-c C-y C-S-S") 'elpy-shell-send-top-statement-and-step-and-go) - (define-key map (kbd "C-c C-y C-f") 'elpy-shell-send-defun-and-step) - (define-key map (kbd "C-c C-y C-S-F") 'elpy-shell-send-defun-and-step-and-go) - (define-key map (kbd "C-c C-y C-c") 'elpy-shell-send-defclass-and-step) - (define-key map (kbd "C-c C-y C-S-C") 'elpy-shell-send-defclass-and-step-and-go) - (define-key map (kbd "C-c C-y C-g") 'elpy-shell-send-group-and-step) - (define-key map (kbd "C-c C-y C-S-G") 'elpy-shell-send-group-and-step-and-go) - (define-key map (kbd "C-c C-y C-w") 'elpy-shell-send-codecell-and-step) - (define-key map (kbd "C-c C-y C-S-W") 'elpy-shell-send-codecell-and-step-and-go) - (define-key map (kbd "C-c C-y C-r") 'elpy-shell-send-region-or-buffer-and-step) - (define-key map (kbd "C-c C-y C-S-R") 'elpy-shell-send-region-or-buffer-and-step-and-go) - (define-key map (kbd "C-c C-y C-b") 'elpy-shell-send-buffer-and-step) - (define-key map (kbd "C-c C-y C-S-B") 'elpy-shell-send-buffer-and-step-and-go) - map) "Key map for the Emacs Lisp Python Environment.") +(defvar elpy-shell-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "e") 'elpy-shell-send-statement) + (define-key map (kbd "E") 'elpy-shell-send-statement-and-go) + (define-key map (kbd "s") 'elpy-shell-send-top-statement) + (define-key map (kbd "S") 'elpy-shell-send-top-statement-and-go) + (define-key map (kbd "f") 'elpy-shell-send-defun) + (define-key map (kbd "F") 'elpy-shell-send-defun-and-go) + (define-key map (kbd "c") 'elpy-shell-send-defclass) + (define-key map (kbd "C") 'elpy-shell-send-defclass-and-go) + (define-key map (kbd "o") 'elpy-shell-send-group) + (define-key map (kbd "O") 'elpy-shell-send-group-and-go) + (define-key map (kbd "w") 'elpy-shell-send-codecell) + (define-key map (kbd "W") 'elpy-shell-send-codecell-and-go) + (define-key map (kbd "r") 'elpy-shell-send-region-or-buffer) + (define-key map (kbd "R") 'elpy-shell-send-region-or-buffer-and-go) + (define-key map (kbd "b") 'elpy-shell-send-buffer) + (define-key map (kbd "B") 'elpy-shell-send-buffer-and-go) + (define-key map (kbd "C-e") 'elpy-shell-send-statement-and-step) + (define-key map (kbd "C-S-E") 'elpy-shell-send-statement-and-step-and-go) + (define-key map (kbd "C-s") 'elpy-shell-send-top-statement-and-step) + (define-key map (kbd "C-S-S") 'elpy-shell-send-top-statement-and-step-and-go) + (define-key map (kbd "C-f") 'elpy-shell-send-defun-and-step) + (define-key map (kbd "C-S-F") 'elpy-shell-send-defun-and-step-and-go) + (define-key map (kbd "C-c") 'elpy-shell-send-defclass-and-step) + (define-key map (kbd "C-S-C") 'elpy-shell-send-defclass-and-step-and-go) + (define-key map (kbd "C-o") 'elpy-shell-send-group-and-step) + (define-key map (kbd "C-S-O") 'elpy-shell-send-group-and-step-and-go) + (define-key map (kbd "C-w") 'elpy-shell-send-codecell-and-step) + (define-key map (kbd "C-S-W") 'elpy-shell-send-codecell-and-step-and-go) + (define-key map (kbd "C-r") 'elpy-shell-send-region-or-buffer-and-step) + (define-key map (kbd "C-S-R") 'elpy-shell-send-region-or-buffer-and-step-and-go) + (define-key map (kbd "C-b") 'elpy-shell-send-buffer-and-step) + (define-key map (kbd "C-S-B") 'elpy-shell-send-buffer-and-step-and-go) + map) + "Key map for the shell related commands") +(fset 'elpy-shell-map elpy-shell-map) + +(defcustom elpy-shell-command-prefix-key "C-c C-y" +"Prefix key used to call elpy shell related commands. + +This option need to bet set through `customize' or `customize-set-variable' to be taken into account." +:type 'string +:group 'elpy +:set +(lambda (var key) + (when (and (boundp var) (symbol-value var)) + (define-key elpy-mode-map (kbd (symbol-value var)) nil)) + (when key + (define-key elpy-mode-map (kbd key) 'elpy-shell-map) + (set var key)))) + (easy-menu-define elpy-menu elpy-mode-map "Elpy Mode Menu" '("Elpy" @@ -603,13 +617,7 @@ (defun elpy-news () "Display Elpy's release notes." (interactive) - (with-current-buffer (get-buffer-create "*Elpy News*") - (let ((inhibit-read-only t)) - (erase-buffer) - (insert-file-contents (concat (file-name-directory (locate-library "elpy")) - "NEWS.rst")) - (help-mode)) - (pop-to-buffer (current-buffer)))) + (message "The Elpy News command is deprecated and will be removed in future versions of Elpy")) ;;;;;;;;;;;;;;; ;;; Elpy Config @@ -624,7 +632,8 @@ ("Snippets (YASnippet)" yasnippet "yas-") ("Directory Grep (rgrep)" grep "grep-") ("Search as You Type (ido)" ido "ido-") - ("Django Extension" elpy-django "elpy-django-") + ("Django extension" elpy-django "elpy-django-") + ("Autodoc extension" elpy-autodoc "elpy-autodoc-") ;; ffip does not use defcustom ;; highlight-indent does not use defcustom, either. Its sole face ;; is defined in basic-faces. @@ -632,6 +641,9 @@ (defvar elpy-config--get-config "import json import sys +import warnings + +warnings.filterwarnings('ignore', category=FutureWarning) try: import xmlrpclib @@ -643,8 +655,8 @@ def latest(package, version=None): try: - pypi = xmlrpclib.ServerProxy('https://pypi.python.org/pypi') - latest = pypi.package_releases(package)[0] + with xmlrpclib.ServerProxy('https://pypi.python.org/pypi') as pypi: + latest = pypi.package_releases(package)[0] if version is None or LooseVersion(version) < LooseVersion(latest): return latest else: @@ -703,6 +715,14 @@ config['yapf_version'] = None config['yapf_latest'] = latest('yapf') +try: + import black + config['black_version'] = black.__version__ + config['black_latest'] = latest('black', config['black_version']) +except: + config['black_version'] = None + config['black_latest'] = latest('black') + json.dump(config, sys.stdout) ") @@ -827,7 +847,7 @@ "no active virtualenv, installing Python packages locally will " "place executables in that directory, so Emacs won't find them. " "If you are missing some commands, do add this directory to your " - "PATH.\n\n")) + "PATH -- and then do `elpy-rpc-restart'.\n\n")) ;; Python found, but can't find the elpy module (when (and (gethash "python_rpc_executable" config) @@ -865,6 +885,23 @@ (gethash "error_output" config) "\n" "\n")) + ;; Interactive python interpreter not in the current virtual env + (when (and pyvenv-virtual-env + (not (string-prefix-p (expand-file-name pyvenv-virtual-env) + (executable-find + python-shell-interpreter)))) + (elpy-insert--para + "The python interactive interpreter (" python-shell-interpreter + ") is not installed on the current virtualenv (" + pyvenv-virtual-env "). The system binary (" + (executable-find python-shell-interpreter) + ") will be used instead." + "\n") + (insert "\n") + (widget-create 'elpy-insert--pip-button + :package python-shell-interpreter) + (insert "\n\n")) + ;; Requested backend unavailable (when (and (gethash "python_rpc_executable" config) (not (gethash "jedi_version" config))) @@ -937,6 +974,26 @@ :package "yapf" :upgrade t) (insert "\n\n")) + ;; No black available + (when (not (gethash "black_version" config)) + (elpy-insert--para + "The black package is not available. Commands using this will " + "not work.\n") + (insert "\n") + (widget-create 'elpy-insert--pip-button + :package "black") + (insert "\n\n")) + + ;; Newer version of black available + (when (and (gethash "black_version" config) + (gethash "black_latest" config)) + (elpy-insert--para + "There is a newer version of the black package available.\n") + (insert "\n") + (widget-create 'elpy-insert--pip-button + :package "black" :upgrade t) + (insert "\n\n")) + ;; Syntax checker not available (when (not (executable-find elpy-syntax-check-command)) (elpy-insert--para @@ -949,6 +1006,11 @@ )) +(defun elpy-config--package-available-p (package) + "Check if PACKAGE is installed in the rpc." + (equal 0 (call-process elpy-rpc-python-command nil nil nil "-c" + (format "import %s" package)))) + (defun elpy-config--get-config () "Return the configuration from `elpy-rpc-python-command'. @@ -1027,6 +1089,8 @@ (autopep8-latest (gethash "autopep8_latest" config)) (yapf-version (gethash "yapf_version" config)) (yapf-latest (gethash "yapf_latest" config)) + (black-version (gethash "black_version" config)) + (black-latest (gethash "black_latest" config)) (virtual-env (gethash "virtual_env" config)) (virtual-env-short (gethash "virtual_env_short" config)) table maxwidth) @@ -1081,6 +1145,9 @@ ("Yapf" . ,(elpy-config--package-link "yapf" yapf-version yapf-latest)) + ("Black" . ,(elpy-config--package-link "black" + black-version + black-latest)) ("Syntax checker" . ,(let ((syntax-checker (executable-find elpy-syntax-check-command))) @@ -1744,7 +1811,10 @@ (setq elpy-nav-expand--initial-position (point)) (let ((indentation (current-indentation))) (if (= indentation 0) - (mark-whole-buffer) + (progn + (push-mark (point)) + (push-mark (point-max) nil t) + (goto-char (point-min))) (while (<= indentation (current-indentation)) (forward-line -1)) (forward-line 1) @@ -1936,44 +2006,6 @@ (apply #'elpy-test-run top command))) (put 'elpy-test-green-runner 'elpy-test-runner-p t) -(defun elpy-test-django-runner (top _file module test) - "Test the project using the Django discover runner, -or with manage.py if elpy-test-django-with-manage is true. - -This requires Django 1.6 or the django-discover-runner package." - (interactive (elpy-test-at-point)) - (if module - (apply #'elpy-test-run - top - (append - ;; if we want to use manage.py, get the root directory where it is. - (if elpy-test-django-with-manage - (append (list (concat (expand-file-name - (locate-dominating-file - (elpy-project-root) - (car elpy-test-django-runner-manage-command))) - (car elpy-test-django-runner-manage-command))) - (cdr elpy-test-django-runner-manage-command)) - ;; or the default: - elpy-test-django-runner-command) - (list (if test - (format "%s.%s" module test) - module)))) - (apply #'elpy-test-run - top - (append - (if elpy-test-django-with-manage - (append (list (concat (expand-file-name - (locate-dominating-file - (if (elpy-project-root) - (elpy-project-root) - ".") - (car elpy-test-django-runner-manage-command))) - (car elpy-test-django-runner-manage-command))) - (cdr elpy-test-django-runner-manage-command)) - elpy-test-django-runner-command))))) -(put 'elpy-test-django-runner 'elpy-test-runner-p t) - (defun elpy-test-nose-runner (top _file module test) "Test the project using the nose test runner. @@ -2124,8 +2156,8 @@ (defun elpy-importmagic-fixup () (interactive)) -(make-obsolete 'elpy-importmagic-add-import "support for importmagic has been dropped.") -(make-obsolete 'elpy-importmagic-fixup "support for importmagic has been dropped.") +(make-obsolete 'elpy-importmagic-add-import "support for importmagic has been dropped." "1.17.0") +(make-obsolete 'elpy-importmagic-fixup "support for importmagic has been dropped." "1.17.0") ;;;;;;;;;;;;;;;;;;;;; ;;; Code reformatting @@ -2134,38 +2166,57 @@ "Format code using the available formatter." (interactive) (cond - ((executable-find "yapf") + ((elpy-config--package-available-p "yapf") (elpy-yapf-fix-code)) - ((executable-find "autopep8") + ((elpy-config--package-available-p "autopep8") (elpy-autopep8-fix-code)) + ((elpy-config--package-available-p "black") + (elpy-black-fix-code)) (t (message "Install yapf/autopep8 to format code.")))) (defun elpy-yapf-fix-code () - "Automatically formats Python code with yapf." + "Automatically formats Python code with yapf. + +Yapf can be configured with a style file placed in the project +root directory." (interactive) (elpy--fix-code-with-formatter "fix_code_with_yapf")) (defun elpy-autopep8-fix-code () - "Automatically formats Python code to conform to the PEP 8 style guide." + "Automatically formats Python code to conform to the PEP 8 style guide. + +Autopep8 can be configured with a style file placed in the project +root directory." (interactive) (elpy--fix-code-with-formatter "fix_code")) +(defun elpy-black-fix-code () + "Automatically formats Python code with black." + (interactive) + (elpy--fix-code-with-formatter "fix_code_with_black")) + (defun elpy--fix-code-with-formatter (method) "Common routine for formatting python code." (let ((line (line-number-at-pos)) - (col (current-column))) + (col (current-column)) + (directory (if (elpy-project-root) + (expand-file-name (elpy-project-root)) + default-directory))) (if (use-region-p) - (let ((new-block (elpy-rpc method (list (elpy-rpc--region-contents)))) - (beg (region-beginning)) (end (region-end))) + (let ((new-block (elpy-rpc method + (list (elpy-rpc--region-contents) + directory))) + (beg (region-beginning)) + (end (region-end))) (elpy-buffer--replace-region beg end (replace-regexp-in-string "\n$" "" new-block)) (goto-char end) (deactivate-mark)) - ;; Vector instead of list, json.el in Emacs 24.3 and before - ;; breaks for single-element lists of alists. - (let ((new-block (elpy-rpc method (vector (elpy-rpc--buffer-contents)))) + (let ((new-block (elpy-rpc method + (list (elpy-rpc--buffer-contents) + directory))) (beg (point-min)) (end (point-max))) (elpy-buffer--replace-region beg end new-block) @@ -2363,7 +2414,7 @@ Also, switch to that buffer." (interactive) (let ((list-matching-lines-face nil)) - (occur "^ *\\(def\\|class\\) ")) + (occur "^\s*\\(\\(async\s\\|\\)def\\|class\\)\s")) (let ((window (get-buffer-window "*Occur*"))) (if window (select-window window) @@ -2752,7 +2803,12 @@ (elpy-insert--para "You are not using the same version of Elpy in Emacs Lisp " "compared to Python. This can cause random problems. Please " - "do make sure to use compatible versions.\n") + "do make sure to use compatible versions.\n\n" + "This often happens because you have an obsolete elpy python " + "package installed on your system/virtualenv. This package " + "shadows the elpy python package shipped with elpy, leading " + "to this mismatch. If it is the case, uninstalling the elpy " + "python package (with pip for example) should resolve the issue.\n") (insert "\n" "Elpy Emacs Lisp version: " elpy-version "\n" @@ -2987,7 +3043,8 @@ Returns a list of possible completions for the Python symbol at point." - (when (< (buffer-size) elpy-rpc-ignored-buffer-size) + (when (and (< (buffer-size) elpy-rpc-ignored-buffer-size) + (not (string-match "^[0-9]+$" (symbol-name (symbol-at-point))))) (elpy-rpc "get_completions" (list buffer-file-name (elpy-rpc--buffer-contents) @@ -3074,7 +3131,10 @@ ;;; Xref backend (defun elpy--xref-backend () "Return the name of the elpy xref backend." - (if elpy-rpc--jedi-available + ;; If no rpc available, start one and assume jedi is available + (if (or (and (not (elpy-rpc--process-buffer-p elpy-rpc--buffer)) + (elpy-rpc--get-rpc-buffer)) + elpy-rpc--jedi-available) 'elpy nil)) @@ -3115,17 +3175,11 @@ "Return identifier at point. Is a string, formatted as \"LINE_NUMBER: VARIABLE_NAME\". -Try to find the identifier assignement if it is in the current buffer. " (let* ((symb (symbol-at-point)) - (symb-str (substring-no-properties (symbol-name symb))) - (assign (elpy-rpc-get-assignment))) + (symb-str (substring-no-properties (symbol-name symb)))) (when symb - (if (and assign (string= (car assign) (buffer-file-name))) - (format "%s: %s" - (line-number-at-pos (+ 1 (car (cdr assign)))) - symb-str) - (format "%s: %s" (line-number-at-pos) symb-str))))) + (format "%s: %s" (line-number-at-pos) symb-str)))) (defun elpy-xref--identifier-name (id) "Return the identifier ID variable name." @@ -3141,9 +3195,11 @@ "Goto the identifier ID in the current buffer. This is needed to get information on the identifier with jedi \(that work only on the symbol at point\)" - (goto-line (elpy-xref--identifier-line id)) - (search-forward (elpy-xref--identifier-name id)) - (goto-char (match-beginning 0))) + (let ((case-fold-search nil)) + (goto-char (point-min)) + (forward-line (1- (elpy-xref--identifier-line id))) + (search-forward (elpy-xref--identifier-name id) (line-end-position)) + (goto-char (match-beginning 0)))) ;; Find definition (cl-defmethod xref-backend-definitions ((_backend (eql elpy)) id) @@ -3180,14 +3236,17 @@ for ref in references for file = (alist-get 'filename ref) for pos = (+ (alist-get 'offset ref) 1) - for line = (with-current-buffer (find-file-noselect file) - (save-excursion - (goto-char (+ pos 1)) - (buffer-substring (line-beginning-position) (line-end-position)))) - for linenumber = (with-current-buffer (find-file-noselect file) - (line-number-at-pos pos)) + for line = (when file + (with-current-buffer (find-file-noselect file) + (save-excursion + (goto-char (+ pos 1)) + (buffer-substring (line-beginning-position) (line-end-position))))) + for linenumber = (when file + (with-current-buffer (find-file-noselect file) + (line-number-at-pos pos))) for summary = (format elpy-xref--format-references linenumber line) for loc = (xref-make-elpy-location file pos) + if file collect (xref-make summary loc))))) ;; Completion table (used when calling `xref-find-references`) @@ -3195,28 +3254,13 @@ (elpy-xref--get-completion-table)) (defun elpy-xref--get-completion-table () - "Return the completion table for identifiers. - -Try to use the identifier assignement instead of the identifier at point. -Also ensure that variables are not represented more than once." - (let ((table nil) - (outside-assigns)) + "Return the completion table for identifiers." (cl-loop for ref in (nreverse (elpy-rpc-get-names)) for offset = (+ (alist-get 'offset ref) 1) for line = (line-number-at-pos offset) - ;; Use assignment line position if the assignement is in the same file - for assign = (save-excursion (goto-char offset) (elpy-rpc-get-assignment)) - do (when (string= (car assign) (buffer-file-name)) - (setq offset (+ 1 (car (cdr assign)))) - (setq line (line-number-at-pos offset))) for id = (format "%s: %s" line (alist-get 'name ref)) - ;; ensure that identifier are represented only once - unless (or (member id table) (member assign outside-assigns)) - do (progn - (push id table) - (when assign (push assign outside-assigns)))) - table)) + collect id)) ;; Apropos (cl-defmethod xref-backend-apropos ((_backend (eql elpy)) regex) @@ -3325,9 +3369,21 @@ (pcase command (`global-init (require 'company) + (require 'company-capf) (elpy-modules-remove-modeline-lighter 'company-mode) (define-key company-active-map (kbd "C-d") - 'company-show-doc-buffer)) + 'company-show-doc-buffer) + (add-hook 'inferior-python-mode-hook + (lambda () + ;; Workaround for company bug + ;; (https://github.com/company-mode/company-mode/issues/759) + (setq-local company-transformers + (remove 'company-sort-by-occurrence + company-transformers)) + ;; Be sure to trigger completion for one character variable + ;; (i.e. `a.`) + (setq-local company-minimum-prefix-length 2)))) + (`buffer-init ;; We want immediate completions from company. (set (make-local-variable 'company-idle-delay) @@ -3496,6 +3552,46 @@ (backward-char 1) (delete-char 2)))))) +(defun elpy-company--add-interpreter-completions-candidates (candidates) + "Add completions candidates from python.el to the list of candidates. + +Get completions candidates at point from python.el, normalize them to look +like what elpy-company returns, merge them with the CANDIDATES list +and return the list. + + python.el provides completion based on what is currently loaded in the +python shell interpreter." + ;; check if prompt available + (if (or (not elpy-company-add-completion-from-shell) + (not (python-shell-get-process)) + (with-current-buffer (process-buffer (python-shell-get-process)) + (save-excursion + (goto-char (point-max)) + (let ((inhibit-field-text-motion t)) + (beginning-of-line) + (not (search-forward-regexp + python-shell--prompt-calculated-input-regexp + nil t)))))) + candidates + (let* ((new-candidates (python-completion-complete-at-point)) + (start (nth 0 new-candidates)) + (end (nth 1 new-candidates)) + (completion-list (nth 2 new-candidates))) + (if (not (and start end)) + candidates + (let ((candidate-names (cl-map 'list + (lambda (el) (cdr (assoc 'name el))) + candidates)) + (new-candidate-names (all-completions (buffer-substring start end) + completion-list))) + (cl-loop + for pytel-cand in new-candidate-names + for pytel-cand = (replace-regexp-in-string "($" "" pytel-cand) + for pytel-cand = (replace-regexp-in-string "^.*\\." "" pytel-cand) + if (not (member pytel-cand candidate-names)) + do (push (list (cons 'name pytel-cand)) candidates))) + candidates)))) + (defun elpy-company-backend (command &optional arg &rest ignored) "A company-mode backend for Elpy." (interactive (list 'interactive)) @@ -3514,6 +3610,10 @@ (lambda (callback) (elpy-rpc-get-completions (lambda (result) + ;; add completion candidates from python.el + (setq result + (elpy-company--add-interpreter-completions-candidates + result)) (elpy-company--cache-clear) (funcall callback @@ -3588,6 +3688,10 @@ (require 'eldoc) (setq eldoc-minor-mode-string nil)) (`buffer-init + ;; avoid interferences between eldoc and company meta frontend + (when (member 'elpy-module-company elpy-modules) + (set (make-local-variable 'company-frontends) + (delq 'company-echo-metadata-frontend company-frontends))) (set (make-local-variable 'eldoc-documentation-function) 'elpy-eldoc-documentation) (eldoc-mode 1)) @@ -3626,10 +3730,12 @@ (propertize (nth index params) 'face 'eldoc-highlight-function-argument))) - (format "%s(%s)" - name - (mapconcat #'identity params ", ")) - )))))) + (let ((prefix (propertize name 'face + 'font-lock-function-name-face)) + (args (format "(%s)" (mapconcat #'identity params ", ")))) + (if (version<= emacs-version "25") + (format "%s%s" prefix args) + (eldoc-docstring-format-sym-doc prefix args nil))))))))) ;; Return the last message until we're done eldoc-last-message))) @@ -3641,14 +3747,24 @@ (pcase command (`global-init (require 'flymake) - (elpy-modules-remove-modeline-lighter 'flymake-mode) - ;; Flymake support using flake8, including warning faces. - (setq python-check-command elpy-syntax-check-command) - - ;; Add our initializer function - (add-to-list 'flymake-allowed-file-name-masks - '("\\.py\\'" elpy-flymake-python-init))) + ;; flymake modeline is quite useful for emacs > 26.1 + (when (version< emacs-version "26.1") + (elpy-modules-remove-modeline-lighter 'flymake-mode)) + ;; Add our initializer function. + (when (not (version<= "26.1" emacs-version)) + (add-to-list 'flymake-allowed-file-name-masks + '("\\.py\\'" elpy-flymake-python-init)))) + (`buffer-init + ;; Set this for `elpy-check' command + (setq-local python-check-command elpy-syntax-check-command) + ;; For emacs > 26.1, python.el natively supports flymake, + ;; so we just tell python.el to use the wanted syntax checker + (when (version<= "26.1" emacs-version) + (setq-local python-flymake-command + (if (string= elpy-syntax-check-command "pyflakes") + '("pyflakes") + `(,elpy-syntax-check-command "-")))) ;; `flymake-no-changes-timeout': The original value of 0.5 is too ;; short for Python code, as that will result in the current line ;; to be highlighted most of the time, and that's annoying. This @@ -3665,22 +3781,35 @@ nil) ;; Enable warning faces for flake8 output. + ;; Useless for emacs >= 26.1, as warning are handled fine ;; COMPAT: Obsolete variable as of 24.4 - (if (boundp 'flymake-warning-predicate) - (set (make-local-variable 'flymake-warning-predicate) "^W[0-9]") - (set (make-local-variable 'flymake-warning-re) "^W[0-9]")) - + (cond + ((version<= "26.1" emacs-version) t) + ((boundp 'flymake-warning-predicate) + (set (make-local-variable 'flymake-warning-predicate) "^W[0-9]")) + (t + (set (make-local-variable 'flymake-warning-re) "^W[0-9]"))) + + ;; for emacs >= 26.1, elpy relies on `python-flymake-command`, and + ;; doesn't need `python-check-command` anymore. (when (and (buffer-file-name) - (executable-find python-check-command)) + (or (version<= "26.1" emacs-version) + (executable-find python-check-command))) (flymake-mode 1))) (`buffer-stop (flymake-mode -1) (kill-local-variable 'flymake-no-changes-timeout) (kill-local-variable 'flymake-start-syntax-check-on-newline) + ;; Disable warning faces for flake8 output. + ;; Useless for emacs >= 26.1, as warning are handled fine ;; COMPAT: Obsolete variable as of 24.4 - (if (boundp 'flymake-warning-predicate) - (kill-local-variable 'flymake-warning-predicate) - (kill-local-variable 'flymake-warning-re))))) + (cond + ((version<= "26.1" emacs-version) t) + ((boundp 'flymake-warning-predicate) + (kill-local-variable 'flymake-warning-predicate)) + (t + (kill-local-variable 'flymake-warning-re)))))) + (defun elpy-flymake-python-init () ;; Make sure it's not a remote buffer as flymake would not work @@ -3715,14 +3844,19 @@ (defun elpy-flymake-error-at-point () "Return the flymake error at point, or nil if there is none." - (when (boundp 'flymake-err-info) - (let* ((lineno (line-number-at-pos)) - (err-info (car (flymake-find-err-info flymake-err-info - lineno)))) - (when err-info - (mapconcat #'flymake-ler-text - err-info - ", "))))) + (cond ((boundp 'flymake-err-info) ; emacs < 26 + (let* ((lineno (line-number-at-pos)) + (err-info (car (flymake-find-err-info flymake-err-info + lineno)))) + (when err-info + (mapconcat #'flymake-ler-text + err-info + ", ")))) + ((and (fboundp 'flymake-diagnostic-text) + (fboundp 'flymake-diagnostics)) ; emacs >= 26 + (let ((diag (flymake-diagnostics (point)))) + (when diag + (mapconcat #'flymake-diagnostic-text diag ", ")))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Module: Highlight Indentation @@ -3793,6 +3927,80 @@ (elpy-django -1)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Module: Autodoc + +(defun elpy-module-autodoc (command &rest _args) + "Module to automatically update documentation." + (pcase command + (`buffer-init + (add-hook 'pre-command-hook 'elpy-autodoc--pre-command nil t) + (add-hook 'post-command-hook 'elpy-autodoc--post-command nil t) + (make-local-variable 'company-frontends) + (add-to-list 'company-frontends 'elpy-autodoc--frontend :append)) + (`buffer-stop + (remove-hook 'pre-command-hook 'elpy-autodoc--pre-command t) + (remove-hook 'post-command-hook 'elpy-autodoc--post-command t) + (setq company-frontends (remove 'elpy-autodoc--frontend company-frontends))))) + + +;; Auto refresh documentation on cursor motion +(defvar elpy-autodoc--timer nil + "Timer to refresh documentation.") + +(defcustom elpy-autodoc-delay .5 + "The idle delay in seconds until documentation is refreshed automatically." + :type '(choice (const :tag "immediate (0)" 0) + (number :tag "seconds")) + :group 'elpy + :group 'elpy-autodoc) + +(defun elpy-autodoc--pre-command () + "Cancel autodoc timer on user action." + (when elpy-autodoc--timer + (cancel-timer elpy-autodoc--timer) + (setq elpy-autodoc--timer nil))) + +(defun elpy-autodoc--post-command () + "Set up autodoc timer after user action." + (when elpy-autodoc-delay + (setq elpy-autodoc--timer + (run-with-timer elpy-autodoc-delay nil + 'elpy-autodoc--refresh-doc)))) + +(defun elpy-autodoc--refresh-doc () + "Refresh the doc asynchronously with the symbol at point." + (when (get-buffer-window "*Python Doc*") + (elpy-rpc-get-docstring 'elpy-autodoc--show-doc + (lambda (_reason) nil)))) + +(defun elpy-autodoc--show-doc (doc) + "Display DOC (if any) but only if the doc buffer is currently visible." + (when (and doc (get-buffer-window "*Python Doc*")) + (elpy-doc--show doc))) + +;; Auto refresh documentation in company candidate selection +(defun elpy-autodoc--frontend (command) + "Elpy autodoc front-end for refreshing documentation." + (pcase command + (`post-command + (when elpy-autodoc-delay + (when elpy-autodoc--timer + (cancel-timer elpy-autodoc--timer)) + (setq elpy-autodoc--timer + (run-with-timer elpy-autodoc-delay + nil + 'elpy-autodoc--refresh-doc-from-company)))) + (`hide + (when elpy-autodoc--timer + (cancel-timer elpy-autodoc--timer))))) + +(defun elpy-autodoc--refresh-doc-from-company () + "Refresh the doc asynchronously using the current company candidate." + (let* ((symbol (nth company-selection company-candidates)) + (doc (elpy-rpc-get-completion-docstring symbol))) + (elpy-autodoc--show-doc doc))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Backwards compatibility ;; TODO Some/most of this compatibility code can now go, as minimum required
rename from elpa/elpy-1.18.0/elpy/__init__.py rename to elpa/elpy-1.25.0/elpy/__init__.py --- a/elpa/elpy-1.18.0/elpy/__init__.py +++ b/elpa/elpy-1.25.0/elpy/__init__.py @@ -37,5 +37,5 @@ """ __author__ = "Jorgen Schaefer" -__version__ = "1.18.0" +__version__ = "1.25.0" __license__ = "GPL"
rename from elpa/elpy-1.18.0/elpy/auto_pep8.py rename to elpa/elpy-1.25.0/elpy/auto_pep8.py --- a/elpa/elpy-1.18.0/elpy/auto_pep8.py +++ b/elpa/elpy-1.25.0/elpy/auto_pep8.py @@ -3,6 +3,7 @@ """ from elpy.rpc import Fault +import os try: @@ -11,11 +12,16 @@ autopep8 = None -def fix_code(code): +def fix_code(code, directory): """Formats Python code to conform to the PEP 8 style guide. """ if not autopep8: raise Fault('autopep8 not installed, cannot fix code.', code=400) - return autopep8.fix_code(code, apply_config=True) + old_dir = os.getcwd() + try: + os.chdir(directory) + return autopep8.fix_code(code, apply_config=True) + finally: + os.chdir(old_dir)
new file mode 100644 --- /dev/null +++ b/elpa/elpy-1.25.0/elpy/blackutil.py @@ -0,0 +1,39 @@ +"""Glue for the "black" library. + +""" + +import os +import sys + +from elpy.rpc import Fault + +BLACK_NOT_SUPPORTED = sys.version_info < (3, 6) + +try: + if BLACK_NOT_SUPPORTED: + black = None + else: + import black +except ImportError: # pragma: no cover + black = None + + +def fix_code(code, directory): + """Formats Python code to conform to the PEP 8 style guide. + + """ + if not black: + raise Fault('black not installed', code=400) + + try: + reformatted_source = black.format_file_contents( + src_contents=code, + line_length=black.DEFAULT_LINE_LENGTH, + fast=False + ) + return reformatted_source + except black.NothingChanged: + return code + except Exception as e: + raise Fault("Error during formatting: {}".format(e), + code=400)
rename from elpa/elpy-1.18.0/elpy/jedibackend.py rename to elpa/elpy-1.25.0/elpy/jedibackend.py --- a/elpa/elpy-1.18.0/elpy/jedibackend.py +++ b/elpa/elpy-1.25.0/elpy/jedibackend.py @@ -8,6 +8,7 @@ import sys import traceback +import re import jedi @@ -143,9 +144,13 @@ call = None if not call: return None + # Strip 'param' added by jedi at the beggining of + # parameter names. Should be unecessary for jedi > 0.13.0 + params = [re.sub("^param ", '', param.description) + for param in call.params] return {"name": call.name, "index": call.index, - "params": [param.description for param in call.params]} + "params": params} def rpc_get_usages(self, filename, source, offset): """Return the uses of the symbol at offset.
rename from elpa/elpy-1.18.0/elpy/server.py rename to elpa/elpy-1.25.0/elpy/server.py --- a/elpa/elpy-1.18.0/elpy/server.py +++ b/elpa/elpy-1.25.0/elpy/server.py @@ -13,6 +13,7 @@ from elpy.rpc import JSONRPCServer, Fault from elpy.auto_pep8 import fix_code from elpy.yapfutil import fix_code as fix_code_with_yapf +from elpy.blackutil import fix_code as fix_code_with_black try: @@ -199,19 +200,26 @@ raise Fault("get_names not implemented by current backend", code=400) - def rpc_fix_code(self, source): + def rpc_fix_code(self, source, directory): """Formats Python code to conform to the PEP 8 style guide. """ source = get_source(source) - return fix_code(source) + return fix_code(source, directory) - def rpc_fix_code_with_yapf(self, source): + def rpc_fix_code_with_yapf(self, source, directory): """Formats Python code to conform to the PEP 8 style guide. """ source = get_source(source) - return fix_code_with_yapf(source) + return fix_code_with_yapf(source, directory) + + def rpc_fix_code_with_black(self, source, directory): + """Formats Python code to conform to the PEP 8 style guide. + + """ + source = get_source(source) + return fix_code_with_black(source, directory) def get_source(fileobj):
rename from elpa/elpy-1.18.0/elpy/tests/__init__.py rename to elpa/elpy-1.25.0/elpy/tests/__init__.py
rename from elpa/elpy-1.18.0/elpy/tests/test_auto_pep8.py rename to elpa/elpy-1.25.0/elpy/tests/test_auto_pep8.py --- a/elpa/elpy-1.18.0/elpy/tests/test_auto_pep8.py +++ b/elpa/elpy-1.25.0/elpy/tests/test_auto_pep8.py @@ -3,6 +3,7 @@ """Tests for the elpy.autopep8 module""" import unittest +import os from elpy import auto_pep8 from elpy.tests.support import BackendTestCase @@ -16,5 +17,5 @@ def test_fix_code(self): code_block = 'x= 123\n' - new_block = auto_pep8.fix_code(code_block) + new_block = auto_pep8.fix_code(code_block, os.getcwd()) self.assertEqual(new_block, 'x = 123\n')
rename from elpa/elpy-1.18.0/elpy/tests/test_yapf.py rename to elpa/elpy-1.25.0/elpy/tests/test_black.py --- a/elpa/elpy-1.18.0/elpy/tests/test_yapf.py +++ b/elpa/elpy-1.25.0/elpy/tests/test_black.py @@ -1,23 +1,24 @@ # coding: utf-8 -"""Tests for the elpy.yapf module""" +"""Tests for the elpy.black module""" import unittest +import os -from elpy import yapfutil +from elpy import blackutil from elpy.rpc import Fault from elpy.tests.support import BackendTestCase -@unittest.skipIf(yapfutil.YAPF_NOT_SUPPORTED, - 'yapf not supported for current python version') -class YAPFTestCase(BackendTestCase): +@unittest.skipIf(blackutil.BLACK_NOT_SUPPORTED, + 'black not supported for current python version') +class BLACKTestCase(BackendTestCase): def setUp(self): - if yapfutil.YAPF_NOT_SUPPORTED: + if blackutil.BLACK_NOT_SUPPORTED: raise unittest.SkipTest def test_fix_code_should_throw_error_for_invalid_code(self): src = 'x = ' - self.assertRaises(Fault, yapfutil.fix_code, src) + self.assertRaises(Fault, blackutil.fix_code, src, os.getcwd()) def test_fix_code(self): testdata = [ @@ -28,5 +29,5 @@ self._assert_format(src, expected) def _assert_format(self, src, expected): - new_block = yapfutil.fix_code(src) + new_block = blackutil.fix_code(src, os.getcwd()) self.assertEqual(new_block, expected)
rename from elpa/elpy-1.18.0/elpy/tests/test_jedibackend.py rename to elpa/elpy-1.25.0/elpy/tests/test_jedibackend.py --- a/elpa/elpy-1.18.0/elpy/tests/test_jedibackend.py +++ b/elpa/elpy-1.25.0/elpy/tests/test_jedibackend.py @@ -49,15 +49,21 @@ class TestRPCGetDocstring(RPCGetDocstringTests, JediBackendTestCase): - JSON_LOADS_DOCSTRING = ( - 'loads(s, encoding=None, cls=None, ' - 'object_hook=None, parse_float=None,' - ) def check_docstring(self, docstring): + if sys.version_info >= (3, 6): + JSON_LOADS_DOCSTRING = ( + 'loads(s, *, encoding=None, cls=None, ' + 'object_hook=None, parse_float=None,' + ) + else: + JSON_LOADS_DOCSTRING = ( + 'loads(s, encoding=None, cls=None, ' + 'object_hook=None, parse_float=None,' + ) lines = docstring.splitlines() self.assertEqual(lines[0], 'Documentation for json.loads:') - self.assertEqual(lines[2], self.JSON_LOADS_DOCSTRING) + self.assertEqual(lines[2], JSON_LOADS_DOCSTRING) @mock.patch("elpy.jedibackend.run_with_debug") def test_should_not_return_empty_docstring(self, run_with_debug): @@ -114,13 +120,13 @@ class TestRPCGetCalltip(RPCGetCalltipTests, JediBackendTestCase): KEYS_CALLTIP = {'index': 0, - 'params': ['param '], + 'params': [''], 'name': u'keys'} RADIX_CALLTIP = {'index': None, 'params': [], 'name': u'radix'} ADD_CALLTIP = {'index': 0, - 'params': [u'param a', u'param b'], + 'params': [u'a', u'b'], 'name': u'add'} if compat.PYTHON3: THREAD_CALLTIP = {"name": "Thread", @@ -133,12 +139,12 @@ "index": 0} else: THREAD_CALLTIP = {"name": "Thread", - "params": ["param group=None", - "param target=None", - "param name=None", - "param args=()", - "param kwargs=None", - "param verbose=None"], + "params": ["group=None", + "target=None", + "name=None", + "args=()", + "kwargs=None", + "verbose=None"], "index": 0} def test_should_not_fail_with_get_subscope_by_name(self):
rename from elpa/elpy-1.18.0/elpy/tests/test_pydocutils.py rename to elpa/elpy-1.25.0/elpy/tests/test_pydocutils.py
rename from elpa/elpy-1.18.0/elpy/tests/test_refactor.py rename to elpa/elpy-1.25.0/elpy/tests/test_refactor.py
rename from elpa/elpy-1.18.0/elpy/tests/test_rpc.py rename to elpa/elpy-1.25.0/elpy/tests/test_rpc.py
rename from elpa/elpy-1.18.0/elpy/tests/test_server.py rename to elpa/elpy-1.25.0/elpy/tests/test_server.py --- a/elpa/elpy-1.18.0/elpy/tests/test_server.py +++ b/elpa/elpy-1.25.0/elpy/tests/test_server.py @@ -363,5 +363,5 @@ def test_rpc_fix_code_should_return_formatted_string(self): code_block = 'x= 123\n' - new_block = self.srv.rpc_fix_code(code_block) + new_block = self.srv.rpc_fix_code(code_block, os.getcwd()) self.assertEqual(new_block, 'x = 123\n')
rename from elpa/elpy-1.18.0/elpy/tests/test_support.py rename to elpa/elpy-1.25.0/elpy/tests/test_support.py
copy from elpa/elpy-1.18.0/elpy/tests/test_yapf.py copy to elpa/elpy-1.25.0/elpy/tests/test_yapf.py --- a/elpa/elpy-1.18.0/elpy/tests/test_yapf.py +++ b/elpa/elpy-1.25.0/elpy/tests/test_yapf.py @@ -2,6 +2,7 @@ """Tests for the elpy.yapf module""" import unittest +import os from elpy import yapfutil from elpy.rpc import Fault @@ -17,7 +18,7 @@ def test_fix_code_should_throw_error_for_invalid_code(self): src = 'x = ' - self.assertRaises(Fault, yapfutil.fix_code, src) + self.assertRaises(Fault, yapfutil.fix_code, src, os.getcwd()) def test_fix_code(self): testdata = [ @@ -28,5 +29,5 @@ self._assert_format(src, expected) def _assert_format(self, src, expected): - new_block = yapfutil.fix_code(src) + new_block = yapfutil.fix_code(src, os.getcwd()) self.assertEqual(new_block, expected)
rename from elpa/elpy-1.18.0/elpy/yapfutil.py rename to elpa/elpy-1.25.0/elpy/yapfutil.py --- a/elpa/elpy-1.18.0/elpy/yapfutil.py +++ b/elpa/elpy-1.25.0/elpy/yapfutil.py @@ -20,13 +20,13 @@ yapf_api = None -def fix_code(code): +def fix_code(code, directory): """Formats Python code to conform to the PEP 8 style guide. """ if not yapf_api: raise Fault('yapf not installed', code=400) - style_config = file_resources.GetDefaultStyleForDir(os.getcwd()) + style_config = file_resources.GetDefaultStyleForDir(directory or os.getcwd()) try: reformatted_source, _ = yapf_api.FormatCode(code, filename='<stdin>',
rename from elpa/elpy-1.18.0/snippets/python-mode/.yas-setup.el rename to elpa/elpy-1.25.0/snippets/python-mode/.yas-setup.el
rename from elpa/elpy-1.18.0/snippets/python-mode/__abs__ rename to elpa/elpy-1.25.0/snippets/python-mode/__abs__
rename from elpa/elpy-1.18.0/snippets/python-mode/__add__ rename to elpa/elpy-1.25.0/snippets/python-mode/__add__
rename from elpa/elpy-1.18.0/snippets/python-mode/__and__ rename to elpa/elpy-1.25.0/snippets/python-mode/__and__
rename from elpa/elpy-1.18.0/snippets/python-mode/__bool__ rename to elpa/elpy-1.25.0/snippets/python-mode/__bool__
rename from elpa/elpy-1.18.0/snippets/python-mode/__call__ rename to elpa/elpy-1.25.0/snippets/python-mode/__call__
rename from elpa/elpy-1.18.0/snippets/python-mode/__cmp__ rename to elpa/elpy-1.25.0/snippets/python-mode/__cmp__
rename from elpa/elpy-1.18.0/snippets/python-mode/__coerce__ rename to elpa/elpy-1.25.0/snippets/python-mode/__coerce__
rename from elpa/elpy-1.18.0/snippets/python-mode/__complex__ rename to elpa/elpy-1.25.0/snippets/python-mode/__complex__
rename from elpa/elpy-1.18.0/snippets/python-mode/__contains__ rename to elpa/elpy-1.25.0/snippets/python-mode/__contains__
rename from elpa/elpy-1.18.0/snippets/python-mode/__del__ rename to elpa/elpy-1.25.0/snippets/python-mode/__del__
rename from elpa/elpy-1.18.0/snippets/python-mode/__delattr__ rename to elpa/elpy-1.25.0/snippets/python-mode/__delattr__
rename from elpa/elpy-1.18.0/snippets/python-mode/__delete__ rename to elpa/elpy-1.25.0/snippets/python-mode/__delete__
rename from elpa/elpy-1.18.0/snippets/python-mode/__delitem__ rename to elpa/elpy-1.25.0/snippets/python-mode/__delitem__
rename from elpa/elpy-1.18.0/snippets/python-mode/__div__ rename to elpa/elpy-1.25.0/snippets/python-mode/__div__
rename from elpa/elpy-1.18.0/snippets/python-mode/__divmod__ rename to elpa/elpy-1.25.0/snippets/python-mode/__divmod__
rename from elpa/elpy-1.18.0/snippets/python-mode/__enter__ rename to elpa/elpy-1.25.0/snippets/python-mode/__enter__
rename from elpa/elpy-1.18.0/snippets/python-mode/__eq__ rename to elpa/elpy-1.25.0/snippets/python-mode/__eq__
rename from elpa/elpy-1.18.0/snippets/python-mode/__exit__ rename to elpa/elpy-1.25.0/snippets/python-mode/__exit__
rename from elpa/elpy-1.18.0/snippets/python-mode/__float__ rename to elpa/elpy-1.25.0/snippets/python-mode/__float__
rename from elpa/elpy-1.18.0/snippets/python-mode/__floordiv__ rename to elpa/elpy-1.25.0/snippets/python-mode/__floordiv__
rename from elpa/elpy-1.18.0/snippets/python-mode/__ge__ rename to elpa/elpy-1.25.0/snippets/python-mode/__ge__
rename from elpa/elpy-1.18.0/snippets/python-mode/__get__ rename to elpa/elpy-1.25.0/snippets/python-mode/__get__
rename from elpa/elpy-1.18.0/snippets/python-mode/__getattr__ rename to elpa/elpy-1.25.0/snippets/python-mode/__getattr__
rename from elpa/elpy-1.18.0/snippets/python-mode/__getattribute__ rename to elpa/elpy-1.25.0/snippets/python-mode/__getattribute__
rename from elpa/elpy-1.18.0/snippets/python-mode/__getitem__ rename to elpa/elpy-1.25.0/snippets/python-mode/__getitem__
rename from elpa/elpy-1.18.0/snippets/python-mode/__gt__ rename to elpa/elpy-1.25.0/snippets/python-mode/__gt__
rename from elpa/elpy-1.18.0/snippets/python-mode/__hash__ rename to elpa/elpy-1.25.0/snippets/python-mode/__hash__
rename from elpa/elpy-1.18.0/snippets/python-mode/__hex__ rename to elpa/elpy-1.25.0/snippets/python-mode/__hex__
rename from elpa/elpy-1.18.0/snippets/python-mode/__iadd__ rename to elpa/elpy-1.25.0/snippets/python-mode/__iadd__
rename from elpa/elpy-1.18.0/snippets/python-mode/__iand__ rename to elpa/elpy-1.25.0/snippets/python-mode/__iand__
rename from elpa/elpy-1.18.0/snippets/python-mode/__idiv__ rename to elpa/elpy-1.25.0/snippets/python-mode/__idiv__
rename from elpa/elpy-1.18.0/snippets/python-mode/__ifloordiv__ rename to elpa/elpy-1.25.0/snippets/python-mode/__ifloordiv__
rename from elpa/elpy-1.18.0/snippets/python-mode/__ilshift__ rename to elpa/elpy-1.25.0/snippets/python-mode/__ilshift__
rename from elpa/elpy-1.18.0/snippets/python-mode/__imod__ rename to elpa/elpy-1.25.0/snippets/python-mode/__imod__
rename from elpa/elpy-1.18.0/snippets/python-mode/__imul__ rename to elpa/elpy-1.25.0/snippets/python-mode/__imul__
rename from elpa/elpy-1.18.0/snippets/python-mode/__index__ rename to elpa/elpy-1.25.0/snippets/python-mode/__index__
rename from elpa/elpy-1.18.0/snippets/python-mode/__init__ rename to elpa/elpy-1.25.0/snippets/python-mode/__init__
rename from elpa/elpy-1.18.0/snippets/python-mode/__instancecheck__ rename to elpa/elpy-1.25.0/snippets/python-mode/__instancecheck__
rename from elpa/elpy-1.18.0/snippets/python-mode/__int__ rename to elpa/elpy-1.25.0/snippets/python-mode/__int__
rename from elpa/elpy-1.18.0/snippets/python-mode/__invert__ rename to elpa/elpy-1.25.0/snippets/python-mode/__invert__
rename from elpa/elpy-1.18.0/snippets/python-mode/__ior__ rename to elpa/elpy-1.25.0/snippets/python-mode/__ior__
rename from elpa/elpy-1.18.0/snippets/python-mode/__ipow__ rename to elpa/elpy-1.25.0/snippets/python-mode/__ipow__
rename from elpa/elpy-1.18.0/snippets/python-mode/__irshift__ rename to elpa/elpy-1.25.0/snippets/python-mode/__irshift__
rename from elpa/elpy-1.18.0/snippets/python-mode/__isub__ rename to elpa/elpy-1.25.0/snippets/python-mode/__isub__
rename from elpa/elpy-1.18.0/snippets/python-mode/__iter__ rename to elpa/elpy-1.25.0/snippets/python-mode/__iter__
rename from elpa/elpy-1.18.0/snippets/python-mode/__itruediv__ rename to elpa/elpy-1.25.0/snippets/python-mode/__itruediv__
rename from elpa/elpy-1.18.0/snippets/python-mode/__ixor__ rename to elpa/elpy-1.25.0/snippets/python-mode/__ixor__
rename from elpa/elpy-1.18.0/snippets/python-mode/__le__ rename to elpa/elpy-1.25.0/snippets/python-mode/__le__
rename from elpa/elpy-1.18.0/snippets/python-mode/__len__ rename to elpa/elpy-1.25.0/snippets/python-mode/__len__
rename from elpa/elpy-1.18.0/snippets/python-mode/__long__ rename to elpa/elpy-1.25.0/snippets/python-mode/__long__
rename from elpa/elpy-1.18.0/snippets/python-mode/__lshift__ rename to elpa/elpy-1.25.0/snippets/python-mode/__lshift__
rename from elpa/elpy-1.18.0/snippets/python-mode/__lt__ rename to elpa/elpy-1.25.0/snippets/python-mode/__lt__
rename from elpa/elpy-1.18.0/snippets/python-mode/__mod__ rename to elpa/elpy-1.25.0/snippets/python-mode/__mod__
rename from elpa/elpy-1.18.0/snippets/python-mode/__mul__ rename to elpa/elpy-1.25.0/snippets/python-mode/__mul__
rename from elpa/elpy-1.18.0/snippets/python-mode/__ne__ rename to elpa/elpy-1.25.0/snippets/python-mode/__ne__
rename from elpa/elpy-1.18.0/snippets/python-mode/__neg__ rename to elpa/elpy-1.25.0/snippets/python-mode/__neg__
rename from elpa/elpy-1.18.0/snippets/python-mode/__new__ rename to elpa/elpy-1.25.0/snippets/python-mode/__new__
rename from elpa/elpy-1.18.0/snippets/python-mode/__nonzero__ rename to elpa/elpy-1.25.0/snippets/python-mode/__nonzero__
rename from elpa/elpy-1.18.0/snippets/python-mode/__oct__ rename to elpa/elpy-1.25.0/snippets/python-mode/__oct__
rename from elpa/elpy-1.18.0/snippets/python-mode/__or__ rename to elpa/elpy-1.25.0/snippets/python-mode/__or__
rename from elpa/elpy-1.18.0/snippets/python-mode/__pos__ rename to elpa/elpy-1.25.0/snippets/python-mode/__pos__
rename from elpa/elpy-1.18.0/snippets/python-mode/__pow__ rename to elpa/elpy-1.25.0/snippets/python-mode/__pow__
rename from elpa/elpy-1.18.0/snippets/python-mode/__radd__ rename to elpa/elpy-1.25.0/snippets/python-mode/__radd__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rand__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rand__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rdivmod__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rdivmod__
rename from elpa/elpy-1.18.0/snippets/python-mode/__repr__ rename to elpa/elpy-1.25.0/snippets/python-mode/__repr__
rename from elpa/elpy-1.18.0/snippets/python-mode/__reversed__ rename to elpa/elpy-1.25.0/snippets/python-mode/__reversed__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rfloordiv__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rfloordiv__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rlshift__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rlshift__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rmod__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rmod__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rmul__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rmul__
rename from elpa/elpy-1.18.0/snippets/python-mode/__ror__ rename to elpa/elpy-1.25.0/snippets/python-mode/__ror__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rpow__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rpow__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rrshift__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rrshift__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rshift__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rshift__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rsub__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rsub__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rtruediv__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rtruediv__
rename from elpa/elpy-1.18.0/snippets/python-mode/__rxor__ rename to elpa/elpy-1.25.0/snippets/python-mode/__rxor__
rename from elpa/elpy-1.18.0/snippets/python-mode/__set__ rename to elpa/elpy-1.25.0/snippets/python-mode/__set__
rename from elpa/elpy-1.18.0/snippets/python-mode/__setattr__ rename to elpa/elpy-1.25.0/snippets/python-mode/__setattr__
rename from elpa/elpy-1.18.0/snippets/python-mode/__setitem__ rename to elpa/elpy-1.25.0/snippets/python-mode/__setitem__
rename from elpa/elpy-1.18.0/snippets/python-mode/__slots__ rename to elpa/elpy-1.25.0/snippets/python-mode/__slots__
rename from elpa/elpy-1.18.0/snippets/python-mode/__str__ rename to elpa/elpy-1.25.0/snippets/python-mode/__str__
rename from elpa/elpy-1.18.0/snippets/python-mode/__sub__ rename to elpa/elpy-1.25.0/snippets/python-mode/__sub__
rename from elpa/elpy-1.18.0/snippets/python-mode/__subclasscheck__ rename to elpa/elpy-1.25.0/snippets/python-mode/__subclasscheck__
rename from elpa/elpy-1.18.0/snippets/python-mode/__truediv__ rename to elpa/elpy-1.25.0/snippets/python-mode/__truediv__
rename from elpa/elpy-1.18.0/snippets/python-mode/__unicode__ rename to elpa/elpy-1.25.0/snippets/python-mode/__unicode__
rename from elpa/elpy-1.18.0/snippets/python-mode/__xor__ rename to elpa/elpy-1.25.0/snippets/python-mode/__xor__
rename from elpa/elpy-1.18.0/snippets/python-mode/ase rename to elpa/elpy-1.25.0/snippets/python-mode/ase
rename from elpa/elpy-1.18.0/snippets/python-mode/asne rename to elpa/elpy-1.25.0/snippets/python-mode/asne
rename from elpa/elpy-1.18.0/snippets/python-mode/asr rename to elpa/elpy-1.25.0/snippets/python-mode/asr
rename from elpa/elpy-1.18.0/snippets/python-mode/class rename to elpa/elpy-1.25.0/snippets/python-mode/class
rename from elpa/elpy-1.18.0/snippets/python-mode/defs rename to elpa/elpy-1.25.0/snippets/python-mode/defs
rename from elpa/elpy-1.18.0/snippets/python-mode/enc rename to elpa/elpy-1.25.0/snippets/python-mode/enc
rename from elpa/elpy-1.18.0/snippets/python-mode/env rename to elpa/elpy-1.25.0/snippets/python-mode/env
rename from elpa/elpy-1.18.0/snippets/python-mode/from rename to elpa/elpy-1.25.0/snippets/python-mode/from
rename from elpa/elpy-1.18.0/snippets/python-mode/pdb rename to elpa/elpy-1.25.0/snippets/python-mode/pdb