multiSSH3 5.52__py3-none-any.whl → 5.54__py3-none-any.whl

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.py CHANGED
@@ -54,7 +54,7 @@ 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.52'
57
+ version = '5.54'
58
58
  VERSION = version
59
59
  __version__ = version
60
60
  COMMIT_DATE = '2025-03-01'
@@ -491,10 +491,10 @@ def replace_magic_strings(string,keys,value,case_sensitive=False):
491
491
  return string
492
492
 
493
493
  def pretty_format_table(data, delimiter = '\t',header = None):
494
- version = 1.1
494
+ version = 1.11
495
495
  if not data:
496
496
  return ''
497
- if type(data) == str:
497
+ if isinstance(data, str):
498
498
  data = data.strip('\n').split('\n')
499
499
  data = [line.split(delimiter) for line in data]
500
500
  elif isinstance(data, dict):
@@ -506,7 +506,7 @@ def pretty_format_table(data, delimiter = '\t',header = None):
506
506
  else:
507
507
  # it is a dict of lists
508
508
  data = [[key] + list(value) for key, value in data.items()]
509
- elif type(data) != list:
509
+ elif not isinstance(data, list):
510
510
  data = list(data)
511
511
  # format the list into 2d list of list of strings
512
512
  if isinstance(data[0], dict):
@@ -521,6 +521,9 @@ def pretty_format_table(data, delimiter = '\t',header = None):
521
521
  #col_widths[c] = max(len(row[c]) for row in data)
522
522
  # handle ansii escape sequences
523
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)]
524
527
  # Build the row format string
525
528
  row_format = ' | '.join('{{:<{}}}'.format(width) for width in col_widths)
526
529
  # Print the header
@@ -1235,9 +1238,9 @@ def run_command(host, sem, timeout=60,passwds=None, retry_limit = 5):
1235
1238
  host.command = replace_magic_strings(host.command,['#PASSWD#','#PASSWORD#'],passwds,case_sensitive=False)
1236
1239
  host.command = replace_magic_strings(host.command,['#UUID#'],str(host.uuid),case_sensitive=False)
1237
1240
  formatedCMD = []
1238
- if host.extraargs and type(host.extraargs) == str:
1241
+ if host.extraargs and isinstance(host.extraargs, str):
1239
1242
  extraargs = host.extraargs.split()
1240
- elif host.extraargs and type(host.extraargs) == list:
1243
+ elif host.extraargs and isinstance(host.extraargs, list):
1241
1244
  extraargs = [str(arg) for arg in host.extraargs]
1242
1245
  else:
1243
1246
  extraargs = []
@@ -2374,7 +2377,7 @@ def formHostStr(host) -> str:
2374
2377
  """
2375
2378
  if not host or len(host) == 0:
2376
2379
  return 'EMPTY_HOSTS'
2377
- if type(host) is str:
2380
+ if isinstance(host, str):
2378
2381
  host = set(host.replace(',',' ').replace('\n',' ').replace('\r',' ').replace('\t',' ').replace(';', ' ').replace('|', ' ').replace('/', ' ').replace('&',' ').split())
2379
2382
  else:
2380
2383
  host = set(host)
@@ -2426,7 +2429,7 @@ def getStrCommand(hosts = DEFAULT_HOSTS,commands = None,oneonone = DEFAULT_ONE_O
2426
2429
  single_window = DEFAULT_SINGLE_WINDOW,file_sync = False,error_only = DEFAULT_ERROR_ONLY, identity_file = DEFAULT_IDENTITY_FILE,
2427
2430
  copy_id = False,
2428
2431
  shortend = False):
2429
- hosts = hosts if type(hosts) == str else frozenset(hosts)
2432
+ hosts = hosts if isinstance(hosts,str) else frozenset(hosts)
2430
2433
  hostStr = formHostStr(hosts)
2431
2434
  files = frozenset(files) if files else None
2432
2435
  argsStr = __formCommandArgStr(oneonone = oneonone, timeout = timeout,password = password,
@@ -2540,10 +2543,10 @@ def run_command_on_hosts(hosts = DEFAULT_HOSTS,commands = None,oneonone = DEFAUL
2540
2543
  if not commands:
2541
2544
  commands = []
2542
2545
  else:
2543
- commands = [commands] if type(commands) == str else commands
2546
+ commands = [commands] if isinstance(commands,str) else commands
2544
2547
  # reformat commands into a list of strings, join the iterables if they are not strings
2545
2548
  try:
2546
- commands = [' '.join(command) if not type(command) == str else command for command in commands]
2549
+ commands = [' '.join(command) if not isinstance(command,str) else command for command in commands]
2547
2550
  except:
2548
2551
  pass
2549
2552
  eprint(f"Warning: commands should ideally be a list of strings. Now mssh had failed to convert {commands!r} to a list of strings. Continuing anyway but expect failures.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: multiSSH3
3
- Version: 5.52
3
+ Version: 5.54
4
4
  Summary: Run commands on multiple hosts via SSH
5
5
  Home-page: https://github.com/yufei-pan/multiSSH3
6
6
  Author: Yufei Pan
@@ -0,0 +1,6 @@
1
+ multiSSH3.py,sha256=-WP8EeQQj-wIIRX-QDUbOr0D66iEQJS9F0oZebbSPwE,139313
2
+ multissh3-5.54.dist-info/METADATA,sha256=t0ulRcBi1UXGWV0_OlCwdwxCYYXqYGSoeY7pH6uF8k8,18092
3
+ multissh3-5.54.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
4
+ multissh3-5.54.dist-info/entry_points.txt,sha256=xi2rWWNfmHx6gS8Mmx0rZL2KZz6XWBYP3DWBpWAnnZ0,143
5
+ multissh3-5.54.dist-info/top_level.txt,sha256=tUwttxlnpLkZorSsroIprNo41lYSxjd2ASuL8-EJIJw,10
6
+ multissh3-5.54.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- multiSSH3.py,sha256=jehXB9OJ5DdqpCB8x8vPftCBDsPzPHh0sJ0sggW3pJo,139086
2
- multissh3-5.52.dist-info/METADATA,sha256=ANTIYDpuku3Dps4XVWXGeCUK-2VBReLUHtPmzsQ34TE,18092
3
- multissh3-5.52.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
4
- multissh3-5.52.dist-info/entry_points.txt,sha256=xi2rWWNfmHx6gS8Mmx0rZL2KZz6XWBYP3DWBpWAnnZ0,143
5
- multissh3-5.52.dist-info/top_level.txt,sha256=tUwttxlnpLkZorSsroIprNo41lYSxjd2ASuL8-EJIJw,10
6
- multissh3-5.52.dist-info/RECORD,,