optimuslib 0.0.41__tar.gz → 0.0.45__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: optimuslib
3
- Version: 0.0.41
3
+ Version: 0.0.45
4
4
  Summary: Function Library for mostly used codes
5
5
  Author: Shomi Nanwani
6
6
  Requires-Python: >=3.9,<4.0
@@ -1379,7 +1379,29 @@ def sendDiscordBotFile(botToken,channelId,filePath):
1379
1379
  log.info('Discord Bot Message Send Failure Error Description: %s', responseJson['description'])
1380
1380
  getVarInfo('responseJson',responseJson)
1381
1381
  return False
1382
-
1382
+
1383
+
1384
+ # format table for discord message
1385
+ def buildUnicodeTable(headers, rows):
1386
+ col_widths = [len(h) for h in headers]
1387
+
1388
+ for row in rows:
1389
+ for idx, cell in enumerate(row):
1390
+ col_widths[idx] = max(col_widths[idx], len(str(cell)))
1391
+
1392
+ top_border = '┌' + '┬'.join('─' * (w + 2) for w in col_widths) + '┐'
1393
+ header_row = '│ ' + ' │ '.join(headers[i].ljust(col_widths[i]) for i in range(len(headers))) + ' │'
1394
+ mid_border = '├' + '┼'.join('─' * (w + 2) for w in col_widths) + '┤'
1395
+
1396
+ data_rows = []
1397
+ for row in rows:
1398
+ data_row = '│ ' + ' │ '.join(str(row[i]).ljust(col_widths[i]) for i in range(len(row))) + ' │'
1399
+ data_rows.append(data_row)
1400
+
1401
+ bottom_border = '└' + '┴'.join('─' * (w + 2) for w in col_widths) + '┘'
1402
+
1403
+ table = [top_border, header_row, mid_border] + data_rows + [bottom_border]
1404
+ return '\n'.join(table)
1383
1405
  # if(optimuslib.sendTelegramNotification(botToken, chatId,output)):
1384
1406
  # print('Telegram Notification Sent.')
1385
1407
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "optimuslib"
3
- version = "0.0.41"
3
+ version = "0.0.45"
4
4
  description = "Function Library for mostly used codes"
5
5
  authors = ["Shomi Nanwani"]
6
6
  readme = "README.md"
File without changes