mirror of https://github.com/scrapy/scrapy.git
added __slots__ to XPathSelector and Libxml2Document classes
This commit is contained in:
parent
64ffe6b2d3
commit
00527fc93c
|
|
@ -10,6 +10,7 @@ from scrapy.xpath.factories import xmlDoc_from_html
|
|||
class Libxml2Document(object):
|
||||
|
||||
cache = weakref.WeakKeyDictionary()
|
||||
__slots__ = ['xmlDoc', 'xpathContext']
|
||||
|
||||
def __new__(cls, response, factory=xmlDoc_from_html):
|
||||
cache = cls.cache.setdefault(response, {})
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ from scrapy.utils.decorator import deprecated
|
|||
|
||||
class XPathSelector(object_ref):
|
||||
|
||||
__slots__ = ['doc', 'xmlNode', 'response', 'expr']
|
||||
|
||||
def __init__(self, response=None, text=None, node=None, parent=None, expr=None):
|
||||
if parent:
|
||||
self.doc = parent.doc
|
||||
|
|
|
|||
Loading…
Reference in New Issue