From 6ee9f63d7a0b4cbec55e58f02462cdd08f9884e0 Mon Sep 17 00:00:00 2001 From: joncrall Date: Fri, 9 Dec 2022 09:20:56 -0500 Subject: [PATCH] Bump version and fix minor linter errors --- CHANGELOG.rst | 5 +++++ kernprof.py | 14 +++++++------- line_profiler/line_profiler.py | 4 +++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1454b704..6a164b62 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,10 @@ Changes ======= + +4.0.2 +~~~~~ +* FIX: AttributeError on certain methods. #191 + 4.0.1 ~~~~~ * FIX: Profiling classmethods works again. #183 diff --git a/kernprof.py b/kernprof.py index 62e939a7..b3a7d619 100755 --- a/kernprof.py +++ b/kernprof.py @@ -6,14 +6,14 @@ import os import sys import threading -import asyncio -import concurrent.futures +import asyncio # NOQA +import concurrent.futures # NOQA import time from argparse import ArgumentError, ArgumentParser # NOTE: This version needs to be manually maintained with the line_profiler # __version__ for now. -__version__ = '4.0.1' +__version__ = '4.0.2' # Guard the import of cProfile such that 3.x people # without lsprof can still use this script. @@ -132,7 +132,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): class RepeatedTimer(object): """ Background timer for outputting file every n seconds. - + Adapted from https://stackoverflow.com/questions/474528/what-is-the-best-way-to-repeatedly-execute-a-function-every-x-seconds/40965385#40965385 """ @@ -161,6 +161,7 @@ def stop(self): self._timer.cancel() self.is_running = False + def find_script(script_name): """ Find the script. @@ -209,8 +210,8 @@ def positive_float(value): parser.add_argument('-z', '--skip-zero', action='store_true', help="Hide functions which have not been called") parser.add_argument('-i', '--output-interval', type=int, default=0, const=0, nargs='?', - help="Enables outputting of cumulative profiling results to file every n seconds. Uses the threading module." - "Minimum value is 1 (second). Defaults to disabled.") + help="Enables outputting of cumulative profiling results to file every n seconds. Uses the threading module." + "Minimum value is 1 (second). Defaults to disabled.") parser.add_argument('script', help='The python script file to run') parser.add_argument('args', nargs='...', help='Optional script arguments') @@ -250,7 +251,6 @@ def positive_float(value): # kernprof.py's. sys.path.insert(0, os.path.dirname(script_file)) - if options.output_interval: rt = RepeatedTimer(max(options.output_interval, 1), prof.dump_stats, options.outfile) original_stdout = sys.stdout diff --git a/line_profiler/line_profiler.py b/line_profiler/line_profiler.py index 10369a1f..e9cf56ad 100755 --- a/line_profiler/line_profiler.py +++ b/line_profiler/line_profiler.py @@ -16,7 +16,7 @@ f'Has it been compiled? Underlying error is ex={ex!r}' ) -__version__ = '4.0.1' +__version__ = '4.0.2' def load_ipython_extension(ip): @@ -39,9 +39,11 @@ def is_generator(f): isgen = (f.__code__.co_flags & CO_GENERATOR) != 0 return isgen + def is_classmethod(f): return isinstance(f, classmethod) + class LineProfiler(CLineProfiler): """ A profiler that records the execution times of individual lines. """