@@ -158,7 +158,7 @@ def format_string(self, arg: celtypes.Value) -> celpy.Result:
158158 # True -> true
159159 return celtypes .StringType (str (arg ).lower ())
160160 if isinstance (arg , celtypes .DoubleType ):
161- return celtypes .StringType (f"{ arg :.0f } " )
161+ return celtypes .StringType (f"{ arg :g } " )
162162 if isinstance (arg , celtypes .DurationType ):
163163 return celtypes .StringType (self ._format_duration (arg ))
164164 if isinstance (arg , celtypes .TimestampType ):
@@ -168,23 +168,12 @@ def format_string(self, arg: celtypes.Value) -> celpy.Result:
168168 return celtypes .StringType (base .removesuffix ("+00:00" ) + "Z" )
169169 return celtypes .StringType (arg )
170170
171- def format_value (self , arg : celtypes .Value ) -> celpy .Result :
172- if isinstance (arg , (celtypes .StringType , str )):
173- return celtypes .StringType (quote (arg ))
174- if isinstance (arg , celtypes .UintType ):
175- return celtypes .StringType (arg )
176- if isinstance (arg , celtypes .DurationType ):
177- return celtypes .StringType (f'duration("{ self ._format_duration (arg )} ")' )
178- if isinstance (arg , celtypes .DoubleType ):
179- return celtypes .StringType (f"{ arg :f} " )
180- return self .format_string (arg )
181-
182171 def format_list (self , arg : celtypes .ListType ) -> celpy .Result :
183172 result = "["
184173 for i in range (len (arg )):
185174 if i > 0 :
186175 result += ", "
187- result += self .format_value (arg [i ])
176+ result += self .format_string (arg [i ])
188177 result += "]"
189178 return celtypes .StringType (result )
190179
0 commit comments