Remove six imports

This commit is contained in:
Eugenio Lacuesta 2019-11-03 00:58:47 -03:00
parent ce8e515fa8
commit 54a786b102
No known key found for this signature in database
GPG Key ID: DA3EF2D0913E9810
16 changed files with 8 additions and 28 deletions

View File

@ -1,9 +1,8 @@
import six
import signal
import logging
import signal
import sys
import warnings
import sys
from twisted.internet import reactor, defer
from zope.interface.verify import verifyClass, DoesNotImplement
@ -22,6 +21,7 @@ from scrapy.utils.log import (
get_scrapy_root_handler, install_scrapy_root_handler)
from scrapy import signals
logger = logging.getLogger(__name__)

View File

@ -11,8 +11,6 @@ import warnings
import pickle
from xml.sax.saxutils import XMLGenerator
import six
from scrapy.utils.serialize import ScrapyJSONEncoder
from scrapy.utils.python import to_bytes, to_unicode, is_listlike
from scrapy.item import BaseItem

View File

@ -1,4 +1,3 @@
import six
from w3lib.http import headers_dict_to_raw
from scrapy.utils.datatypes import CaselessDict
from scrapy.utils.python import to_unicode
@ -68,9 +67,6 @@ class Headers(CaselessDict):
self[key] = lst
def items(self):
return list(self.iteritems())
def iteritems(self):
return ((k, self.getlist(k)) for k in self.keys())
def values(self):

View File

@ -4,7 +4,6 @@ requests in Scrapy.
See documentation in docs/topics/request-response.rst
"""
import six
from w3lib.url import safe_url_string
from scrapy.http.headers import Headers

View File

@ -8,7 +8,6 @@ See documentation in docs/topics/request-response.rst
from urllib.parse import urljoin
import parsel
import six
from w3lib.encoding import html_to_unicode, resolve_encoding, \
html_body_declared_encoding, http_content_type_encoding
from w3lib.html import strip_html5_whitespace

View File

@ -5,7 +5,6 @@ import warnings
from html.parser import HTMLParser
from urllib.parse import urljoin
import six
from w3lib.url import safe_url_string
from w3lib.html import strip_html5_whitespace

View File

@ -3,7 +3,6 @@ Link extractor based on lxml.html
"""
from urllib.parse import urljoin
import six
import lxml.etree as etree
from w3lib.html import strip_html5_whitespace
from w3lib.url import canonicalize_url

View File

@ -5,7 +5,6 @@ import warnings
from urllib.parse import urljoin
from sgmllib import SGMLParser
import six
from w3lib.url import safe_url_string, canonicalize_url
from w3lib.html import strip_html5_whitespace

View File

@ -1,4 +1,3 @@
import six
import json
import copy
from collections.abc import MutableMapping

View File

@ -8,8 +8,6 @@ See documentation in docs/topics/spiders.rst
import copy
import warnings
import six
from scrapy.exceptions import ScrapyDeprecationWarning
from scrapy.http import Request, HtmlResponse
from scrapy.linkextractors import LinkExtractor

View File

@ -1,6 +1,5 @@
import re
import logging
import six
from scrapy.spiders import Spider
from scrapy.http import Request, XmlResponse

View File

@ -4,7 +4,6 @@ from shlex import split
from http.cookies import SimpleCookie
from urllib.parse import urlparse
from six import string_types, iteritems
from w3lib.http import basic_auth_header
@ -76,7 +75,7 @@ def curl_to_request_kwargs(curl_command, ignore_unknown_options=True):
name = name.strip()
val = val.strip()
if name.title() == 'Cookie':
for name, morsel in iteritems(SimpleCookie(val)):
for name, morsel in SimpleCookie(val).items():
cookies[name] = morsel.value
else:
headers.append((name, val))

View File

@ -1,13 +1,13 @@
import re
import csv
from io import StringIO
import logging
import six
import re
from io import StringIO
from scrapy.http import TextResponse, Response
from scrapy.selector import Selector
from scrapy.utils.python import re_rsearch, to_unicode
logger = logging.getLogger(__name__)

View File

@ -6,7 +6,6 @@ from contextlib import contextmanager
from importlib import import_module
from pkgutil import iter_modules
import six
from w3lib.html import replace_entities
from scrapy.utils.python import flatten, to_unicode

View File

@ -85,9 +85,6 @@ class HeadersTest(unittest.TestCase):
self.assertSortedEqual(h.items(),
[(b'X-Forwarded-For', [b'ip1', b'ip2']),
(b'Content-Type', [b'text/html'])])
self.assertSortedEqual(h.iteritems(),
[(b'X-Forwarded-For', [b'ip1', b'ip2']),
(b'Content-Type', [b'text/html'])])
self.assertSortedEqual(h.values(), [b'ip2', b'text/html'])
def test_update(self):

View File

@ -62,7 +62,7 @@ class RequestTest(unittest.TestCase):
# headers must not be unicode
h = Headers({'key1': u'val1', u'key2': 'val2'})
h[u'newkey'] = u'newval'
for k, v in h.iteritems():
for k, v in h.items():
self.assertIsInstance(k, bytes)
for s in v:
self.assertIsInstance(s, bytes)