Scrapy, a fast high-level web crawling & scraping framework for Python.
Prevent more DeprecationWarnings
Eugenio Lacuesta40086dabb85a
diff --git a/scrapy/core/downloader/handlers/ftp.py b/scrapy/core/downloader/handlers/ftp.pyindex c342d4ab1..806a537d4 100644--- a/scrapy/core/downloader/handlers/ftp.py+++ b/scrapy/core/downloader/handlers/ftp.py@@ -59,7 +59,7 @@ class ReceivedDataProtocol(Protocol):def close(self):self.body.close() if self.filename else self.body.seek(0)-_CODE_RE = re.compile("\d+")+_CODE_RE = re.compile(r"\d+")class FTPDownloadHandler(object):diff --git a/scrapy/core/downloader/handlers/http11.py b/scrapy/core/downloader/handlers/http11.pyindex 74ef82874..cbaa36b2d 100644--- a/scrapy/core/downloader/handlers/http11.py+++ b/scrapy/core/downloader/handlers/http11.py@@ -101,7 +101,7 @@ class TunnelingTCP4ClientEndpoint(TCP4ClientEndpoint):for it."""- _responseMatcher = re.compile(b'HTTP/1\.. (?P<status>\d{3})(?P<reason>.{,32})')+ _responseMatcher = re.compile(br'HTTP/1\.. (?P<status>\d{3})(?P<reason>.{,32})')def __init__(self, reactor, host, port, proxyConf, contextFactory,timeout=30, bindAddress=None):diff --git a/scrapy/utils/template.py b/scrapy/utils/template.pyindex 1d7bd006c..615372fc8 100644--- a/scrapy/utils/template.py+++ b/scrapy/utils/template.py@@ -18,7 +18,7 @@ def render_templatefile(path, **kwargs):os.remove(path)-CAMELCASE_INVALID_CHARS = re.compile('[^a-zA-Z\d]')+CAMELCASE_INVALID_CHARS = re.compile(r'[^a-zA-Z\d]')def string_camelcase(string):""" Convert a word to its CamelCase version and remove invalid charsdiff --git a/tests/test_downloadermiddleware_cookies.py b/tests/test_downloadermiddleware_cookies.pyindex 17801e502..04884fb78 100644--- a/tests/test_downloadermiddleware_cookies.py+++ b/tests/test_downloadermiddleware_cookies.py@@ -13,7 +13,7 @@ from scrapy.downloadermiddlewares.cookies import CookiesMiddlewareclass CookiesMiddlewareTest(TestCase):def assertCookieValEqual(self, first, second, msg=None):- cookievaleq = lambda cv: re.split(';\s*', cv.decode('latin1'))+ cookievaleq = lambda cv: re.split(r';\s*', cv.decode('latin1'))return self.assertEqual(sorted(cookievaleq(first)),sorted(cookievaleq(second)), msg)diff --git a/tests/test_engine.py b/tests/test_engine.pyindex 856465161..30150391a 100644--- a/tests/test_engine.py+++ b/tests/test_engine.py@@ -40,9 +40,9 @@ class TestSpider(Spider):name = "scrapytest.org"allowed_domains = ["scrapytest.org", "localhost"]- itemurl_re = re.compile("item\d+.html")- name_re = re.compile("<h1>(.*?)</h1>", re.M)- price_re = re.compile(">Price: \$(.*?)<", re.M)+ itemurl_re = re.compile(r"item\d+.html")+ name_re = re.compile(r"<h1>(.*?)</h1>", re.M)+ price_re = re.compile(r">Price: \$(.*?)<", re.M)item_cls = TestItemdiff --git a/tests/test_linkextractors.py b/tests/test_linkextractors.pyindex c9cd629f4..d96e259f6 100644--- a/tests/test_linkextractors.py+++ b/tests/test_linkextractors.py@@ -288,7 +288,7 @@ class Base:response = HtmlResponse("http://example.org/somepage/index.html", body=html, encoding='windows-1252')def process_value(value):- m = re.search("javascript:goToPage\('(.*?)'", value)+ m = re.search(r"javascript:goToPage\('(.*?)'", value)if m:return m.group(1)diff --git a/tests/test_loader.py b/tests/test_loader.pyindex ce0fa0701..2725b001a 100644--- a/tests/test_loader.py+++ b/tests/test_loader.py@@ -691,7 +691,7 @@ class SelectortemLoaderTest(unittest.TestCase):self.assertTrue(l.selector)l.add_css('url', 'a::attr(href)')self.assertEqual(l.get_output_value('url'), [u'http://www.scrapy.org'])- l.replace_css('url', 'a::attr(href)', re='http://www\.(.+)')+ l.replace_css('url', 'a::attr(href)', re=r'http://www\.(.+)')self.assertEqual(l.get_output_value('url'), [u'scrapy.org'])diff --git a/tests/test_utils_url.py b/tests/test_utils_url.pyindex c2b9fc176..e6588055c 100644--- a/tests/test_utils_url.py+++ b/tests/test_utils_url.py@@ -233,8 +233,8 @@ for k, args in enumerate ([setattr (GuessSchemeTest, t_method.__name__, t_method)# TODO: the following tests do not pass with current implementation-for k, args in enumerate ([- ('C:\absolute\path\to\a\file.html', 'file://',+for k, args in enumerate([+ (r'C:\absolute\path\to\a\file.html', 'file://','Windows filepath are not supported for scrapy shell'),], start=1):t_method = create_skipped_scheme_t(args)