Scrapy, a fast high-level web crawling & scraping framework for Python.
renamed scrapy.utils.ref module to scrapy.utils.trackref, and improved docstring
Pablo Hoffman9c5dad3f89f6
diff --git a/scrapy/http/request/__init__.py b/scrapy/http/request/__init__.pyindex 201ceddac..bb4691a44 100644--- a/scrapy/http/request/__init__.py+++ b/scrapy/http/request/__init__.py@@ -11,7 +11,7 @@ from twisted.internet import deferfrom scrapy.http.headers import Headersfrom scrapy.utils.url import safe_url_string-from scrapy.utils.ref import object_ref+from scrapy.utils.trackref import object_refclass Request(object_ref):diff --git a/scrapy/http/response/__init__.py b/scrapy/http/response/__init__.pyindex 6eb78625b..8b23de88c 100644--- a/scrapy/http/response/__init__.py+++ b/scrapy/http/response/__init__.py@@ -8,7 +8,7 @@ See documentation in docs/ref/request-response.rstimport copyfrom scrapy.http.headers import Headers-from scrapy.utils.ref import object_ref+from scrapy.utils.trackref import object_refclass Response(object_ref):diff --git a/scrapy/item.py b/scrapy/item.pyindex ca56f27ea..64254a7d4 100644--- a/scrapy/item.py+++ b/scrapy/item.py@@ -1,4 +1,4 @@-from scrapy.utils.ref import object_ref+from scrapy.utils.trackref import object_refclass BaseItem(object_ref):"""Base class for all scraped items."""@@ -23,6 +23,7 @@ class ScrapedItem(BaseItem):Generate the following format so that items can be deserializedeasily: ClassName({'attrib': value, ...})"""- reprdict = dict(items for items in self.__dict__.iteritems() if not items[0].startswith('_'))+ reprdict = dict(items for items in self.__dict__.iteritems() \+ if not items[0].startswith('_'))return "%s(%s)" % (self.__class__.__name__, repr(reprdict))diff --git a/scrapy/management/telnet.py b/scrapy/management/telnet.pyindex 48f651482..4aa9e9f11 100644--- a/scrapy/management/telnet.py+++ b/scrapy/management/telnet.py@@ -15,7 +15,7 @@ from scrapy.core.manager import scrapymanagerfrom scrapy.core.engine import scrapyenginefrom scrapy.spider import spidersfrom scrapy.stats import stats-from scrapy.utils.ref import print_live_refs+from scrapy.utils.trackref import print_live_refsfrom scrapy.conf import settingstry:diff --git a/scrapy/utils/ref.py b/scrapy/utils/trackref.pysimilarity index 71%rename from scrapy/utils/ref.pyrename to scrapy/utils/trackref.pyindex 32b35b1d8..86dbc085b 100644--- a/scrapy/utils/ref.py+++ b/scrapy/utils/trackref.py@@ -1,5 +1,14 @@-"""This module provides some functions and classes to record and report live-references to object instances, for certain classes"""+"""This module provides some functions and classes to record and report+references to live object instances.++If you want live objects for a particular class to be tracked, you only have to+subclass form object_ref (instead of object). Also, remember to turn on+tracking by enabling the TRACK_REFS setting.++About performance: This library has a minimal performance impact when enabled,+and no performance penalty at all when disabled (as object_ref becomes just an+alias to object in that case).+"""import weakreffrom collections import defaultdictdiff --git a/scrapy/xpath/selector.py b/scrapy/xpath/selector.pyindex f7d579a12..4cdf55200 100644--- a/scrapy/xpath/selector.py+++ b/scrapy/xpath/selector.py@@ -11,7 +11,7 @@ from scrapy.xpath.factories import xmlDoc_from_html, xmlDoc_from_xmlfrom scrapy.xpath.document import Libxml2Documentfrom scrapy.utils.python import flatten, unicode_to_strfrom scrapy.utils.misc import extract_regex-from scrapy.utils.ref import object_ref+from scrapy.utils.trackref import object_reffrom scrapy.utils.decorator import deprecatedclass XPathSelector(object_ref):