From 88699026b6f94d6d7a831e849b01b8f3582d57a4 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Mon, 3 Jun 2013 09:32:03 -0400 Subject: Inlined some commonly called code to save a function call. --- bs4/dammit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bs4/dammit.py') diff --git a/bs4/dammit.py b/bs4/dammit.py index a6b8663..c859066 100644 --- a/bs4/dammit.py +++ b/bs4/dammit.py @@ -295,15 +295,15 @@ class EncodingDetector: beginning of the document. """ if search_entire_document: - xml_endpos = html_endpos = -1 + xml_endpos = html_endpos = len(markup) else: - xml_endpos = 1025 + xml_endpos = 1024 html_endpos = max(2048, int(len(markup) * 0.05)) declared_encoding = None - declared_encoding_match = xml_encoding_re.search(markup, xml_endpos) + declared_encoding_match = xml_encoding_re.search(markup, endpos=xml_endpos) if not declared_encoding_match and is_html: - declared_encoding_match = html_meta_re.search(markup, html_endpos) + declared_encoding_match = html_meta_re.search(markup, endpos=html_endpos) if declared_encoding_match is not None: declared_encoding = declared_encoding_match.groups()[0].decode( 'ascii') -- cgit v1.2.3