pyhw 0.6.5__tar.gz → 0.6.6__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. {pyhw-0.6.5/src/pyhw.egg-info → pyhw-0.6.6}/PKG-INFO +1 -1
  2. {pyhw-0.6.5 → pyhw-0.6.6}/pyproject.toml +1 -1
  3. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/frontendBase.py +32 -0
  4. pyhw-0.6.6/src/pyhw/pyhwUtil/pyhwUtil.py +189 -0
  5. {pyhw-0.6.5 → pyhw-0.6.6/src/pyhw.egg-info}/PKG-INFO +1 -1
  6. pyhw-0.6.5/src/pyhw/pyhwUtil/pyhwUtil.py +0 -89
  7. {pyhw-0.6.5 → pyhw-0.6.6}/LICENSE +0 -0
  8. {pyhw-0.6.5 → pyhw-0.6.6}/README.md +0 -0
  9. {pyhw-0.6.5 → pyhw-0.6.6}/setup.cfg +0 -0
  10. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/__init__.py +0 -0
  11. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/__main__.py +0 -0
  12. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/__init__.py +0 -0
  13. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/backendBase.py +0 -0
  14. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/cpu/__init__.py +0 -0
  15. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/cpu/cpuBase.py +0 -0
  16. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/cpu/cpuInfo.py +0 -0
  17. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/cpu/linux.py +0 -0
  18. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/cpu/macos.py +0 -0
  19. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/gpu/__init__.py +0 -0
  20. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/gpu/gpuBase.py +0 -0
  21. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/gpu/gpuInfo.py +0 -0
  22. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/gpu/linux.py +0 -0
  23. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/gpu/macos.py +0 -0
  24. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/host/__init__.py +0 -0
  25. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/host/hostBase.py +0 -0
  26. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/host/hostInfo.py +0 -0
  27. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/host/linux.py +0 -0
  28. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/host/macos.py +0 -0
  29. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/host/windows.py +0 -0
  30. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/kernel/__init__.py +0 -0
  31. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/kernel/kernelBase.py +0 -0
  32. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/kernel/kernelInfo.py +0 -0
  33. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/kernel/unix.py +0 -0
  34. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/kernel/windows.py +0 -0
  35. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/memory/__init__.py +0 -0
  36. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/memory/linux.py +0 -0
  37. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/memory/macos.py +0 -0
  38. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/memory/memoryBase.py +0 -0
  39. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/memory/memoryInfo.py +0 -0
  40. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/metal/t.py +0 -0
  41. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/nic/__init__.py +0 -0
  42. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/nic/linux.py +0 -0
  43. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/nic/macos.py +0 -0
  44. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/nic/nicBase.py +0 -0
  45. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/nic/nicInfo.py +0 -0
  46. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/npu/__init__.py +0 -0
  47. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/npu/linux.py +0 -0
  48. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/npu/macos.py +0 -0
  49. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/npu/npuBase.py +0 -0
  50. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/npu/npuInfo.py +0 -0
  51. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/os/__init__.py +0 -0
  52. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/os/linux.py +0 -0
  53. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/os/macos.py +0 -0
  54. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/os/osBase.py +0 -0
  55. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/os/osInfo.py +0 -0
  56. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/shell/__init__.py +0 -0
  57. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/shell/shellBase.py +0 -0
  58. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/shell/unix.py +0 -0
  59. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/title/__init__.py +0 -0
  60. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/title/titleBase.py +0 -0
  61. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/title/unix.py +0 -0
  62. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/title/windows.py +0 -0
  63. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/uptime/__init__.py +0 -0
  64. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/uptime/linux.py +0 -0
  65. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/uptime/macos.py +0 -0
  66. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/uptime/uptimeBase.py +0 -0
  67. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/backend/uptime/uptimeInfo.py +0 -0
  68. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/__init__.py +0 -0
  69. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/color/__init__.py +0 -0
  70. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/color/colorConfig.py +0 -0
  71. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/color/colorSet.py +0 -0
  72. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/color/colorUtil.py +0 -0
  73. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/__init__.py +0 -0
  74. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/alpine.pyhw +0 -0
  75. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/arch.pyhw +0 -0
  76. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/armbian.pyhw +0 -0
  77. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/centos.pyhw +0 -0
  78. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/debian.pyhw +0 -0
  79. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/fedora.pyhw +0 -0
  80. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/fedora_small.pyhw +0 -0
  81. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/linux.pyhw +0 -0
  82. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/macOS.pyhw +0 -0
  83. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/raspbian.pyhw +0 -0
  84. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/ubuntu.pyhw +0 -0
  85. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/ascii/ubuntu_small.pyhw +0 -0
  86. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/frontend/logo/logoBase.py +0 -0
  87. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/library/lib/iokitGPULib.dylib +0 -0
  88. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/macos.py +0 -0
  89. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/pyhwException/__init__.py +0 -0
  90. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/pyhwException/pyhwException.py +0 -0
  91. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/pyhwUtil/__init__.py +0 -0
  92. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw/pyhwUtil/sysctlUtil.py +0 -0
  93. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw.egg-info/SOURCES.txt +0 -0
  94. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw.egg-info/dependency_links.txt +0 -0
  95. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw.egg-info/entry_points.txt +0 -0
  96. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw.egg-info/requires.txt +0 -0
  97. {pyhw-0.6.5 → pyhw-0.6.6}/src/pyhw.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyhw
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: PyHw, a neofetch-like command line tool for fetching system information but written mostly in python.
5
5
  Author-email: Xiao Ran <xiaoran.007@icloud.com>
6
6
  License: BSD-3-Clause
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyhw"
7
- version = "0.6.5"
7
+ version = "0.6.6"
8
8
  description = "PyHw, a neofetch-like command line tool for fetching system information but written mostly in python."
9
9
  keywords = ["neofetch", "system information", "command line tool", "python", "hardware information", "fastfetch", "fetching"]
10
10
  authors = [
@@ -1,5 +1,7 @@
1
1
  from .logo import Logo
2
2
  from .color import ColorConfigSet, colorPrefix, colorSuffix, ColorSet
3
+ from ..pyhwUtil import getOS
4
+ import os
3
5
  import re
4
6
 
5
7
 
@@ -16,6 +18,7 @@ class Printer:
16
18
  self.__combined_lines = []
17
19
  self.__logo_color_indexes = {}
18
20
  self.__reg = r'\$(\d)'
21
+ self.__columns = self.__getColumns()
19
22
 
20
23
  def cPrint(self):
21
24
  self.__LogoPreprocess()
@@ -31,8 +34,37 @@ class Printer:
31
34
  for data_line in self.__processed_data_lines[len(self.__processed_logo_lines):]:
32
35
  self.__combined_lines.append(" " * (max_len_logo + 1) + data_line)
33
36
 
37
+ self.__dropLongString()
38
+
34
39
  print("\n".join(self.__combined_lines))
35
40
 
41
+ def __dropLongString(self):
42
+ # Need more accurate way to drop long strings
43
+ if getOS() == "linux":
44
+ fixed_lines = list()
45
+ for line in self.__combined_lines:
46
+ if len(line) > self.__columns+20:
47
+ fixed_lines.append(line[:self.__columns+20])
48
+ else:
49
+ fixed_lines.append(line)
50
+ self.__combined_lines = fixed_lines
51
+ else:
52
+ pass
53
+
54
+
55
+ @staticmethod
56
+ def __getColumns() -> int:
57
+ if getOS() == "linux":
58
+ try:
59
+ _, columns_str = os.popen('stty size', 'r').read().split()
60
+ columns = int(columns_str)
61
+ except:
62
+ columns = 80 # default terminal size is 80 columns
63
+ else:
64
+ # macOS default terminal size is 80 columns
65
+ columns = 80
66
+ return columns
67
+
36
68
  def __LogoPreprocess(self):
37
69
  global_color = self.__config.get("colors")[0]
38
70
  for logo_line in self.__logo_lines:
@@ -0,0 +1,189 @@
1
+ import platform
2
+ from ..backend import Data
3
+ import os
4
+ from dataclasses import dataclass
5
+
6
+
7
+ def getOS():
8
+ """
9
+ Get the os type in lower case.
10
+ :return: str, os type, value in [windows, linux, macos, unknown].
11
+ """
12
+ system = platform.system()
13
+ if system == "Windows":
14
+ return "windows"
15
+ elif system == "Linux":
16
+ return "linux"
17
+ elif system == "Darwin":
18
+ return "macos"
19
+ else:
20
+ return "unknown"
21
+
22
+
23
+ def getArch():
24
+ """
25
+ Get the machine architecture.
26
+ :return: str, value in [x86_64, x86, aarch64, arm32].
27
+ """
28
+ arch = platform.machine()
29
+ if arch == "x86_64" or arch == "AMD64" or arch == "amd64":
30
+ return "x86_64"
31
+ elif arch == "i386" or arch == "i686" or arch == "x86":
32
+ return "x86"
33
+ elif arch == "aarch64" or arch == "arm64":
34
+ return "aarch64"
35
+ elif arch.find("arm") != -1:
36
+ return "arm32"
37
+ else:
38
+ return "unknown"
39
+
40
+
41
+ class DataStringProcessor:
42
+ def __init__(self, data: Data):
43
+ self.data = data
44
+ self.columns = self.__getENV()
45
+
46
+ @staticmethod
47
+ def __getENV() -> int:
48
+ if getOS() == "linux":
49
+ _, columns_str = os.popen('stty size', 'r').read().split()
50
+ columns = int(columns_str)
51
+ else:
52
+ # macOS default terminal size is 80 columns
53
+ columns = 80
54
+ return columns
55
+
56
+ def __dropLongString(self, string: str) -> str:
57
+ """
58
+ Drop the string if it's too long to fit in the terminal.
59
+ :param string: str, the input string.
60
+ :return: str, the shortened string, do not include newline char.
61
+ """
62
+ if len(string) >= self.columns:
63
+ return f"{string[:self.columns-1]}"
64
+ else:
65
+ return f"{string}"
66
+
67
+ def getTitle(self) -> str:
68
+ return f" {self.data.title}\n"
69
+
70
+ def getLine(self) -> str:
71
+ return f" {'-'*len(self.data.title)}\n"
72
+
73
+ def getOS(self) -> str:
74
+ os_str = f" OS: {self.data.OS}"
75
+ return f"{self.__dropLongString(os_str)}\n"
76
+
77
+ def getHost(self) -> str:
78
+ host_str = f" Host: {self.data.Host}"
79
+ return f"{self.__dropLongString(host_str)}\n"
80
+
81
+ def getKernel(self) -> str:
82
+ kernel_str = f" Kernel: {self.data.Kernel}"
83
+ return f"{self.__dropLongString(kernel_str)}\n"
84
+
85
+ def getUptime(self) -> str:
86
+ uptime_str = f" Uptime: {self.data.Uptime}"
87
+ return f"{self.__dropLongString(uptime_str)}\n"
88
+
89
+ def getShell(self) -> str:
90
+ shell_str = f" Shell: {self.data.Shell}"
91
+ return f"{self.__dropLongString(shell_str)}\n"
92
+
93
+ def getCPU(self) -> str:
94
+ cpu_str = f" CPU: {self.data.CPU}"
95
+ return f"{self.__dropLongString(cpu_str)}\n"
96
+
97
+ def getGPU(self) -> str:
98
+ ret_str = ""
99
+ for gpu in self.data.GPU:
100
+ gpu_str = f" GPU: {gpu}"
101
+ ret_str += f"{self.__dropLongString(gpu_str)}\n"
102
+ return ret_str
103
+
104
+ def getMemory(self) -> str:
105
+ memory_str = f" Memory: {self.data.Memory}"
106
+ return f"{self.__dropLongString(memory_str)}\n"
107
+
108
+ def getNIC(self) -> str:
109
+ ret_str = ""
110
+ for nic in self.data.NIC:
111
+ nic_str = f" NIC: {nic}"
112
+ ret_str += f"{self.__dropLongString(nic_str)}\n"
113
+ return ret_str
114
+
115
+ def getNPU(self) -> str:
116
+ ret_str = ""
117
+ for npu in self.data.NPU:
118
+ npu_str = f" NPU: {npu}"
119
+ ret_str += f"{self.__dropLongString(npu_str)}\n"
120
+ return ret_str
121
+
122
+
123
+ def createDataString(data: Data):
124
+ data_string_processor = DataStringProcessor(data)
125
+ data_string = ""
126
+ data_string += data_string_processor.getTitle()
127
+ data_string += data_string_processor.getLine()
128
+ data_string += data_string_processor.getOS()
129
+ data_string += data_string_processor.getHost()
130
+ data_string += data_string_processor.getKernel()
131
+ data_string += data_string_processor.getUptime()
132
+ data_string += data_string_processor.getShell()
133
+ data_string += data_string_processor.getCPU()
134
+ data_string += data_string_processor.getGPU()
135
+ data_string += data_string_processor.getMemory()
136
+ data_string += data_string_processor.getNIC()
137
+ data_string += data_string_processor.getNPU()
138
+ return data_string
139
+
140
+
141
+ def createDataStringOld(data: Data):
142
+ data_string = ""
143
+ data_string += f" {data.title}\n"
144
+ data_string += f" {'-'*len(data.title)}\n"
145
+ data_string += f" OS: {data.OS}\n"
146
+ data_string += f" Host: {data.Host}\n"
147
+ data_string += f" Kernel: {data.Kernel}\n"
148
+ data_string += f" Uptime: {data.Uptime}\n"
149
+ data_string += f" Shell: {data.Shell}\n"
150
+ data_string += f" CPU: {data.CPU}\n"
151
+ for gpu in data.GPU:
152
+ data_string += f" GPU: {gpu}\n"
153
+ data_string += f" Memory: {data.Memory}\n"
154
+ for nic in data.NIC:
155
+ data_string += f" NIC: {nic}\n"
156
+ for npu in data.NPU:
157
+ data_string += f" NPU: {npu}\n"
158
+ return data_string
159
+
160
+
161
+ @dataclass
162
+ class SupportedOS:
163
+ ColorConfig = ["armbian", "arch", "alpine", "centos", "debian", "fedora", "macOS", "raspbian", "ubuntu"]
164
+ AsciiLogo = ["armbian", "arch", "alpine", "centos", "debian", "fedora", "macOS", "raspbian", "ubuntu"]
165
+
166
+
167
+ def selectOSLogo(os_id: str):
168
+ """
169
+ Select the logo based on the os id and terminal size.
170
+ :param os_id: str, os id.
171
+ :return: str, logo id.
172
+ """
173
+ if getOS() == "macos":
174
+ return os_id
175
+ if os_id in SupportedOS.ColorConfig and os_id in SupportedOS.AsciiLogo:
176
+ pass
177
+ else:
178
+ return "linux"
179
+ rows_str, columns_str = os.popen('stty size', 'r').read().split()
180
+ rows = int(rows_str)
181
+ columns = int(columns_str)
182
+ if columns <= 80:
183
+ if os_id in ["fedora", "ubuntu"]:
184
+ return f"{os_id}_small"
185
+ else:
186
+ return os_id
187
+ else:
188
+ return os_id
189
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyhw
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: PyHw, a neofetch-like command line tool for fetching system information but written mostly in python.
5
5
  Author-email: Xiao Ran <xiaoran.007@icloud.com>
6
6
  License: BSD-3-Clause
@@ -1,89 +0,0 @@
1
- import platform
2
- from ..backend import Data
3
- import os
4
- from dataclasses import dataclass
5
-
6
-
7
- def getOS():
8
- """
9
- Get the os type in lower case.
10
- :return: str, os type, value in [windows, linux, macos, unknown].
11
- """
12
- system = platform.system()
13
- if system == "Windows":
14
- return "windows"
15
- elif system == "Linux":
16
- return "linux"
17
- elif system == "Darwin":
18
- return "macos"
19
- else:
20
- return "unknown"
21
-
22
-
23
- def getArch():
24
- """
25
- Get the machine architecture.
26
- :return: str, value in [x86_64, x86, aarch64, arm32].
27
- """
28
- arch = platform.machine()
29
- if arch == "x86_64" or arch == "AMD64" or arch == "amd64":
30
- return "x86_64"
31
- elif arch == "i386" or arch == "i686" or arch == "x86":
32
- return "x86"
33
- elif arch == "aarch64" or arch == "arm64":
34
- return "aarch64"
35
- elif arch.find("arm") != -1:
36
- return "arm32"
37
- else:
38
- return "unknown"
39
-
40
-
41
- def createDataString(data: Data):
42
- data_string = ""
43
- data_string += f" {data.title}\n"
44
- data_string += f" {'-'*len(data.title)}\n"
45
- data_string += f" OS: {data.OS}\n"
46
- data_string += f" Host: {data.Host}\n"
47
- data_string += f" Kernel: {data.Kernel}\n"
48
- data_string += f" Uptime: {data.Uptime}\n"
49
- data_string += f" Shell: {data.Shell}\n"
50
- data_string += f" CPU: {data.CPU}\n"
51
- for gpu in data.GPU:
52
- data_string += f" GPU: {gpu}\n"
53
- data_string += f" Memory: {data.Memory}\n"
54
- for nic in data.NIC:
55
- data_string += f" NIC: {nic}\n"
56
- for npu in data.NPU:
57
- data_string += f" NPU: {npu}\n"
58
- return data_string
59
-
60
-
61
- @dataclass
62
- class SupportedOS:
63
- ColorConfig = ["armbian", "arch", "alpine", "centos", "debian", "fedora", "macOS", "raspbian", "ubuntu"]
64
- AsciiLogo = ["armbian", "arch", "alpine", "centos", "debian", "fedora", "macOS", "raspbian", "ubuntu"]
65
-
66
-
67
- def selectOSLogo(os_id: str):
68
- """
69
- Select the logo based on the os id and terminal size.
70
- :param os_id: str, os id.
71
- :return: str, logo id.
72
- """
73
- if getOS() == "macos":
74
- return os_id
75
- if os_id in SupportedOS.ColorConfig and os_id in SupportedOS.AsciiLogo:
76
- pass
77
- else:
78
- return "linux"
79
- rows_str, columns_str = os.popen('stty size', 'r').read().split()
80
- rows = int(rows_str)
81
- columns = int(columns_str)
82
- if columns <= 80:
83
- if os_id in ["fedora", "ubuntu"]:
84
- return f"{os_id}_small"
85
- else:
86
- return os_id
87
- else:
88
- return os_id
89
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes