diff --git a/scrapy/crawler.py b/scrapy/crawler.py index 4ae1c49d8..3866ba76d 100644 --- a/scrapy/crawler.py +++ b/scrapy/crawler.py @@ -1,5 +1,4 @@ import signal -from itertools import chain from twisted.internet import reactor, defer diff --git a/scrapy/exceptions.py b/scrapy/exceptions.py index c22ba0204..4bcecd994 100644 --- a/scrapy/exceptions.py +++ b/scrapy/exceptions.py @@ -24,6 +24,7 @@ class CloseSpider(Exception): """Raise this from callbacks to request the spider to be closed""" def __init__(self, reason='cancelled'): + super(CloseSpider, self).__init__() self.reason = reason # Items diff --git a/scrapy/utils/datatypes.py b/scrapy/utils/datatypes.py index 1c1b54f41..d7fd27143 100644 --- a/scrapy/utils/datatypes.py +++ b/scrapy/utils/datatypes.py @@ -6,8 +6,6 @@ This module must not depend on any module outside the Standard Library. """ import copy -from collections import deque, defaultdict -from itertools import chain from scrapy.utils.py27 import OrderedDict @@ -46,7 +44,7 @@ class MultiValueDict(dict): try: list_ = dict.__getitem__(self, key) except KeyError: - raise MultiValueDictKeyError, "Key %r not found in %r" % (key, self) + raise MultiValueDictKeyError("Key %r not found in %r" % (key, self)) try: return list_[-1] except IndexError: @@ -124,7 +122,7 @@ class MultiValueDict(dict): def update(self, *args, **kwargs): "update() extends rather than replaces existing key lists. Also accepts keyword args." if len(args) > 1: - raise TypeError, "update expected at most 1 arguments, got %d" % len(args) + raise TypeError("update expected at most 1 arguments, got %d" % len(args)) if args: other_dict = args[0] if isinstance(other_dict, MultiValueDict): @@ -135,7 +133,7 @@ class MultiValueDict(dict): for key, value in other_dict.items(): self.setlistdefault(key, []).append(value) except TypeError: - raise ValueError, "MultiValueDict.update() takes either a MultiValueDict or dictionary" + raise ValueError("MultiValueDict.update() takes either a MultiValueDict or dictionary") for key, value in kwargs.iteritems(): self.setlistdefault(key, []).append(value) diff --git a/scrapy/utils/url.py b/scrapy/utils/url.py index 4ef014fd9..918042064 100644 --- a/scrapy/utils/url.py +++ b/scrapy/utils/url.py @@ -5,10 +5,12 @@ library. Some of the functions that used to be imported from this module have been moved to the w3lib.url module. Always import those from there instead. """ +import posixpath import urlparse import urllib import cgi +# scrapy.utils.url was moved to w3lib.url and import * ensures this move doesn't break old code from w3lib.url import * from scrapy.utils.python import unicode_to_str