2017-10-11 06:55:49 +00:00
|
|
|
def tostring(i, *, random=False):
|
2017-10-17 23:04:45 +00:00
|
|
|
o = ''
|
|
|
|
if i:
|
|
|
|
for v in i:
|
|
|
|
o += v + ' '
|
|
|
|
o = o[:-1]
|
|
|
|
elif random is True:
|
|
|
|
o += 'order:random'
|
|
|
|
else:
|
|
|
|
o = ' '
|
|
|
|
return o
|
2017-09-24 15:05:28 +00:00
|
|
|
|
2017-10-13 02:26:22 +00:00
|
|
|
|
2017-09-24 15:05:28 +00:00
|
|
|
def tostring_commas(i):
|
2017-10-17 23:04:45 +00:00
|
|
|
if i:
|
|
|
|
o = ','
|
|
|
|
for v in i:
|
|
|
|
o += v + ','
|
|
|
|
return o[:-1]
|
|
|
|
return ''
|
2017-09-24 15:05:28 +00:00
|
|
|
|
2017-10-13 02:26:22 +00:00
|
|
|
|
2017-09-24 15:05:28 +00:00
|
|
|
def dict_tostring(i):
|
2017-10-17 23:04:45 +00:00
|
|
|
o = ''
|
|
|
|
if i:
|
|
|
|
for k, v in i.items():
|
|
|
|
o += '**' + k + ':** `' + tostring(v) + '`\n'
|
|
|
|
return o
|
2017-09-24 15:05:28 +00:00
|
|
|
|
2017-10-13 02:26:22 +00:00
|
|
|
|
2017-09-24 15:05:28 +00:00
|
|
|
def dictelem_tostring(i):
|
2017-10-17 23:04:45 +00:00
|
|
|
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
|