multiCMD 1.25__py3-none-any.whl → 1.26__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.
multiCMD.py CHANGED
@@ -18,7 +18,7 @@ import re
18
18
  import itertools
19
19
  import signal
20
20
 
21
- version = '1.25'
21
+ version = '1.26'
22
22
  __version__ = version
23
23
 
24
24
  __running_threads = []
@@ -265,7 +265,7 @@ def __run_command(task,sem, timeout=60, quiet=False,dry_run=False,with_stdErr=Fa
265
265
  return task.stdout
266
266
 
267
267
  def ping(hosts,timeout=1,max_threads=0,quiet=True,dry_run=False,with_stdErr=False,
268
- return_code_only=True,return_object=False,wait_for_return=True):
268
+ return_code_only=False,return_object=False,wait_for_return=True,return_true_false=True):
269
269
  '''
270
270
  Ping multiple hosts
271
271
 
@@ -283,15 +283,27 @@ def ping(hosts,timeout=1,max_threads=0,quiet=True,dry_run=False,with_stdErr=Fals
283
283
  @returns:
284
284
  None | int | list[str] | Task: The output of the command
285
285
  '''
286
+ single_host = False
286
287
  if isinstance(hosts,str):
287
288
  commands = [f'ping -c 1 {hosts}']
288
- return run_commands(commands, timeout=timeout, max_threads=max_threads, quiet=quiet,
289
- dry_run=dry_run, with_stdErr=with_stdErr, return_code_only=return_code_only,
290
- return_object=return_object,wait_for_return=wait_for_return)[0]
291
- commands = [f'ping -c 1 {host}' for host in hosts]
292
- return run_commands(commands, timeout=timeout, max_threads=max_threads, quiet=quiet,
289
+ single_host = True
290
+ else:
291
+ commands = [f'ping -c 1 {host}' for host in hosts]
292
+ if return_true_false:
293
+ return_code_only = True
294
+ results = run_commands(commands, timeout=timeout, max_threads=max_threads, quiet=quiet,
293
295
  dry_run=dry_run, with_stdErr=with_stdErr, return_code_only=return_code_only,
294
296
  return_object=return_object,wait_for_return=wait_for_return)
297
+ if return_true_false:
298
+ if single_host:
299
+ return not results[0]
300
+ else:
301
+ return [not result for result in results]
302
+ else:
303
+ if single_host:
304
+ return results[0]
305
+ else:
306
+ return results
295
307
 
296
308
 
297
309
  def run_command(command, timeout=0,max_threads=1,quiet=False,dry_run=False,with_stdErr=False,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: multiCMD
3
- Version: 1.25
3
+ Version: 1.26
4
4
  Summary: Run commands simultaneously
5
5
  Home-page: https://github.com/yufei-pan/multiCMD
6
6
  Author: Yufei Pan
@@ -0,0 +1,6 @@
1
+ multiCMD.py,sha256=NIUkbXTFdCTQJb6QMuAAhf6cJoiDwZ0vZ0H721ND85c,18750
2
+ multicmd-1.26.dist-info/METADATA,sha256=Xy_tztr92dFb0cszDrbVGHeI4SOybpmhYTEP0IIqUJ0,5640
3
+ multicmd-1.26.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
4
+ multicmd-1.26.dist-info/entry_points.txt,sha256=nSLBkYrcUCQxt1w3LIJkvgOhpRYEC0xAPqNG7u4OYs8,89
5
+ multicmd-1.26.dist-info/top_level.txt,sha256=DSqgftD40G09F3qEjpHRCUNUsGUvGZZG69Sm3YEUiWI,9
6
+ multicmd-1.26.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- multiCMD.py,sha256=jj44YzujdvBUTbBb3S94OP0-TDWA4wXzFd4wEQIqUYQ,18676
2
- multicmd-1.25.dist-info/METADATA,sha256=4NX-fl2sXchCHsTPhvtZkG2ze-gPY7tDB-dAHGXhsH4,5640
3
- multicmd-1.25.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
4
- multicmd-1.25.dist-info/entry_points.txt,sha256=nSLBkYrcUCQxt1w3LIJkvgOhpRYEC0xAPqNG7u4OYs8,89
5
- multicmd-1.25.dist-info/top_level.txt,sha256=DSqgftD40G09F3qEjpHRCUNUsGUvGZZG69Sm3YEUiWI,9
6
- multicmd-1.25.dist-info/RECORD,,