[diffoscope] 01/05: Profile "recognizes" methods.
Chris Lamb
chris at chris-lamb.co.uk
Fri Dec 23 12:46:37 CET 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository diffoscope.
commit 08bc8f85a0cabbeb1dd90df9b59b48a412ca674c
Author: Chris Lamb <lamby at debian.org>
Date: Fri Dec 23 11:41:48 2016 +0000
Profile "recognizes" methods.
Signed-off-by: Chris Lamb <lamby at debian.org>
---
diffoscope/comparators/__init__.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/diffoscope/comparators/__init__.py b/diffoscope/comparators/__init__.py
index 63f43a8..4d7f9e0 100644
--- a/diffoscope/comparators/__init__.py
+++ b/diffoscope/comparators/__init__.py
@@ -164,11 +164,12 @@ def specialize(file):
if isinstance(file, cls):
logger.debug("%s is already specialized", file.name)
return file
- if cls.recognizes(file):
- logger.debug("Using %s for %s", cls.__name__, file.name)
- new_cls = type(cls.__name__, (cls, type(file)), {})
- file.__class__ = new_cls
- return file
+ with profile('recognizes', file):
+ if cls.recognizes(file):
+ logger.debug("Using %s for %s", cls.__name__, file.name)
+ new_cls = type(cls.__name__, (cls, type(file)), {})
+ file.__class__ = new_cls
+ return file
logger.debug('Unidentified file. Magic says: %s', file.magic_file_type)
return file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list