Emacs: base class methods for Python

Is it possible to execute either methods of the base class, or jedi.el or anaconda-mode ? For example, when subclassing html.parser.HTMLParser I expect it to complete the following code at point (1) (the base class has methods such as handle_data or handle_starttag ):

 import html.parser class MyParser(html.parser.HTMLParser): def handle_ # (1) 
+5
source share
1 answer

I did some research on this issue and I found that it is implemented in the latest version of jedi (0.10.0). Unfortunately, this version is under development right now and is not available from pip. However, many editors use 0.10.0: Atom, VsCode, and even jedi-vim by jedi.

It is easy to upgrade the jedi version in anaconda mode: https://github.com/nightuser/anaconda-mode . The actual change is just one line. Part of Python in anaconda mode needs to be reinstalled - just delete the anaconda-mode directory. The default location is ~/.emacs.d/anaconda-mode for Emacs and ~/.emacs.d/.cache/anaconda-mode for Spacemacs.

upd: It looks like 0.10.0 is coming soon: https://github.com/davidhalter/jedi/issues/740 .

upd2: It was released and knew that everything worked out of the box. Just delete the anaconda-mode directory and it will automatically install the latest version.

+2
source

Source: https://habr.com/ru/post/1262308/


All Articles