From be96abc86d5f45a3ff91e6567594736176b08c27 Mon Sep 17 00:00:00 2001 From: Falcon Darkstar Momot Date: Mon, 15 May 2017 04:18:38 +0000 Subject: [PATCH] Fix crash introduced by removal of FrozenDict in 561380774baf5fd44990d16d64f545259c7385a1, but without constantly reallocating dicts --- wpull/scraper/html.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wpull/scraper/html.py b/wpull/scraper/html.py index a1672515..7c2921e8 100644 --- a/wpull/scraper/html.py +++ b/wpull/scraper/html.py @@ -20,7 +20,7 @@ _logger = StyleAdapter(logging.getLogger(__name__)) -LinkInfo = collections.namedtuple( +_BaseLinkInfo = collections.namedtuple( 'LinkInfoType', [ 'element', 'tag', 'attrib', 'link', @@ -28,7 +28,15 @@ 'link_type' ] ) -'''Information about a link in a lxml document. + +class LinkInfo(_BaseLinkInfo): + def __hash__(self): + return self.link.__hash__() + + def __eq__(self, other): + return self.link.__eq__(other['link']) + +'''Information about a link in a lxml document. Comparable on link only. Attributes: element: An instance of :class:`.document.HTMLReadElement`.