Merge pull request #430 from alexanderlukanin13/cleanup

pylint cleanup: unused imports and old-style exceptions
This commit is contained in:
Mikhail Korobov 2013-10-18 16:20:04 -07:00
commit 62fd5b3213
4 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,4 @@
import signal
from itertools import chain
from twisted.internet import reactor, defer

View File

@ -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

View File

@ -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)

View File

@ -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