mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Merge branch 'feature/UpdateProfileHooks' into develop
This commit is contained in:
commit
4eec1150e5
2 changed files with 21 additions and 18 deletions
|
@ -10,6 +10,7 @@
|
||||||
* Update IMDb 5.1 (r907) to 5.2.1dev20171113 (f640595)
|
* Update IMDb 5.1 (r907) to 5.2.1dev20171113 (f640595)
|
||||||
* Update jquery.form plugin 3.51.0 to 4.2.2
|
* Update jquery.form plugin 3.51.0 to 4.2.2
|
||||||
* Update moment.js 2.17.1 to 2.21.0
|
* Update moment.js 2.17.1 to 2.21.0
|
||||||
|
* Update profilehooks 1.9.0 (de7d59b) to 1.10.0 (0ce1e29)
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ instead of a detailed (but costly) profile.
|
||||||
Caveats
|
Caveats
|
||||||
|
|
||||||
A thread on python-dev convinced me that hotshot produces bogus numbers.
|
A thread on python-dev convinced me that hotshot produces bogus numbers.
|
||||||
See http://mail.python.org/pipermail/python-dev/2005-November/058264.html
|
See https://mail.python.org/pipermail/python-dev/2005-November/058264.html
|
||||||
|
|
||||||
I don't know what will happen if a decorated function will try to call
|
I don't know what will happen if a decorated function will try to call
|
||||||
another decorated function. All decorators probably need to explicitly
|
another decorated function. All decorators probably need to explicitly
|
||||||
|
@ -74,7 +74,7 @@ Caveats
|
||||||
executed. For this reason coverage analysis now uses trace.py which is
|
executed. For this reason coverage analysis now uses trace.py which is
|
||||||
slower, but more accurate.
|
slower, but more accurate.
|
||||||
|
|
||||||
Copyright (c) 2004--2016 Marius Gedminas <marius@pov.lt>
|
Copyright (c) 2004--2017 Marius Gedminas <marius@gedmin.as>
|
||||||
Copyright (c) 2007 Hanno Schlichting
|
Copyright (c) 2007 Hanno Schlichting
|
||||||
Copyright (c) 2008 Florian Schulze
|
Copyright (c) 2008 Florian Schulze
|
||||||
|
|
||||||
|
@ -104,8 +104,8 @@ Released under the MIT licence since December 2006:
|
||||||
__author__ = "Marius Gedminas <marius@gedmin.as>"
|
__author__ = "Marius Gedminas <marius@gedmin.as>"
|
||||||
__copyright__ = "Copyright 2004-2017 Marius Gedminas and contributors"
|
__copyright__ = "Copyright 2004-2017 Marius Gedminas and contributors"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__version__ = '1.9.0'
|
__version__ = '1.10.0'
|
||||||
__date__ = "2017-01-02"
|
__date__ = "2017-12-09"
|
||||||
|
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
|
@ -118,6 +118,9 @@ import sys
|
||||||
from profile import Profile
|
from profile import Profile
|
||||||
import pstats
|
import pstats
|
||||||
|
|
||||||
|
# For timecall
|
||||||
|
import timeit
|
||||||
|
|
||||||
# For hotshot profiling (inaccurate!)
|
# For hotshot profiling (inaccurate!)
|
||||||
try:
|
try:
|
||||||
import hotshot
|
import hotshot
|
||||||
|
@ -142,9 +145,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
cProfile = None
|
cProfile = None
|
||||||
|
|
||||||
# For timecall
|
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
# registry of available profilers
|
# registry of available profilers
|
||||||
AVAILABLE_PROFILERS = {}
|
AVAILABLE_PROFILERS = {}
|
||||||
|
@ -503,7 +503,7 @@ if hotshot is not None:
|
||||||
old_trace = sys.gettrace()
|
old_trace = sys.gettrace()
|
||||||
try:
|
try:
|
||||||
return self.profiler.runcall(self.fn, args, kw)
|
return self.profiler.runcall(self.fn, args, kw)
|
||||||
finally: # pragma: nocover
|
finally: # pragma: nocover
|
||||||
sys.settrace(old_trace)
|
sys.settrace(old_trace)
|
||||||
|
|
||||||
def atexit(self):
|
def atexit(self):
|
||||||
|
@ -528,10 +528,11 @@ if hotshot is not None:
|
||||||
if what == hotshot.log.LINE:
|
if what == hotshot.log.LINE:
|
||||||
fs.mark(lineno)
|
fs.mark(lineno)
|
||||||
if what == hotshot.log.ENTER:
|
if what == hotshot.log.ENTER:
|
||||||
# hotshot gives us the line number of the function definition
|
# hotshot gives us the line number of the function
|
||||||
# and never gives us a LINE event for the first statement in
|
# definition and never gives us a LINE event for the first
|
||||||
# a function, so if we didn't perform this mapping, the first
|
# statement in a function, so if we didn't perform this
|
||||||
# statement would be marked as never executed
|
# mapping, the first statement would be marked as never
|
||||||
|
# executed
|
||||||
if lineno == fs.firstlineno:
|
if lineno == fs.firstlineno:
|
||||||
lineno = fs.firstcodelineno
|
lineno = fs.firstcodelineno
|
||||||
fs.mark(lineno)
|
fs.mark(lineno)
|
||||||
|
@ -576,13 +577,13 @@ class TraceFuncCoverage:
|
||||||
def __call__(self, *args, **kw):
|
def __call__(self, *args, **kw):
|
||||||
"""Profile a singe call to the function."""
|
"""Profile a singe call to the function."""
|
||||||
self.ncalls += 1
|
self.ncalls += 1
|
||||||
if TraceFuncCoverage.tracing: # pragma: nocover
|
if TraceFuncCoverage.tracing: # pragma: nocover
|
||||||
return self.fn(*args, **kw)
|
return self.fn(*args, **kw)
|
||||||
old_trace = sys.gettrace()
|
old_trace = sys.gettrace()
|
||||||
try:
|
try:
|
||||||
TraceFuncCoverage.tracing = True
|
TraceFuncCoverage.tracing = True
|
||||||
return self.tracer.runfunc(self.fn, *args, **kw)
|
return self.tracer.runfunc(self.fn, *args, **kw)
|
||||||
finally: # pragma: nocover
|
finally: # pragma: nocover
|
||||||
sys.settrace(old_trace)
|
sys.settrace(old_trace)
|
||||||
TraceFuncCoverage.tracing = False
|
TraceFuncCoverage.tracing = False
|
||||||
|
|
||||||
|
@ -710,12 +711,12 @@ def timecall(fn=None, immediate=True, timer=None):
|
||||||
somefunc(2, 3)
|
somefunc(2, 3)
|
||||||
|
|
||||||
will print the time taken by somefunc on every call. If you want just
|
will print the time taken by somefunc on every call. If you want just
|
||||||
a summary at program termination, use
|
a summary at program termination, use ::
|
||||||
|
|
||||||
@timecall(immediate=False)
|
@timecall(immediate=False)
|
||||||
|
|
||||||
You can also choose a timing method other than the default ``time.time()``,
|
You can also choose a timing method other than the default
|
||||||
e.g.:
|
``timeit.default_timer()``, e.g.::
|
||||||
|
|
||||||
@timecall(timer=time.clock)
|
@timecall(timer=time.clock)
|
||||||
|
|
||||||
|
@ -726,7 +727,7 @@ def timecall(fn=None, immediate=True, timer=None):
|
||||||
return decorator
|
return decorator
|
||||||
# @timecall syntax -- we are a decorator.
|
# @timecall syntax -- we are a decorator.
|
||||||
if timer is None:
|
if timer is None:
|
||||||
timer = time.time
|
timer = timeit.default_timer
|
||||||
fp = FuncTimer(fn, immediate=immediate, timer=timer)
|
fp = FuncTimer(fn, immediate=immediate, timer=timer)
|
||||||
# We cannot return fp or fp.__call__ directly as that would break method
|
# We cannot return fp or fp.__call__ directly as that would break method
|
||||||
# definitions, instead we need to return a plain function.
|
# definitions, instead we need to return a plain function.
|
||||||
|
@ -783,6 +784,7 @@ class FuncTimer(object):
|
||||||
self.totaltime, self.totaltime / self.ncalls)
|
self.totaltime, self.totaltime / self.ncalls)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
local = dict((name, globals()[name]) for name in __all__)
|
local = dict((name, globals()[name]) for name in __all__)
|
||||||
|
|
Loading…
Reference in a new issue