You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Merge branch 'master' into python-3.3-to-3.5
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
Generators and comprehenison functions
|
Generators and comprehension functions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@@ -191,7 +191,13 @@ class ComprehensionMixin:
|
|||||||
self.preorder(tree[iter_index])
|
self.preorder(tree[iter_index])
|
||||||
self.prec = p
|
self.prec = p
|
||||||
|
|
||||||
def comprehension_walk_newer(self, node, iter_index, code_index=-5):
|
def comprehension_walk_newer(
|
||||||
|
self,
|
||||||
|
node,
|
||||||
|
iter_index,
|
||||||
|
code_index=-5,
|
||||||
|
collection_node=None,
|
||||||
|
):
|
||||||
"""Non-closure-based comprehensions the way they are done in Python3
|
"""Non-closure-based comprehensions the way they are done in Python3
|
||||||
and some Python 2.7. Note: there are also other set comprehensions.
|
and some Python 2.7. Note: there are also other set comprehensions.
|
||||||
"""
|
"""
|
||||||
|
@@ -1541,7 +1541,7 @@ class SourceWalker(GenericASTTraversal, ComprehensionMixin):
|
|||||||
|
|
||||||
def n_list(self, node):
|
def n_list(self, node):
|
||||||
"""
|
"""
|
||||||
prettyprint a list or tuple
|
prettyprint a dict, list, set or tuple.
|
||||||
"""
|
"""
|
||||||
p = self.prec
|
p = self.prec
|
||||||
self.prec = PRECEDENCE["yield"] - 1
|
self.prec = PRECEDENCE["yield"] - 1
|
||||||
@@ -1564,6 +1564,12 @@ class SourceWalker(GenericASTTraversal, ComprehensionMixin):
|
|||||||
if lastnodetype.startswith("BUILD_LIST"):
|
if lastnodetype.startswith("BUILD_LIST"):
|
||||||
self.write("[")
|
self.write("[")
|
||||||
endchar = "]"
|
endchar = "]"
|
||||||
|
elif lastnodetype.startswith("BUILD_MAP_UNPACK"):
|
||||||
|
self.write("{*")
|
||||||
|
endchar = "}"
|
||||||
|
elif lastnodetype.startswith("BUILD_SET"):
|
||||||
|
self.write("{")
|
||||||
|
endchar = "}"
|
||||||
elif lastnodetype.startswith("BUILD_TUPLE"):
|
elif lastnodetype.startswith("BUILD_TUPLE"):
|
||||||
# Tuples can appear places that can NOT
|
# Tuples can appear places that can NOT
|
||||||
# have parenthesis around them, like array
|
# have parenthesis around them, like array
|
||||||
@@ -1582,12 +1588,6 @@ class SourceWalker(GenericASTTraversal, ComprehensionMixin):
|
|||||||
endchar = ")"
|
endchar = ")"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif lastnodetype.startswith("BUILD_SET"):
|
|
||||||
self.write("{")
|
|
||||||
endchar = "}"
|
|
||||||
elif lastnodetype.startswith("BUILD_MAP_UNPACK"):
|
|
||||||
self.write("{*")
|
|
||||||
endchar = "}"
|
|
||||||
elif lastnodetype.startswith("ROT_TWO"):
|
elif lastnodetype.startswith("ROT_TWO"):
|
||||||
self.write("(")
|
self.write("(")
|
||||||
endchar = ")"
|
endchar = ")"
|
||||||
|
Reference in New Issue
Block a user