File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -117,15 +117,25 @@ def formatString(node, config):
117117 method = dot .parent
118118 arg_list = method .firstChildOfType (tokens .ARGUMENT_LIST )
119119 call_args = [arg for arg in arg_list .childrenOfType (tokens .EXPR )]
120-
121- format = call_args [0 ].firstChildOfType (tokens .STRING_LITERAL )
122120 args = [arg .firstChildOfType (tokens .IDENT ) for arg in call_args [1 :]]
123121
124- # Translate format syntax
125- format .token .text = re .sub (r'%(?P<idx>\d+\$)?(?P<convers>[scdoxefg])' ,
122+ # Translate format syntax (if format == string_literal)
123+ format = call_args [0 ].firstChildOfType (tokens .STRING_LITERAL )
124+ if format :
125+ format .token .text = \
126+ re .sub (r'%(?P<idx>\d+\$)?(?P<convers>[scdoxefg])' ,
126127 formatSyntaxTransf ,
127128 format .token .text ,
128129 flags = re .IGNORECASE )
130+ else :
131+ # Translation should happen at runtime
132+ format = call_args [0 ].firstChild ()
133+ if format .type == tokens .IDENT :
134+ # String variable
135+ pass
136+ else :
137+ # Function that returns String
138+ pass
129139
130140 left_ident = dot .children [0 ]
131141 right_ident = dot .children [1 ]
You can’t perform that action at this time.
0 commit comments