wibiti / uncompyle2 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from gstarnberger/uncompyle
Python 2.7 decompiler
This project forked from gstarnberger/uncompyle
Python 2.7 decompiler
uncompyle2 A Python 2.7 byte-code decompiler, written in Python 2.7 0.13 2012-2-22 Introduction ------------ 'uncompyle2' converts Python byte-code back into equivalent Python source. It accepts byte-code from Python version 2.7 only. Additionally, it will only run on Python 2.7. The generated source is very readable: docstrings, lists, tuples and hashes get pretty-printed. 'uncompyle2' may also verify the equivalence of the generated source by by compiling it and comparing both byte-codes. 'uncompyle2' is based on John Aycock's generic small languages compiler 'spark' (http://www.csr.uvic.ca/~aycock/python/) and his prior work on a tool called 'decompyle'. This tool has been vastly improved by Hartmut Goebel `http://www.crazy-compilers.com/`_ Additional note (3 July 2004, Ben Burton): This software is no longer available from the original website. It has now become a commercial decompilation service, with no software available for download. Any developers seeking to make alterations or enhancements to this code should therefore consider these debian packages an appropriate starting point. Features -------- * decompiles Python byte-code into equivalent Python source * decompiles byte-code from Python version 2.7 * pretty-prints docstrings, hashes, lists and tuples * reads directly from .pyc/.pyo files, bulk-decompile whole directories * output may be written to file, a directory or to stdout * option for including byte-code disassembly into generated source For a list of changes please refer to the 'CHANGES' file. Requirements ------------ uncompyle2 requires Python 2.7 Installation ------------ You may either create a RPM and install this, or install directly from the source distribution. Creating RPMS: python setup.py bdist_rpm If you need to force the python interpreter to eg. python2: python2 setup.py bdist_rpm --python=python2 Installation from the source distribution: python setup.py install To install to a user's home-dir: python setup.py install --home=<dir> To install to another prefix (eg. /usr/local) python setup.py install --prefix=/usr/local If you need to force the python interpreter to eg. python2: python2 setup.py install For more information on 'Installing Python Modules' please refer to http://www.python.org/doc/current/inst/inst.html Usage ----- uncompyle2 -h prints short usage uncompyle2 --help prints long usage Known Bugs/Restrictions -----------------------
Hi,
As you foresaw, there is a new problem. It's failing to decompile these 2 methods:
twisted.internet._pollingfile.py: def checkWork
twisted.internet.base: def fireEvent
Best regards
Running on:
# Tests
# while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK COME_FROM
# tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK
try:
while 1:
if __file__:
break
finally:
pass
produces:
$ uncompyle2 10_if_break_finally.pyc
# 2017.10.11 09:47:12 EDT
#Embedded file name: simple_source/stmts/10_if_break_finally.py
--- This code section failed: ---
0 SETUP_FINALLY '24'
3 SETUP_LOOP '20'
6 LOAD_NAME '__file__'
9 POP_JUMP_IF_FALSE '6'
12 BREAK_LOOP None
13 JUMP_BACK '6'
16 JUMP_BACK '6'
19 POP_BLOCK None
20_0 COME_FROM '3'
20 POP_BLOCK None
21 LOAD_CONST None
24_0 COME_FROM '0'
24 END_FINALLY None
Syntax error at or near `POP_BLOCK' token at offset 19
Decompiling https://github.com/rocky/python-uncompyle6/blob/master/test/bytecode_2.7.5/01_while1.pyc
should give:
ms = 0
if ms == 1:
while 1:
pass
Even with recent changes I get:
$ uncompyle2 bytecode_2.7.5/01_while1.pyc
# 2018.07.16 05:45:17 EDT
#Embedded file name: simple_source/bug275/01_while1.py
--- This code section failed: ---
0 LOAD_CONST 0
3 STORE_NAME 'ms'
6 LOAD_NAME 'ms'
9 LOAD_CONST 1
12 COMPARE_OP '=='
15 POP_JUMP_IF_FALSE '27'
18 SETUP_LOOP '27'
21 JUMP_ABSOLUTE '21'
24_0 COME_FROM '18'
24 JUMP_FORWARD '27'
27_0 COME_FROM '24'
Syntax error at or near `COME_FROM' token at offset 24_0
### Can't uncompyle bytecode_2.7.5/01_while1.pyc
Traceback (most recent call last):
File "/home/rocky/.pyenv/versions/2.7.15/lib/python2.7/site-packages/uncompyle2/__init__.py", line 197, in main
uncompyle_file(infile, outstream, showasm, showast, deob)
File "/home/rocky/.pyenv/versions/2.7.15/lib/python2.7/site-packages/uncompyle2/__init__.py", line 130, in uncompyle_file
uncompyle(version, co, outstream, showasm, showast, deob)
File "/home/rocky/.pyenv/versions/2.7.15/lib/python2.7/site-packages/uncompyle2/__init__.py", line 98, in uncompyle
ast = walker.build_ast(tokens, customize)
File "/home/rocky/.pyenv/versions/2.7.15/lib/python2.7/site-packages/uncompyle2/Walker.py", line 1449, in build_ast
raise ParserError(e, tokens)
ParserError: --- This code section failed: ---
0 LOAD_CONST 0
3 STORE_NAME 'ms'
6 LOAD_NAME 'ms'
9 LOAD_CONST 1
12 COMPARE_OP '=='
15 POP_JUMP_IF_FALSE '27'
18 SETUP_LOOP '27'
21 JUMP_ABSOLUTE '21'
24_0 COME_FROM '18'
24 JUMP_FORWARD '27'
27_0 COME_FROM '24'
Syntax error at or near `COME_FROM' token at offset 24_0
# decompiled 0 files: 0 okay, 1 failed, 0 verify failed
# 2018.07.16 05:45:17 EDT
See rocky/python-uncompyle6#172 for problem and possible resolution.
[root@server uncompyle2]# python setup.py bdist_rpm
running bdist_rpm
creating build
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/rpm
creating build/bdist.linux-x86_64/rpm/SOURCES
creating build/bdist.linux-x86_64/rpm/SPECS
creating build/bdist.linux-x86_64/rpm/BUILD
creating build/bdist.linux-x86_64/rpm/RPMS
creating build/bdist.linux-x86_64/rpm/SRPMS
writing 'build/bdist.linux-x86_64/rpm/SPECS/uncompyle2.spec'
running sdist
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ANNOUNCE'
warning: no files found matching 'CHANGES'
warning: no files found matching 'TODO'
warning: no files found matching 'uncompyle'
warning: no previously-included files matching '~' found anywhere in distribution
warning: no previously-included files matching '.~' found anywhere in distribution
writing manifest file 'MANIFEST'
creating uncompyle2-1.1
creating uncompyle2-1.1/scripts
creating uncompyle2-1.1/test
creating uncompyle2-1.1/uncompyle2
making hard links in uncompyle2-1.1...
hard linking MANIFEST.in -> uncompyle2-1.1
hard linking README -> uncompyle2-1.1
hard linking compile_tests -> uncompyle2-1.1
hard linking setup.cfg -> uncompyle2-1.1
hard linking setup.py -> uncompyle2-1.1
hard linking test_one -> uncompyle2-1.1
hard linking test_pythonlib -> uncompyle2-1.1
hard linking scripts/uncompyle2 -> uncompyle2-1.1/scripts
hard linking test/compile_tests -> uncompyle2-1.1/test
hard linking test/test_applyEquiv.py -> uncompyle2-1.1/test
hard linking test/test_augmentedAssign.py -> uncompyle2-1.1/test
hard linking test/test_class.py -> uncompyle2-1.1/test
hard linking test/test_del.py -> uncompyle2-1.1/test
hard linking test/test_divide_future.py -> uncompyle2-1.1/test
hard linking test/test_divide_no_future.py -> uncompyle2-1.1/test
hard linking test/test_docstring.py -> uncompyle2-1.1/test
hard linking test/test_empty.py -> uncompyle2-1.1/test
hard linking test/test_exceptions.py -> uncompyle2-1.1/test
hard linking test/test_exec.py -> uncompyle2-1.1/test
hard linking test/test_expressions.py -> uncompyle2-1.1/test
hard linking test/test_extendedImport.py -> uncompyle2-1.1/test
hard linking test/test_extendedPrint.py -> uncompyle2-1.1/test
hard linking test/test_extendedarg.py -> uncompyle2-1.1/test
hard linking test/test_functions.py -> uncompyle2-1.1/test
hard linking test/test_global.py -> uncompyle2-1.1/test
hard linking test/test_globals.py -> uncompyle2-1.1/test
hard linking test/test_import.py -> uncompyle2-1.1/test
hard linking test/test_import_as.py -> uncompyle2-1.1/test
hard linking test/test_integers.py -> uncompyle2-1.1/test
hard linking test/test_iterators.py -> uncompyle2-1.1/test
hard linking test/test_lambda.py -> uncompyle2-1.1/test
hard linking test/test_listComprehensions.py -> uncompyle2-1.1/test
hard linking test/test_loops.py -> uncompyle2-1.1/test
hard linking test/test_loops2.py -> uncompyle2-1.1/test
hard linking test/test_mine.py -> uncompyle2-1.1/test
hard linking test/test_misc.py -> uncompyle2-1.1/test
hard linking test/test_nested_elif.py -> uncompyle2-1.1/test
hard linking test/test_nested_scopes.py -> uncompyle2-1.1/test
hard linking test/test_prettyprint.py -> uncompyle2-1.1/test
hard linking test/test_print.py -> uncompyle2-1.1/test
hard linking test/test_print_to.py -> uncompyle2-1.1/test
hard linking test/test_single_stmt.py -> uncompyle2-1.1/test
hard linking test/test_slices.py -> uncompyle2-1.1/test
hard linking test/test_tuple_params.py -> uncompyle2-1.1/test
hard linking test/test_tuples.py -> uncompyle2-1.1/test
hard linking test/test_yield.py -> uncompyle2-1.1/test
hard linking uncompyle2/Parser.py -> uncompyle2-1.1/uncompyle2
hard linking uncompyle2/Scanner.py -> uncompyle2-1.1/uncompyle2
hard linking uncompyle2/Walker.py -> uncompyle2-1.1/uncompyle2
hard linking uncompyle2/init.py -> uncompyle2-1.1/uncompyle2
hard linking uncompyle2/magics.py -> uncompyle2-1.1/uncompyle2
hard linking uncompyle2/spark.py -> uncompyle2-1.1/uncompyle2
hard linking uncompyle2/verify.py -> uncompyle2-1.1/uncompyle2
creating dist
tar -cf dist/uncompyle2-1.1.tar uncompyle2-1.1
gzip -f9 dist/uncompyle2-1.1.tar
tar -cf dist/uncompyle2-1.1.tar uncompyle2-1.1
gzip -f9 dist/uncompyle2-1.1.tar
removing 'uncompyle2-1.1' (and everything under it)
copying dist/uncompyle2-1.1.tar.gz -> build/bdist.linux-x86_64/rpm/SOURCES
building RPMs
rpm -ba --define _topdir /tmp/uncompyle2/build/bdist.linux-x86_64/rpm --clean build/bdist.linux-x86_64/rpm/SPECS/uncompyle2.spec
-ba: unknown option
error: command 'rpm' failed with exit status 1
Python 2.7 generates special code for if 1 else
as oppsed to if True else
and this causes a parse error.
To repeat try:
1 if 1 else __file__
Or see https://github.com/rocky/python-uncompyle6/blob/master/test/bytecode_2.7/03_if_1_else.pyc
787 STORE_FAST 'e'
790 POP_TOP None
791 RAISE_VARARGS None
794 JUMP_BACK '56'
797 END_FINALLY None
798_0 COME_FROM '797'
798 JUMP_BACK '56'
801 POP_BLOCK None
802_0 COME_FROM '53'
802 POP_BLOCK None
803 LOAD_CONST None
806_0 COME_FROM '50'
806 LOAD_FAST 'self'
809 LOAD_ATTR 'finished'
812 LOAD_ATTR 'set'
815 CALL_FUNCTION_0 None
818 POP_TOP None
819 END_FINALLY None
Syntax error at or near `DUP_TOP' token at offset 513
HI, everyone:
I try to install uncompyle2 by using "python setup.py install"
and after that I use "uncompyle2 file.pyc" to decompile.
BUT I got this error:
2013.12.30 11:26:17 CST
Traceback (most recent call last):
File "/usr/local/bin/uncompyle2", line 166, in
showasm, showast, do_verify, py, deob)
TypeError: main() takes at most 8 arguments (10 given)
My OS is Ubuntu13.10. May anyone offer me some tips to address this problem?
Thanks!!
Python 2.7 generates special code for expression x if 1 else y as opposed to x if True else y and this causes a parse error.
To repeat try:
1 if 1 else __file__
Or see https://github.com/rocky/python-uncompyle6/blob/master/test/bytecode_2.7/03_if_1_else.pyc
Grammar code from https://github.com/rocky/python-uncompyle6/ could probably be used here.
Running on:
# Extracted from 2.6.9 text_file.py
# Bugs in 2.6 and 2.7 detecting structure
def readline (self):
while 1:
if self:
if __file__:
continue
return
produces:
...
ParserError: --- This code section failed: ---
0 SETUP_LOOP '29'
3 LOAD_FAST 'self'
6 POP_JUMP_IF_FALSE '24'
9 LOAD_GLOBAL '__file__'
12 POP_JUMP_IF_FALSE '24'
15 CONTINUE '3'
18 JUMP_ABSOLUTE '24'
21 JUMP_FORWARD '24'
24_0 COME_FROM '21'
24 LOAD_CONST None
27 RETURN_VALUE None
28 POP_BLOCK None
29_0 COME_FROM '0'
...
let test_my.py contain "for x in range(10)[::-1]: print x", then
uncompyle2 test_my.pyc produces
#2012.01.05 15:14:59 CET
for x in range(10)[None]:
print x
+++ okay decompyling test_my.pyc 11
#2012.01.05 15:14:59 CET
(same for [::-2], [::2], ...)
conf:
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
This code with embedded triple quotes isn't handled properly.
r'''func placeholder - with ("""\nstring\n""")'''
def foo():
r'''func placeholder - ' and with ("""\nstring\n""")'''
def bar():
r"""func placeholder - ' and with ('''\nstring\n''') and \"\"\"\nstring\n\"\"\" """
A possible patch is:
Not a bug but some things I noticed with the decompiled code.
Plenty of elifs are removed, which can result in big cascades of if/else code, below is an example, though nothing really big:
def nice_repr(v):
if isinstance(v, (types.ClassType, type)):
return v.__module__ + '.' + v.__name__
else:
if isinstance(v, types.FunctionType):
if '__name__' in v.func_globals:
if getattr(sys.modules[v.func_globals['__name__']], v.func_name, None) is v:
return '%s.%s' % (v.func_globals['__name__'], v.func_name)
return repr(v)
if isinstance(v, types.MethodType):
return '%s.%s of %s' % (nice_repr(v.im_class), v.im_func.func_name, nice_repr(v.im_self))
return repr(v)
instead of
def nice_repr(v):
if isinstance(v, (types.ClassType, type)):
return v.__module__ + '.' + v.__name__
elif isinstance(v, types.FunctionType):
if '__name__' in v.func_globals:
if getattr(sys.modules[v.func_globals['__name__']],
v.func_name, None) is v:
return '%s.%s' % (v.func_globals['__name__'], v.func_name)
return repr(v)
elif isinstance(v, types.MethodType):
return '%s.%s of %s' % (
nice_repr(v.im_class), v.im_func.func_name,
nice_repr(v.im_self))
else:
return repr(v)
I also noticed it puts the vars in multi-var assignment and multi-var loops in a tuple, doesn't really look good
for (bin, points,) in self.bins.items():
#another one
for r in cursor.fetchall():
(name, xpPrimary, xpSecondary, xpTertiary, playerID,) = r
instead of
for bin, points in self.bins.items():
#another one
for r in cursor.fetchall():
name, xpPrimary, xpSecondary, xpTertiary, playerID = r
And the last thing I noticed and I think is particularly bad, is the use of dict.has_key instead of the 'in' keyword
if COMMANDS.has_key(cmd):
instead of
if cmd in COMMANDS:
Please don't take it as an offense, I know how much work you put in uncompyle2 and that's exactly why I decided to report this, because I believe it can become even better!
Best regards
See rocky/python-uncompyle6#170 and for possible fix
This is the error
TypeError: main() takes at most 8 arguments (10 given)
while calling
python uncompyle2 -o some.pyc
Here's an example:
[dhcp151182:~/test] habnabit% echo 'z = []; {x: y for x, y in z}' > test_uncompyle.py
[dhcp151182:~/test] habnabit% python2.7 -c 'import test_uncompyle'
[dhcp151182:~/test] habnabit% /usr/local/share/python/uncompyle2 test_uncompyle.pyc
#2011.04.21 17:49:59 PDT
z = []
{y:x for (x, y,) in z}
+++ okay decompyling test_uncompyle.pyc
# decompiled 1 files: 1 okay, 0 failed, 0 verify failed
#2011.04.21 17:50:00 PDT
root@t:~/wibiti-uncompyle2-5f4ddc2# uncompyle2 -o /tmp/ aa.pyc
#2012.09.07 07:44:02 CST
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/uncompyle2/init.py", line 191, in main
uncompyle_file(infile, outstream, showasm, showast)
File "/usr/local/lib/python2.7/site-packages/uncompyle2/init.py", line 127, in uncompyle_file
version, co = _load_module(filename)
File "/usr/local/lib/python2.7/site-packages/uncompyle2/init.py", line 72, in _load_module
raise ImportError, "Unknown magic number %s in %s" % (ord(magic[0])+256*ord(magic[1]), filename)
ImportError: Unknown magic number 99 in aa.pyc
#2012.09.07 07:44:02 CST
# https://github.com/remoun/python-protobuf/blob/master/google/protobuf/internal/encoder.py#L75
print 1e10000
# https://github.com/tomerfiliba/rpyc/blob/master/rpyc/core/netref.py#L28
print (1).__add__
Which decompyles to
print inf
print 1.__add__
After running "setup.py install" I get the following error message whenever I run "python uncompyle2"
Can't find 'main' module in 'uncompyle2'
See gstarnberger#20
the file http://www.sendspace.com/file/tmdc57
....
....
File "/usr/local/lib/python2.7/dist-packages/uncompyle2/spark.py", line 638, in
self.buildASTNode(args, lhs)
File "/usr/local/lib/python2.7/dist-packages/uncompyle2/spark.py", line 649, in buildASTNode
return self.nonterminal(lhs, children)
File "/usr/local/lib/python2.7/dist-packages/uncompyle2/Parser.py", line 708, in nonterminal
rv = GenericASTBuilder.nonterminal(self, nt, args)
File "/usr/local/lib/python2.7/dist-packages/uncompyle2/spark.py", line 652, in nonterminal
rv = self.AST(type)
File "/usr/local/lib/python2.7/dist-packages/uncompyle2/Parser.py", line 19, in init
UserList.init(self, kids)
File "/usr/lib/python2.7/abc.py", line 132, in instancecheck
if subclass is not None and subclass in cls._abc_cache:
File "/usr/lib/python2.7/_weakrefset.py", line 73, in contains
return wr in self.data
RuntimeError: maximum recursion depth exceeded in cmp
# Tests and empty finally section
# tryfinallystmt ::= SETUP_FINALLY e_suite_stmts_opt
# POP_BLOCK LOAD_CONST COME_FROM e_suite_stmts_opt END_FINALLY
#
try:
pass
finally:
pass
pass
https://github.com/rocky/python-uncompyle6/blob/master/test/bytecode_2.7/05_try_finally_pass.pyc
Hi,
I am using Uncompyle2 for my own purpose and trying to decompile .pyc file to py with 2.7 Python Shell for this.
Below is the message I am getting :
uncompyle2.uncompyle_file("\Queue.pyc",None,0,0)
Traceback (most recent call last):
File "<pyshell#11>", line 1, in
uncompyle2.uncompyle_file("\Queue.pyc",None,0,0)
File "C:\uncompyle2\uncompyle2__init__.py", line 140, in uncompyle_file
version, co = load_module(filename)
File "C:\uncompyle2\uncompyle2__init_.py", line 74, in _load_module
raise ImportError, "Unknown magic number %s in %s" % (ord(magic[0])+256*ord(magic[1]), filename)
ImportError: Unknown magic number 62215 in \Queue.pyc
Thanks,
Vimarsh
while 1:
z = 2
else:
raise
return
Adding grammar rule
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK else_suite COME_FROM
fixed this in uncompyle6 so it will probably do so here.
Hi,
Sorry to bother again but I found a new issue with the latest revision:
in distutils/dep_util.py, method newer_group is failing to decompile
def newer_group--- This code section failed: --- 0 LOAD_GLOBAL 'os' 3 LOAD_ATTR 'path' 6 LOAD_ATTR 'exists' 9 LOAD_FAST 'target' 12 CALL_FUNCTION_1 None 15 POP_JUMP_IF_TRUE '22' 18 LOAD_GLOBAL 'True' 21 RETURN_VALUE None 22 LOAD_GLOBAL 'os' 25 LOAD_ATTR 'stat' 28 LOAD_FAST 'target' 31 CALL_FUNCTION_1 None 34 LOAD_ATTR 'st_mtime' 37 STORE_FAST 'target_mtime' 40 SETUP_LOOP '155' 43 LOAD_FAST 'sources' 46 GET_ITER None 47 FOR_ITER '154' 50 STORE_FAST 'source' 53 LOAD_GLOBAL 'os' 56 LOAD_ATTR 'path' 59 LOAD_ATTR 'exists' 62 LOAD_FAST 'source' 65 CALL_FUNCTION_1 None 68 POP_JUMP_IF_TRUE '123' 71 LOAD_FAST 'missing' 74 LOAD_CONST 'error' 77 COMPARE_OP '==' 80_0 COME_FROM '68' 80 POP_JUMP_IF_FALSE '86' 83 JUMP_ABSOLUTE '123' 86 LOAD_FAST 'missing' 89 LOAD_CONST 'ignore' 92 COMPARE_OP '==' 95 POP_JUMP_IF_FALSE '104' 98 CONTINUE '47' 101 JUMP_ABSOLUTE '123' 104 LOAD_FAST 'missing' 107 LOAD_CONST 'newer' 110 COMPARE_OP '==' 113 POP_JUMP_IF_FALSE '123' 116 LOAD_GLOBAL 'True' 119 RETURN_VALUE None 120 JUMP_FORWARD '123' 123_0 COME_FROM '120' 123 LOAD_GLOBAL 'os' 126 LOAD_ATTR 'stat' 129 LOAD_FAST 'source' 132 CALL_FUNCTION_1 None 135 LOAD_ATTR 'st_mtime' 138 LOAD_FAST 'target_mtime' 141 COMPARE_OP '>' 144 POP_JUMP_IF_FALSE '47' 147 LOAD_GLOBAL 'True' 150 RETURN_VALUE None 151 JUMP_BACK '47' 154 POP_BLOCK None 155_0 COME_FROM '40' 155 LOAD_GLOBAL 'False' 158 RETURN_VALUE None -1 RETURN_LAST None Syntax error at or near `LOAD_FAST' token at offset 86
The actual code is this:
def newer_group(sources, target, missing='error'): """Return true if 'target' is out-of-date with respect to any file listed in 'sources'. In other words, if 'target' exists and is newer than every file in 'sources', return false; otherwise return true. 'missing' controls what we do when a source file is missing; the default ("error") is to blow up with an OSError from inside 'stat()'; if it is "ignore", we silently drop any missing source files; if it is "newer", any missing source files make us assume that 'target' is out-of-date (this is handy in "dry-run" mode: it'll make you pretend to carry out commands that wouldn't work because inputs are missing, but that doesn't matter because you're not actually going to run the commands). """ # If the target doesn't even exist, then it's definitely out-of-date. if not os.path.exists(target): return True # Otherwise we have to find out the hard way: if *any* source file # is more recent than 'target', then 'target' is out-of-date and # we can immediately return true. If we fall through to the end # of the loop, then 'target' is up-to-date and we return false. target_mtime = os.stat(target).st_mtime for source in sources: if not os.path.exists(source): if missing == 'error': # blow up when we stat() the file pass elif missing == 'ignore': # missing source dropped from continue # target's dependency list elif missing == 'newer': # missing source means target is return True # out-of-date if os.stat(source).st_mtime > target_mtime: return True return False
Best regards
nja2\ext.pyc
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\uncompyle2__init__.py", line 191, in main
uncompyle_file(infile, outstream, showasm, showast)
File "C:\Python27\lib\site-packages\uncompyle2__init__.py", line 128, in unco
mpyle_file
uncompyle(version, co, outstream, showasm, showast)
File "C:\Python27\lib\site-packages\uncompyle2__init__.py", line 121, in unco
mpyle
raise walker.ERROR
ParserError: --- This code section failed: ---
0 BUILD_LIST_0 None
3 STORE_FAST 'referenced'
6 BUILD_LIST_0 None
9 STORE_FAST 'buf'
12 SETUP_LOOP '343'
15 LOAD_FAST 'parser'
18 LOAD_ATTR 'stream'
21 LOAD_ATTR 'current'
24 LOAD_ATTR 'type'
27 LOAD_CONST 'data'
30 COMPARE_OP '=='
33 POP_JUMP_IF_FALSE '86'
36 LOAD_FAST 'buf'
39 LOAD_ATTR 'append'
42 LOAD_FAST 'parser'
45 LOAD_ATTR 'stream'
48 LOAD_ATTR 'current'
51 LOAD_ATTR 'value'
54 LOAD_ATTR 'replace'
57 LOAD_CONST '%'
60 LOAD_CONST '%%'
63 CALL_FUNCTION_2 None
66 CALL_FUNCTION_1 None
69 POP_TOP None
70 LOAD_GLOBAL 'next'
73 LOAD_FAST 'parser'
76 LOAD_ATTR 'stream'
79 CALL_FUNCTION_1 None
82 POP_TOP None
83 JUMP_BACK '15'
86 LOAD_FAST 'parser'
89 LOAD_ATTR 'stream'
92 LOAD_ATTR 'current'
95 LOAD_ATTR 'type'
98 LOAD_CONST 'variable_begin'
101 COMPARE_OP '=='
104 POP_JUMP_IF_FALSE '190'
107 LOAD_GLOBAL 'next'
110 LOAD_FAST 'parser'
113 LOAD_ATTR 'stream'
116 CALL_FUNCTION_1 None
119 POP_TOP None
120 LOAD_FAST 'parser'
123 LOAD_ATTR 'stream'
126 LOAD_ATTR 'expect'
129 LOAD_CONST 'name'
132 CALL_FUNCTION_1 None
135 LOAD_ATTR 'value'
138 STORE_FAST 'name'
141 LOAD_FAST 'referenced'
144 LOAD_ATTR 'append'
147 LOAD_FAST 'name'
150 CALL_FUNCTION_1 None
153 POP_TOP None
154 LOAD_FAST 'buf'
157 LOAD_ATTR 'append'
160 LOAD_CONST '%%(%s)s'
163 LOAD_FAST 'name'
166 BINARY_MODULO None
167 CALL_FUNCTION_1 None
170 POP_TOP None
171 LOAD_FAST 'parser'
174 LOAD_ATTR 'stream'
177 LOAD_ATTR 'expect'
180 LOAD_CONST 'variable_end'
183 CALL_FUNCTION_1 None
186 POP_TOP None
187 JUMP_BACK '15'
190 LOAD_FAST 'parser'
193 LOAD_ATTR 'stream'
196 LOAD_ATTR 'current'
199 LOAD_ATTR 'type'
202 LOAD_CONST 'block_begin'
205 COMPARE_OP '=='
208 POP_JUMP_IF_FALSE '312'
211 LOAD_GLOBAL 'next'
214 LOAD_FAST 'parser'
217 LOAD_ATTR 'stream'
220 CALL_FUNCTION_1 None
223 POP_TOP None
224 LOAD_FAST 'parser'
227 LOAD_ATTR 'stream'
230 LOAD_ATTR 'current'
233 LOAD_ATTR 'test'
236 LOAD_CONST 'name:endtrans'
239 CALL_FUNCTION_1 None
242 POP_JUMP_IF_FALSE '249'
245 BREAK_LOOP None
246 JUMP_FORWARD '296'
249 LOAD_FAST 'parser'
252 LOAD_ATTR 'stream'
255 LOAD_ATTR 'current'
258 LOAD_ATTR 'test'
261 LOAD_CONST 'name:pluralize'
264 CALL_FUNCTION_1 None
267 POP_JUMP_IF_FALSE '296'
270 LOAD_FAST 'allow_pluralize'
273 POP_JUMP_IF_FALSE '280'
276 BREAK_LOOP None
277 JUMP_FORWARD '280'
280_0 COME_FROM '277'
280 LOAD_FAST 'parser'
283 LOAD_ATTR 'fail'
286 LOAD_CONST 'a translatable section can have only one pluralize se
ction'
289 CALL_FUNCTION_1 None
292 POP_TOP None
293 JUMP_FORWARD '296'
296_0 COME_FROM '246'
296_1 COME_FROM '293'
296 LOAD_FAST 'parser'
299 LOAD_ATTR 'fail'
302 LOAD_CONST 'control structures in translatable sections are not a
llowed'
305 CALL_FUNCTION_1 None
308 POP_TOP None
309 JUMP_BACK '15'
312 LOAD_FAST 'parser'
315 LOAD_ATTR 'stream'
318 LOAD_ATTR 'eos'
321 POP_JUMP_IF_FALSE '15'
324 LOAD_FAST 'parser'
327 LOAD_ATTR 'fail'
330 LOAD_CONST 'unclosed translation block'
333 CALL_FUNCTION_1 None
336 POP_TOP None
337 JUMP_BACK '15'
340 CONTINUE '15'
343_0 COME_FROM '12'
343 LOAD_FAST 'referenced'
346 LOAD_GLOBAL 'concat'
349 LOAD_FAST 'buf'
352 CALL_FUNCTION_1 None
355 BUILD_TUPLE_2 None
358 RETURN_VALUE None
-1 RETURN_LAST None
Syntax error at or near `COME_FROM' token at offset 343_0
I have a .pyc file which is generating decompilation errors.
See http://dl.dropbox.com/u/1522424/failing-pyc.tar
$ python --version
Python 2.7.3
$ git rev-parse HEAD
be336ddcf66a13f2599712775b1c5428b1199b5a
In the file: http://codepad.org/WCMXobwi
you can see this in the leave method:
for m in self.members:
if m == who:
if not m.loggingOut and not m.transfering:
try:
m.sendGameText(RPG_MSG_GAME_GOOD,"You have left the alliance.\\n")
except:
pass
continue
else:
m.alliance = None
else:
nmembers.append(m)
the decompiled version looks like this:
for m in self.members:
if m == who:
if not m.loggingOut and not m.transfering:
try:
m.sendGameText(RPG_MSG_GAME_GOOD, 'You have left the alliance.\\n')
except:
pass
else:
continue
else:
m.alliance = None
else:
nmembers.append(m)
Best regards
I'm creating an Arch Linux package for the AUR and I'm a bit puzzled by the licensing informations provided.
https://github.com/wibiti/uncompyle2/blob/master/PKG-INFO says GPLv3
But all other files state to refer to the main module (https://github.com/wibiti/uncompyle2/blob/master/uncompyle2/__init__.py) which holds an MIT license.
I believe the source code has priority and PKG-INFO is wrong.
Hi,
I want to report an issue I've noticed recently and it seems to be related to IF/ELIF statements without ELSE.
For example:
win32com.decimal_23:695-699 if not res: return 0 elif res._sign: return -1 return 1
disassembly:
430 LOAD_FAST 'res' 433 POP_JUMP_IF_TRUE '440' 436 LOAD_CONST '' 439 RETURN_VALUE '' 440 LOAD_FAST 'res' 443 LOAD_ATTR '_sign' 446 POP_JUMP_IF_FALSE '453' 449 LOAD_CONST -1 452 RETURN_VALUE '' 453 LOAD_CONST 1 456 RETURN_VALUE '' -1 RETURN_LAST '' Syntax error at or near `RETURN_VALUE' token at offset 456
I also had similar problems with the following files: twisted.python.reflect, twisted.internet.process and pkg_resources.
Though in twisted.internet.process it seems to be related to a try/except block inside a try block, but not really sure.
Regards,
Luis Henrique
Traceback (most recent call last):
File "D:\Python27\Scripts\uncompyle2", line 55, in
from uncompyle2 import main, verify
File "D:\Python27\Scripts\uncompyle2.py", line 55, in
from uncompyle2 import main, verify
ImportError: cannot import name main
with <censored> as _, curs:
NameError: global name 'curs' is not defined
File Link : http://dl.dropbox.com/u/1522424/pyc-NameError.tar
When I build on my Mac using Python 2.6, I get this error:
SyntaxError: ('invalid syntax', ('/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/uncompyle2/Scanner.py', 18, 42, "globals().update({k.replace('+','_'):v for (k,v) in dis.opmap.items()})\n"))
... running uncompyle2 gives a similar error, with the caret under the for:
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/uncompyle2/Scanner.py", line 18
globals().update({k.replace('+','_'):v for (k,v) in dis.opmap.items()})
^
SyntaxError: invalid syntax
carbonstdlib\ _abcoll.pyc_dis_failed
carbonstdlib\ _strptime.pyc_dis_failed
evelib\appConst.pyc_dis_failed
carbonstdlib\cmd.pyc_dis_failed
carbonstdlib\xml\etree\ElementTree.pyc_dis_failed
carbonlib\paste\httpserver.pyc_dis_failed
carbonlib\paste\debug\prints.pyc_dis_failed
carbonstdlib\quopri.pyc_dis_failed
carbonstdlib\unittest2\result.pyc_dis_failed
carbonstdlib\unittest\result.pyc_dis_failed
carbonstdlib\sre_parse.pyc_dis_failed
carbonlib\paste\util\template.pyc_dis_failed
carbonstdlib\unittest\test\test_assertions.pyc_dis_failed
carbonstdlib\unittest\test\test_break.pyc_dis_failed
carbonstdlib\unittest\test\test_case.pyc_dis_failed
carbonstdlib\unittest\test\test_result.pyc_dis_failed
carbonstdlib\unittest\test\test_skipping.pyc_dis_failed
carbonstdlib\unittest2\test\test_unittest2.pyc_dis_failed
carbonstdlib\unittest2\test\test_unittest2_with.pyc_dis_failed
carbonstdlib\urllib.pyc_dis_failed
carbonstdlib\urlparse.pyc_dis_failed
carbonstdlib\whichdb.pyc_dis_failed
Hi,
Nothing major but there is a parsed string variable missing:
__init__.py:74 raise ImportError, "This is a Python %s file! Only Python 2.7 files are supported."
Should be:
raise ImportError, "This is a Python %s file! Only Python 2.7 files are supported." % version
Regards,
Luis Henrique
This is from Python 2.7's test_collections.py:
def test_Iterable(self):
return (lambda: (yield))()
which erroneously decompiles to:
def test_Iterable(self):
return (lambda : yield
None)()
rocky/python-uncompyle6@0c386d2 is my hacky fix for this. If you find something more elegant, let me know.
Hello,
I have the following portion of code I submitted to uncompyle2 :
def _get_by_key(self,key,return_guid=True):
try:
# print '>>get_by_key SELECT'
result=self.table.select(getattr(self.table.c,self.key)==key).execute().fetchall()
# print '<<get_by_key SELECT'
if len(result)>0 and result[0] is not None:
result=self._dict(result[0])
self._data_key[key]=result
else:
result=None
except:
# print 'EXCEPT GET_BY_KEY %s' % traceback.format_exc()
result=None
return result['_guid'] if return_guid and result is not None else result
and the result was :
def _get_by_key--- This code section failed: ---
0 SETUP_EXCEPT '136'
3 LOAD_FAST 'self'
6 LOAD_ATTR 'table'
9 LOAD_ATTR 'select'
12 LOAD_GLOBAL 'getattr'
15 LOAD_FAST 'self'
18 LOAD_ATTR 'table'
21 LOAD_ATTR 'c'
24 LOAD_FAST 'self'
27 LOAD_ATTR 'key'
30 CALL_FUNCTION_2 ''
33 LOAD_FAST 'key'
36 COMPARE_OP '=='
39 CALL_FUNCTION_1 ''
42 LOAD_ATTR 'execute'
45 CALL_FUNCTION_0 ''
48 LOAD_ATTR 'fetchall'
51 CALL_FUNCTION_0 ''
54 STORE_FAST 'result'
57 LOAD_GLOBAL 'len'
60 LOAD_FAST 'result'
63 CALL_FUNCTION_1 ''
66 LOAD_CONST ''
69 COMPARE_OP '>'
72 POP_JUMP_IF_FALSE '126'
75 LOAD_FAST 'result'
78 LOAD_CONST ''
81 BINARY_SUBSCR ''
82 LOAD_CONST ''
85 COMPARE_OP 'is not'
88_0 COME_FROM '72'
88 POP_JUMP_IF_FALSE '126'
91 LOAD_FAST 'self'
94 LOAD_ATTR '_dict'
97 LOAD_FAST 'result'
100 LOAD_CONST ''
103 BINARY_SUBSCR ''
104 CALL_FUNCTION_1 ''
107 STORE_FAST 'result'
110 LOAD_FAST 'result'
113 LOAD_FAST 'self'
116 LOAD_ATTR '_data_key'
119 LOAD_FAST 'key'
122 STORE_SUBSCR ''
123 JUMP_FORWARD '132'
126 LOAD_CONST ''
129 STORE_FAST 'result'
132_0 COME_FROM '123'
132 POP_BLOCK ''
133 JUMP_FORWARD '149'
136_0 COME_FROM '0'
136 POP_TOP ''
137 POP_TOP ''
138 POP_TOP ''
139 LOAD_CONST ''
142 STORE_FAST 'result'
145 JUMP_FORWARD '149'
148 END_FINALLY ''
149_0 COME_FROM '133'
149_1 COME_FROM '145'
149 LOAD_FAST 'return_guid'
152 POP_JUMP_IF_FALSE '175'
155 LOAD_FAST 'result'
158 LOAD_CONST ''
161 COMPARE_OP 'is not'
164 POP_JUMP_IF_FALSE '175'
167 LOAD_FAST 'result'
170 LOAD_CONST '_guid'
173 BINARY_SUBSCR ''
174 RETURN_VALUE ''
175 LOAD_FAST 'result'
178 RETURN_VALUE ''
-1 RETURN_LAST ''
Syntax error at or near `RETURN_VALUE' token at offset 178
Code :
def create_mappings(metadata,create_file=False):
global mapping_stub
cl=['from sqlalchemy.orm import *','from context import CONTEXT','metadata=CONTEXT.DB.metadata'];mp=[]
cl.append(str_stub)
mp_popo=['from data_session import session_obj']
for t in sort_by_depends(metadata):
if 'depends' in t.info and not t.name.startswith('model') and t.info.get('has_object_model',False):
cl.append(t.info['mapping_sources'][0])
mp.append('CONTEXT.logger.debug("Mapping "%s" .. ")' % t.name)
mp.append(t.info['mapping_sources'][1])
mp_popo.append(t.info['mapping_sources'][2])
if create_file:
main_dir=util.get_main_dir()
sys.path.append(main_dir)
if not os.path.exists(main_dir+'/application/object_mappings/__init__.py'):
util.forcedirs(main_dir+'/application/object_mappings')
with file(main_dir+'/application/object_mappings/__init__.py','w') as f:
pass
f=file(main_dir+'/application/object_mappings/_object_mappings.py','w');f.write('\n'.join(cl));f.write('\n'.join(mp));f.close()
f=file(main_dir+'/application/object_mappings/_object_popo.py','w');f.write('\n'.join(mp_popo));f.close()
import application.object_mappings._object_mappings as _object_mappings
import application.object_mappings._object_popo as _object_popo
#Session = sqa.orm.sessionmaker(bind=metadata.bind)
#session=Session()
mapping_stub=_object_mappings.mapping_stub
for t in metadata.tables.values():
if '_depends' in t.info and not t.name.startswith('model_') and t.info.get('has_object_model',False):
t._obj=getattr(_object_mappings,'O'+t.name)
t._obj.__metadata=metadata
t._plain_obj=getattr(_object_popo,'popo_O'+t.name)
t._plain_obj._cls_=t._obj
Failure:
def create_mappings--- This code section failed: ---
0 LOAD_CONST 'from sqlalchemy.orm import *'
3 LOAD_CONST 'from context import CONTEXT'
6 LOAD_CONST 'metadata=CONTEXT.DB.metadata'
9 BUILD_LIST_3 ''
12 STORE_FAST 'cl'
15 BUILD_LIST_0 ''
18 STORE_FAST 'mp'
21 LOAD_FAST 'cl'
24 LOAD_ATTR 'append'
27 LOAD_GLOBAL 'str_stub'
30 CALL_FUNCTION_1 ''
33 POP_TOP ''
34 LOAD_CONST 'from data_session import session_obj'
37 BUILD_LIST_1 ''
40 STORE_FAST 'mp_popo'
43 SETUP_LOOP '216'
46 LOAD_GLOBAL 'sort_by_depends'
49 LOAD_FAST 'metadata'
52 CALL_FUNCTION_1 ''
55 GET_ITER ''
56 FOR_ITER '215'
59 STORE_FAST 't'
62 LOAD_CONST 'depends'
65 LOAD_FAST 't'
68 LOAD_ATTR 'info'
71 COMPARE_OP 'in'
74 POP_JUMP_IF_FALSE '56'
77 LOAD_FAST 't'
80 LOAD_ATTR 'name'
83 LOAD_ATTR 'startswith'
86 LOAD_CONST 'model'
89 CALL_FUNCTION_1 ''
92 UNARY_NOT ''
93 POP_JUMP_IF_FALSE '56'
96 LOAD_FAST 't'
99 LOAD_ATTR 'info'
102 LOAD_ATTR 'get'
105 LOAD_CONST 'has_object_model'
108 LOAD_GLOBAL 'False'
111 CALL_FUNCTION_2 ''
114_0 COME_FROM '74'
114_1 COME_FROM '93'
114 POP_JUMP_IF_FALSE '56'
117 LOAD_FAST 'cl'
120 LOAD_ATTR 'append'
123 LOAD_FAST 't'
126 LOAD_ATTR 'info'
129 LOAD_CONST 'mapping_sources'
132 BINARY_SUBSCR ''
133 LOAD_CONST ''
136 BINARY_SUBSCR ''
137 CALL_FUNCTION_1 ''
140 POP_TOP ''
141 LOAD_FAST 'mp'
144 LOAD_ATTR 'append'
147 LOAD_CONST 'CONTEXT.logger.debug("Mapping "%s" .. ")'
150 LOAD_FAST 't'
153 LOAD_ATTR 'name'
156 BINARY_MODULO ''
157 CALL_FUNCTION_1 ''
160 POP_TOP ''
161 LOAD_FAST 'mp'
164 LOAD_ATTR 'append'
167 LOAD_FAST 't'
170 LOAD_ATTR 'info'
173 LOAD_CONST 'mapping_sources'
176 BINARY_SUBSCR ''
177 LOAD_CONST 1
180 BINARY_SUBSCR ''
181 CALL_FUNCTION_1 ''
184 POP_TOP ''
185 LOAD_FAST 'mp_popo'
188 LOAD_ATTR 'append'
191 LOAD_FAST 't'
194 LOAD_ATTR 'info'
197 LOAD_CONST 'mapping_sources'
200 BINARY_SUBSCR ''
201 LOAD_CONST 2
204 BINARY_SUBSCR ''
205 CALL_FUNCTION_1 ''
208 POP_TOP ''
209 JUMP_BACK '56'
212 JUMP_BACK '56'
215_0 COME_FROM '56'
215 POP_BLOCK ''
216_0 COME_FROM '43'
216 LOAD_FAST 'create_file'
219 POP_JUMP_IF_FALSE '447'
222 LOAD_GLOBAL 'util'
225 LOAD_ATTR 'get_main_dir'
228 CALL_FUNCTION_0 ''
231 STORE_FAST 'main_dir'
234 LOAD_GLOBAL 'sys'
237 LOAD_ATTR 'path'
240 LOAD_ATTR 'append'
243 LOAD_FAST 'main_dir'
246 CALL_FUNCTION_1 ''
249 POP_TOP ''
250 LOAD_GLOBAL 'os'
253 LOAD_ATTR 'path'
256 LOAD_ATTR 'exists'
259 LOAD_FAST 'main_dir'
262 LOAD_CONST '/application/object_mappings/init.py'
265 BINARY_ADD ''
266 CALL_FUNCTION_1 ''
269 POP_JUMP_IF_TRUE '320'
272 LOAD_GLOBAL 'util'
275 LOAD_ATTR 'forcedirs'
278 LOAD_FAST 'main_dir'
281 LOAD_CONST '/application/object_mappings'
284 BINARY_ADD ''
285 CALL_FUNCTION_1 ''
288 POP_TOP ''
289 LOAD_GLOBAL 'file'
292 LOAD_FAST 'main_dir'
295 LOAD_CONST '/application/object_mappings/init.py'
298 BINARY_ADD ''
299 LOAD_CONST 'w'
302 CALL_FUNCTION_2 ''
305 SETUP_WITH '315'
308 STORE_FAST 'f'
311 POP_BLOCK ''
312 LOAD_CONST ''
315_0 COME_FROM '305'
315 WITH_CLEANUP ''
316 END_FINALLY ''
317 JUMP_FORWARD '320'
320_0 COME_FROM '317'
320 LOAD_GLOBAL 'file'
323 LOAD_FAST 'main_dir'
326 LOAD_CONST '/application/object_mappings/_object_mappings.py'
329 BINARY_ADD ''
330 LOAD_CONST 'w'
333 CALL_FUNCTION_2 ''
336 STORE_FAST 'f'
339 LOAD_FAST 'f'
342 LOAD_ATTR 'write'
345 LOAD_CONST '\n'
348 LOAD_ATTR 'join'
351 LOAD_FAST 'cl'
354 CALL_FUNCTION_1 ''
357 CALL_FUNCTION_1 ''
360 POP_TOP ''
361 LOAD_FAST 'f'
364 LOAD_ATTR 'write'
367 LOAD_CONST '\n'
370 LOAD_ATTR 'join'
373 LOAD_FAST 'mp'
376 CALL_FUNCTION_1 ''
379 CALL_FUNCTION_1 ''
382 POP_TOP ''
383 LOAD_FAST 'f'
386 LOAD_ATTR 'close'
389 CALL_FUNCTION_0 ''
392 POP_TOP ''
393 LOAD_GLOBAL 'file'
396 LOAD_FAST 'main_dir'
399 LOAD_CONST '/application/object_mappings/_object_popo.py'
402 BINARY_ADD ''
403 LOAD_CONST 'w'
406 CALL_FUNCTION_2 ''
409 STORE_FAST 'f'
412 LOAD_FAST 'f'
415 LOAD_ATTR 'write'
418 LOAD_CONST '\n'
421 LOAD_ATTR 'join'
424 LOAD_FAST 'mp_popo'
427 CALL_FUNCTION_1 ''
430 CALL_FUNCTION_1 ''
433 POP_TOP ''
434 LOAD_FAST 'f'
437 LOAD_ATTR 'close'
440 CALL_FUNCTION_0 ''
443 POP_TOP ''
444 JUMP_FORWARD '447'
447_0 COME_FROM '444'
447 LOAD_CONST -1
450 LOAD_CONST ''
453 IMPORT_NAME 'application.object_mappings._object_mappings'
456 LOAD_ATTR 'object_mappings'
459 LOAD_ATTR '_object_mappings'
462 STORE_FAST '_object_mappings'
465 LOAD_CONST -1
468 LOAD_CONST ''
471 IMPORT_NAME 'application.object_mappings._object_popo'
474 LOAD_ATTR 'object_mappings'
477 LOAD_ATTR '_object_popo'
480 STORE_FAST '_object_popo'
483 LOAD_FAST '_object_mappings'
486 LOAD_ATTR 'mapping_stub'
489 STORE_GLOBAL 'mapping_stub'
492 SETUP_LOOP '653'
495 LOAD_FAST 'metadata'
498 LOAD_ATTR 'tables'
501 LOAD_ATTR 'values'
504 CALL_FUNCTION_0 ''
507 GET_ITER ''
508 FOR_ITER '652'
511 STORE_FAST 't'
514 LOAD_CONST 'depends'
517 LOAD_FAST 't'
520 LOAD_ATTR 'info'
523 COMPARE_OP 'in'
526 POP_JUMP_IF_FALSE '508'
529 LOAD_FAST 't'
532 LOAD_ATTR 'name'
535 LOAD_ATTR 'startswith'
538 LOAD_CONST 'model'
541 CALL_FUNCTION_1 ''
544 UNARY_NOT ''
545 POP_JUMP_IF_FALSE '508'
548 LOAD_FAST 't'
551 LOAD_ATTR 'info'
554 LOAD_ATTR 'get'
557 LOAD_CONST 'has_object_model'
560 LOAD_GLOBAL 'False'
563 CALL_FUNCTION_2 ''
566_0 COME_FROM '526'
566_1 COME_FROM '545'
566 POP_JUMP_IF_FALSE '508'
569 LOAD_GLOBAL 'getattr'
572 LOAD_FAST '_object_mappings'
575 LOAD_CONST 'O'
578 LOAD_FAST 't'
581 LOAD_ATTR 'name'
584 BINARY_ADD ''
585 CALL_FUNCTION_2 ''
588 LOAD_FAST 't'
591 STORE_ATTR '_obj'
594 LOAD_FAST 'metadata'
597 LOAD_FAST 't'
600 LOAD_ATTR '_obj'
603 STORE_ATTR '__metadata'
606 LOAD_GLOBAL 'getattr'
609 LOAD_FAST '_object_popo'
612 LOAD_CONST 'popo_O'
615 LOAD_FAST 't'
618 LOAD_ATTR 'name'
621 BINARY_ADD ''
622 CALL_FUNCTION_2 ''
625 LOAD_FAST 't'
628 STORE_ATTR '_plain_obj'
631 LOAD_FAST 't'
634 LOAD_ATTR '_obj'
637 LOAD_FAST 't'
640 LOAD_ATTR '_plain_obj'
643 STORE_ATTR 'cls'
646 JUMP_BACK '508'
649 JUMP_BACK '508'
652_0 COME_FROM '508'
652 POP_BLOCK ''
653_0 COME_FROM '492'
Syntax error at or near `POP_BLOCK' token at offset 311
Hi,
on my Windows 7 the "executable" in Scripts
has no extension. This causes the problem that it can not called from command line. Renaming it to uncompyle2.py
solves the issue.
D:\Program Files\Microsoft Visual Studio 11.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild /EXP
ORT:inituncompyle/marshal_22 build\temp.win32-2.7\Release\uncompyle/marshal_22.obj /OUT:build\lib.win32-2.7\uncompyle\marshal_22.pyd /IMPLIB:build\tem
p.win32-2.7\Release\uncompyle\marshal_22.lib /MANIFESTFILE:build\temp.win32-2.7\Release\uncompyle\marshal_22.pyd.manifest
LINK : error LNK2001: unresolved external symbol inituncompyle/marshal_22
build\temp.win32-2.7\Release\uncompyle\marshal_22.lib : fatal error LNK1120: 1 unresolved externals
error: command '"D:\Program Files\Microsoft Visual Studio 11.0\VC\BIN\link.exe"' failed with exit status 1120
Hello,
I've encountered the following problem while decompiling an application :
C:\Python27\python.exe \python27\scripts\unpyc.py ..\mx\DateTime\DateTime.pyc
#2012.09.04 11:42:44 Paris, Madrid (heure d'été)
""" Python part of the low-level DateTime[Delta] type implementation.
Copyright (c) 1998-2001, Marc-Andre Lemburg; mailto:[email protected]
Copyright (c) 2000-2011, eGenix.com Software GmbH; mailto:[email protected]
See the documentation for further information on copyrights,
or contact the author. All Rights Reserved.
"""
#2012.09.04 11:42:45 Paris, Madrid (heure d'été)
""" Python part of the low-level DateTime[Delta] type implementation.
Copyright (c) 1998-2001, Marc-Andre Lemburg; mailto:[email protected]
Copyright (c) 2000-2011, eGenix.com Software GmbH; mailto:[email protected]
See the documentation for further information on copyrights,
or contact the author. All Rights Reserved.
"""
from mxDateTime import *
from mxDateTime import version
oneSecond = DateTimeDelta(0,0,0,1)
oneMinute = DateTimeDelta(0,0,1)
oneHour = DateTimeDelta(0,1)
oneDay = DateTimeDelta(1)
oneWeek = DateTimeDelta(7)
Epoch = DateTimeFromAbsDateTime(1, 0)
def _DT(absdate,abstime):
return DateTimeFromAbsDateTime(absdate,abstime)
def _DTD(seconds):
return DateTimeDeltaFromSeconds(seconds)
class modinit:
global _time, _math, _types, _sys, _pydatetime, _pydate, _pytime, _pytimedelta
import time, math, types, sys
_time = time
_math = math
_types = types
_sys = sys
try:
import datetime
_pydatetime = datetime.datetime
_pydate = datetime.date
_pytime = datetime.time
_pytimedelta = datetime.timedelta
except ImportError:
# Set them to (), so that isinstance() works with them
_pydatetime = ()
_pydate = ()
_pytime = ()
_pytimedelta = ()
del modinit
def _isstring(arg,
isinstance=isinstance, types=_types):
if isinstance(arg, types.StringType):
return 1
try:
if isinstance(arg, types.UnicodeType):
return 1
except AttributeError:
pass
return 0
def localtime(ticks=None,
# Locals:
time=_time.time,float=float,localtime=_time.localtime,
round=round,int=int,DateTime=DateTime,floor=_math.floor):
"""localtime(ticks=None)
Construct a DateTime instance using local time from ticks. If
ticks are not given, it defaults to the current time. The
result is similar to time.localtime(). Fractions of a second
are rounded to the nearest micro-second.
"""
if ticks is None:
ticks = time()
else:
ticks = float(ticks)
ticks = round(ticks, 6)
fticks = floor(ticks)
Y,M,D,h,m,s = localtime(fticks)[:6]
s = s + (ticks - fticks)
return DateTime(Y,M,D,h,m,s)
def gmtime(ticks=None,
# Locals:
time=_time.time,float=float,gmtime=_time.gmtime,
round=round,int=int,DateTime=DateTime,floor=_math.floor,
DateTimeDeltaFromSeconds=DateTimeDeltaFromSeconds,
Unix_Epoch=DateTime(1970, 1, 1)):
"""gmtime(ticks=None)
Construct a DateTime instance using UTC time from ticks. If
ticks are not given, it defaults to the current time. The
result is similar to time.gmtime(). Fractions of a second are
rounded to the nearest micro-second.
"""
if ticks is None:
ticks = time()
else:
ticks = float(ticks)
ticks = round(ticks, 6)
if POSIX:
# On POSIX platforms, the calulation is easy (and this also
# makes the calulation safe against year 2038 wrap-arounds and
# errors); see #421
return Unix_Epoch + DateTimeDeltaFromSeconds(float(ticks))
fticks = floor(ticks)
Y,M,D,h,m,s = gmtime(ticks)[:6]
s = s + (ticks - fticks)
return DateTime(Y,M,D,h,m,s)
def mktime((year,month,day,hour,minute,second,dow,doy,dst),
# Locals:
DateTime=DateTime):
"""mktime((year,month,day,hour,minute,second,dow,doy,dst))
Same as the DateTime() constructor accept that the interface
used is compatible to the similar time.mktime() API.
Note that the tuple elements dow, doy and dst are not used in
any way.
"""
return DateTime(year,month,day,hour,minute,second)
def ctime(datetime):
"""ctime(datetime)
Returns a string representation of the given DateTime instance
using the current locale's default settings.
"""
return datetime.strftime('%c')
def today(hour=0,minute=0,second=0.0,
# Locals:
localtime=_time.localtime,time=_time.time,DateTime=DateTime):
"""today(hour=0,minute=0,second=0.0)
Returns a DateTime instance for today (in local time) at the
given time (defaults to midnight).
"""
Y,M,D = localtime(time())[:3]
return DateTime(Y,M,D,hour,minute,second)
def TimeDelta(hours=0.0,minutes=0.0,seconds=0.0,
# Locals:
DateTimeDelta=DateTimeDelta):
"""TimeDelta(hours=0.0,minutes=0.0,seconds=0.0)
Returns a DateTimeDelta-object reflecting the given time
delta. Seconds can be given as float to indicate fractions.
"""
return DateTimeDelta(0,hours,minutes,seconds)
def gm2local(datetime):
""" gm2local(datetime)
Convert a DateTime instance holding UTC time to a DateTime
instance using local time.
"""
return localtime(datetime.gmticks())
def local2gm(datetime):
""" local2gm(datetime)
Convert a DateTime instance holding local time to a DateTime
instance using UTC time.
"""
return gmtime(datetime.ticks())
gmt = utc
current_myriad = localtime().tjd_myriad
def DateTimeFromTJD(tjd,tjd_myriad=current_myriad):
""" DateTimeFromTJD(tjd[,myriad])
Return a DateTime instance for the given Truncated Julian Day.
myriad defaults to the TJD myriad current at package import
time.
Note that this version of Truncated Julian Day number does
real truncation of important information. It's use is
discouraged and unsupported.
"""
return DateTimeFromAbsDays(tjd + tjd_myriad * 10000.0 - 1721425.0)
def DateTimeFromJDN(jdn):
""" DateTimeFromJDN(jdn)
Return a DateTime instance for the given Julian Day Number.
References:
-----------
Gregorian 2000-01-01 12:00:00 corresponds to JDN 2451545.0.
Gregorian 1858-11-17 00:00:00.00 corresponds to JDN 2400000.5; MJD 0.0.
Julian -4712-01-01 12:00:00.00 corresponds to JDN 0.0.
Gregorian -4713-11-24 12:00:00.00 corresponds to JDN 0.0.
"""
return DateTimeFromAbsDays(jdn - 1721425.5)
def DateTimeFromMJD(mjd):
""" DateTimeFromMJD(mjd)
Return a DateTime instance for the given Modified Julian Day
(MJD). The MJD is calculated the same way as the JDN except
that 1858-11-17 00:00:00.00 is taken as origin of the scale.
"""
return DateTimeFromAbsDays(mjd + 678575.0)
def DateTimeFrom(_args, *_kws):
""" DateTimeFrom(*args, **kws)
Generic DateTime instance constructor. Can handle parsing
strings, numbers and keywords.
"""
if len(args) == 1:
# Single argument
arg = args[0]
argtype = type(arg)
if _isstring(arg):
import Parser
return Parser.DateTimeFromString(*args, **kws)
elif argtype is DateTimeType:
return arg
elif argtype is DateTimeDeltaType:
raise TypeError,'cannot convert DateTimeDelta to DateTime'
elif isinstance(arg, _pydatetime):
if arg.tzinfo is not None:
# Convert to UTC
offset = arg.utcoffset()
arg -= offset
return DateTime(
arg.year, arg.month, arg.day,
arg.hour, arg.minute,
arg.second + arg.microsecond * 1e-6)
elif isinstance(arg, _pydate):
# Note: _pydatetime are subclasses of _pydates !
return DateTime(arg.year, arg.month, arg.day)
else:
try:
value = float(arg)
except (TypeError, ValueError):
value = int(arg)
assert not kws
return DateTimeFromTicks(value)
elif len(args) > 1:
# More than one argument
if len(args) == 2 and _isstring(args[0]) and _isstring(args[1]):
# interpret as date and time string
import Parser
return Parser.DateTimeFromString(
args[0] + ' ' + args[1],
**kws)
# Assume the arguments are the same as for DateTime()
if 'defaultdate' in kws:
raise TypeError('defaultdate is only supported when parsing '
'strings or using keyword arguments only')
return DateTime(*args, **kws)
elif len(kws) > 0:
# Keyword arguments only; add defaults... today at 0:00:00
defaultdate = kws.get('defaultdate', None)
if defaultdate is None:
defaultdate = today()
hour = kws.get('hour', defaultdate.hour)
minute = kws.get('minute', defaultdate.minute)
second = kws.get('second', defaultdate.second)
day = kws.get('day', defaultdate.day)
month = kws.get('month', defaultdate.month)
year = kws.get('year', defaultdate.year)
return DateTime(year,month,day,hour,minute,second)
else:
raise TypeError(
'cannot convert date/time arguments to DateTime: '
'args=%r, kws=%r' % (args, kws))
def DateFrom(_args, *_kws):
""" DateFrom(*args, **kws)
Generic DateTime instance constructor. Can handle parsing
strings, numbers and keywords, but only works on the date
part.
"""
if len(args) == 1:
# Single argument
arg = args[0]
argtype = type(arg)
if _isstring(arg):
import Parser
return Parser.DateFromString(*args, **kws)
elif argtype is DateTimeType:
return arg
elif argtype is DateTimeDeltaType:
raise TypeError,'cannot convert DateTimeDelta to DateTime'
elif isinstance(arg, _pydate):
# Note: _pydatetime are subclasses of _pydates !
return DateTime(arg.year, arg.month, arg.day)
else:
try:
value = float(arg)
except (TypeError, ValueError):
value = int(arg)
assert not kws
return DateTimeFromTicks(value)
elif len(args) > 1:
# Assume the arguments are the same as for DateTime()
return DateTime(*args, **kws)
elif len(kws) > 0:
# Keyword arguments; add defaults... today at 0:00:00
today = now()
day = kws.get('day',today.day)
month = kws.get('month',today.month)
year = kws.get('year',today.year)
return DateTime(year,month,day)
else:
raise TypeError(
'cannot convert date arguments to DateTime: args=%r, kws=%r' %
(args, kws))
def DateTimeDeltaFrom(_args, *_kws):
""" DateTimeDeltaFrom(*args, **kws)
Generic DateTimeDelta instance constructor. Can handle parsing
strings, numbers and keywords.
"""
if len(args) == 1:
# Single argument
arg = args[0]
if _isstring(arg):
import Parser
return Parser.DateTimeDeltaFromString(*args, **kws)
elif type(arg) is DateTimeDeltaType:
return arg
elif type(arg) is DateTimeType:
raise TypeError,'cannot convert DateTime to DateTimeDelta'
elif isinstance(arg, _pytime):
if arg.tzinfo is not None:
# Convert to UTC
offset = arg.utcoffset()
# Another datetime module quirk: time - timedelta
# doesn't work, so we have to use a different method
# of adjusting the result
return DateTimeDelta(0,
arg.hour, arg.minute,
arg.second + arg.microsecond * 1e-6
- offset.seconds)
else:
return DateTimeDelta(0,
arg.hour, arg.minute,
arg.second + arg.microsecond * 1e-6)
elif isinstance(arg, _pytimedelta):
return DateTimeDelta(arg.days,
0, 0,
arg.seconds + arg.microseconds * 1e-6)
else:
try:
value = float(arg)
except TypeError:
value = int(arg)
assert not kws
return DateTimeDeltaFromSeconds(value)
elif len(args) > 1:
# Assume the arguments are the same as for DateTimeDelta()
return DateTimeDelta(*args, **kws)
elif len(kws) > 0:
# Keyword arguments; default: 00:00:00:00.00
hours = kws.get('hours',0)
minutes = kws.get('minutes',0)
seconds = kws.get('seconds',0.0)
days = kws.get('days',0)
return DateTimeDelta(days,hours,minutes,seconds)
else:
raise TypeError,'cannot convert arguments to DateTimeDelta'
def TimeDeltaFrom(_args, *_kws):
""" TimeDeltaFrom(*args, **kws)
Generic TimeDelta instance constructor. Can handle parsing
strings, numbers and keywords.
"""
if len(args) > 1:
# Assume the arguments are the same as for TimeDelta(): without
# days part !
return DateTimeDelta(0, *args, **kws)
else:
# Otherwise treat the arguments just like for DateTimeDelta
# instances.
return DateTimeDeltaFrom(*args, **kws)
def DateFromTicks(ticks,
# Locals:
DateTime=DateTime,localtime=_time.localtime):
""" DateFromTicks(ticks)
Constructs a DateTime instance pointing to the local time date
at 00:00:00.00 (midnight) indicated by the given ticks value.
The time part is ignored.
"""
return DateTime(*localtime(ticks)[:3])
def TimestampFromTicks(ticks,
# Locals:
DateTime=DateTime,localtime=_time.localtime):
""" TimestampFromTicks(ticks)
Constructs a DateTime instance pointing to the local date and
time indicated by the given ticks value.
"""
return DateTime(*localtime(ticks)[:6])
def TimeFromTicks(ticks,
# Locals:
DateTimeDelta=DateTimeDelta,localtime=_time.localtime):
""" TimeFromTicks(ticks)
Constructs a DateTimeDelta instance pointing to the local time
indicated by the given ticks value. The date part is ignored.
"""
return DateTimeDelta(0, *localtime(ticks)[3:6])
utctime = gmtime
utc2local = gm2local
local2utc = local2gm
DateTimeFromTicks = localtime
Date = DateTime
Time = TimeDelta
Timestamp = DateTime
TimeFrom = TimeDeltaFrom
TimestampFrom = DateTimeFrom
GregorianDateTime = DateTime
GregorianDate = Date
JulianDate = JulianDateTime
def gmticks(datetime):
"""gmticks(datetime)
[DEPRECIATED: use the .gmticks() method]
Returns a ticks value based on the values stored in
datetime under the assumption that they are given in UTC,
rather than local time.
"""
return datetime.gmticks()
utcticks = gmticks
def tz_offset(datetime,
# Locals:
oneSecond=oneSecond):
"""tz_offset(datetime)
[DEPRECIATED: use the .gmtoffset() method]
Returns a DateTimeDelta instance representing the UTC
offset for datetime assuming that the stored values refer
to local time. If you subtract this value from datetime,
you'll get UTC time.
"""
return datetime.gmtoffset()
Monday = 0
Tuesday = 1
Wednesday = 2
Thursday = 3
Friday = 4
Saturday = 5
Sunday = 6
Weekday = {'Saturday': 5, 6: 'Sunday', 'Sunday': 6, 'Thursday': 3,
'Wednesday': 2, 'Friday': 4, 'Tuesday': 1, 'Monday': 0,
5: 'Saturday', 4: 'Friday', 3: 'Thursday', 2: 'Wednesday',
1: 'Tuesday', 0: 'Monday'}
January = 1
February = 2
March = 3
April = 4
May = 5
June = 6
July = 7
August = 8
September = 9
October = 10
November = 11
December = 12
Month = {2: 'February', 3: 'March', None: 0, 'July': 7, 11: 'November',
'December': 12, 'June': 6, 'January': 1, 'September': 9, 'August':
8, 'March': 3, 'November': 11, 'April': 4, 12: 'December', 'May':
5, 10: 'October', 9: 'September', 8: 'August', 7: 'July', 6:
'June', 5: 'May', 4: 'April', 'October': 10, 'February': 2, 1:
'January', 0: None}
MaxDateTime = DateTime(_sys.maxint / 366 - 1, 12, 31)
MinDateTime = DateTime(-_sys.maxint / 366 + 2, 1, 1)
MaxDateTimeDelta = DateTimeDeltaFromSeconds(_sys.maxint * 86400.0)
MinDateTimeDelta = -MaxDateTimeDelta
class RelativeDateTime:
"""RelativeDateTime(years=0,months=0,days=0,
hours=0,minutes=0,seconds=0,
year=0,month=0,day=0,
hour=None,minute=None,second=None,
weekday=None,weeks=None)
Returns a RelativeDateTime instance for the specified relative
time. The constructor handles keywords, so you'll only have to
give those parameters which should be changed when you add the
relative to an absolute DateTime instance.
Adding RelativeDateTime instances is supported with the
following rules: deltas will be added together, right side
absolute values override left side ones.
Adding RelativeDateTime instances to DateTime instances will
return DateTime instances with the appropriate calculations
applied, e.g. to get a DateTime instance for the first of next
month, you'd call now() + RelativeDateTime(months=+1,day=1).
"""
years = 0
months = 0
days = 0
year = None
month = 0
day = 0
hours = 0
minutes = 0
seconds = 0
hour = None
minute = None
second = None
weekday = None
# cached hash value
_hash = None
# For Zope security:
__roles__ = None
__allow_access_to_unprotected_subobjects__ = 1
def __init__(self,
years=0,months=0,days=0,
hours=0,minutes=0,seconds=0,
year=None,month=None,day=None,
hour=None,minute=None,second=None,
weekday=None,weeks=0):
self.years = years
self.months = months
self.days = days + weeks*7
self.year = year
self.month = month
self.day = day
self.hours = hours
self.minutes = minutes
self.seconds = seconds
self.hour = hour
self.minute = minute
self.second = second
if weekday is not None:
# Make sure we've got a 2-tuple
assert len(weekday) == 2
self.weekday = weekday
def __add__(self,other,
# Locals:
isinstance=isinstance):
if isinstance(other,RelativeDateTime):
# RelativeDateTime (self) + RelativeDateTime (other)
r = RelativeDateTime()
# date deltas
r.years = self.years + other.years
r.months = self.months + other.months
r.days = self.days + other.days
# absolute entries of other override those in self, if given
r.year = other.year or self.year
r.month = other.month or self.month
r.day = other.day or self.day
r.weekday = other.weekday or self.weekday
# time deltas
r.hours = self.hours + other.hours
r.minutes = self.minutes + other.minutes
r.seconds = self.seconds + other.seconds
# absolute entries of other override those in self, if given
r.hour = other.hour or self.hour
r.minute = other.minute or self.minute
r.second = other.second or self.second
return r
else:
raise TypeError,"can't add the two types"
def __radd__(self,other,
# Locals:
isinstance=isinstance,DateTimeType=DateTimeType,
DateTime=DateTime,DateTimeDelta=DateTimeDelta):
if isinstance(other,DateTimeType):
# DateTime (other) + RelativeDateTime (self)
# date
if self.year is None:
year = other.year + self.years
else:
year = self.year + self.years
if self.month is None:
month = other.month + self.months
else:
month = self.month + self.months
if self.day is None:
day = other.day
else:
day = self.day
if day < 0:
# fix negative day values
month = month + 1
day = day + 1
day = day + self.days
# time
if self.hour is None:
hour = other.hour + self.hours
else:
hour = self.hour + self.hours
if self.minute is None:
minute = other.minute + self.minutes
else:
minute = self.minute + self.minutes
if self.second is None:
second = other.second + self.seconds
else:
second = self.second + self.seconds
# Refit into proper ranges:
if month < 1 or month > 12:
month = month - 1
yeardelta, monthdelta = divmod(month, 12)
year = year + yeardelta
month = monthdelta + 1
# Make sure we have integers
year = int(year)
month = int(month)
day = int(day)
if self.weekday is None:
return DateTime(year, month, 1) + \
DateTimeDelta(day-1,hour,minute,second)
# Adjust to the correct weekday
day_of_week,index = self.weekday
d = DateTime(year, month, 1) + \
DateTimeDelta(day-1,hour,minute,second)
if index == 0:
#0 index: next weekday if no match
return d + (day_of_week - d.day_of_week)
elif index > 0:
# positive index (1 == first weekday of month)
first = d - (d.day - 1)
diff = day_of_week - first.day_of_week
if diff >= 0:
return first + (diff + (index-1) * 7)
else:
return first + (diff + index * 7)
else:
# negative index (-1 == last weekday of month)
last = d + (d.days_in_month - d.day)
diff = day_of_week - last.day_of_week
if diff <= 0:
return last + (diff + (index+1) * 7)
else:
return last + (diff + index * 7)
else:
raise TypeError,"can't add the two types"
def __sub__(self,other):
if isinstance(other,RelativeDateTime):
# RelativeDateTime (self) - RelativeDateTime (other)
r = RelativeDateTime()
# date deltas
r.years = self.years - other.years
r.months = self.months - other.months
r.days = self.days - other.days
# absolute entries of other override those in self, if given
r.year = other.year or self.year
r.month = other.month or self.month
r.day = other.day or self.day
r.weekday = other.weekday or self.weekday
# time deltas
r.hours = self.hours - other.hours
r.minutes = self.minutes - other.minutes
r.seconds = self.seconds - other.seconds
# absolute entries of other override those in self, if given
r.hour = other.hour or self.hour
r.minute = other.minute or self.minute
r.second = other.second or self.second
return r
else:
raise TypeError,"can't subtract the two types"
def __rsub__(self,other,
# Locals:
isinstance=isinstance,DateTimeType=DateTimeType):
if isinstance(other,DateTimeType):
# DateTime (other) - RelativeDateTime (self)
return other + self.__neg__()
else:
raise TypeError,"can't subtract the two types"
def __neg__(self):
# - RelativeDateTime(self)
r = RelativeDateTime()
# negate date deltas
r.years = - self.years
r.months = - self.months
r.days = - self.days
# absolute entries don't change
r.year = self.year
r.month = self.month
r.day = self.day
r.weekday = self.weekday
# negate time deltas
r.hours = - self.hours
r.minutes = - self.minutes
r.seconds = - self.seconds
# absolute entries don't change
r.hour = self.hour
r.minute = self.minute
r.second = self.second
return r
def __nonzero__(self):
# RelativeDateTime instances are considered false in case
# they do not define any alterations
if (self.year is None and
self.years == 0 and
self.month is None and
self.months == 0 and
self.day is None and
self.weekday is None and
self.days == 0 and
self.hour is None and
self.hours == 0 and
self.minute is None and
self.minutes == 0 and
self.second is None and
self.seconds == 0):
return 0
else:
return 1
def __mul__(self,other):
# RelativeDateTime (self) * Number (other)
factor = float(other)
r = RelativeDateTime()
# date deltas
r.years = factor * self.years
r.months = factor * self.months
r.days = factor * self.days
# time deltas
r.hours = factor * self.hours
r.minutes = factor * self.minutes
r.seconds = factor * self.seconds
return r
__rmul__ = __mul__
def __div__(self,other):
# RelativeDateTime (self) / Number (other)
return self.__mul__(1/float(other))
def __eq__(self, other):
if isinstance(self, RelativeDateTime) and \
isinstance(other, RelativeDateTime):
# RelativeDateTime (self) == RelativeDateTime (other)
if (self.years == other.years and
self.months == other.months and
self.days == other.days and
self.year == other.year and
self.day == other.day and
self.hours == other.hours and
self.minutes == other.minutes and
self.seconds == other.seconds and
self.hour == other.hour and
self.minute == other.minute and
self.second == other.second and
self.weekday == other.weekday):
return 1
else:
return 0
else:
raise TypeError,"can't compare the two types"
def __hash__(self):
if self._hash is not None:
return self._hash
x = 1234
for value in (self.years, self.months, self.days,
self.year, self.day,
self.hours, self.minutes, self.seconds,
self.hour, self.minute, self.second,
self.weekday):
if value is None:
x = 135051820 ^ x
else:
x = hash(value) ^ x
self._hash = x
return x
def __str__(self):
l = []
append = l.append
# Format date part
if self.year is not None:
append('%04i-' % self.year)
elif self.years:
append('(%0+5i)-' % self.years)
else:
append('YYYY-')
if self.month is not None:
append('%02i-' % self.month)
elif self.months:
append('(%0+3i)-' % self.months)
else:
append('MM-')
if self.day is not None:
append('%02i' % self.day)
elif self.days:
append('(%0+3i)' % self.days)
else:
append('DD')
if self.weekday:
append(' %s:%i' % (Weekday[self.weekday[0]][:3],self.weekday[1]))
append(' ')
# Normalize relative time values to avoid fractions
hours = self.hours
minutes = self.minutes
seconds = self.seconds
hours_fraction = hours - int(hours)
minutes = minutes + hours_fraction * 60.0
minutes_fraction = minutes - int(minutes)
seconds = seconds + minutes_fraction * 6.0
seconds_fraction = seconds - int(seconds)
if 0:
# Normalize to standard time ranges
if seconds > 60.0:
extra_minutes, seconds = divmod(seconds, 60.0)
minutes = minutes + extra_minutes
elif seconds < -60.0:
extra_minutes, seconds = divmod(seconds, -60.0)
minutes = minutes - extra_minutes
if minutes >= 60.0:
extra_hours, minutes = divmod(minutes, 60.0)
hours = hours + extra_hours
elif minutes <= -60.0:
extra_hours, minutes = divmod(minutes, -60.0)
hours = hours - extra_hours
# Format time part
if self.hour is not None:
append('%02i:' % self.hour)
elif hours:
append('(%0+3i):' % hours)
else:
append('HH:')
if self.minute is not None:
append('%02i:' % self.minute)
elif minutes:
append('(%0+3i):' % minutes)
else:
append('MM:')
if self.second is not None:
append('%02i' % self.second)
elif seconds:
append('(%0+3i)' % seconds)
else:
append('SS')
return ''.join(l)
def __repr__(self):
return "<%s instance for '%s' at 0x%x>" % (
self.__class__.__name__,
self.__str__(),
id(self))
RelativeDate = RelativeDateTime
def RelativeDateTimeFrom(_args, *_kws):
""" RelativeDateTimeFrom(*args, **kws)
Generic RelativeDateTime instance constructor. Can handle
parsing strings and keywords.
"""
if len(args) == 1:
# Single argument
arg = args[0]
if _isstring(arg):
import Parser
return Parser.RelativeDateTimeFromString(*args, **kws)
elif isinstance(arg, RelativeDateTime):
return arg
else:
raise TypeError,\
'cannot convert argument to RelativeDateTime'
else:
return RelativeDateTime(*args, **kws)
def RelativeDateTimeDiff(date1,date2,
floor=_math.floor,int=int,divmod=divmod,
RelativeDateTime=RelativeDateTime):
""" RelativeDateTimeDiff(date1,date2)
Returns a RelativeDateTime instance representing the difference
between date1 and date2 in relative terms.
The following should hold:
date2 + RelativeDateDiff(date1,date2) == date1
for all dates date1 and date2.
Note that due to the algorithm used by this function, not the
whole range of DateTime instances is supported; there could
also be a loss of precision.
XXX There are still some problems left (thanks to Carel
Fellinger for pointing these out):
29 1 1901 -> 1 3 1901 = 1 month
29 1 1901 -> 1 3 1900 = -10 month and -28 days, but
29 1 1901 -> 28 2 1900 = -11 month and -1 day
and even worse:
>>> print RelativeDateDiff(Date(1900,3,1),Date(1901,2,1))
YYYY-(-11)-DD HH:MM:SS
with:
>>> print Date(1901,1,29) + RelativeDateTime(months=-11)
1900-03-01 00:00:00.00
>>> print Date(1901,2,1) + RelativeDateTime(months=-11)
1900-03-01 00:00:00.00
"""
diff = date1 - date2
if diff.days == 0:
return RelativeDateTime()
date1months = date1.year * 12 + (date1.month - 1)
date2months = date2.year * 12 + (date2.month - 1)
#print 'months',date1months,date2months
# Calculate the months difference
diffmonths = date1months - date2months
#print 'diffmonths',diffmonths
if diff.days > 0:
years,months = divmod(diffmonths,12)
else:
years,months = divmod(diffmonths,-12)
years = -years
date3 = date2 + RelativeDateTime(years=years,months=months)
diff3 = date1 - date3
days = date1.absdays - date3.absdays
#print 'date3',date3,'diff3',diff3,'days',days
# Correction to ensure that all relative parts have the same sign
while days * diff.days < 0:
if diff.days > 0:
diffmonths = diffmonths - 1
years,months = divmod(diffmonths,12)
else:
diffmonths = diffmonths + 1
years,months = divmod(diffmonths,-12)
years = -years
#print 'diffmonths',diffmonths
date3 = date2 + RelativeDateTime(years=years,months=months)
diff3 = date1 - date3
days = date1.absdays - date3.absdays
#print 'date3',date3,'diff3',diff3,'days',days
# Drop the fraction part of days
if days > 0:
days = int(floor(days))
else:
days = int(-floor(-days))
return RelativeDateTime(years=years,
months=months,
days=days,
hours=diff3.hour,
minutes=diff3.minute,
seconds=diff3.second)
RelativeDateDiff = RelativeDateTimeDiff
Age = RelativeDateTimeDiff
_current_year = now().year
_current_century, _current_year_in_century = divmod(_current_year, 100)
_current_century = _current_century * 100
def add_century(year,
current_year=_current_year,
current_century=_current_century):
""" Sliding window approach to the Y2K problem: adds a suitable
century to the given year and returns it as integer.
The window used depends on the current year (at import time).
If adding the current century to the given year gives a year
within the range current_year-70...current_year+30 [both
inclusive], then the current century is added. Otherwise the
century (current + 1 or - 1) producing the smallest difference is
chosen.
"""
if year > 99:
# Take it as-is
return year
year = year + current_century
diff = year - current_year
if diff >= -70 and diff <= 30:
return year
elif diff < -70:
return year + 100
else:
return year - 100
def gregorian_jdn(year,month,day):
# XXX These require proper integer division.
a = (14-month)/12
y = year+4800-a
m = month + 12*a - 3
return day + (306*m+5)/10 + y*365 + y/4 - y/100 + y/400 - 32045
def julian_jdn(year,month,day):
# XXX These require proper integer division.
a = (14-month)/12
y = year+4800-a
m = month + 12*a - 3
return day + (306*m+5)/10 + y*365 + y/4 - 32083
Hi, firstofall thanks for this great tool! :)
I stumbled upon a little problem: Decompiling something like the following failes and I’ve no idea on how to fix it:
def bar(self):
return 'C' or ('A' if True else 'B')
Here is the output:
0 LOAD_CONST 'C'
3 JUMP_IF_TRUE_OR_POP '19'
6 LOAD_GLOBAL 'True'
9 POP_JUMP_IF_FALSE '16'
12 LOAD_CONST 'A'
15 RETURN_END_IF None
16 LOAD_CONST 'B'
19_0 COME_FROM '3'
19 RETURN_VALUE None
-1 RETURN_LAST None
Syntax error at or near `RETURN_END_IF' token at offset 15
There are a number of bugs in the unmaintained forks of uncompyle2. I'd like folks to know what those issues are but reporting them in all the forks is a bit tedious. Details can be found in
https://github.com/gstarnberger/uncompyle/issues
Periodically I'll update the numbers in the title.
In commit 9b0c0da, non-python-2.7 specific files were removed, but looks like you forgot to add python2.7-specific files under new name, which results in inability to use functionality of dis and opcode modules, which in turn results into uncompyle being unable to even show help (broken attribute references), let alone uncompyling pycs.
Reverting to previous commit resolves issue.
Hi wibiti, now a different file is failing: zope.interface.verify: def _verify()
Sure seems like a neverending job for you :(
Pyo: http://www.mediafire.com/?2dhdffc6t7tc5ay
Py: http://codepad.org/nl7UkFYK
Best regards
Please add support for decompiling Python 2.5 and 2.6 bytecode.
https://github.com/Mysterie/uncompyle2 supports decompiling Python 2.5 and 2.6 bytecode.
I tried to do this myself (by integrating changes from the above repository) but it didn't work out well.
decompiled 4 files: 4 okay, 232 failed, 0 verify failed
The last commit fixed a 4 of 7 files I had trouble decompiling, there are still 3 though that I have a need for, and because of that I decided to post a new issue, though I don't have the source code for those:
def remote_mouseSelect--- This code section failed: --- 0 SETUP_LOOP '185' 3 LOAD_FAST 'self' 6 LOAD_ATTR 'charInfos' 9 LOAD_ATTR 'iteritems' 12 CALL_FUNCTION_0 '' 15 GET_ITER '' 16 FOR_ITER '184' 19 UNPACK_SEQUENCE_2 '' 22 STORE_FAST 'x' 25 STORE_FAST 'cinfo' 28 LOAD_FAST 'x' 31 LOAD_FAST 'charIndex' 34 COMPARE_OP '==' 37 POP_JUMP_IF_FALSE '131' 40 LOAD_FAST 'cinfo' 43 LOAD_ATTR 'clientSettings' 46 LOAD_CONST 'LINKTARGET' 49 BINARY_SUBSCR '' 50 POP_JUMP_IF_FALSE '16' 53 LOAD_CONST -1 56 LOAD_CONST ('PARTYWND',) 59 IMPORT_NAME 'gui.partyWnd' 62 IMPORT_FROM 'PARTYWND' 65 STORE_FAST 'PARTYWND' 68 POP_TOP '' 69 LOAD_CONST '' 72 LOAD_FAST 'cinfo' 75 LOAD_ATTR 'clientSettings' 78 LOAD_CONST 'LINKTARGET' 81 STORE_SUBSCR '' 82 LOAD_FAST 'PARTYWND' 85 LOAD_ATTR 'settingsPane' 88 LOAD_ATTR 'currentChar' 91 LOAD_FAST 'cinfo' 94 COMPARE_OP '==' 97 POP_JUMP_IF_FALSE '125' 100 LOAD_FAST 'PARTYWND' 103 LOAD_ATTR 'settingsPane' 106 LOAD_ATTR 'setFromCharacterInfo' 109 LOAD_FAST 'cinfo' 112 LOAD_GLOBAL 'True' 115 CALL_FUNCTION_2 '' 118 POP_TOP '' 119 JUMP_ABSOLUTE '125' 122 JUMP_BACK '16' 122_ JUMP_BACK_ELSE '' 125 JUMP_BACK '16' 128 JUMP_FORWARD '131' 131_0 COME_FROM '128' 131 LOAD_FAST 'cinfo' 134 LOAD_ATTR 'clientSettings' 137 LOAD_CONST 'LINKMOUSETARGET' 140 BINARY_SUBSCR '' 141 POP_JUMP_IF_FALSE '16' 144 LOAD_FAST 'self' 147 LOAD_ATTR 'perspective' 150 LOAD_ATTR 'callRemote' 153 LOAD_CONST 'PlayerAvatar' 156 LOAD_CONST 'doCommand' 159 LOAD_CONST 'TARGETID' 162 LOAD_FAST 'x' 165 LOAD_FAST 'mobId' 168 LOAD_CONST '' 171 BUILD_LIST_3 '' 174 CALL_FUNCTION_4 '' 177 POP_TOP '' 178 JUMP_BACK '16' 181 JUMP_BACK '16' 184 POP_BLOCK '' 185_0 COME_FROM '0' Syntax error at or near `COME_FROM' token at offset 131_0
def checkTrainSkill--- This code section failed: --- 0 LOAD_GLOBAL 'list' 3 LOAD_FAST 'self' 6 LOAD_ATTR 'trainSkills' 9 CALL_FUNCTION_1 '' 12 STORE_FAST 'trainSkillList' 15 LOAD_GLOBAL 'len' 18 LOAD_FAST 'trainSkillList' 21 CALL_FUNCTION_1 '' 24 POP_JUMP_IF_TRUE '31' 27 LOAD_GLOBAL 'True' 30 RETURN_VALUE '' 31 LOAD_FAST 'player' 34 LOAD_ATTR 'curChar' 37 STORE_FAST 'char' 40 LOAD_FAST 'char' 43 LOAD_ATTR 'spawn' 46 STORE_FAST 'spawn' 49 SETUP_LOOP '141' 52 LOAD_GLOBAL 'reversed' 55 LOAD_FAST 'trainSkillList' 58 CALL_FUNCTION_1 '' 61 GET_ITER '' 62 FOR_ITER '140' 65 STORE_FAST 'ts' 68 LOAD_FAST 'ts' 71 LOAD_ATTR 'skill' 74 LOAD_FAST 'char' 77 LOAD_ATTR 'mob' 80 LOAD_ATTR 'skillLevels' 83 COMPARE_OP 'in' 86 POP_JUMP_IF_FALSE '62' 89 LOAD_FAST 'player' 92 LOAD_ATTR 'sendGameText' 95 LOAD_GLOBAL 'RPG_MSG_GAME_DENIED' 98 LOAD_CONST '%s already knows the %s skill.\\n' 101 LOAD_FAST 'char' 104 LOAD_ATTR 'name' 107 LOAD_FAST 'ts' 110 LOAD_ATTR 'skill' 113 BUILD_TUPLE_2 '' 116 BINARY_MODULO '' 117 CALL_FUNCTION_2 '' 120 POP_TOP '' 121 LOAD_FAST 'trainSkillList' 124 LOAD_ATTR 'remove' 127 LOAD_FAST 'ts' 130 CALL_FUNCTION_1 '' 133 POP_TOP '' 134 JUMP_BACK '62' 137 JUMP_BACK '62' 140 POP_BLOCK '' 141_0 COME_FROM '49' 141 LOAD_GLOBAL 'len' 144 LOAD_FAST 'trainSkillList' 147 CALL_FUNCTION_1 '' 150 POP_JUMP_IF_TRUE '157' 153 LOAD_GLOBAL 'False' 156 RETURN_VALUE '' 157 BUILD_MAP '' 160 STORE_FAST 'pneeded' 163 BUILD_MAP '' 166 STORE_FAST 'sneeded' 169 BUILD_MAP '' 172 STORE_FAST 'tneeded' 175 LOAD_GLOBAL 'set' 178 CALL_FUNCTION_0 '' 181 STORE_FAST 'noClassSkill' 184 SETUP_LOOP '756' 187 LOAD_GLOBAL 'reversed' 190 LOAD_FAST 'trainSkillList' 193 CALL_FUNCTION_1 '' 196 GET_ITER '' 197 FOR_ITER '755' 200 STORE_FAST 'ts' 203 LOAD_FAST 'noClassSkill' 206 LOAD_ATTR 'add' 209 LOAD_FAST 'ts' 212 LOAD_ATTR 'skill' 215 CALL_FUNCTION_1 '' 218 POP_TOP '' 219 SETUP_LOOP '752' 222 LOAD_FAST 'spawn' 225 LOAD_ATTR 'pclass' 228 LOAD_ATTR 'classSkills' 231 GET_ITER '' 232 FOR_ITER '333' 235 STORE_FAST 'skill' 238 LOAD_FAST 'skill' 241 LOAD_ATTR 'skillname' 244 LOAD_FAST 'ts' 247 LOAD_ATTR 'skill' 250 COMPARE_OP '!=' 253 POP_JUMP_IF_FALSE '262' 256 JUMP_BACK '232' 259 JUMP_FORWARD '262' 262_0 COME_FROM '259' 262 LOAD_FAST 'noClassSkill' 265 LOAD_ATTR 'discard' 268 LOAD_FAST 'ts' 271 LOAD_ATTR 'skill' 274 CALL_FUNCTION_1 '' 277 POP_TOP '' 278 LOAD_FAST 'skill' 281 LOAD_ATTR 'levelGained' 284 LOAD_FAST 'spawn' 287 LOAD_ATTR 'plevel' 290 COMPARE_OP '>' 293 POP_JUMP_IF_FALSE '316' 296 LOAD_FAST 'skill' 299 LOAD_ATTR 'levelGained' 302 LOAD_FAST 'pneeded' 305 LOAD_FAST 'skill' 308 LOAD_ATTR 'skillname' 311 STORE_SUBSCR '' 312 BREAK_LOOP '' 313 JUMP_FORWARD '316' 316_0 COME_FROM '313' 316 LOAD_FAST 'trainSkillList' 319 LOAD_ATTR 'remove' 322 LOAD_FAST 'ts' 325 CALL_FUNCTION_1 '' 328 POP_TOP '' 329 BREAK_LOOP '' 330 JUMP_BACK '232' 333 POP_BLOCK '' 334 LOAD_FAST 'spawn' 337 LOAD_ATTR 'sclass' 340 POP_JUMP_IF_FALSE '197' 343 SETUP_LOOP '752' 346 LOAD_FAST 'spawn' 349 LOAD_ATTR 'sclass' 352 LOAD_ATTR 'classSkills' 355 GET_ITER '' 356 FOR_ITER '512' 359 STORE_FAST 'skill' 362 LOAD_FAST 'skill' 365 LOAD_ATTR 'skillname' 368 LOAD_FAST 'ts' 371 LOAD_ATTR 'skill' 374 COMPARE_OP '!=' 377 POP_JUMP_IF_FALSE '386' 380 JUMP_BACK '356' 383 JUMP_FORWARD '386' 386_0 COME_FROM '383' 386 LOAD_FAST 'noClassSkill' 389 LOAD_ATTR 'discard' 392 LOAD_FAST 'ts' 395 LOAD_ATTR 'skill' 398 CALL_FUNCTION_1 '' 401 POP_TOP '' 402 LOAD_FAST 'skill' 405 LOAD_ATTR 'levelGained' 408 LOAD_FAST 'spawn' 411 LOAD_ATTR 'slevel' 414 COMPARE_OP '>' 417 POP_JUMP_IF_FALSE '461' 420 LOAD_FAST 'pneeded' 423 LOAD_ATTR 'has_key' 426 LOAD_FAST 'skill' 429 LOAD_ATTR 'skillname' 432 CALL_FUNCTION_1 '' 435 POP_JUMP_IF_TRUE '457' 438 LOAD_FAST 'skill' 441 LOAD_ATTR 'levelGained' 444 LOAD_FAST 'sneeded' 447 LOAD_FAST 'skill' 450 LOAD_ATTR 'skillname' 453 STORE_SUBSCR '' 454 JUMP_FORWARD '457' 457_0 COME_FROM '454' 457 BREAK_LOOP '' 458 JUMP_FORWARD '461' 461_0 COME_FROM '458' 461 SETUP_EXCEPT '478' 464 LOAD_FAST 'pneeded' 467 LOAD_FAST 'skill' 470 LOAD_ATTR 'skillname' 473 DELETE_SUBSCR '' 474 POP_BLOCK '' 475 JUMP_FORWARD '495' 478_0 COME_FROM '461' 478 DUP_TOP '' 479 LOAD_GLOBAL 'KeyError' 482 COMPARE_OP 'exception match' 485 POP_JUMP_IF_FALSE '494' 488 POP_TOP '' 489 POP_TOP '' 490 POP_TOP '' 491 JUMP_FORWARD '495' 494 END_FINALLY '' 495_0 COME_FROM '475' 495_1 COME_FROM '491' 495 LOAD_FAST 'trainSkillList' 498 LOAD_ATTR 'remove' 501 LOAD_FAST 'ts' 504 CALL_FUNCTION_1 '' 507 POP_TOP '' 508 BREAK_LOOP '' 509 JUMP_BACK '356' 512 POP_BLOCK '' 513 LOAD_FAST 'spawn' 516 LOAD_ATTR 'tclass' 519 POP_JUMP_IF_FALSE '752' 522 SETUP_LOOP '749' 525 LOAD_FAST 'spawn' 528 LOAD_ATTR 'tclass' 531 LOAD_ATTR 'classSkills' 534 GET_ITER '' 535 FOR_ITER '745' 538 STORE_FAST 'skill' 541 LOAD_FAST 'skill' 544 LOAD_ATTR 'skillname' 547 LOAD_FAST 'ts' 550 LOAD_ATTR 'skill' 553 COMPARE_OP '!=' 556 POP_JUMP_IF_FALSE '565' 559 JUMP_BACK '535' 562 JUMP_FORWARD '565' 565_0 COME_FROM '562' 565 LOAD_FAST 'noClassSkill' 568 LOAD_ATTR 'discard' 571 LOAD_FAST 'ts' 574 LOAD_ATTR 'skill' 577 CALL_FUNCTION_1 '' 580 POP_TOP '' 581 LOAD_FAST 'skill' 584 LOAD_ATTR 'levelGained' 587 LOAD_FAST 'spawn' 590 LOAD_ATTR 'tlevel' 593 COMPARE_OP '>' 596 POP_JUMP_IF_FALSE '660' 599 LOAD_FAST 'pneeded' 602 LOAD_ATTR 'has_key' 605 LOAD_FAST 'skill' 608 LOAD_ATTR 'skillname' 611 CALL_FUNCTION_1 '' 614 UNARY_NOT '' 615 POP_JUMP_IF_FALSE '656' 618 LOAD_FAST 'sneeded' 621 LOAD_ATTR 'has_key' 624 LOAD_FAST 'skill' 627 LOAD_ATTR 'skillname' 630 CALL_FUNCTION_1 '' 633 UNARY_NOT '' 634_0 COME_FROM '615' 634 POP_JUMP_IF_FALSE '656' 637 LOAD_FAST 'skill' 640 LOAD_ATTR 'levelGained' 643 LOAD_FAST 'tneeded' 646 LOAD_FAST 'skill' 649 LOAD_ATTR 'skillname' 652 STORE_SUBSCR '' 653 JUMP_FORWARD '656' 656_0 COME_FROM '653' 656 BREAK_LOOP '' 657 JUMP_FORWARD '660' 660_0 COME_FROM '657' 660 SETUP_EXCEPT '677' 663 LOAD_FAST 'pneeded' 666 LOAD_FAST 'skill' 669 LOAD_ATTR 'skillname' 672 DELETE_SUBSCR '' 673 POP_BLOCK '' 674 JUMP_FORWARD '728' 677_0 COME_FROM '660' 677 DUP_TOP '' 678 LOAD_GLOBAL 'KeyError' 681 COMPARE_OP 'exception match' 684 POP_JUMP_IF_FALSE '727' 687 POP_TOP '' 688 POP_TOP '' 689 POP_TOP '' 690 SETUP_EXCEPT '707' 693 LOAD_FAST 'sneeded' 696 LOAD_FAST 'skill' 699 LOAD_ATTR 'skillname' 702 DELETE_SUBSCR '' 703 POP_BLOCK '' 704 JUMP_ABSOLUTE '728' 707_0 COME_FROM '690' 707 DUP_TOP '' 708 LOAD_GLOBAL 'KeyError' 711 COMPARE_OP 'exception match' 714 POP_JUMP_IF_FALSE '723' 717 POP_TOP '' 718 POP_TOP '' 719 POP_TOP '' 720 JUMP_ABSOLUTE '728' 723 END_FINALLY '' 724 JUMP_FORWARD '728' 727 END_FINALLY '' 728_0 COME_FROM '674' 728_1 COME_FROM '724' 728 LOAD_FAST 'trainSkillList' 731 LOAD_ATTR 'remove' 734 LOAD_FAST 'ts' 737 CALL_FUNCTION_1 '' 740 POP_TOP '' 741 BREAK_LOOP '' 742 JUMP_BACK '535' 745 POP_BLOCK '' 746_0 COME_FROM '522' 746 JUMP_ABSOLUTE '752' 749_0 COME_FROM '343' 749 JUMP_BACK '197' 752_0 COME_FROM '219' 752 JUMP_BACK '197' 755 POP_BLOCK '' 756_0 COME_FROM '184' 756 LOAD_GLOBAL 'len' 759 LOAD_FAST 'trainSkillList' 762 CALL_FUNCTION_1 '' 765 POP_JUMP_IF_TRUE '772' 768 LOAD_GLOBAL 'True' 771 RETURN_VALUE '' 772 SETUP_LOOP '826' 775 LOAD_GLOBAL 'reversed' 778 LOAD_FAST 'trainSkillList' 781 CALL_FUNCTION_1 '' 784 GET_ITER '' 785 FOR_ITER '825' 788 STORE_FAST 'sk' 791 LOAD_FAST 'sk' 794 LOAD_ATTR 'skill' 797 LOAD_FAST 'noClassSkill' 800 COMPARE_OP 'in' 803 POP_JUMP_IF_FALSE '785' 806 LOAD_FAST 'trainSkillList' 809 LOAD_ATTR 'remove' 812 LOAD_FAST 'sk' 815 CALL_FUNCTION_1 '' 818 POP_TOP '' 819 JUMP_BACK '785' 822 JUMP_BACK '785' 825 POP_BLOCK '' 826_0 COME_FROM '772' 826 LOAD_GLOBAL 'len' 829 LOAD_FAST 'trainSkillList' 832 CALL_FUNCTION_1 '' 835 POP_JUMP_IF_FALSE '1198' 838 BUILD_LIST_0 '' 841 STORE_FAST 'stext' 844 LOAD_FAST 'pneeded' 847 POP_JUMP_IF_FALSE '911' 850 LOAD_FAST 'stext' 853 LOAD_ATTR 'append' 856 LOAD_CONST '%s ' 859 LOAD_FAST 'spawn' 862 LOAD_ATTR 'pclassInternal' 865 BINARY_MODULO '' 866 CALL_FUNCTION_1 '' 869 POP_TOP '' 870 LOAD_FAST 'stext' 873 LOAD_ATTR 'append' 876 LOAD_CONST ', ' 879 LOAD_ATTR 'join' 882 LOAD_GENEXPR '<code_object <genexpr>>' 885 MAKE_FUNCTION_0 '' 888 LOAD_FAST 'pneeded' 891 LOAD_ATTR 'iteritems' 894 CALL_FUNCTION_0 '' 897 GET_ITER '' 898 CALL_FUNCTION_1 '' 901 CALL_FUNCTION_1 '' 904 CALL_FUNCTION_1 '' 907 POP_TOP '' 908 JUMP_FORWARD '911' 911_0 COME_FROM '908' 911 LOAD_FAST 'sneeded' 914 POP_JUMP_IF_FALSE '1006' 917 LOAD_GLOBAL 'len' 920 LOAD_FAST 'stext' 923 CALL_FUNCTION_1 '' 926 POP_JUMP_IF_FALSE '945' 929 LOAD_FAST 'stext' 932 LOAD_ATTR 'append' 935 LOAD_CONST '; ' 938 CALL_FUNCTION_1 '' 941 POP_TOP '' 942 JUMP_FORWARD '945' 945_0 COME_FROM '942' 945 LOAD_FAST 'stext' 948 LOAD_ATTR 'append' 951 LOAD_CONST '%s ' 954 LOAD_FAST 'spawn' 957 LOAD_ATTR 'sclassInternal' 960 BINARY_MODULO '' 961 CALL_FUNCTION_1 '' 964 POP_TOP '' 965 LOAD_FAST 'stext' 968 LOAD_ATTR 'append' 971 LOAD_CONST ', ' 974 LOAD_ATTR 'join' 977 LOAD_GENEXPR '<code_object <genexpr>>' 980 MAKE_FUNCTION_0 '' 983 LOAD_FAST 'sneeded' 986 LOAD_ATTR 'iteritems' 989 CALL_FUNCTION_0 '' 992 GET_ITER '' 993 CALL_FUNCTION_1 '' 996 CALL_FUNCTION_1 '' 999 CALL_FUNCTION_1 '' 1002 POP_TOP '' 1003 JUMP_FORWARD '1006' 1006_0 COME_FROM '1003' 1006 LOAD_FAST 'tneeded' 1009 POP_JUMP_IF_FALSE '1101' 1012 LOAD_GLOBAL 'len' 1015 LOAD_FAST 'stext' 1018 CALL_FUNCTION_1 '' 1021 POP_JUMP_IF_FALSE '1040' 1024 LOAD_FAST 'stext' 1027 LOAD_ATTR 'append' 1030 LOAD_CONST '; ' 1033 CALL_FUNCTION_1 '' 1036 POP_TOP '' 1037 JUMP_FORWARD '1040' 1040_0 COME_FROM '1037' 1040 LOAD_FAST 'stext' 1043 LOAD_ATTR 'append' 1046 LOAD_CONST '%s ' 1049 LOAD_FAST 'spawn' 1052 LOAD_ATTR 'tclassInternal' 1055 BINARY_MODULO '' 1056 CALL_FUNCTION_1 '' 1059 POP_TOP '' 1060 LOAD_FAST 'stext' 1063 LOAD_ATTR 'append' 1066 LOAD_CONST ', ' 1069 LOAD_ATTR 'join' 1072 LOAD_GENEXPR '<code_object <genexpr>>' 1075 MAKE_FUNCTION_0 '' 1078 LOAD_FAST 'tneeded' 1081 LOAD_ATTR 'iteritems' 1084 CALL_FUNCTION_0 '' 1087 GET_ITER '' 1088 CALL_FUNCTION_1 '' 1091 CALL_FUNCTION_1 '' 1094 CALL_FUNCTION_1 '' 1097 POP_TOP '' 1098 JUMP_FORWARD '1101' 1101_0 COME_FROM '1098' 1101 LOAD_CONST '' 1104 LOAD_ATTR 'join' 1107 LOAD_FAST 'stext' 1110 CALL_FUNCTION_1 '' 1113 STORE_FAST 'stext' 1116 LOAD_GLOBAL 'len' 1119 LOAD_FAST 'trainSkillList' 1122 CALL_FUNCTION_1 '' 1125 LOAD_CONST 1 1128 COMPARE_OP '==' 1131 POP_JUMP_IF_FALSE '1166' 1134 LOAD_FAST 'player' 1137 LOAD_ATTR 'sendGameText' 1140 LOAD_GLOBAL 'RPG_MSG_GAME_DENIED' 1143 LOAD_CONST "%s isn't experienced enough to learn this skill.\\n< %s >\\n" 1146 LOAD_FAST 'char' 1149 LOAD_ATTR 'name' 1152 LOAD_FAST 'stext' 1155 BUILD_TUPLE_2 '' 1158 BINARY_MODULO '' 1159 CALL_FUNCTION_2 '' 1162 POP_TOP '' 1163 JUMP_ABSOLUTE '1198' 1166 LOAD_FAST 'player' 1169 LOAD_ATTR 'sendGameText' 1172 LOAD_GLOBAL 'RPG_MSG_GAME_DENIED' 1175 LOAD_CONST "%s isn't experienced enough to learn these skills.\\n< %s >\\n" 1178 LOAD_FAST 'char' 1181 LOAD_ATTR 'name' 1184 LOAD_FAST 'stext' 1187 BUILD_TUPLE_2 '' 1190 BINARY_MODULO '' 1191 CALL_FUNCTION_2 '' 1194 POP_TOP '' 1195 JUMP_FORWARD '1198' 1198_0 COME_FROM '1195' 1198 LOAD_GLOBAL 'len' 1201 LOAD_FAST 'noClassSkill' 1204 CALL_FUNCTION_1 '' 1207 POP_JUMP_IF_FALSE '1313' 1210 LOAD_GLOBAL 'len' 1213 LOAD_FAST 'noClassSkill' 1216 CALL_FUNCTION_1 '' 1219 LOAD_CONST 1 1222 COMPARE_OP '==' 1225 POP_JUMP_IF_FALSE '1266' 1228 LOAD_FAST 'player' 1231 LOAD_ATTR 'sendGameText' 1234 LOAD_GLOBAL 'RPG_MSG_GAME_DENIED' 1237 LOAD_CONST "The %s skill is not in %s's class skills and cannot be learned.\\n" 1240 LOAD_FAST 'noClassSkill' 1243 LOAD_ATTR 'pop' 1246 CALL_FUNCTION_0 '' 1249 LOAD_FAST 'char' 1252 LOAD_ATTR 'name' 1255 BUILD_TUPLE_2 '' 1258 BINARY_MODULO '' 1259 CALL_FUNCTION_2 '' 1262 POP_TOP '' 1263 JUMP_ABSOLUTE '1313' 1266 LOAD_CONST ', ' 1269 LOAD_ATTR 'join' 1272 LOAD_FAST 'noClassSkill' 1275 CALL_FUNCTION_1 '' 1278 STORE_FAST 'noClassText' 1281 LOAD_FAST 'player' 1284 LOAD_ATTR 'sendGameText' 1287 LOAD_GLOBAL 'RPG_MSG_GAME_DENIED' 1290 LOAD_CONST "The %s skills are not in %s's class skills and cannot be learned.\\n" 1293 LOAD_FAST 'noClassText' 1296 LOAD_FAST 'char' 1299 LOAD_ATTR 'name' 1302 BUILD_TUPLE_2 '' 1305 BINARY_MODULO '' 1306 CALL_FUNCTION_2 '' 1309 POP_TOP '' 1310 JUMP_FORWARD '1313' 1313_0 COME_FROM '1310' 1313 LOAD_GLOBAL 'False' 1316 RETURN_VALUE '' -1 RETURN_LAST '' Syntax error at or near `JUMP_BACK' token at offset 749
def tick--- This code section failed: --- 0 LOAD_FAST 'self' 3 LOAD_ATTR 'mob' 6 STORE_FAST 'mob' 9 LOAD_FAST 'mob' 12 LOAD_ATTR 'zone' 15 LOAD_ATTR 'world' 18 LOAD_ATTR 'aggroOn' 21 POP_JUMP_IF_TRUE '28' 24 LOAD_CONST '' 27 RETURN_VALUE '' 28 LOAD_FAST 'mob' 31 LOAD_ATTR 'player' 34 POP_JUMP_IF_TRUE '46' 37 LOAD_FAST 'mob' 40 LOAD_ATTR 'detached' 43_0 COME_FROM '34' 43 POP_JUMP_IF_FALSE '50' 46 LOAD_CONST '' 49 RETURN_VALUE '' 50 LOAD_FAST 'mob' 53 LOAD_ATTR 'zone' 56 STORE_FAST 'zone' 59 LOAD_FAST 'zone' 62 LOAD_ATTR 'simAvatar' 65 STORE_FAST 'simAvatar' 68 LOAD_FAST 'mob' 71 LOAD_ATTR 'target' 74 UNARY_NOT '' 75 STORE_FAST 'doNewAggro' 78 LOAD_FAST 'mob' 81 LOAD_ATTR 'aggroRange' 84 POP_JUMP_IF_FALSE '1062' 87 LOAD_FAST 'mob' 90 LOAD_ATTR 'battle' 93 UNARY_NOT '' 94_0 COME_FROM '84' 94 POP_JUMP_IF_FALSE '1062' 97 SETUP_LOOP '1062' 100 LOAD_FAST 'mob' 103 LOAD_ATTR 'simObject' 106 LOAD_ATTR 'canSee' 109 GET_ITER '' 110 FOR_ITER '1058' 113 STORE_FAST 'id' 116 SETUP_EXCEPT '143' 119 LOAD_FAST 'zone' 122 LOAD_ATTR 'mobLookup' 125 LOAD_FAST 'simAvatar' 128 LOAD_ATTR 'simLookup' 131 LOAD_FAST 'id' 134 BINARY_SUBSCR '' 135 BINARY_SUBSCR '' 136 STORE_FAST 'otherMob' 139 POP_BLOCK '' 140 JUMP_FORWARD '163' 143_0 COME_FROM '116' 143 DUP_TOP '' 144 LOAD_GLOBAL 'KeyError' 147 COMPARE_OP 'exception match' 150 POP_JUMP_IF_FALSE '162' 153 POP_TOP '' 154 POP_TOP '' 155 POP_TOP '' 156 JUMP_BACK '110' 159 JUMP_FORWARD '163' 162 END_FINALLY '' 163_0 COME_FROM '140' 163_1 COME_FROM '159' 163 LOAD_FAST 'mob' 166 LOAD_FAST 'otherMob' 169 COMPARE_OP '==' 172 POP_JUMP_IF_FALSE '181' 175 JUMP_BACK '110' 178 JUMP_FORWARD '181' 181_0 COME_FROM '178' 181 LOAD_FAST 'otherMob' 184 LOAD_ATTR 'player' 187 UNARY_NOT '' 188 POP_JUMP_IF_FALSE '206' 191 LOAD_FAST 'otherMob' 194 LOAD_ATTR 'detached' 197_0 COME_FROM '188' 197 POP_JUMP_IF_FALSE '206' 200 JUMP_BACK '110' 203 JUMP_FORWARD '206' 206_0 COME_FROM '203' 206 LOAD_FAST 'otherMob' 209 LOAD_ATTR 'invulnerable' 212 LOAD_CONST '' 215 COMPARE_OP '>' 218 POP_JUMP_IF_FALSE '227' 221 JUMP_BACK '110' 224 JUMP_FORWARD '227' 227_0 COME_FROM '224' 227 LOAD_FAST 'mob' 230 LOAD_ATTR 'plevel' 233 LOAD_CONST 50 236 COMPARE_OP '<' 239 POP_JUMP_IF_FALSE '273' 242 LOAD_FAST 'mob' 245 LOAD_ATTR 'plevel' 248 LOAD_FAST 'otherMob' 251 LOAD_ATTR 'plevel' 254 LOAD_CONST 20 257 BINARY_SUBTRACT '' 258 COMPARE_OP '<' 261 POP_JUMP_IF_FALSE '273' 264 JUMP_BACK '110' 267 JUMP_ABSOLUTE '273' 270 JUMP_FORWARD '273' 273_0 COME_FROM '270' 273 LOAD_FAST 'otherMob' 276 LOAD_ATTR 'aggroRange' 279 POP_JUMP_IF_TRUE '288' 282 JUMP_BACK '110' 285 JUMP_FORWARD '288' 288_0 COME_FROM '285' 288 LOAD_FAST 'mob' 291 LOAD_ATTR 'master' 294 POP_JUMP_IF_FALSE '339' 297 LOAD_FAST 'mob' 300 LOAD_ATTR 'master' 303 LOAD_ATTR 'player' 306_0 COME_FROM '294' 306 POP_JUMP_IF_FALSE '339' 309 LOAD_FAST 'mob' 312 LOAD_ATTR 'aggro' 315 LOAD_ATTR 'get' 318 LOAD_FAST 'otherMob' 321 LOAD_CONST '' 324 CALL_FUNCTION_2 '' 327 POP_JUMP_IF_TRUE '339' 330 JUMP_BACK '110' 333 JUMP_ABSOLUTE '339' 336 JUMP_FORWARD '339' 339_0 COME_FROM '336' 339 LOAD_FAST 'otherMob' 342 LOAD_ATTR 'battle' 345 POP_JUMP_IF_FALSE '354' 348 JUMP_BACK '110' 351 JUMP_FORWARD '354' 354_0 COME_FROM '351' 354 LOAD_GLOBAL 'IsKOS' 357 LOAD_FAST 'mob' 360 LOAD_FAST 'otherMob' 363 CALL_FUNCTION_2 '' 366 POP_JUMP_IF_TRUE '782' 369 LOAD_FAST 'mob' 372 LOAD_ATTR 'master' 375 POP_JUMP_IF_TRUE '110' 378 LOAD_FAST 'otherMob' 381 LOAD_ATTR 'master' 384_0 COME_FROM '375' 384 POP_JUMP_IF_FALSE '393' 387 JUMP_BACK '110' 390 JUMP_FORWARD '393' 393_0 COME_FROM '390' 393 LOAD_FAST 'otherMob' 396 LOAD_ATTR 'player' 399 POP_JUMP_IF_TRUE '548' 402 LOAD_FAST 'otherMob' 405 LOAD_ATTR 'assists' 408 POP_JUMP_IF_FALSE '776' 411 LOAD_FAST 'mob' 414 LOAD_ATTR 'realm' 417 LOAD_FAST 'otherMob' 420 LOAD_ATTR 'realm' 423 COMPARE_OP '==' 426_0 COME_FROM '408' 426 POP_JUMP_IF_FALSE '776' 429 LOAD_GLOBAL 'GetRange' 432 LOAD_FAST 'mob' 435 LOAD_FAST 'otherMob' 438 CALL_FUNCTION_2 '' 441 LOAD_FAST 'otherMob' 444 LOAD_ATTR 'spawn' 447 LOAD_ATTR 'aggroRange' 450 LOAD_FAST 'mob' 453 LOAD_ATTR 'zone' 456 LOAD_ATTR 'zone' 459 LOAD_ATTR 'aggroMod' 462 BINARY_MULTIPLY '' 463 LOAD_CONST 0.65 466 BINARY_MULTIPLY '' 467 COMPARE_OP '<=' 470 POP_JUMP_IF_FALSE '545' 473 SETUP_LOOP '542' 476 LOAD_FAST 'mob' 479 LOAD_ATTR 'aggro' 482 LOAD_ATTR 'iterkeys' 485 CALL_FUNCTION_0 '' 488 GET_ITER '' 489 FOR_ITER '538' 492 STORE_FAST 'm' 495 LOAD_FAST 'otherMob' 498 LOAD_ATTR 'aggro' 501 LOAD_ATTR 'get' 504 LOAD_FAST 'm' 507 LOAD_CONST '' 510 CALL_FUNCTION_2 '' 513 POP_JUMP_IF_TRUE '489' 516 LOAD_FAST 'otherMob' 519 LOAD_ATTR 'addAggro' 522 LOAD_FAST 'm' 525 LOAD_CONST 5 528 CALL_FUNCTION_2 '' 531 POP_TOP '' 532 JUMP_BACK '489' 535 JUMP_BACK '489' 538 POP_BLOCK '' 539_0 COME_FROM '473' 539 JUMP_ABSOLUTE '545' 542 JUMP_ABSOLUTE '776' 545 JUMP_BACK '110' 545_ JUMP_BACK_ELSE '' 548 LOAD_FAST 'mob' 551 LOAD_ATTR 'assists' 554 POP_JUMP_IF_FALSE '110' 557 LOAD_FAST 'mob' 560 LOAD_ATTR 'realm' 563 LOAD_FAST 'otherMob' 566 LOAD_ATTR 'realm' 569 COMPARE_OP '==' 572_0 COME_FROM '554' 572 POP_JUMP_IF_FALSE '110' 575 LOAD_GLOBAL 'GetRange' 578 LOAD_FAST 'mob' 581 LOAD_FAST 'otherMob' 584 CALL_FUNCTION_2 '' 587 LOAD_FAST 'mob' 590 LOAD_ATTR 'spawn' 593 LOAD_ATTR 'aggroRange' 596 LOAD_FAST 'mob' 599 LOAD_ATTR 'zone' 602 LOAD_ATTR 'zone' 605 LOAD_ATTR 'aggroMod' 608 BINARY_MULTIPLY '' 609 LOAD_CONST 0.65 612 BINARY_MULTIPLY '' 613 COMPARE_OP '<=' 616 POP_JUMP_IF_FALSE '776' 619 SETUP_LOOP '773' 622 LOAD_FAST 'otherMob' 625 LOAD_ATTR 'aggro' 628 LOAD_ATTR 'iterkeys' 631 CALL_FUNCTION_0 '' 634 GET_ITER '' 635 FOR_ITER '769' 638 STORE_FAST 'm' 641 LOAD_FAST 'm' 644 LOAD_ATTR 'player' 647 UNARY_NOT '' 648 POP_JUMP_IF_TRUE '635' 651 LOAD_FAST 'm' 654 LOAD_ATTR 'detached' 657_0 COME_FROM '648' 657 POP_JUMP_IF_FALSE '666' 660 JUMP_BACK '635' 663 JUMP_FORWARD '666' 666_0 COME_FROM '663' 666 LOAD_FAST 'mob' 669 LOAD_ATTR 'aggro' 672 LOAD_ATTR 'get' 675 LOAD_FAST 'm' 678 LOAD_CONST '' 681 CALL_FUNCTION_2 '' 684 POP_JUMP_IF_TRUE '635' 687 LOAD_FAST 'm' 690 LOAD_ATTR 'realm' 693 LOAD_FAST 'mob' 696 LOAD_ATTR 'realm' 699 COMPARE_OP '!=' 702 POP_JUMP_IF_FALSE '766' 705 LOAD_GLOBAL 'AllowHarmful' 708 LOAD_FAST 'm' 711 LOAD_FAST 'otherMob' 714 CALL_FUNCTION_2 '' 717 POP_JUMP_IF_FALSE '766' 720 LOAD_FAST 'm' 723 LOAD_ATTR 'simObject' 726 LOAD_ATTR 'id' 729 LOAD_FAST 'mob' 732 LOAD_ATTR 'simObject' 735 LOAD_ATTR 'canSee' 738 COMPARE_OP 'in' 741_0 COME_FROM '702' 741_1 COME_FROM '717' 741 POP_JUMP_IF_FALSE '766' 744 LOAD_FAST 'mob' 747 LOAD_ATTR 'addAggro' 750 LOAD_FAST 'm' 753 LOAD_CONST 5 756 CALL_FUNCTION_2 '' 759 POP_TOP '' 760 JUMP_ABSOLUTE '766' 763 JUMP_BACK '635' 766 JUMP_BACK '635' 769 POP_BLOCK '' 770 JUMP_ABSOLUTE '776' 773_0 COME_FROM '619' 773 JUMP_BACK '110' 773_ JUMP_BACK_ELSE '' 776 JUMP_BACK '110' 779 JUMP_FORWARD '782' 782_0 COME_FROM '779' 782 LOAD_FAST 'doNewAggro' 785 POP_JUMP_IF_FALSE '110' 788 LOAD_FAST 'otherMob' 791 LOAD_ATTR 'player' 794 POP_JUMP_IF_FALSE '1039' 797 LOAD_FAST 'mob' 800 LOAD_ATTR 'aggro' 803 LOAD_ATTR 'get' 806 LOAD_FAST 'otherMob' 809 LOAD_CONST '' 812 CALL_FUNCTION_2 '' 815 UNARY_NOT '' 816 STORE_FAST 'initial' 819 SETUP_LOOP '879' 822 LOAD_FAST 'otherMob' 825 LOAD_ATTR 'player' 828 LOAD_ATTR 'party' 831 LOAD_ATTR 'members' 834 GET_ITER '' 835 FOR_ITER '878' 838 STORE_FAST 'c' 841 LOAD_FAST 'c' 844 LOAD_ATTR 'mob' 847 LOAD_ATTR 'detached' 850 POP_JUMP_IF_FALSE '859' 853 JUMP_BACK '835' 856 JUMP_FORWARD '859' 859_0 COME_FROM '856' 859 LOAD_FAST 'self' 862 LOAD_ATTR 'doMob' 865 LOAD_FAST 'c' 868 LOAD_ATTR 'mob' 871 CALL_FUNCTION_1 '' 874 POP_TOP '' 875 JUMP_BACK '835' 878 POP_BLOCK '' 879_0 COME_FROM '819' 879 LOAD_FAST 'initial' 882 POP_JUMP_IF_FALSE '1052' 885 LOAD_FAST 'mob' 888 LOAD_ATTR 'aggro' 891 LOAD_ATTR 'get' 894 LOAD_FAST 'otherMob' 897 LOAD_CONST '' 900 CALL_FUNCTION_2 '' 903_0 COME_FROM '882' 903 POP_JUMP_IF_FALSE '1052' 906 LOAD_CONST 10 909 STORE_FAST 'a' 912 SETUP_LOOP '1036' 915 LOAD_FAST 'otherMob' 918 LOAD_ATTR 'player' 921 LOAD_ATTR 'party' 924 LOAD_ATTR 'members' 927 GET_ITER '' 928 FOR_ITER '1032' 931 STORE_FAST 'member' 934 LOAD_FAST 'member' 937 LOAD_ATTR 'mob' 940 LOAD_ATTR 'detached' 943 UNARY_NOT '' 944 POP_JUMP_IF_FALSE '928' 947 LOAD_FAST 'member' 950 LOAD_ATTR 'mob' 953 LOAD_ATTR 'sneak' 956 UNARY_NOT '' 957_0 COME_FROM '944' 957 POP_JUMP_IF_FALSE '928' 960 LOAD_FAST 'member' 963 LOAD_ATTR 'mob' 966 LOAD_ATTR 'pet' 969 POP_JUMP_IF_FALSE '997' 972 LOAD_FAST 'mob' 975 LOAD_ATTR 'addAggro' 978 LOAD_FAST 'member' 981 LOAD_ATTR 'mob' 984 LOAD_ATTR 'pet' 987 LOAD_FAST 'a' 990 CALL_FUNCTION_2 '' 993 POP_TOP '' 994 JUMP_FORWARD '1016' 997 LOAD_FAST 'mob' 1000 LOAD_ATTR 'addAggro' 1003 LOAD_FAST 'member' 1006 LOAD_ATTR 'mob' 1009 LOAD_FAST 'a' 1012 CALL_FUNCTION_2 '' 1015 POP_TOP '' 1016_0 COME_FROM '994' 1016 LOAD_FAST 'a' 1019 LOAD_CONST 1 1022 INPLACE_SUBTRACT '' 1023 STORE_FAST 'a' 1026 JUMP_BACK '928' 1029 JUMP_BACK '928' 1032 POP_BLOCK '' 1033_0 COME_FROM '912' 1033 JUMP_ABSOLUTE '1052' 1036 JUMP_ABSOLUTE '1055' 1039 LOAD_FAST 'self' 1042 LOAD_ATTR 'doMob' 1045 LOAD_FAST 'otherMob' 1048 CALL_FUNCTION_1 '' 1051 POP_TOP '' 1052 JUMP_BACK '110' 1055 JUMP_BACK '110' 1058 POP_BLOCK '' 1059_0 COME_FROM '97' 1059 JUMP_FORWARD '1062' 1062_0 COME_FROM '1059' 1062 LOAD_GLOBAL 'len' 1065 LOAD_FAST 'mob' 1068 LOAD_ATTR 'aggro' 1071 CALL_FUNCTION_1 '' 1074 POP_JUMP_IF_FALSE '1896' 1077 LOAD_CONST '' 1080 STORE_FAST 'mostHated' 1083 LOAD_CONST -999999 1086 STORE_FAST 'bestAggro' 1089 LOAD_CONST 999999 1092 STORE_FAST 'bestRange' 1095 LOAD_CONST -999999 1098 STORE_FAST 'bestRangeAggro' 1101 LOAD_CONST '' 1104 STORE_FAST 'bestRangeMob' 1107 LOAD_FAST 'mob' 1110 LOAD_ATTR 'target' 1113 POP_JUMP_IF_FALSE '1219' 1116 LOAD_GLOBAL 'GetRange' 1119 LOAD_FAST 'mob' 1122 LOAD_FAST 'mob' 1125 LOAD_ATTR 'target' 1128 CALL_FUNCTION_2 '' 1131 STORE_FAST 'bestRange' 1134 LOAD_FAST 'bestRange' 1137 LOAD_FAST 'mob' 1140 LOAD_ATTR 'followRange' 1143 COMPARE_OP '<=' 1146 POP_JUMP_IF_TRUE '1158' 1149 LOAD_FAST 'mob' 1152 LOAD_ATTR 'battle' 1155_0 COME_FROM '1146' 1155 POP_JUMP_IF_FALSE '1219' 1158 LOAD_FAST 'mob' 1161 LOAD_ATTR 'aggro' 1164 LOAD_ATTR 'get' 1167 LOAD_FAST 'mob' 1170 LOAD_ATTR 'target' 1173 LOAD_CONST '' 1176 CALL_FUNCTION_2 '' 1179 DUP_TOP '' 1180 STORE_FAST 'bestRangeAggro' 1183 STORE_FAST 'bestAggro' 1186 LOAD_FAST 'bestAggro' 1189 POP_JUMP_IF_FALSE '1216' 1192 LOAD_FAST 'mob' 1195 LOAD_ATTR 'target' 1198 STORE_FAST 'mostHated' 1201 LOAD_FAST 'mob' 1204 LOAD_ATTR 'target' 1207 STORE_FAST 'bestRangeMob' 1210 JUMP_ABSOLUTE '1216' 1213 JUMP_ABSOLUTE '1219' 1216 JUMP_FORWARD '1219' 1219_0 COME_FROM '1216' 1219 SETUP_LOOP '1377' 1222 LOAD_FAST 'mob' 1225 LOAD_ATTR 'aggro' 1228 LOAD_ATTR 'iteritems' 1231 CALL_FUNCTION_0 '' 1234 GET_ITER '' 1235 FOR_ITER '1376' 1238 UNPACK_SEQUENCE_2 '' 1241 STORE_FAST 'm' 1244 STORE_FAST 'hate' 1247 LOAD_FAST 'm' 1250 LOAD_ATTR 'feignDeath' 1253 POP_JUMP_IF_FALSE '1262' 1256 JUMP_BACK '1235' 1259 JUMP_FORWARD '1262' 1262_0 COME_FROM '1259' 1262 LOAD_FAST 'hate' 1265 POP_JUMP_IF_FALSE '1235' 1268 LOAD_GLOBAL 'GetRange' 1271 LOAD_FAST 'mob' 1274 LOAD_FAST 'm' 1277 CALL_FUNCTION_2 '' 1280 STORE_FAST 'testRange' 1283 LOAD_FAST 'testRange' 1286 LOAD_FAST 'mob' 1289 LOAD_ATTR 'followRange' 1292 COMPARE_OP '<=' 1295 POP_JUMP_IF_TRUE '1307' 1298 LOAD_FAST 'mob' 1301 LOAD_ATTR 'battle' 1304_0 COME_FROM '1295' 1304 POP_JUMP_IF_FALSE '1373' 1307 LOAD_FAST 'hate' 1310 LOAD_FAST 'bestAggro' 1313 COMPARE_OP '>' 1316 POP_JUMP_IF_FALSE '1334' 1319 LOAD_FAST 'hate' 1322 STORE_FAST 'bestAggro' 1325 LOAD_FAST 'm' 1328 STORE_FAST 'mostHated' 1331 JUMP_FORWARD '1334' 1334_0 COME_FROM '1331' 1334 LOAD_FAST 'testRange' 1337 LOAD_FAST 'bestRange' 1340 COMPARE_OP '<' 1343 POP_JUMP_IF_FALSE '1370' 1346 LOAD_FAST 'testRange' 1349 STORE_FAST 'bestRange' 1352 LOAD_FAST 'hate' 1355 STORE_FAST 'bestRangeAggro' 1358 LOAD_FAST 'm' 1361 STORE_FAST 'bestRangeMob' 1364 JUMP_ABSOLUTE '1370' 1367 JUMP_ABSOLUTE '1373' 1370 JUMP_BACK '1235' 1373 JUMP_BACK '1235' 1376 POP_BLOCK '' 1377_0 COME_FROM '1219' 1377 LOAD_FAST 'mob' 1380 LOAD_ATTR 'move' 1383 LOAD_CONST '' 1386 COMPARE_OP '<=' 1389 POP_JUMP_IF_FALSE '1565' 1392 LOAD_FAST 'bestRangeMob' 1395_0 COME_FROM '1389' 1395 POP_JUMP_IF_FALSE '1565' 1398 LOAD_GLOBAL 'GetRangeMin' 1401 LOAD_FAST 'mob' 1404 LOAD_FAST 'mostHated' 1407 CALL_FUNCTION_2 '' 1410 STORE_FAST 'crange' 1413 LOAD_CONST '' 1416 STORE_FAST 'wpnRange' 1419 LOAD_FAST 'mob' 1422 LOAD_ATTR 'worn' 1425 LOAD_ATTR 'get' 1428 LOAD_GLOBAL 'RPG_SLOT_PRIMARY' 1431 CALL_FUNCTION_1 '' 1434 STORE_FAST 'pweapon' 1437 LOAD_FAST 'mob' 1440 LOAD_ATTR 'worn' 1443 LOAD_ATTR 'get' 1446 LOAD_GLOBAL 'RPG_SLOT_SECONDARY' 1449 CALL_FUNCTION_1 '' 1452 STORE_FAST 'sweapon' 1455 LOAD_FAST 'pweapon' 1458 POP_JUMP_IF_FALSE '1492' 1461 LOAD_FAST 'pweapon' 1464 LOAD_ATTR 'wpnRange' 1467 LOAD_FAST 'wpnRange' 1470 COMPARE_OP '>' 1473_0 COME_FROM '1458' 1473 POP_JUMP_IF_FALSE '1492' 1476 LOAD_FAST 'pweapon' 1479 LOAD_ATTR 'wpnRange' 1482 LOAD_CONST 5.0 1485 BINARY_DIVIDE '' 1486 STORE_FAST 'wpnRange' 1489 JUMP_FORWARD '1492' 1492_0 COME_FROM '1489' 1492 LOAD_FAST 'sweapon' 1495 POP_JUMP_IF_FALSE '1535' 1498 LOAD_FAST 'sweapon' 1501 LOAD_ATTR 'wpnRange' 1504 LOAD_CONST 5.0 1507 BINARY_DIVIDE '' 1508 STORE_FAST 'secondaryRangeAdjusted' 1511 LOAD_FAST 'secondaryRangeAdjusted' 1514 LOAD_FAST 'wpnRange' 1517 COMPARE_OP '>' 1520 POP_JUMP_IF_FALSE '1535' 1523 LOAD_FAST 'secondaryRangeAdjusted' 1526 STORE_FAST 'wpnRange' 1529 JUMP_ABSOLUTE '1535' 1532 JUMP_FORWARD '1535' 1535_0 COME_FROM '1532' 1535 LOAD_FAST 'crange' 1538 LOAD_FAST 'wpnRange' 1541 COMPARE_OP '>' 1544 POP_JUMP_IF_FALSE '1565' 1547 LOAD_FAST 'bestRangeMob' 1550 STORE_FAST 'mostHated' 1553 LOAD_FAST 'bestRangeAggro' 1556 STORE_FAST 'bestAggro' 1559 JUMP_ABSOLUTE '1565' 1562 JUMP_FORWARD '1565' 1565_0 COME_FROM '1562' 1565 LOAD_FAST 'mostHated' 1568 POP_JUMP_IF_FALSE '1850' 1571 LOAD_FAST 'mob' 1574 LOAD_ATTR 'master' 1577 POP_JUMP_IF_FALSE '1634' 1580 LOAD_FAST 'mob' 1583 LOAD_ATTR 'master' 1586 LOAD_ATTR 'player' 1589_0 COME_FROM '1577' 1589 POP_JUMP_IF_FALSE '1634' 1592 LOAD_FAST 'bestAggro' 1595 LOAD_GLOBAL 'RPG_PLAYERPET_AGGROTHRESHOLD' 1598 LOAD_FAST 'mob' 1601 LOAD_ATTR 'level' 1604 BINARY_MULTIPLY '' 1605 COMPARE_OP '<' 1608 POP_JUMP_IF_FALSE '1634' 1611 LOAD_FAST 'zone' 1614 LOAD_ATTR 'setTarget' 1617 LOAD_FAST 'mob' 1620 LOAD_CONST '' 1623 CALL_FUNCTION_2 '' 1626 POP_TOP '' 1627 LOAD_CONST '' 1630 RETURN_VALUE '' 1631 JUMP_FORWARD '1634' 1634_0 COME_FROM '1631' 1634 LOAD_FAST 'mostHated' 1637 LOAD_ATTR 'isFeared' 1640 POP_JUMP_IF_FALSE '1733' 1643 LOAD_FAST 'mostHated' 1646 LOAD_ATTR 'master' 1649_0 COME_FROM '1640' 1649 POP_JUMP_IF_FALSE '1733' 1652 LOAD_FAST 'mostHated' 1655 LOAD_ATTR 'master' 1658 STORE_FAST 'master' 1661 LOAD_FAST 'mob' 1664 LOAD_ATTR 'aggro' 1667 LOAD_ATTR 'has_key' 1670 LOAD_FAST 'master' 1673 CALL_FUNCTION_1 '' 1676 POP_JUMP_IF_FALSE '1733' 1679 LOAD_GLOBAL 'GetRange' 1682 LOAD_FAST 'mob' 1685 LOAD_FAST 'master' 1688 CALL_FUNCTION_2 '' 1691 STORE_FAST 'testRange' 1694 LOAD_FAST 'testRange' 1697 LOAD_FAST 'mob' 1700 LOAD_ATTR 'followRange' 1703 COMPARE_OP '<=' 1706 POP_JUMP_IF_TRUE '1718' 1709 LOAD_FAST 'mob' 1712 LOAD_ATTR 'battle' 1715_0 COME_FROM '1706' 1715 POP_JUMP_IF_FALSE '1730' 1718 LOAD_FAST 'master' 1721 STORE_FAST 'mostHated' 1724 JUMP_ABSOLUTE '1730' 1727 JUMP_ABSOLUTE '1733' 1730 JUMP_FORWARD '1733' 1733_0 COME_FROM '1730' 1733 LOAD_FAST 'mostHated' 1736 LOAD_FAST 'mob' 1739 LOAD_ATTR 'target' 1742 COMPARE_OP '!=' 1745 POP_JUMP_IF_FALSE '1820' 1748 LOAD_FAST 'mob' 1751 LOAD_ATTR 'spawn' 1754 LOAD_ATTR 'getSound' 1757 LOAD_CONST 'sndAlert' 1760 CALL_FUNCTION_1 '' 1763 STORE_FAST 'snd' 1766 LOAD_FAST 'snd' 1769 POP_JUMP_IF_FALSE '1788' 1772 LOAD_FAST 'mob' 1775 LOAD_ATTR 'playSound' 1778 LOAD_FAST 'snd' 1781 CALL_FUNCTION_1 '' 1784 POP_TOP '' 1785 JUMP_FORWARD '1801' 1788 LOAD_FAST 'mob' 1791 LOAD_ATTR 'vocalize' 1794 LOAD_GLOBAL 'VOX_MADSCREAM' 1797 CALL_FUNCTION_1 '' 1800 POP_TOP '' 1801_0 COME_FROM '1785' 1801 LOAD_FAST 'zone' 1804 LOAD_ATTR 'setTarget' 1807 LOAD_FAST 'mob' 1810 LOAD_FAST 'mostHated' 1813 CALL_FUNCTION_2 '' 1816 POP_TOP '' 1817 JUMP_FORWARD '1820' 1820_0 COME_FROM '1817' 1820 LOAD_FAST 'mostHated' 1823 LOAD_ATTR 'combatTimer' 1826 LOAD_CONST 72 1829 COMPARE_OP '<' 1832 POP_JUMP_IF_FALSE '1893' 1835 LOAD_CONST 72 1838 LOAD_FAST 'mostHated' 1841 STORE_ATTR 'combatTimer' 1844 JUMP_ABSOLUTE '1893' 1847 JUMP_ABSOLUTE '1912' 1850 LOAD_GLOBAL 'defaultdict' 1853 LOAD_GLOBAL 'int' 1856 CALL_FUNCTION_1 '' 1859 LOAD_FAST 'mob' 1862 STORE_ATTR 'aggro' 1865 LOAD_FAST 'mob' 1868 LOAD_ATTR 'target' 1871 POP_JUMP_IF_FALSE '1912' 1874 LOAD_FAST 'zone' 1877 LOAD_ATTR 'setTarget' 1880 LOAD_FAST 'mob' 1883 LOAD_CONST '' 1886 CALL_FUNCTION_2 '' 1889 POP_TOP '' 1890 JUMP_ABSOLUTE '1912' 1893 JUMP_FORWARD '1912' 1896 LOAD_FAST 'zone' 1899 LOAD_ATTR 'setTarget' 1902 LOAD_FAST 'mob' 1905 LOAD_CONST '' 1908 CALL_FUNCTION_2 '' 1911 POP_TOP '' 1912_0 COME_FROM '1893' Syntax error at or near `COME_FROM' token at offset 773_0
Thanks for the great job you keep doing on uncompyle2
Hi,
on windows 7 (after installing from source with python setup.py install
) I get:
ImportError: cannot import name main.
The side-packages follder contains:
__init__.py
magics.py
Parser.py
Scanner.py
spark.py
verify.py
Walker.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.