Skip to content

Commit

Permalink
Merge pull request scrapy#798 from felixonmars/py3-port
Browse files Browse the repository at this point in the history
PY3: fix has_key and use six.moves.configparser
  • Loading branch information
kmike committed Jul 14, 2014
2 parents 2cddc2a + 3067d6d commit 2f567f9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion scrapy/tests/test_utils_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def test_contains(self):
d = CaselessDict()
d['a'] = 1
assert 'a' in d
assert d.has_key('a')

def test_pop(self):
d = CaselessDict()
Expand Down
2 changes: 1 addition & 1 deletion scrapy/utils/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import os
from ConfigParser import SafeConfigParser
from six.moves.configparser import SafeConfigParser
from operator import itemgetter

def build_component_list(base, custom):
Expand Down
6 changes: 3 additions & 3 deletions scrapy/xlib/pydispatch/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def connect(receiver, signal=Any, sender=Any, weak=True):
if weak:
receiver = saferef.safeRef(receiver, onDelete=_removeReceiver)
senderkey = id(sender)
if connections.has_key(senderkey):
if senderkey in connections:
signals = connections[senderkey]
else:
connections[senderkey] = signals = {}
Expand All @@ -154,7 +154,7 @@ def remove(object, senderkey=senderkey):
receiverID = id(receiver)
# get current set, remove any current references to
# this receiver in the set, including back-references
if signals.has_key(signal):
if signal in signals:
receivers = signals[signal]
_removeOldBackRefs(senderkey, signal, receiver, receivers)
else:
Expand Down Expand Up @@ -290,7 +290,7 @@ def getAllReceivers( sender = Any, signal = Any ):
for receiver in set:
if receiver: # filter out dead instance-method weakrefs
try:
if not receivers.has_key( receiver ):
if receiver not in receivers:
receivers[receiver] = 1
yield receiver
except TypeError:
Expand Down
2 changes: 1 addition & 1 deletion scrapy/xlib/pydispatch/robustapply.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def robustApply(receiver, *arguments, **named):
receiver, codeObject, startIndex = function(receiver)
acceptable = codeObject.co_varnames[startIndex+len(arguments):codeObject.co_argcount]
for name in codeObject.co_varnames[startIndex:startIndex+len(arguments)]:
if named.has_key(name):
if name in named:
raise TypeError(
"""Argument %r specified both positionally and as a keyword for calling %r"""% (
name, receiver,
Expand Down

0 comments on commit 2f567f9

Please sign in to comment.