Scrapy, a fast high-level web crawling & scraping framework for Python.
Move scrapy/contrib/linkextractors to scrapy/linkextractors
Julia Medinacf064b143747
diff --git a/docs/topics/firebug.rst b/docs/topics/firebug.rstindex ad3f26b50..3bbb902b2 100644--- a/docs/topics/firebug.rst+++ b/docs/topics/firebug.rst@@ -81,7 +81,7 @@ process and extract data from those pages.This is how the spider would look so far::- from scrapy.contrib.linkextractors import LinkExtractor+ from scrapy.linkextractors import LinkExtractorfrom scrapy.contrib.spiders import CrawlSpider, Ruleclass GoogleDirectorySpider(CrawlSpider):diff --git a/docs/topics/link-extractors.rst b/docs/topics/link-extractors.rstindex f2f296fba..be3eb4537 100644--- a/docs/topics/link-extractors.rst+++ b/docs/topics/link-extractors.rst@@ -8,7 +8,7 @@ Link extractors are objects whose only purpose is to extract links from webpages (:class:`scrapy.http.Response` objects) which will be eventuallyfollowed.-There is ``scrapy.contrib.linkextractors import LinkExtractor`` available+There is ``scrapy.linkextractors import LinkExtractor`` availablein Scrapy, but you can create your own custom Link Extractors to suit yourneeds by implementing a simple interface.@@ -30,16 +30,16 @@ extract links.Built-in link extractors reference==================================-.. module:: scrapy.contrib.linkextractors+.. module:: scrapy.linkextractors:synopsis: Link extractors classesLink extractors classes bundled with Scrapy are provided in the-:mod:`scrapy.contrib.linkextractors` module.+:mod:`scrapy.linkextractors` module.The default link extractor is ``LinkExtractor``, which is the same as:class:`~.LxmlLinkExtractor`::- from scrapy.contrib.linkextractors import LinkExtractor+ from scrapy.linkextractors import LinkExtractorThere used to be other link extractor classes in previous Scrapy versions,but they are deprecated now.@@ -47,7 +47,7 @@ but they are deprecated now.LxmlLinkExtractor------------------.. module:: scrapy.contrib.linkextractors.lxmlhtml+.. module:: scrapy.linkextractors.lxmlhtml:synopsis: lxml's HTMLParser-based link extractorsdiff --git a/docs/topics/spiders.rst b/docs/topics/spiders.rstindex 7c7d5d731..fdc5581a0 100644--- a/docs/topics/spiders.rst+++ b/docs/topics/spiders.rst@@ -395,7 +395,7 @@ Let's now take a look at an example CrawlSpider with rules::import scrapyfrom scrapy.contrib.spiders import CrawlSpider, Rule- from scrapy.contrib.linkextractors import LinkExtractor+ from scrapy.linkextractors import LinkExtractorclass MySpider(CrawlSpider):name = 'example.com'diff --git a/scrapy/commands/bench.py b/scrapy/commands/bench.pyindex 395597546..7c056a990 100644--- a/scrapy/commands/bench.py+++ b/scrapy/commands/bench.py@@ -6,7 +6,7 @@ from six.moves.urllib.parse import urlencodeimport scrapyfrom scrapy.command import ScrapyCommand-from scrapy.contrib.linkextractors import LinkExtractor+from scrapy.linkextractors import LinkExtractorclass Command(ScrapyCommand):diff --git a/scrapy/link.py b/scrapy/link.pyindex 42c0e4f48..8bdcce761 100644--- a/scrapy/link.py+++ b/scrapy/link.py@@ -1,7 +1,7 @@"""This module defines the Link object used in Link extractors.-For actual link extractors implementation see scrapy.contrib.linkextractor, or+For actual link extractors implementation see scrapy.linkextractors, orits documentation in: docs/topics/link-extractors.rst"""diff --git a/scrapy/linkextractor.py b/scrapy/linkextractor.pyindex 227d79b46..2a4d18877 100644--- a/scrapy/linkextractor.py+++ b/scrapy/linkextractor.py@@ -1,6 +1,6 @@"""Common code and definitions used by Link extractors (located in-scrapy.contrib.linkextractor).+scrapy.linkextractors)."""import refrom six.moves.urllib.parse import urlparsediff --git a/scrapy/contrib/linkextractors/__init__.py b/scrapy/linkextractors/__init__.pysimilarity index 85%rename from scrapy/contrib/linkextractors/__init__.pyrename to scrapy/linkextractors/__init__.pyindex 48b9c757a..28afaa2f1 100644--- a/scrapy/contrib/linkextractors/__init__.py+++ b/scrapy/linkextractors/__init__.py@@ -1,5 +1,5 @@"""-scrapy.contrib.linkextractors+scrapy.linkextractorsThis package contains a collection of Link Extractors.diff --git a/scrapy/contrib/linkextractors/htmlparser.py b/scrapy/linkextractors/htmlparser.pysimilarity index 100%rename from scrapy/contrib/linkextractors/htmlparser.pyrename to scrapy/linkextractors/htmlparser.pydiff --git a/scrapy/contrib/linkextractors/lxmlhtml.py b/scrapy/linkextractors/lxmlhtml.pysimilarity index 100%rename from scrapy/contrib/linkextractors/lxmlhtml.pyrename to scrapy/linkextractors/lxmlhtml.pydiff --git a/scrapy/contrib/linkextractors/regex.py b/scrapy/linkextractors/regex.pysimilarity index 100%rename from scrapy/contrib/linkextractors/regex.pyrename to scrapy/linkextractors/regex.pydiff --git a/scrapy/contrib/linkextractors/sgml.py b/scrapy/linkextractors/sgml.pysimilarity index 97%rename from scrapy/contrib/linkextractors/sgml.pyrename to scrapy/linkextractors/sgml.pyindex 335773db1..b1f3da416 100644--- a/scrapy/contrib/linkextractors/sgml.py+++ b/scrapy/linkextractors/sgml.py@@ -20,7 +20,7 @@ class BaseSgmlLinkExtractor(SGMLParser):def __init__(self, tag="a", attr="href", unique=False, process_value=None):warnings.warn("BaseSgmlLinkExtractor is deprecated and will be removed in future releases. "- "Please use scrapy.contrib.linkextractors.LinkExtractor",+ "Please use scrapy.linkextractors.LinkExtractor",ScrapyDeprecationWarning)SGMLParser.__init__(self)@@ -103,7 +103,7 @@ class SgmlLinkExtractor(FilteringLinkExtractor):warnings.warn("SgmlLinkExtractor is deprecated and will be removed in future releases. "- "Please use scrapy.contrib.linkextractors.LinkExtractor",+ "Please use scrapy.linkextractors.LinkExtractor",ScrapyDeprecationWarning)diff --git a/scrapy/templates/spiders/crawl.tmpl b/scrapy/templates/spiders/crawl.tmplindex 0482a5496..b84e785fd 100644--- a/scrapy/templates/spiders/crawl.tmpl+++ b/scrapy/templates/spiders/crawl.tmpl@@ -1,6 +1,6 @@# -*- coding: utf-8 -*-import scrapy-from scrapy.contrib.linkextractors import LinkExtractor+from scrapy.linkextractors import LinkExtractorfrom scrapy.contrib.spiders import CrawlSpider, Rulefrom $project_name.items import ${ProjectName}Itemdiff --git a/tests/py3-ignores.txt b/tests/py3-ignores.txtindex 8e5c5dc9b..3f1da0751 100644--- a/tests/py3-ignores.txt+++ b/tests/py3-ignores.txt@@ -5,7 +5,7 @@ tests/test_command_shell.pytests/test_commands.pytests/test_command_version.pytests/test_exporters.py-tests/test_contrib_linkextractors.py+tests/test_linkextractors.pytests/test_contrib_loader.pytests/test_crawl.pytests/test_crawler.py@@ -88,6 +88,9 @@ scrapy/contrib/pipeline/files.pyscrapy/contrib/linkextractors/sgml.pyscrapy/contrib/linkextractors/regex.pyscrapy/contrib/linkextractors/htmlparser.py+scrapy/linkextractors/sgml.py+scrapy/linkextractors/regex.py+scrapy/linkextractors/htmlparser.pyscrapy/contrib/downloadermiddleware/retry.pyscrapy/contrib/downloadermiddleware/httpproxy.pyscrapy/contrib/downloadermiddleware/cookies.pydiff --git a/tests/spiders.py b/tests/spiders.pyindex 5484fc5b9..c2956d741 100644--- a/tests/spiders.py+++ b/tests/spiders.py@@ -8,7 +8,7 @@ from six.moves.urllib.parse import urlencodefrom scrapy.spider import Spiderfrom scrapy.http import Requestfrom scrapy.item import Item-from scrapy.contrib.linkextractors import LinkExtractor+from scrapy.linkextractors import LinkExtractorclass MetaSpider(Spider):diff --git a/tests/test_engine.py b/tests/test_engine.pyindex 04fae02c0..bbb94fd58 100644--- a/tests/test_engine.py+++ b/tests/test_engine.py@@ -24,7 +24,7 @@ from scrapy.xlib.pydispatch import dispatcherfrom tests import tests_datadirfrom scrapy.spider import Spiderfrom scrapy.item import Item, Field-from scrapy.contrib.linkextractors import LinkExtractor+from scrapy.linkextractors import LinkExtractorfrom scrapy.http import Requestfrom scrapy.utils.signal import disconnect_alldiff --git a/tests/test_contrib_linkextractors.py b/tests/test_linkextractors.pysimilarity index 98%rename from tests/test_contrib_linkextractors.pyrename to tests/test_linkextractors.pyindex a624f9e66..948289f8f 100644--- a/tests/test_contrib_linkextractors.py+++ b/tests/test_linkextractors.py@@ -1,11 +1,11 @@import reimport unittest-from scrapy.contrib.linkextractors.regex import RegexLinkExtractor+from scrapy.linkextractors.regex import RegexLinkExtractorfrom scrapy.http import HtmlResponse, XmlResponsefrom scrapy.link import Link-from scrapy.contrib.linkextractors.htmlparser import HtmlParserLinkExtractor-from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor, BaseSgmlLinkExtractor-from scrapy.contrib.linkextractors.lxmlhtml import LxmlLinkExtractor+from scrapy.linkextractors.htmlparser import HtmlParserLinkExtractor+from scrapy.linkextractors.sgml import SgmlLinkExtractor, BaseSgmlLinkExtractor+from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractorfrom tests import get_testdatadiff --git a/tests/test_spider.py b/tests/test_spider.pyindex 517fc0995..02352ec29 100644--- a/tests/test_spider.py+++ b/tests/test_spider.py@@ -13,7 +13,7 @@ from scrapy.http import Request, Response, TextResponse, XmlResponse, HtmlResponfrom scrapy.contrib.spiders.init import InitSpiderfrom scrapy.contrib.spiders import CrawlSpider, Rule, XMLFeedSpider, \CSVFeedSpider, SitemapSpider-from scrapy.contrib.linkextractors import LinkExtractor+from scrapy.linkextractors import LinkExtractorfrom scrapy.exceptions import ScrapyDeprecationWarningfrom scrapy.utils.trackref import object_reffrom scrapy.utils.test import get_crawler