multiSSH3 5.51__tar.gz → 5.53__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.
Potentially problematic release.
This version of multiSSH3 might be problematic. Click here for more details.
- {multissh3-5.51 → multissh3-5.53}/PKG-INFO +1 -1
- {multissh3-5.51 → multissh3-5.53}/multiSSH3.egg-info/PKG-INFO +1 -1
- {multissh3-5.51 → multissh3-5.53}/multiSSH3.py +68 -45
- {multissh3-5.51 → multissh3-5.53}/README.md +0 -0
- {multissh3-5.51 → multissh3-5.53}/multiSSH3.egg-info/SOURCES.txt +0 -0
- {multissh3-5.51 → multissh3-5.53}/multiSSH3.egg-info/dependency_links.txt +0 -0
- {multissh3-5.51 → multissh3-5.53}/multiSSH3.egg-info/entry_points.txt +0 -0
- {multissh3-5.51 → multissh3-5.53}/multiSSH3.egg-info/requires.txt +0 -0
- {multissh3-5.51 → multissh3-5.53}/multiSSH3.egg-info/top_level.txt +0 -0
- {multissh3-5.51 → multissh3-5.53}/setup.cfg +0 -0
- {multissh3-5.51 → multissh3-5.53}/setup.py +0 -0
- {multissh3-5.51 → multissh3-5.53}/test/test.py +0 -0
- {multissh3-5.51 → multissh3-5.53}/test/testCurses.py +0 -0
- {multissh3-5.51 → multissh3-5.53}/test/testCursesOld.py +0 -0
- {multissh3-5.51 → multissh3-5.53}/test/testPerfCompact.py +0 -0
- {multissh3-5.51 → multissh3-5.53}/test/testPerfExpand.py +0 -0
|
@@ -54,10 +54,10 @@ except AttributeError:
|
|
|
54
54
|
# If neither is available, use a dummy decorator
|
|
55
55
|
def cache_decorator(func):
|
|
56
56
|
return func
|
|
57
|
-
version = '5.
|
|
57
|
+
version = '5.53'
|
|
58
58
|
VERSION = version
|
|
59
59
|
__version__ = version
|
|
60
|
-
COMMIT_DATE = '2025-01
|
|
60
|
+
COMMIT_DATE = '2025-03-01'
|
|
61
61
|
|
|
62
62
|
CONFIG_FILE_CHAIN = ['./multiSSH3.config.json',
|
|
63
63
|
'~/multiSSH3.config.json',
|
|
@@ -490,49 +490,72 @@ def replace_magic_strings(string,keys,value,case_sensitive=False):
|
|
|
490
490
|
string = re.sub(re.escape(key),value,string,flags=re.IGNORECASE)
|
|
491
491
|
return string
|
|
492
492
|
|
|
493
|
-
def pretty_format_table(data):
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
493
|
+
def pretty_format_table(data, delimiter = '\t',header = None):
|
|
494
|
+
version = 1.11
|
|
495
|
+
if not data:
|
|
496
|
+
return ''
|
|
497
|
+
if type(data) == str:
|
|
498
|
+
data = data.strip('\n').split('\n')
|
|
499
|
+
data = [line.split(delimiter) for line in data]
|
|
500
|
+
elif isinstance(data, dict):
|
|
501
|
+
# flatten the 2D dict to a list of lists
|
|
502
|
+
if isinstance(next(iter(data.values())), dict):
|
|
503
|
+
tempData = [['key'] + list(next(iter(data.values())).keys())]
|
|
504
|
+
tempData.extend( [[key] + list(value.values()) for key, value in data.items()])
|
|
505
|
+
data = tempData
|
|
506
|
+
else:
|
|
507
|
+
# it is a dict of lists
|
|
508
|
+
data = [[key] + list(value) for key, value in data.items()]
|
|
509
|
+
elif type(data) != list:
|
|
510
|
+
data = list(data)
|
|
511
|
+
# format the list into 2d list of list of strings
|
|
512
|
+
if isinstance(data[0], dict):
|
|
513
|
+
tempData = [data[0].keys()]
|
|
514
|
+
tempData.extend([list(item.values()) for item in data])
|
|
515
|
+
data = tempData
|
|
516
|
+
data = [[str(item) for item in row] for row in data]
|
|
517
|
+
num_cols = len(data[0])
|
|
518
|
+
col_widths = [0] * num_cols
|
|
519
|
+
# Calculate the maximum width of each column
|
|
520
|
+
for c in range(num_cols):
|
|
521
|
+
#col_widths[c] = max(len(row[c]) for row in data)
|
|
522
|
+
# handle ansii escape sequences
|
|
523
|
+
col_widths[c] = max(len(re.sub(r'\x1b\[[0-?]*[ -/]*[@-~]','',row[c])) for row in data)
|
|
524
|
+
if header:
|
|
525
|
+
header_widths = [len(re.sub(r'\x1b\[[0-?]*[ -/]*[@-~]', '', col)) for col in header]
|
|
526
|
+
col_widths = [max(col_widths[i], header_widths[i]) for i in range(num_cols)]
|
|
527
|
+
# Build the row format string
|
|
528
|
+
row_format = ' | '.join('{{:<{}}}'.format(width) for width in col_widths)
|
|
529
|
+
# Print the header
|
|
530
|
+
if not header:
|
|
531
|
+
header = data[0]
|
|
532
|
+
outTable = []
|
|
533
|
+
outTable.append(row_format.format(*header))
|
|
534
|
+
outTable.append('-+-'.join('-' * width for width in col_widths))
|
|
535
|
+
for row in data[1:]:
|
|
536
|
+
# if the row is empty, print an divider
|
|
537
|
+
if not any(row):
|
|
538
|
+
outTable.append('-+-'.join('-' * width for width in col_widths))
|
|
539
|
+
else:
|
|
540
|
+
outTable.append(row_format.format(*row))
|
|
541
|
+
else:
|
|
542
|
+
# pad / truncate header to appropriate length
|
|
543
|
+
if isinstance(header,str):
|
|
544
|
+
header = header.split(delimiter)
|
|
545
|
+
if len(header) < num_cols:
|
|
546
|
+
header += ['']*(num_cols-len(header))
|
|
547
|
+
elif len(header) > num_cols:
|
|
548
|
+
header = header[:num_cols]
|
|
549
|
+
outTable = []
|
|
550
|
+
outTable.append(row_format.format(*header))
|
|
551
|
+
outTable.append('-+-'.join('-' * width for width in col_widths))
|
|
552
|
+
for row in data:
|
|
553
|
+
# if the row is empty, print an divider
|
|
554
|
+
if not any(row):
|
|
555
|
+
outTable.append('-+-'.join('-' * width for width in col_widths))
|
|
556
|
+
else:
|
|
557
|
+
outTable.append(row_format.format(*row))
|
|
558
|
+
return '\n'.join(outTable) + '\n'
|
|
536
559
|
|
|
537
560
|
# ------------ Compacting Hostnames ----------------
|
|
538
561
|
def __tokenize_hostname(hostname):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|