|
6 | 6 | import os
|
7 | 7 | import sys
|
8 | 8 | import threading
|
9 |
| -import asyncio |
10 |
| -import concurrent.futures |
| 9 | +import asyncio # NOQA |
| 10 | +import concurrent.futures # NOQA |
11 | 11 | import time
|
12 | 12 | from argparse import ArgumentError, ArgumentParser
|
13 | 13 |
|
14 | 14 | # NOTE: This version needs to be manually maintained with the line_profiler
|
15 | 15 | # __version__ for now.
|
16 |
| -__version__ = '4.0.1' |
| 16 | +__version__ = '4.0.2' |
17 | 17 |
|
18 | 18 | # Guard the import of cProfile such that 3.x people
|
19 | 19 | # without lsprof can still use this script.
|
@@ -132,7 +132,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
|
132 | 132 | class RepeatedTimer(object):
|
133 | 133 | """
|
134 | 134 | Background timer for outputting file every n seconds.
|
135 |
| - |
| 135 | +
|
136 | 136 | Adapted from
|
137 | 137 | https://stackoverflow.com/questions/474528/what-is-the-best-way-to-repeatedly-execute-a-function-every-x-seconds/40965385#40965385
|
138 | 138 | """
|
@@ -161,6 +161,7 @@ def stop(self):
|
161 | 161 | self._timer.cancel()
|
162 | 162 | self.is_running = False
|
163 | 163 |
|
| 164 | + |
164 | 165 | def find_script(script_name):
|
165 | 166 | """ Find the script.
|
166 | 167 |
|
@@ -209,8 +210,8 @@ def positive_float(value):
|
209 | 210 | parser.add_argument('-z', '--skip-zero', action='store_true',
|
210 | 211 | help="Hide functions which have not been called")
|
211 | 212 | parser.add_argument('-i', '--output-interval', type=int, default=0, const=0, nargs='?',
|
212 |
| - help="Enables outputting of cumulative profiling results to file every n seconds. Uses the threading module." |
213 |
| - "Minimum value is 1 (second). Defaults to disabled.") |
| 213 | + help="Enables outputting of cumulative profiling results to file every n seconds. Uses the threading module." |
| 214 | + "Minimum value is 1 (second). Defaults to disabled.") |
214 | 215 |
|
215 | 216 | parser.add_argument('script', help='The python script file to run')
|
216 | 217 | parser.add_argument('args', nargs='...', help='Optional script arguments')
|
@@ -250,7 +251,6 @@ def positive_float(value):
|
250 | 251 | # kernprof.py's.
|
251 | 252 | sys.path.insert(0, os.path.dirname(script_file))
|
252 | 253 |
|
253 |
| - |
254 | 254 | if options.output_interval:
|
255 | 255 | rt = RepeatedTimer(max(options.output_interval, 1), prof.dump_stats, options.outfile)
|
256 | 256 | original_stdout = sys.stdout
|
|
0 commit comments