commiefetch 1.2.2__tar.gz → 1.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commiefetch
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Communist-themed system information tool — like neofetch, but red
5
5
  Author: commiefetch contributors
6
6
  License-Expression: GPL-3.0-only
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "commiefetch"
7
- version = "1.2.2"
7
+ version = "1.2.3"
8
8
  description = "Communist-themed system information tool — like neofetch, but red"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -1,2 +1,2 @@
1
- __version__ = "1.2.2"
1
+ __version__ = "1.2.3"
2
2
  __app_name__ = "commiefetch"
@@ -440,19 +440,27 @@ def get_memory():
440
440
  system = platform.system()
441
441
  if system == "Linux":
442
442
  meminfo = {}
443
- raw = None
444
443
  try:
445
444
  with open("/proc/meminfo") as f:
446
- raw = f.read()
445
+ for line in f:
446
+ parts = line.split(":")
447
+ if len(parts) == 2:
448
+ val = parts[1].strip()
449
+ if val.endswith(" kB"):
450
+ val = int(val.split()[0]) // 1024
451
+ meminfo[parts[0]] = val
447
452
  except Exception:
448
- raw = run_cmd(["cat", "/proc/meminfo"], timeout=3)
449
- if raw:
450
- for line in raw.split("\n"):
451
- parts = line.split(":")
452
- if len(parts) == 2:
453
- meminfo[parts[0]] = _parse_meminfo_value(parts[1])
453
+ out = run_cmd(["cat", "/proc/meminfo"], timeout=3)
454
+ if out:
455
+ for line in out.split("\n"):
456
+ parts = line.split(":")
457
+ if len(parts) == 2:
458
+ val = parts[1].strip()
459
+ if val.endswith(" kB"):
460
+ val = int(val.split()[0]) // 1024
461
+ meminfo[parts[0]] = val
454
462
  total = meminfo.get("MemTotal", 0)
455
- if not isinstance(total, (int, float)) or total <= 0:
463
+ if not isinstance(total, (int, float)):
456
464
  total = 0
457
465
  if total == 0:
458
466
  result = _get_sysinfo_memory()
@@ -467,17 +475,14 @@ def get_memory():
467
475
  if line.startswith("Mem:"):
468
476
  cols = line.split()
469
477
  if len(cols) >= 3:
470
- try:
471
- t = int(cols[1])
472
- if t > 0:
473
- u = int(cols[2])
474
- return {
475
- "total": t, "used": u,
476
- "available": t - u, "unit": "MiB",
477
- "percent": round(u / t * 100, 1),
478
- }
479
- except Exception:
480
- pass
478
+ t = int(cols[1])
479
+ if t > 0:
480
+ u = int(cols[2])
481
+ return {
482
+ "total": t, "used": u,
483
+ "available": t - u, "unit": "MiB",
484
+ "percent": round(u / t * 100, 1),
485
+ }
481
486
  return None
482
487
  avail = meminfo.get("MemAvailable", 0)
483
488
  if not isinstance(avail, (int, float)):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commiefetch
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Communist-themed system information tool — like neofetch, but red
5
5
  Author: commiefetch contributors
6
6
  License-Expression: GPL-3.0-only
File without changes
File without changes
File without changes
File without changes