Added the disassemble_pyc tool.
This commit is contained in:
parent
6807711384
commit
1106819e42
4 changed files with 8 additions and 3 deletions
4
TODO
4
TODO
|
|
@ -1,5 +1,4 @@
|
||||||
Todo
|
Todo
|
||||||
- Test the tools.
|
|
||||||
- Publish. pypi and github will do.
|
- Publish. pypi and github will do.
|
||||||
- docs?, setup.py?, wheel?, __pkginfo__.py?
|
- docs?, setup.py?, wheel?, __pkginfo__.py?
|
||||||
- Maybe also use cxfreeze, py2exe, pyrun or zipapp? Is zipapp the standard way?
|
- Maybe also use cxfreeze, py2exe, pyrun or zipapp? Is zipapp the standard way?
|
||||||
|
|
@ -159,7 +158,8 @@ Done
|
||||||
- Don't let the user scroll indefinately below the end of the page.
|
- Don't let the user scroll indefinately below the end of the page.
|
||||||
- Add command line options, e.g. -h
|
- Add command line options, e.g. -h
|
||||||
- Boilerplate: Readme, usage
|
- Boilerplate: Readme, usage
|
||||||
|
- Test the tools.
|
||||||
|
<- All the existing tools now have basic tests.
|
||||||
|
|
||||||
A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps
|
A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps
|
||||||
A B C D E F G H
|
A B C D E F G H
|
||||||
|
|
|
||||||
BIN
golden-files/input/hi3.cpython-34.pyc
Normal file
BIN
golden-files/input/hi3.cpython-34.pyc
Normal file
Binary file not shown.
3
tools.py
3
tools.py
|
|
@ -396,7 +396,8 @@ def python_tidy(path): # Deps: found on internet?
|
||||||
|
|
||||||
|
|
||||||
def disassemble_pyc(path):
|
def disassemble_pyc(path):
|
||||||
bytecode = open(path, "rb").read()
|
with open(path, "rb") as file_:
|
||||||
|
bytecode = file_.read()
|
||||||
stringio = io.StringIO()
|
stringio = io.StringIO()
|
||||||
dis.dis(bytecode, file=stringio)
|
dis.dis(bytecode, file=stringio)
|
||||||
stringio.seek(0)
|
stringio.seek(0)
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,10 @@ class ToolsTestCase(unittest.TestCase):
|
||||||
def test_python_mccable(self):
|
def test_python_mccable(self):
|
||||||
self._test_tool(tools.python_mccabe, self.HI_OK)
|
self._test_tool(tools.python_mccabe, self.HI_OK)
|
||||||
|
|
||||||
|
def test_disassemble_pyc(self):
|
||||||
|
self._test_tool(tools.disassemble_pyc,
|
||||||
|
[("hi3.cpython-34.pyc", tools.Status.normal)])
|
||||||
|
|
||||||
def test_perl_syntax(self):
|
def test_perl_syntax(self):
|
||||||
self._test_tool(tools.perl_syntax, [("perl.pl", tools.Status.ok)])
|
self._test_tool(tools.perl_syntax, [("perl.pl", tools.Status.ok)])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue