File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 2
2
import json
3
3
import logging
4
4
import time
5
+ from tkinter import E
5
6
import warnings
6
7
from collections import namedtuple
7
8
from datetime import datetime , timezone
@@ -278,13 +279,11 @@ def _string_from_dict(dictionary: dict, value_with_quotes=False) -> str:
278
279
279
280
The string will be formatted as {key}: 'value' for each key. Value will be inclusive of
280
281
quotations while key will not. This can be toggled with `value_with_quotes`"""
281
- if value_with_quotes :
282
- return "," .join ([
283
- f"""{ c } : "{ dictionary .get (c )} \" """ for c in dictionary
284
- if dictionary .get (c )
285
- ])
282
+
283
+ quote = "\" " if value_with_quotes else ""
286
284
return "," .join ([
287
- f"""{ c } : { dictionary .get (c )} """ for c in dictionary
285
+ f"""{ c } : { quote } { dictionary .get (c )} { quote } """
286
+ for c in dictionary
288
287
if dictionary .get (c )
289
288
])
290
289
@@ -293,7 +292,7 @@ def _validate_datetime(string_date: str) -> bool:
293
292
if string_date :
294
293
try :
295
294
datetime .strptime (string_date , "%Y-%m-%d" )
296
- except :
295
+ except ValueError :
297
296
raise ValueError (f"""Incorrect format for: { string_date } .
298
297
Format must be \" YYYY-MM-DD\" """ )
299
298
return True
You can’t perform that action at this time.
0 commit comments