1
- # Copyright (c) 2019-2023 by Rocky Bernstein
1
+ # Copyright (c) 2019-2024 by Rocky Bernstein
2
2
#
3
3
# This program is free software: you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
15
15
"""Isolate Python 3.6 version-specific semantic actions here.
16
16
"""
17
17
18
- from xdis import iscode
19
18
from spark_parser .ast import GenericASTTraversalPruningException
19
+ from xdis import iscode
20
+
20
21
from uncompyle6 .scanners .tok import Token
21
- from uncompyle6 .semantics .helper import flatten_list , escape_string , strip_quotes
22
22
from uncompyle6 .semantics .consts import (
23
23
INDENT_PER_LEVEL ,
24
24
PRECEDENCE ,
25
25
TABLE_DIRECT ,
26
26
TABLE_R ,
27
27
)
28
+ from uncompyle6 .semantics .helper import escape_string , flatten_list , strip_quotes
28
29
from uncompyle6 .util import get_code_name
29
30
30
31
@@ -38,7 +39,6 @@ def escape_format(s):
38
39
39
40
40
41
def customize_for_version36 (self , version ):
41
-
42
42
# fmt: off
43
43
PRECEDENCE ["call_kw" ] = 0
44
44
PRECEDENCE ["call_kw36" ] = 1
@@ -276,7 +276,7 @@ def call_ex_kw(node):
276
276
if value == "" :
277
277
fmt = "%c(%p)"
278
278
else :
279
- fmt = "%%c( %s, %%p)" % value
279
+ fmt = "%c" + ( "( %s, " % value ). replace ( "%" , "%%" ) + "%p)"
280
280
281
281
self .template_engine (
282
282
(fmt , (0 , "expr" ), (2 , "build_map_unpack_with_call" , 100 )), node
@@ -295,7 +295,7 @@ def call_ex_kw2(node):
295
295
if value == "" :
296
296
fmt = "%c(%p)"
297
297
else :
298
- fmt = "%%c( %s, %%p)" % value
298
+ fmt = "%c" + ( "( %s, " % value ). replace ( "%" , "%%" ) + "%p)"
299
299
300
300
self .template_engine (
301
301
(fmt , (0 , "expr" ), (2 , "build_map_unpack_with_call" , 100 )), node
@@ -707,6 +707,7 @@ def n_list_comp_async(node):
707
707
self .comprehension_walk_newer (node , iter_index = 3 , code_index = 0 )
708
708
self .write ("]" )
709
709
self .prune ()
710
+
710
711
self .n_list_comp_async = n_list_comp_async
711
712
712
713
# def kwargs_only_36(node):
0 commit comments