Commit 94bd7a1b authored by Swann Perarnau's avatar Swann Perarnau

[style] Fix pep8 issues, has notified by flake8

Small things like spacing and extra semicolon. It is also recommended to
use the 0o notation for octal, as a way to make them stand out in the
code.
parent 1498ec1b
......@@ -12,6 +12,7 @@ import uuid
logger = logging.getLogger('perf-wrapper')
class PerfWrapper(object):
"""Implements middleware between the Linux perf and
......@@ -89,7 +90,7 @@ class PerfWrapper(object):
tmpdir = tempfile.mkdtemp()
fifoname = os.path.join(tmpdir, 'perf-fifo')
logger.info("fifoname: %r", fifoname)
os.mkfifo(fifoname, 0600)
os.mkfifo(fifoname, 0o600)
argv = ['perf', 'stat', '-e', 'instructions', '-x', ',',
'-I', str(args.frequency), '-o', fifoname, '--']
......@@ -107,11 +108,11 @@ class PerfWrapper(object):
# "for line in fifo" idiom didn't work for me here -- Python was
# buffering the output internally until perf was finished.
while True:
line = fifo.readline();
line = fifo.readline()
if not line:
break
line = line.strip();
line = line.strip()
if len(line) == 0 or line[0] == '#':
continue
tokens = line.split(',')
......@@ -138,6 +139,7 @@ class PerfWrapper(object):
os.remove(fifoname)
os.rmdir(tmpdir)
if __name__ == "__main__":
logging.basicConfig(level=logging.WARNING)
wrapper = PerfWrapper()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment