Rename some variables to fix codding-style

This commit is contained in:
Dionisio E Alonso 2015-04-09 17:35:21 -03:00
parent a9269dd622
commit cf10b7d2b5
1 changed files with 11 additions and 9 deletions

View File

@ -27,8 +27,8 @@ class SystemInformation:
def __init__(self):
self.cpu = self._cpu().strip()
self.graphics = self._graphics()
self.totalRam, self.availableRam = self._ram()
self.hdFree = self._disk_c()
self.total_ram, self.available_ram = self._ram()
self.hdd_free = self._disk()
self.os = self._os_version()
def _cpu(self):
@ -95,7 +95,7 @@ class SystemInformation:
kernel32.GlobalMemoryStatus(ctypes.byref(mem_status))
return (mem_status.dwTotalPhys, mem_status.dwAvailPhys)
def _disk_c(self):
def _disk(self):
drives = [c + ':' for c in list(string.ascii_uppercase)]
freeuser = ctypes.c_int64()
total = ctypes.c_int64()
@ -128,17 +128,19 @@ class SystemInformation:
return '{} {} (build {})'.format(os, sp, build)
def save(self):
hdd = []
for part in self.hdFree:
hdd.append('{} {:.2f}GB free'.format(part[0], part[1]/(1024**3)))
hdstring = ', '.join(hdd)
# hdd_gb = [(drive, free/(1024**3)) for drive, free in self.hdd_free]
# part_strs = ['{} {:.2f}GB free'.format(*part) for part in hdd_gb]
part_strs = []
for p in self.hdd_free:
part_strs.append('{} {:.2f}GB free'.format(p[0], p[1]/(1024**3)))
hdd_string = ', '.join(part_strs)
with open('system_information.txt', 'w') as f:
f.write('System Information\n'
'==================\n\n')
f.write('CPU:\t{}\n'.format(self.cpu))
f.write('Video:\t{}\n'.format(self.graphics))
f.write('RAM:\t{:.2f}GB total\n'.format(self.totalRam/(1024**3)))
f.write('HDD:\t{}\n'.format(hdstring))
f.write('RAM:\t{:.2f}GB total\n'.format(self.total_ram/(1024**3)))
f.write('HDD:\t{}\n'.format(hdd_string))
f.write('OS:\t{}\n'.format(self.os))
if __name__ == '__main__':