+ f = open('/proc/cpuinfo', 'r')
+ cpu_info = f.readlines()
+ f.close()
+ for line in cpu_info:
+ if line.startswith('model name') and 'QEMU' in line:
+ return (False, None)
The idiomatic way to do this in recent Python versions is:
with open('/proc/cpuinfo', 'r') as fd:
for line in fd:
if line.startswith('model name') and 'QEMU' in line: return (False, None)
Same for the other copy-n-pasted version of this function :-/
[1]
+ f = open('/ proc/cpuinfo' , 'r') ('model name') and 'QEMU' in line:
+ cpu_info = f.readlines()
+ f.close()
+ for line in cpu_info:
+ if line.startswith
+ return (False, None)
The idiomatic way to do this in recent Python versions is:
with open('/ proc/cpuinfo' , 'r') as fd: ('model name') and 'QEMU' in line:
return (False, None)
for line in fd:
if line.startswith
Same for the other copy-n-pasted version of this function :-/