mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-02 17:33:37 +00:00
Merge branch 'feature/UpdateProfileHooks' into develop
This commit is contained in:
commit
f97459d6ce
2 changed files with 13 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
||||||
* Update Certifi 2018.01.18 (e225253) to 2018.08.24 (8be9f89)
|
* Update Certifi 2018.01.18 (e225253) to 2018.08.24 (8be9f89)
|
||||||
* Update dateutil module 2.7.2 (ff03c0f) to 2.7.2 (49690ee)
|
* Update dateutil module 2.7.2 (ff03c0f) to 2.7.2 (49690ee)
|
||||||
* Update feedparser 5.2.1 (5646f4c) to 5.2.1 (2b11c80)
|
* Update feedparser 5.2.1 (5646f4c) to 5.2.1 (2b11c80)
|
||||||
|
* Update profilehooks module 1.10.0 (0ce1e29) to 1.10.1 (fdbf19d)
|
||||||
|
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
|
|
|
@ -104,7 +104,7 @@ 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.10.0'
|
__version__ = '1.10.1.dev0'
|
||||||
__date__ = "2017-12-09"
|
__date__ = "2017-12-09"
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ class FuncProfile(object):
|
||||||
self.fn = fn
|
self.fn = fn
|
||||||
self.skip = skip
|
self.skip = skip
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.immediate = immediate
|
self._immediate = immediate
|
||||||
self.stdout = stdout
|
self.stdout = stdout
|
||||||
self.dirs = dirs
|
self.dirs = dirs
|
||||||
self.sort = sort or ('cumulative', 'time', 'calls')
|
self.sort = sort or ('cumulative', 'time', 'calls')
|
||||||
|
@ -327,7 +327,12 @@ class FuncProfile(object):
|
||||||
self.sort = (self.sort, )
|
self.sort = (self.sort, )
|
||||||
self.entries = entries
|
self.entries = entries
|
||||||
self.reset_stats()
|
self.reset_stats()
|
||||||
atexit.register(self.atexit)
|
if not self.immediate:
|
||||||
|
atexit.register(self.atexit)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def immediate(self):
|
||||||
|
return self._immediate
|
||||||
|
|
||||||
def __call__(self, *args, **kw):
|
def __call__(self, *args, **kw):
|
||||||
"""Profile a singe call to the function."""
|
"""Profile a singe call to the function."""
|
||||||
|
@ -387,9 +392,7 @@ class FuncProfile(object):
|
||||||
|
|
||||||
This function is registered as an atexit hook.
|
This function is registered as an atexit hook.
|
||||||
"""
|
"""
|
||||||
# XXX: uh, why even register this as an atexit hook if immediate is True?
|
self.print_stats()
|
||||||
if not self.immediate:
|
|
||||||
self.print_stats()
|
|
||||||
|
|
||||||
|
|
||||||
AVAILABLE_PROFILERS['profile'] = FuncProfile
|
AVAILABLE_PROFILERS['profile'] = FuncProfile
|
||||||
|
@ -650,7 +653,8 @@ class FuncSource:
|
||||||
strs = set()
|
strs = set()
|
||||||
prev = token.INDENT # so module docstring is detected as docstring
|
prev = token.INDENT # so module docstring is detected as docstring
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
for ttype, tstr, start, end, line in tokenize.generate_tokens(f.readline):
|
tokens = tokenize.generate_tokens(f.readline)
|
||||||
|
for ttype, tstr, start, end, line in tokens:
|
||||||
if ttype == token.STRING and prev == token.INDENT:
|
if ttype == token.STRING and prev == token.INDENT:
|
||||||
strs.update(range(start[0], end[0] + 1))
|
strs.update(range(start[0], end[0] + 1))
|
||||||
prev = ttype
|
prev = ttype
|
||||||
|
@ -757,8 +761,8 @@ class FuncTimer(object):
|
||||||
fn = self.fn
|
fn = self.fn
|
||||||
timer = self.timer
|
timer = self.timer
|
||||||
self.ncalls += 1
|
self.ncalls += 1
|
||||||
|
start = timer()
|
||||||
try:
|
try:
|
||||||
start = timer()
|
|
||||||
return fn(*args, **kw)
|
return fn(*args, **kw)
|
||||||
finally:
|
finally:
|
||||||
duration = timer() - start
|
duration = timer() - start
|
||||||
|
|
Loading…
Reference in a new issue