statblk 1.23__py3-none-any.whl → 1.25__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statblk
3
- Version: 1.23
3
+ Version: 1.25
4
4
  Summary: Gather essential disk and partition info for block devices and print it in a nice table
5
5
  Home-page: https://github.com/yufei-pan/statblk
6
6
  Author: Yufei Pan
@@ -0,0 +1,6 @@
1
+ statblk.py,sha256=TCKW0HYDMb0OMtgCZb7yLGjDjvRXcnEzEVP83d7xcXY,27617
2
+ statblk-1.25.dist-info/METADATA,sha256=w_cWbClMEHwLXQhCmtX1-vb0KJ9Y0J2cby9Dqn7i0mw,1465
3
+ statblk-1.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4
+ statblk-1.25.dist-info/entry_points.txt,sha256=JDz-sa6FIdaOckmlz9NbnhZXQaB5Yle-cTKgUQmAV40,41
5
+ statblk-1.25.dist-info/top_level.txt,sha256=dBdU6_PD4tG_7uquWEs6YremqudiePASv3u3G59scf4,8
6
+ statblk-1.25.dist-info/RECORD,,
statblk.py CHANGED
@@ -276,7 +276,7 @@ except :
276
276
  def cache_decorator(func):
277
277
  return func
278
278
 
279
- version = '1.23'
279
+ version = '1.25'
280
280
  VERSION = version
281
281
  __version__ = version
282
282
  COMMIT_DATE = '2025-09-10'
@@ -501,7 +501,9 @@ def get_read_write_rate_throughput_iter(sysfs_block_path):
501
501
 
502
502
  # DRIVE_INFO = namedtuple("DRIVE_INFO",
503
503
  # ["NAME", "FSTYPE", "SIZE", "FSUSEPCT", "MOUNTPOINT", "SMART","RTPT",'WTPT', "LABEL", "UUID", "MODEL", "SERIAL", "DISCARD"])
504
- def get_drives_info(print_bytes = False, use_1024 = False, mounted_only=False, best_only=False, formated_only=False, show_zero_size_devices=False,pseudo=False,tptDict = {},full=False):
504
+ def get_drives_info(print_bytes = False, use_1024 = False, mounted_only=False, best_only=False,
505
+ formated_only=False, show_zero_size_devices=False,pseudo=False,tptDict = {},
506
+ full=False,active_only=False):
505
507
  lsblk_result = multiCMD.run_command(f'lsblk -brnp -o NAME,SIZE,FSTYPE,UUID,LABEL',timeout=2,quiet=True,wait_for_return=False,return_object=True)
506
508
  block_devices = get_blocks()
507
509
  smart_infos = {}
@@ -542,10 +544,12 @@ def get_drives_info(print_bytes = False, use_1024 = False, mounted_only=False, b
542
544
  size_dict[lsblk_name] = int(lsblk_size)
543
545
  except Exception:
544
546
  pass
545
- output = [["NAME", "FSTYPE", "SIZE", "FSUSE%", "MOUNTPOINT", "SMART", "LABEL", "UUID", "MODEL", "SERIAL", "DISCARD","RTPT",'WTPT']]
547
+ output = [["NAME", "FSTYPE", "SIZE", "FSUSE%", "MOUNTPOINT", "SMART", "LABEL", "UUID", "MODEL", "SERIAL", "DISCARD","READ",'WRITE']]
546
548
  for device_name in target_devices:
547
549
  if mounted_only and device_name not in mount_table:
548
550
  continue
551
+ if active_only and device_name not in tptDict:
552
+ continue
549
553
  fstype = ''
550
554
  size = ''
551
555
  fsusepct = ''
@@ -582,12 +586,14 @@ def get_drives_info(print_bytes = False, use_1024 = False, mounted_only=False, b
582
586
  if device_name in tptDict:
583
587
  try:
584
588
  rtpt, wtpt = next(tptDict[device_name])
589
+ if active_only and rtpt == 0 and wtpt == 0:
590
+ continue
585
591
  if print_bytes:
586
592
  rtpt = str(rtpt)
587
593
  wtpt = str(wtpt)
588
594
  else:
589
- rtpt = multiCMD.format_bytes(rtpt, use_1024_bytes=use_1024, to_str=True,str_format='.1f') + 'B/s'
590
- wtpt = multiCMD.format_bytes(wtpt, use_1024_bytes=use_1024, to_str=True,str_format='.1f') + 'B/s'
595
+ rtpt = multiCMD.format_bytes(rtpt, use_1024_bytes=use_1024, to_str=True,str_format='.0f') + 'B/s'
596
+ wtpt = multiCMD.format_bytes(wtpt, use_1024_bytes=use_1024, to_str=True,str_format='.0f') + 'B/s'
591
597
  except Exception:
592
598
  rtpt = ''
593
599
  wtpt = ''
@@ -642,7 +648,8 @@ def main():
642
648
  parser.add_argument('-F','-fo','--formated_only', help="Show only formated filesystems", action="store_true")
643
649
  parser.add_argument('-M','-mo','--mounted_only', help="Show only mounted filesystems", action="store_true")
644
650
  parser.add_argument('-B','-bo','--best_only', help="Show only shortest mount point for each device", action="store_true")
645
- parser.add_argument('-a','--full', help="Show full device information, do not collapse drive info when length > console length", action="store_true")
651
+ parser.add_argument('-A','-ao','--active_only', help="Show only active devices (positive read/write activity)", action="store_true")
652
+ parser.add_argument('-R','--full', help="Show full device information, do not collapse drive info when length > console length", action="store_true")
646
653
  parser.add_argument('-P','--pseudo', help="Include pseudo file systems as well (tmpfs / nfs / cifs etc.)", action="store_true")
647
654
  parser.add_argument('--show_zero_size_devices', help="Show devices with zero size", action="store_true")
648
655
  parser.add_argument('print_period', nargs='?', default=0, type=int, help="If specified as a number, repeat the output every N seconds")
@@ -654,7 +661,7 @@ def main():
654
661
  results = get_drives_info(print_bytes = args.bytes, use_1024 = not args.si,
655
662
  mounted_only=args.mounted_only, best_only=args.best_only,
656
663
  formated_only=args.formated_only, show_zero_size_devices=args.show_zero_size_devices,
657
- pseudo=args.pseudo,tptDict=tptDict,full=args.full)
664
+ pseudo=args.pseudo,tptDict=tptDict,full=args.full,active_only=args.active_only)
658
665
  if args.json:
659
666
  import json
660
667
  print(json.dumps(results, indent=1))
@@ -1,6 +0,0 @@
1
- statblk.py,sha256=x1A2ApJusueQjPRXKJnjfoScjtjv6wtysdDMKlL1jKI,27300
2
- statblk-1.23.dist-info/METADATA,sha256=tA7bFzT0XfgZioOKPz1kmt1jWmNybpxv8N_9vXC63FI,1465
3
- statblk-1.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4
- statblk-1.23.dist-info/entry_points.txt,sha256=JDz-sa6FIdaOckmlz9NbnhZXQaB5Yle-cTKgUQmAV40,41
5
- statblk-1.23.dist-info/top_level.txt,sha256=dBdU6_PD4tG_7uquWEs6YremqudiePASv3u3G59scf4,8
6
- statblk-1.23.dist-info/RECORD,,
File without changes