tools: Added dis for disassembling python code.
This commit is contained in:
parent
09cc7d3272
commit
c02fdc1bfb
2 changed files with 9 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ then to run:
|
||||||
Extensions | Tools
|
Extensions | Tools
|
||||||
---------- | -----
|
---------- | -----
|
||||||
.* | [contents](http://pygments.org/) • metadata • [git_blame](https://git-scm.com/)
|
.* | [contents](http://pygments.org/) • metadata • [git_blame](https://git-scm.com/)
|
||||||
.py | [python_syntax](https://en.wikipedia.org/wiki/Python_syntax_and_semantics) • [python_unittests](https://docs.python.org/3/library/unittest.html) • [pydoc](https://docs.python.org/3/library/pydoc.html) • [mypy](http://www.mypy-lang.org/) • [python_coverage](http://nedbatchelder.com/code/coverage/) • [pycodestyle](https://pypi.python.org/pypi/pycodestyle) • [pyflakes](https://launchpad.net/pyflakes) • [pylint](http://www.pylint.org/) • [python_gut](https://github.com/ahamilton/vigil/blob/master/gut.py) • [python_modulefinder](https://docs.python.org/3/library/modulefinder.html) • [python_mccabe](https://github.com/flintwork/mccabe) • [bandit](https://wiki.openstack.org/wiki/Security/Projects/Bandit)
|
.py | [python_syntax](https://en.wikipedia.org/wiki/Python_syntax_and_semantics) • [python_unittests](https://docs.python.org/3/library/unittest.html) • [pydoc](https://docs.python.org/3/library/pydoc.html) • [mypy](http://www.mypy-lang.org/) • [python_coverage](http://nedbatchelder.com/code/coverage/) • [pycodestyle](https://pypi.python.org/pypi/pycodestyle) • [pyflakes](https://launchpad.net/pyflakes) • [pylint](http://www.pylint.org/) • [python_gut](https://github.com/ahamilton/vigil/blob/master/gut.py) • [python_modulefinder](https://docs.python.org/3/library/modulefinder.html) • [python_mccabe](https://github.com/flintwork/mccabe) • [dis](https://docs.python.org/3/library/dis.html) • [bandit](https://wiki.openstack.org/wiki/Security/Projects/Bandit)
|
||||||
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/)
|
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/)
|
||||||
.pod .pod6 | [perldoc](http://perldoc.perl.org/)
|
.pod .pod6 | [perldoc](http://perldoc.perl.org/)
|
||||||
.java | [uncrustify](https://github.com/uncrustify/uncrustify)
|
.java | [uncrustify](https://github.com/uncrustify/uncrustify)
|
||||||
|
|
|
||||||
|
|
@ -421,6 +421,13 @@ def python_modulefinder(path):
|
||||||
Status.normal)
|
Status.normal)
|
||||||
|
|
||||||
|
|
||||||
|
@deps(deps={"python", "python3"},
|
||||||
|
url="https://docs.python.org/3/library/dis.html")
|
||||||
|
def dis(path):
|
||||||
|
return _run_command([_python_version(path), "-m", "dis", path],
|
||||||
|
Status.normal)
|
||||||
|
|
||||||
|
|
||||||
def _get_mccabe_line_score(line, python_version):
|
def _get_mccabe_line_score(line, python_version):
|
||||||
position, function_name, score = line.split()
|
position, function_name, score = line.split()
|
||||||
return int(score if python_version == "python3" else score[:-1])
|
return int(score if python_version == "python3" else score[:-1])
|
||||||
|
|
@ -802,7 +809,7 @@ TOOLS_FOR_EXTENSIONS = \
|
||||||
[
|
[
|
||||||
(["py"], [python_syntax, python_unittests, pydoc, mypy,
|
(["py"], [python_syntax, python_unittests, pydoc, mypy,
|
||||||
python_coverage, pycodestyle, pyflakes, pylint, python_gut,
|
python_coverage, pycodestyle, pyflakes, pylint, python_gut,
|
||||||
python_modulefinder, python_mccabe, bandit]),
|
python_modulefinder, python_mccabe, dis, bandit]),
|
||||||
# (["pyc"], [pydisasm]),
|
# (["pyc"], [pydisasm]),
|
||||||
(["pl", "pm", "t"], [perl_syntax, perldoc, perltidy]),
|
(["pl", "pm", "t"], [perl_syntax, perldoc, perltidy]),
|
||||||
# (["p6", "pm6"], [perl6_syntax, perldoc]),
|
# (["p6", "pm6"], [perl6_syntax, perldoc]),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue