From 7b97f221bf07ffa8c9c498f5ff12af47821561b5 Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Fri, 12 Feb 2016 12:25:34 -0800 Subject: [PATCH] f argument is file object; also renaming fin to f fin was the argument and was a filelike object, but it was pointless, now it is just a file object and called f; also shrinking the length of two logging lines --- tldp/doctypes/common.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tldp/doctypes/common.py b/tldp/doctypes/common.py index daba514..d020357 100644 --- a/tldp/doctypes/common.py +++ b/tldp/doctypes/common.py @@ -9,18 +9,18 @@ from ..utils import logger class SignatureChecker(object): @classmethod - def signatureLocation(cls, name, fin): - fin.seek(0) - buf = fin.read(1024) + def signatureLocation(cls, f): + f.seek(0) + buf = f.read(1024) for sig in cls.signatures: try: sindex = string.index(buf.lower(), sig.lower()) - logger.debug("In file %s, signature %s found at %s; doctype %s found", - name, sig, sindex, cls) + logger.debug("Found signature %s in %s at %s; doctype %s.", + sig, f.name, sindex, cls) return sindex except ValueError: - logger.debug("In file %s, signature %s not found for document type %s", - name, sig, cls.__name__) + logger.debug("Signature %s not found in %s for type %s", + sig, f.name, cls.__name__) return None #