1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 14:27:27 +00:00

Changed formatter to use any order: tag

This commit is contained in:
Myned 2017-10-30 23:29:22 -04:00
parent 801ee2be71
commit 17b8ccb895

View file

@ -1,38 +1,38 @@
def tostring(i, *, random=False): def tostring(i, *, order=None):
o = '' o = ''
if i: if i:
for v in i: for v in i:
o += v + ' ' o += v + ' '
o = o[:-1] o = o[:-1]
elif random is True: elif order:
o += 'order:random' o += order
else: else:
o = ' ' o = ' '
return o return o
def tostring_commas(i): def tostring_commas(i):
if i: if i:
o = ',' o = ','
for v in i: for v in i:
o += v + ',' o += v + ','
return o[:-1] return o[:-1]
return '' return ''
def dict_tostring(i): def dict_tostring(i):
o = '' o = ''
if i: if i:
for k, v in i.items(): for k, v in i.items():
o += '**' + k + ':** `' + tostring(v) + '`\n' o += '**' + k + ':** `' + tostring(v) + '`\n'
return o return o
def dictelem_tostring(i): def dictelem_tostring(i):
o = '' o = ''
if i: if i:
for dic, elem in i.items(): for dic, elem in i.items():
o += '**__' + dic + '__**\n' o += '**__' + dic + '__**\n'
for k, v in elem.items(): for k, v in elem.items():
o += '***' + k + ':*** `' + tostring(v) + '`\n' o += '***' + k + ':*** `' + tostring(v) + '`\n'
return o return o