From 17b8ccb895a3b35e40bbcea4e89ac08b80de3b50 Mon Sep 17 00:00:00 2001 From: Myned Date: Mon, 30 Oct 2017 23:29:22 -0400 Subject: [PATCH] Changed formatter to use any order: tag --- src/main/utils/formatter.py | 58 ++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/utils/formatter.py b/src/main/utils/formatter.py index d2644cf..87f3f74 100644 --- a/src/main/utils/formatter.py +++ b/src/main/utils/formatter.py @@ -1,38 +1,38 @@ -def tostring(i, *, random=False): - o = '' - if i: - for v in i: - o += v + ' ' - o = o[:-1] - elif random is True: - o += 'order:random' - else: - o = ' ' - return o +def tostring(i, *, order=None): + o = '' + if i: + for v in i: + o += v + ' ' + o = o[:-1] + elif order: + o += order + else: + o = ' ' + return o def tostring_commas(i): - if i: - o = ',' - for v in i: - o += v + ',' - return o[:-1] - return '' + if i: + o = ',' + for v in i: + o += v + ',' + return o[:-1] + return '' def dict_tostring(i): - o = '' - if i: - for k, v in i.items(): - o += '**' + k + ':** `' + tostring(v) + '`\n' - return o + o = '' + if i: + for k, v in i.items(): + o += '**' + k + ':** `' + tostring(v) + '`\n' + return o def dictelem_tostring(i): - o = '' - if i: - for dic, elem in i.items(): - o += '**__' + dic + '__**\n' - for k, v in elem.items(): - o += '***' + k + ':*** `' + tostring(v) + '`\n' - return o + o = '' + if i: + for dic, elem in i.items(): + o += '**__' + dic + '__**\n' + for k, v in elem.items(): + o += '***' + k + ':*** `' + tostring(v) + '`\n' + return o