Skip to content

Commit

Permalink
try to fix GH failure
Browse files Browse the repository at this point in the history
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
  • Loading branch information
giampaolo committed Oct 26, 2021
1 parent cba37f4 commit 2974941
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions psutil/_pslinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,23 +1320,25 @@ def disk_swaps():
with f:
lines = f.readlines()
lines.pop(0) # header
for line in lines:
# Format is confusing:
# Filename Type\tSize Used Priority
# /dev/nvme0n1p3 partition\t11718652 2724 -2
line = line.strip()
name_and_type, _, other_fields = line.partition('\t')
fstype = name_and_type.split()[-1]
# "/dev/nvme0n1p3 partition" -> "/dev/nvme0n1p3"
path = name_and_type.rstrip(fstype).strip()
# The priority column is useful when multiple swap
# files are in use. The lower the priority, the
# more likely the swap file is to be used.
total, used, priority = map(int, other_fields.split('\t'))
total *= 1024
used *= 1024
nt = sdiskswap(path, total, used, fstype, priority)
retlist.append(nt)
for line in lines:
# Format is confusing:
# Filename Type\tSize Used Priority
# /dev/nvme0n1p3 partition\t11718652 2724 -2
line = line.strip()
if not line:
continue
name_and_type, _, other_fields = line.partition('\t')
fstype = name_and_type.split()[-1]
# "/dev/nvme0n1p3 partition" -> "/dev/nvme0n1p3"
path = name_and_type.rstrip(fstype).strip()
# The priority column is useful when multiple swap
# files are in use. The lower the priority, the
# more likely the swap file is to be used.
total, used, priority = map(int, other_fields.split('\t'))
total *= 1024
used *= 1024
nt = sdiskswap(path, total, used, fstype, priority)
retlist.append(nt)
return retlist


Expand Down

0 comments on commit 2974941

Please sign in to comment.