pyhw 0.11.5__py3-none-any.whl → 0.11.7__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.
pyhw/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.11.5'
1
+ __version__ = '0.11.7'
@@ -1,11 +1,25 @@
1
1
  from .linux import MemoryDetectLinux
2
+ from ...pyhwUtil import sysctlGetInt
2
3
 
3
4
 
4
5
  class MemoryDetectBSD(MemoryDetectLinux):
5
6
  def __init__(self):
6
7
  MemoryDetectLinux.__init__(self)
8
+ self.__page_size = 0
9
+ self.__physical_memory = 0
10
+ self.__free_pages = 0
11
+ self.__free_memory = 0
7
12
 
8
13
  def getMemoryInfo(self):
9
- self._memoryInfo.memory = f"Pass"
14
+ self.__getMemorySysctl()
15
+ self._memoryInfo.total = self.__physical_memory / 1024 / 1024 # Convert bytes to MiB
16
+ self._memoryInfo.used = (self.__physical_memory - self.__free_memory) / 1024 / 1024 # Convert bytes to MiB
17
+ self._memoryInfo.memory = f"{round(self._memoryInfo.used, 2)} MiB / {round(self._memoryInfo.total, 2)} MiB"
10
18
  return self._memoryInfo
11
19
 
20
+ def __getMemorySysctl(self):
21
+ self.__page_size = sysctlGetInt("hw.pagesize")
22
+ self.__physical_memory = sysctlGetInt("hw.physmem")
23
+ self.__free_pages = sysctlGetInt("vm.stats.vm.v_free_count")
24
+ self.__free_memory = self.__free_pages * self.__page_size
25
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyhw
3
- Version: 0.11.5
3
+ Version: 0.11.7
4
4
  Summary: PyHw, a neofetch-like command line tool for fetching system information but written mostly in python.
5
5
  Author: Xiao Ran
6
6
  Maintainer-email: Xiao Ran <xiaoran.007@icloud.com>
@@ -14,7 +14,7 @@ Classifier: Operating System :: OS Independent
14
14
  Requires-Python: >=3.9
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: pypci-ng>=0.1.5
17
+ Requires-Dist: pypci-ng>=0.2.0
18
18
 
19
19
  # PyHw
20
20
  [![Downloads](https://static.pepy.tech/badge/pyhw)](https://pepy.tech/project/pyhw)
@@ -1,4 +1,4 @@
1
- pyhw/__init__.py,sha256=gN1ufRkaZlKpdMO5J8sGvHRDFI_E6UXkLhyEz7iUzIg,23
1
+ pyhw/__init__.py,sha256=ym3HELiHS5Mp3OBGyRihieTVc505lLMaOerZDCHLXCE,23
2
2
  pyhw/__main__.py,sha256=oZpFtvSyYTM8cMsulvi51zJV0gtmw3OCQVdgoaHbtxc,4977
3
3
  pyhw/backend/__init__.py,sha256=knn_3Yroow1h0dqdrozk3zyy3vz-kQyNBRjR6OLmVoY,50
4
4
  pyhw/backend/backendBase.py,sha256=mloo8mPEbgbIdmyQ3I4vdEXMSSjxWi_wnwACmzvHbEo,506
@@ -29,7 +29,7 @@ pyhw/backend/kernel/kernelInfo.py,sha256=Nkumd0McbimCjc7yJrvz6bcwpWu1Tdo_LKomjZr
29
29
  pyhw/backend/kernel/unix.py,sha256=XDV2GIjamERcmlrQFaKFZY-OJO1xj76Im_7lmg2uFzo,1192
30
30
  pyhw/backend/kernel/windows.py,sha256=MpY6S54VYQ_5l4f93GLOaXd4l-uIjg_k6AEYftkgvcc,1246
31
31
  pyhw/backend/memory/__init__.py,sha256=zGBWxfPAAk8ivCBWPLJIpuD-lB7wUJT3x8u2jHiAoCY,65
32
- pyhw/backend/memory/bsd.py,sha256=GKTCs6RocdoWj-5ZZRMB4xAWGWljor6leuwX-L-7bW0,251
32
+ pyhw/backend/memory/bsd.py,sha256=_Yv2W6T-h5ULqOQHp0dGYJvxPDzlPEkFiusYMKPxTHY,1014
33
33
  pyhw/backend/memory/linux.py,sha256=kxP0LxXdTWYRtu9nDyKqZeIzZrQI84kVOPMeN1GwSOo,917
34
34
  pyhw/backend/memory/macos.py,sha256=ur2HxmmmVkXmaxEcw_otphifVp_csfNMJdgt-idCq7M,2770
35
35
  pyhw/backend/memory/memoryBase.py,sha256=trubcJ_7JD_FnrKefUycPFd4OZMFj3Rk75ih5YVsSXg,790
@@ -111,9 +111,9 @@ pyhw/pyhwUtil/__init__.py,sha256=34ygvVBBqfJ_9OMzHToCcV_BVahixNsa_Z5yh6VsaPQ,304
111
111
  pyhw/pyhwUtil/cliUtil.py,sha256=42Gdi9wTg5XOYuEvGHEgOaZJ6dJk1qSuHIprR8pCA-g,2344
112
112
  pyhw/pyhwUtil/pyhwUtil.py,sha256=RokrE7X99pkS0LtN4wyJS_ZQmjtMwiNxA7MwXMoO96c,7664
113
113
  pyhw/pyhwUtil/sysctlUtil.py,sha256=S-rUvqi7ZrMyMouIhxlyHEQ4agM7sCT1Y7uzs3Hu5-o,841
114
- pyhw-0.11.5.dist-info/LICENSE,sha256=hJs6RBqSVCexbTsalkMLNFI5t06kekQEsSVaOt_-yLs,1497
115
- pyhw-0.11.5.dist-info/METADATA,sha256=0Uckaj6O8Z6X1KufRdc1uMEPSt_nzUki7gZFJ_Sa6kc,6753
116
- pyhw-0.11.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
117
- pyhw-0.11.5.dist-info/entry_points.txt,sha256=q-AB8im_QahpmNrmy4aPTJRGi0LlbNlnI3kF7s6pKss,44
118
- pyhw-0.11.5.dist-info/top_level.txt,sha256=7Inxvxt1TngEricKZEex9_WJZS3DbKYFUXDz4v5WHYU,5
119
- pyhw-0.11.5.dist-info/RECORD,,
114
+ pyhw-0.11.7.dist-info/LICENSE,sha256=hJs6RBqSVCexbTsalkMLNFI5t06kekQEsSVaOt_-yLs,1497
115
+ pyhw-0.11.7.dist-info/METADATA,sha256=wJX9m2nSsRbMMLc8JyAAOF8dhESIYe1Um-Ib_FDK0a8,6753
116
+ pyhw-0.11.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
117
+ pyhw-0.11.7.dist-info/entry_points.txt,sha256=q-AB8im_QahpmNrmy4aPTJRGi0LlbNlnI3kF7s6pKss,44
118
+ pyhw-0.11.7.dist-info/top_level.txt,sha256=7Inxvxt1TngEricKZEex9_WJZS3DbKYFUXDz4v5WHYU,5
119
+ pyhw-0.11.7.dist-info/RECORD,,
File without changes
File without changes