mirror of
https://github.com/SickGear/SickGear.git
synced 2024-11-15 01:15:05 +00:00
Update profilehooks module 1.12.0 (3ee1f60) → 1.12.1 (c3fc078).
This commit is contained in:
parent
13ca837535
commit
fc23db13ac
2 changed files with 41 additions and 31 deletions
|
@ -8,6 +8,7 @@
|
||||||
* Update certifi 2022.09.24 to 2022.12.07
|
* Update certifi 2022.09.24 to 2022.12.07
|
||||||
* Update diskcache 5.1.0 (40ce0de) to 5.4.0 (1cb1425)
|
* Update diskcache 5.1.0 (40ce0de) to 5.4.0 (1cb1425)
|
||||||
* Update humanize 3.5.0 (b6b0ea5) to 4.0.0 (a1514eb)
|
* Update humanize 3.5.0 (b6b0ea5) to 4.0.0 (a1514eb)
|
||||||
|
* Update profilehooks module 1.12.0 (3ee1f60) to 1.12.1 (c3fc078)
|
||||||
* Update Rarfile 4.0 (55fe778) to 4.1a1 (8a72967)
|
* Update Rarfile 4.0 (55fe778) to 4.1a1 (8a72967)
|
||||||
* Update UnRar x64 for Windows 6.11 to 6.20
|
* Update UnRar x64 for Windows 6.11 to 6.20
|
||||||
* Update Send2Trash 1.5.0 (66afce7) to 1.8.1b0 (0ef9b32)
|
* Update Send2Trash 1.5.0 (66afce7) to 1.8.1b0 (0ef9b32)
|
||||||
|
|
|
@ -88,43 +88,32 @@ Released under the MIT licence since December 2006:
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
__author__ = "Marius Gedminas <marius@gedmin.as>"
|
|
||||||
__copyright__ = "Copyright 2004-2020 Marius Gedminas and contributors"
|
|
||||||
__license__ = "MIT"
|
|
||||||
__version__ = '1.12.0'
|
|
||||||
__date__ = "2020-08-20"
|
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
|
import dis
|
||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import pstats
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# For profiling
|
|
||||||
from profile import Profile
|
|
||||||
import pstats
|
|
||||||
|
|
||||||
# For timecall
|
|
||||||
import timeit
|
import timeit
|
||||||
|
import token
|
||||||
|
import tokenize
|
||||||
|
import trace
|
||||||
|
from profile import Profile
|
||||||
|
|
||||||
|
|
||||||
# For hotshot profiling (inaccurate!)
|
# For hotshot profiling (inaccurate!)
|
||||||
try:
|
try: # pragma: PY2
|
||||||
import hotshot
|
import hotshot
|
||||||
import hotshot.stats
|
import hotshot.stats
|
||||||
except ImportError:
|
except ImportError:
|
||||||
hotshot = None
|
hotshot = None
|
||||||
|
|
||||||
# For trace.py coverage
|
|
||||||
import trace
|
|
||||||
import dis
|
|
||||||
import token
|
|
||||||
import tokenize
|
|
||||||
|
|
||||||
# For hotshot coverage (inaccurate!; uses undocumented APIs; might break)
|
# For hotshot coverage (inaccurate!; uses undocumented APIs; might break)
|
||||||
if hotshot is not None:
|
if hotshot is not None: # pragma: PY2
|
||||||
import _hotshot
|
import _hotshot
|
||||||
import hotshot.log
|
import hotshot.log
|
||||||
|
|
||||||
|
@ -134,6 +123,14 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
cProfile = None
|
cProfile = None
|
||||||
|
|
||||||
|
|
||||||
|
__author__ = "Marius Gedminas <marius@gedmin.as>"
|
||||||
|
__copyright__ = "Copyright 2004-2020 Marius Gedminas and contributors"
|
||||||
|
__license__ = "MIT"
|
||||||
|
__version__ = '1.12.1.dev0'
|
||||||
|
__date__ = "2020-08-20"
|
||||||
|
|
||||||
|
|
||||||
# registry of available profilers
|
# registry of available profilers
|
||||||
AVAILABLE_PROFILERS = {}
|
AVAILABLE_PROFILERS = {}
|
||||||
|
|
||||||
|
@ -144,12 +141,18 @@ __all__ = ['coverage', 'coverage_with_hotshot', 'profile', 'timecall']
|
||||||
tokenize_open = getattr(tokenize, 'open', open)
|
tokenize_open = getattr(tokenize, 'open', open)
|
||||||
|
|
||||||
|
|
||||||
def _unwrap(fn):
|
try:
|
||||||
|
from inspect import unwrap as _unwrap
|
||||||
|
except ImportError: # pragma: PY2
|
||||||
# inspect.unwrap() doesn't exist on Python 2
|
# inspect.unwrap() doesn't exist on Python 2
|
||||||
|
def _unwrap(fn):
|
||||||
if not hasattr(fn, '__wrapped__'):
|
if not hasattr(fn, '__wrapped__'):
|
||||||
return fn
|
return fn
|
||||||
else:
|
else: # pragma: nocover
|
||||||
# intentionally using recursion here instead of a while loop to
|
# functools.wraps() doesn't set __wrapped__ on Python 2 either,
|
||||||
|
# so this branch will only get reached if somebody
|
||||||
|
# manually sets __wrapped__, hence the pragma: nocover.
|
||||||
|
# NB: intentionally using recursion here instead of a while loop to
|
||||||
# make cycles fail with a recursion error instead of looping forever.
|
# make cycles fail with a recursion error instead of looping forever.
|
||||||
return _unwrap(fn.__wrapped__)
|
return _unwrap(fn.__wrapped__)
|
||||||
|
|
||||||
|
@ -289,7 +292,7 @@ def coverage(fn):
|
||||||
return new_fn
|
return new_fn
|
||||||
|
|
||||||
|
|
||||||
def coverage_with_hotshot(fn):
|
def coverage_with_hotshot(fn): # pragma: PY2
|
||||||
"""Mark `fn` for line coverage analysis.
|
"""Mark `fn` for line coverage analysis.
|
||||||
|
|
||||||
Uses the 'hotshot' module for fast coverage analysis.
|
Uses the 'hotshot' module for fast coverage analysis.
|
||||||
|
@ -424,7 +427,7 @@ if cProfile is not None:
|
||||||
AVAILABLE_PROFILERS['cProfile'] = CProfileFuncProfile
|
AVAILABLE_PROFILERS['cProfile'] = CProfileFuncProfile
|
||||||
|
|
||||||
|
|
||||||
if hotshot is not None:
|
if hotshot is not None: # pragma: PY2
|
||||||
|
|
||||||
class HotShotFuncProfile(FuncProfile):
|
class HotShotFuncProfile(FuncProfile):
|
||||||
"""Profiler for a function (uses hotshot)."""
|
"""Profiler for a function (uses hotshot)."""
|
||||||
|
@ -646,13 +649,19 @@ class FuncSource:
|
||||||
|
|
||||||
def find_source_lines(self):
|
def find_source_lines(self):
|
||||||
"""Mark all executable source lines in fn as executed 0 times."""
|
"""Mark all executable source lines in fn as executed 0 times."""
|
||||||
if self.filename is None:
|
if self.filename is None: # pragma: nocover
|
||||||
|
# I don't know how to make inspect.getsourcefile() return None in
|
||||||
|
# our test suite, but I've looked at its source and I know that it
|
||||||
|
# can do so.
|
||||||
return
|
return
|
||||||
strs = self._find_docstrings(self.filename)
|
strs = self._find_docstrings(self.filename)
|
||||||
lines = {
|
lines = {
|
||||||
ln
|
ln
|
||||||
for off, ln in dis.findlinestarts(_unwrap(self.fn).__code__)
|
for off, ln in dis.findlinestarts(_unwrap(self.fn).__code__)
|
||||||
if ln not in strs
|
# skipping firstlineno because Python 3.11 adds a 'RESUME' opcode
|
||||||
|
# attributed to the `def` line, but then trace.py never sees it
|
||||||
|
# getting executed
|
||||||
|
if ln not in strs and ln != self.firstlineno
|
||||||
}
|
}
|
||||||
for lineno in lines:
|
for lineno in lines:
|
||||||
self.sourcelines.setdefault(lineno, 0)
|
self.sourcelines.setdefault(lineno, 0)
|
||||||
|
|
Loading…
Reference in a new issue