mirror of https://github.com/scrapy/scrapy.git
Suggested changes
This commit is contained in:
parent
d5a2a70329
commit
7e3a602d56
|
|
@ -1,7 +1,8 @@
|
|||
import sys
|
||||
import six
|
||||
from six.moves import copyreg
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
|
||||
if six.PY2:
|
||||
from urlparse import urlparse
|
||||
|
||||
# workaround for https://bugs.python.org/issue7904 - Python < 2.7
|
||||
|
|
@ -14,11 +15,6 @@ if sys.version_info[0] == 2:
|
|||
from urlparse import uses_query
|
||||
uses_query.append('s3')
|
||||
|
||||
# Prevent the DeprecationWarning about SafeConfigParser -> ConfigParser
|
||||
import configparser
|
||||
if not getattr(configparser, 'ConfigParser', None):
|
||||
configparser.ConfigParser = configparser.SafeConfigParser
|
||||
|
||||
|
||||
# Undo what Twisted's perspective broker adds to pickle register
|
||||
# to prevent bugs like Twisted#7989 while serializing requests
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ import six
|
|||
from scrapy.utils.trackref import object_ref
|
||||
|
||||
|
||||
if six.PY3:
|
||||
MutableMapping = collections.abc.MutableMapping
|
||||
else:
|
||||
if six.PY2:
|
||||
MutableMapping = collections.MutableMapping
|
||||
else:
|
||||
MutableMapping = collections.abc.MutableMapping
|
||||
|
||||
|
||||
class BaseItem(object_ref):
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ from pprint import pformat
|
|||
from scrapy.settings import default_settings
|
||||
|
||||
|
||||
if six.PY3:
|
||||
MutableMapping = collections.abc.MutableMapping
|
||||
else:
|
||||
if six.PY2:
|
||||
MutableMapping = collections.MutableMapping
|
||||
else:
|
||||
MutableMapping = collections.abc.MutableMapping
|
||||
|
||||
|
||||
SETTINGS_PRIORITIES = {
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ import six
|
|||
from scrapy.exceptions import ScrapyDeprecationWarning
|
||||
|
||||
|
||||
if six.PY3:
|
||||
Mapping = collections.abc.Mapping
|
||||
else:
|
||||
if six.PY2:
|
||||
Mapping = collections.Mapping
|
||||
else:
|
||||
Mapping = collections.abc.Mapping
|
||||
|
||||
|
||||
class MultiValueDictKeyError(KeyError):
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ def get_testdata(*paths):
|
|||
# FIXME: delete after dropping py2 support
|
||||
# Monkey patch the unittest module to prevent the
|
||||
# DeprecationWarning about assertRaisesRegexp -> assertRaisesRegex
|
||||
import sys
|
||||
if sys.version_info[0] == 2:
|
||||
import six
|
||||
if six.PY2:
|
||||
import unittest
|
||||
import twisted.trial.unittest
|
||||
if not getattr(unittest.TestCase, 'assertRegex', None):
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ import copy
|
|||
import unittest
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
from collections.abc import Mapping, MutableMapping
|
||||
else:
|
||||
if six.PY2:
|
||||
from collections import Mapping, MutableMapping
|
||||
else:
|
||||
from collections.abc import Mapping, MutableMapping
|
||||
|
||||
from scrapy.utils.datatypes import CaselessDict, SequenceExclude
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue