Remove six types

This commit is contained in:
Eugenio Lacuesta 2019-11-03 12:10:37 -03:00
parent 7f3cb05d8e
commit 586b25d27e
No known key found for this signature in database
GPG Key ID: DA3EF2D0913E9810
3 changed files with 6 additions and 7 deletions

View File

@ -2,7 +2,6 @@
import re
import logging
import six
from w3lib import html
from scrapy.exceptions import NotConfigured
@ -66,7 +65,7 @@ class AjaxCrawlMiddleware(object):
# XXX: move it to w3lib?
_ajax_crawlable_re = re.compile(six.u(r'<meta\s+name=["\']fragment["\']\s+content=["\']!["\']/?>'))
_ajax_crawlable_re = re.compile(r'<meta\s+name=["\']fragment["\']\s+content=["\']!["\']/?>')
def _has_ajaxcrawlable_meta(text):
"""
>>> _has_ajaxcrawlable_meta('<html><head><meta name="fragment" content="!"/></head><body></body></html>')

View File

@ -7,7 +7,6 @@ import re
import inspect
import weakref
import errno
import six
from functools import partial, wraps
from itertools import chain
import sys
@ -162,7 +161,7 @@ def memoizemethod_noargs(method):
return new_method
_BINARYCHARS = {six.b(chr(i)) for i in range(32)} - {b"\0", b"\t", b"\n", b"\r"}
_BINARYCHARS = {to_bytes(chr(i)) for i in range(32)} - {b"\0", b"\t", b"\n", b"\r"}
_BINARYCHARS |= {ord(ch) for ch in _BINARYCHARS}
@deprecated("scrapy.utils.python.binary_is_text")

View File

@ -1,6 +1,7 @@
import six
import unittest
from io import StringIO
from unittest import mock
from scrapy.utils import trackref
@ -38,12 +39,12 @@ Live References
Bar 1 oldest: 0s ago
''')
@mock.patch('sys.stdout', new_callable=six.StringIO)
@mock.patch('sys.stdout', new_callable=StringIO)
def test_print_live_refs_empty(self, stdout):
trackref.print_live_refs()
self.assertEqual(stdout.getvalue(), 'Live References\n\n\n')
@mock.patch('sys.stdout', new_callable=six.StringIO)
@mock.patch('sys.stdout', new_callable=StringIO)
def test_print_live_refs_with_objects(self, stdout):
o1 = Foo() # NOQA
trackref.print_live_refs()