[PATCH 02 of 10 V2] statprof: fix flake8 warnings
Gregory Szorc
gregory.szorc at gmail.com
Wed Aug 17 16:03:40 UTC 2016
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1471227212 25200
# Sun Aug 14 19:13:32 2016 -0700
# Node ID 3f37aba5e38717c7373101e7c868d13f6d809574
# Parent d9790aec4f500ab47c550b033f84fc090e537fc3
statprof: fix flake8 warnings
My local flake8 hook informed me of these warnings in the upstream
code. Fix them.
diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -99,21 +99,20 @@ Because signals only get delivered to th
statprof only profiles the main thread. However because the time
reporting function uses per-process timers, the results can be
significantly off if other threads' work patterns are not similar to the
main thread's work patterns.
"""
# no-check-code
from __future__ import division
-import inspect, json, os, signal, tempfile, sys, getopt, threading, traceback
+import inspect, json, os, signal, tempfile, sys, getopt, threading
import time
from collections import defaultdict
from contextlib import contextmanager
-from subprocess import call
__all__ = ['start', 'stop', 'reset', 'display', 'profile']
skips = set(["util.py:check", "extensions.py:closure",
"color.py:colorcmd", "dispatch.py:checkargs",
"dispatch.py:<lambda>", "dispatch.py:_runcatch",
"dispatch.py:_dispatch", "dispatch.py:_runcommand",
"pager.py:pagecmd", "dispatch.py:run",
@@ -321,17 +320,17 @@ def save_data(path=None):
for sample in state.samples:
time = str(sample.time)
stack = sample.stack
sites = ['\1'.join([s.path, str(s.lineno), s.function])
for s in stack]
file.write(time + '\0' + '\0'.join(sites) + '\n')
file.close()
- except (IOError, OSError) as ex:
+ except (IOError, OSError):
# The home directory probably didn't exist, or wasn't writable. Oh well.
pass
def load_data(path=None):
path = path or (os.environ['HOME'] + '/statprof.data')
lines = open(path, 'r').read().splitlines()
state.accumulated_time = float(lines[0])
More information about the Mercurial-devel
mailing list