You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Towards fixing annotated decorator functions...
and annotate functions
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -17,3 +17,9 @@ def div(a: dict(type=float, help='the dividend'),
|
||||
) -> dict(type=float, help='the result of dividing a by b'):
|
||||
"""Divide a by b"""
|
||||
return a / b
|
||||
|
||||
class SupportsInt(_Protocol):
|
||||
|
||||
@abstractmethod
|
||||
def __int__(self) -> int:
|
||||
pass
|
||||
|
@@ -275,12 +275,15 @@ class Python3Parser(PythonParser):
|
||||
stmt ::= funcdef_annotate
|
||||
funcdef_annotate ::= mkfunc_annotate designator
|
||||
|
||||
mkfuncdeco0 ::= mkfunc_annotate
|
||||
|
||||
# This has the annotation value.
|
||||
# LOAD_NAME is used in an annotation type like
|
||||
# int, float, str
|
||||
annotate_arg ::= LOAD_NAME
|
||||
# LOAD_CONST is used in an annotation string
|
||||
annotate_arg ::= LOAD_CONST
|
||||
annotate_arg ::= LOAD_GLOBAL
|
||||
|
||||
# This stores the tuple of parameter names
|
||||
# that have been annotated
|
||||
@@ -709,9 +712,6 @@ class Python3Parser(PythonParser):
|
||||
('pos_arg ' * args_pos, opname))
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
if opname.startswith('MAKE_FUNCTION_A'):
|
||||
# rule = ('mkfunc2 ::= %s%sEXTENDED_ARG %s' %
|
||||
# ('pos_arg ' * (args_pos), 'kwargs ' * (annotate_args-1), opname))
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
if self.version >= 3.3:
|
||||
rule = ('mkfunc_annotate ::= %s%sannotate_tuple LOAD_CONST LOAD_CONST EXTENDED_ARG %s' %
|
||||
(('pos_arg ' * (args_pos)),
|
||||
|
@@ -1788,7 +1788,6 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
# lowest down the stack
|
||||
na = (v & 0xff) # positional parameters
|
||||
if self.version == 3.5 and na == 0:
|
||||
print("XXX", k)
|
||||
if p2[2]: p2 = (2, -2, ', ')
|
||||
entry = (str, 0, p2, 1, -2)
|
||||
else:
|
||||
|
Reference in New Issue
Block a user