machineconfig 5.91__py3-none-any.whl → 5.92__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 machineconfig might be problematic. Click here for more details.

@@ -2,12 +2,11 @@
2
2
 
3
3
  import psutil
4
4
  from rich.progress import Progress, SpinnerColumn, TextColumn
5
- from zoneinfo import ZoneInfo
6
5
  from machineconfig.utils.options import choose_from_options
7
- from typing import Optional, Any
6
+ from typing import Optional
8
7
  from rich.console import Console
9
8
  from rich.panel import Panel
10
- from datetime import datetime, timezone
9
+ from datetime import datetime
11
10
  from machineconfig.utils.accessories import pprint
12
11
 
13
12
  console = Console()
@@ -63,9 +62,7 @@ class ProcessManager:
63
62
  for proc in psutil.process_iter():
64
63
  try:
65
64
  mem_usage_mb = proc.memory_info().rss / (1024 * 1024)
66
- # Convert create_time to local timezone
67
- create_time_utc = datetime.fromtimestamp(proc.create_time(), tz=timezone.utc)
68
- create_time_local = create_time_utc.astimezone(ZoneInfo("Australia/Adelaide"))
65
+ create_time = datetime.fromtimestamp(proc.create_time(), tz=None)
69
66
 
70
67
  process_info.append(
71
68
  {
@@ -75,7 +72,7 @@ class ProcessManager:
75
72
  "cpu_percent": proc.cpu_percent(),
76
73
  "memory_usage_mb": mem_usage_mb,
77
74
  "status": proc.status(),
78
- "create_time": create_time_local,
75
+ "create_time": create_time,
79
76
  "command": " ".join(proc.cmdline()),
80
77
  }
81
78
  )
@@ -208,32 +205,11 @@ class ProcessManager:
208
205
  console.print(Panel(f"✅ Termination complete: {killed_count} processes terminated", title="[bold blue]Process Info[/bold blue]", border_style="blue"))
209
206
 
210
207
 
211
- def get_age(create_time: Any) -> str:
212
- """Calculate age from create_time which can be either float timestamp or datetime object."""
213
- try:
214
- if isinstance(create_time, (int, float)):
215
- # Handle timestampz
216
- create_time_utc = datetime.fromtimestamp(create_time, tz=timezone.utc)
217
- create_time_local = create_time_utc.astimezone(ZoneInfo("Australia/Adelaide"))
218
- else:
219
- # Already a datetime object
220
- create_time_local = create_time
221
-
222
- now_local = datetime.now(tz=ZoneInfo("Australia/Adelaide"))
223
- age = now_local - create_time_local
224
- return str(age)
225
- except Exception as e:
226
- try:
227
- # Fallback without timezone
228
- if isinstance(create_time, (int, float)):
229
- create_time_dt = datetime.fromtimestamp(create_time)
230
- else:
231
- create_time_dt = create_time.replace(tzinfo=None) if create_time.tzinfo else create_time
232
- now_dt = datetime.now()
233
- age = now_dt - create_time_dt
234
- return str(age)
235
- except Exception as ee:
236
- return f"unknown due to {ee} and {e}"
208
+ def get_age(create_time: int) -> str:
209
+ dtm_now = datetime.now()
210
+ dtm_create = datetime.fromtimestamp(create_time, tz=None)
211
+ delta = dtm_now - dtm_create
212
+ return str(delta).split(".")[0] # remove microseconds
237
213
 
238
214
 
239
215
  def main():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 5.91
3
+ Version: 5.92
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -392,7 +392,7 @@ machineconfig/utils/notifications.py,sha256=tuXIudcip0tEioG-bm8BbLr3FMDve4f6Bktl
392
392
  machineconfig/utils/options.py,sha256=vUO4Kej-vDOv64wHr2HNDyu6PATURpjd7xp6N8OOoJg,7083
393
393
  machineconfig/utils/path_extended.py,sha256=4RhL0twcIG2kJxmC4r_YzaiTxrYkSRbdh9SO5ObMABw,53122
394
394
  machineconfig/utils/path_helper.py,sha256=0e3Xh3BAEv27oqcezNeVLHJllGmLEgLH4T1l90m-650,8014
395
- machineconfig/utils/procs.py,sha256=w75oGKfR7FpT1pGTGd2XscnEOO0IHBWxohLbi69hLqg,11418
395
+ machineconfig/utils/procs.py,sha256=lGPzGl6vAdnuzdiP_FrDikEf2NFOTo-li3SuyUgYWuY,10268
396
396
  machineconfig/utils/scheduler.py,sha256=jZ_1yghqA3-aINPRmE_76gboqJc0UElroR7urNOfXKs,14940
397
397
  machineconfig/utils/scheduling.py,sha256=RF1iXJpqf4Dg18jdZWtBixz97KAHC6VKYqTFSpdLWuc,11188
398
398
  machineconfig/utils/source_of_truth.py,sha256=ZAnCRltiM07ig--P6g9_6nEAvNFC4X4ERFTVcvpIYsE,764
@@ -421,8 +421,8 @@ machineconfig/utils/schemas/installer/installer_types.py,sha256=QClRY61QaduBPJoS
421
421
  machineconfig/utils/schemas/layouts/layout_types.py,sha256=TcqlZdGVoH8htG5fHn1KWXhRdPueAcoyApppZsPAPto,2020
422
422
  machineconfig/utils/schemas/repos/repos_types.py,sha256=ECVr-3IVIo8yjmYmVXX2mnDDN1SLSwvQIhx4KDDQHBQ,405
423
423
  machineconfig/utils/ssh_utils/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
424
- machineconfig-5.91.dist-info/METADATA,sha256=GhvLlUJSx4c1ZSW0-rkO3Okoh-yx_b4oJSKIo6Dpj3M,3012
425
- machineconfig-5.91.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
426
- machineconfig-5.91.dist-info/entry_points.txt,sha256=M0jwN_brZdXWhmNVeXLvdKxfkv8WhhXFZYcuKBA9qnk,418
427
- machineconfig-5.91.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
428
- machineconfig-5.91.dist-info/RECORD,,
424
+ machineconfig-5.92.dist-info/METADATA,sha256=VKZb_26gFUj2XJ4609bUjJbV0uwfF39Dlb3lbNv2ULw,3012
425
+ machineconfig-5.92.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
426
+ machineconfig-5.92.dist-info/entry_points.txt,sha256=M0jwN_brZdXWhmNVeXLvdKxfkv8WhhXFZYcuKBA9qnk,418
427
+ machineconfig-5.92.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
428
+ machineconfig-5.92.dist-info/RECORD,,