mirror of https://github.com/scrapy/scrapy.git
Remove cStringIO imports.
This commit is contained in:
parent
065fe29d3c
commit
85e79ae792
|
|
@ -4,6 +4,7 @@ and extract the potentially compressed responses that may arrive.
|
|||
|
||||
import bz2
|
||||
import gzip
|
||||
from io import BytesIO
|
||||
import zipfile
|
||||
import tarfile
|
||||
import logging
|
||||
|
|
@ -11,11 +12,6 @@ from tempfile import mktemp
|
|||
|
||||
import six
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
|
||||
from scrapy.responsetypes import responsetypes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
|||
|
|
@ -3,13 +3,9 @@ Mail sending helpers
|
|||
|
||||
See documentation in docs/topics/email.rst
|
||||
"""
|
||||
from io import BytesIO
|
||||
import logging
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
|
||||
from email.utils import COMMASPACE, formatdate
|
||||
from six.moves.email_mime_multipart import MIMEMultipart
|
||||
from six.moves.email_mime_text import MIMEText
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ See documentation in topics/media-pipeline.rst
|
|||
"""
|
||||
import functools
|
||||
import hashlib
|
||||
from io import BytesIO
|
||||
import mimetypes
|
||||
import os
|
||||
import os.path
|
||||
|
|
@ -15,12 +16,6 @@ from six.moves.urllib.parse import urlparse
|
|||
from collections import defaultdict
|
||||
import six
|
||||
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
|
||||
from twisted.internet import defer, threads
|
||||
|
||||
from scrapy.pipelines.media import MediaPipeline
|
||||
|
|
|
|||
|
|
@ -5,13 +5,9 @@ See documentation in topics/media-pipeline.rst
|
|||
"""
|
||||
import functools
|
||||
import hashlib
|
||||
from io import BytesIO
|
||||
import six
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from scrapy.utils.misc import md5sum
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
import struct
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
from gzip import GzipFile
|
||||
|
||||
from io import BytesIO
|
||||
import re
|
||||
import struct
|
||||
|
||||
from scrapy.utils.decorators import deprecated
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
import re
|
||||
import csv
|
||||
import logging
|
||||
try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
from io import StringIO
|
||||
import logging
|
||||
import six
|
||||
|
||||
from scrapy.http import TextResponse, Response
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from io import StringIO
|
||||
import json
|
||||
import os
|
||||
import pstats
|
||||
|
|
@ -7,10 +8,6 @@ from subprocess import Popen, PIPE
|
|||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
|
||||
from scrapy.utils.test import get_testenv
|
||||
|
||||
|
|
|
|||
|
|
@ -144,10 +144,8 @@ class BaseMediaPipelineTestCase(unittest.TestCase):
|
|||
|
||||
# The Failure should encapsulate a FileException ...
|
||||
self.assertEqual(failure.value, file_exc)
|
||||
# ... and if we're running on Python 3 ...
|
||||
if sys.version_info.major >= 3:
|
||||
# ... it should have the returnValue exception set as its context
|
||||
self.assertEqual(failure.value.__context__, def_gen_return_exc)
|
||||
# ... and it should have the returnValue exception set as its context
|
||||
self.assertEqual(failure.value.__context__, def_gen_return_exc)
|
||||
|
||||
# Let's calculate the request fingerprint and fake some runtime data...
|
||||
fp = request_fingerprint(request)
|
||||
|
|
|
|||
Loading…
Reference in New Issue