Remove u'' in front of strings.

This commit is contained in:
Rémy HUBSCHER 2020-01-07 15:21:34 +01:00
parent 6c7c8d9a60
commit af30524bd2
No known key found for this signature in database
GPG key ID: 82B47F36036A312A
10 changed files with 24 additions and 24 deletions

View file

@ -12,7 +12,7 @@ from demoproject.compat import reverse
def setup_file():
if not os.path.exists(storage_dir):
os.makedirs(storage_dir)
storage.save("hello-world.txt", ContentFile(u"Hello world!\n"))
storage.save("hello-world.txt", ContentFile("Hello world!\n"))
class OptimizedByMiddlewareTestCase(django.test.TestCase):

View file

@ -12,7 +12,7 @@ from demoproject.lighttpd.views import storage, storage_dir
def setup_file():
if not os.path.exists(storage_dir):
os.makedirs(storage_dir)
storage.save("hello-world.txt", ContentFile(u"Hello world!\n"))
storage.save("hello-world.txt", ContentFile("Hello world!\n"))
class OptimizedByMiddlewareTestCase(django.test.TestCase):

View file

@ -12,7 +12,7 @@ from demoproject.nginx.views import storage, storage_dir
def setup_file():
if not os.path.exists(storage_dir):
os.makedirs(storage_dir)
storage.save("hello-world.txt", ContentFile(u"Hello world!\n"))
storage.save("hello-world.txt", ContentFile("Hello world!\n"))
class OptimizedByMiddlewareTestCase(django.test.TestCase):

View file

@ -13,14 +13,14 @@ class TextDownloadView(VirtualDownloadView):
class StringIODownloadView(VirtualDownloadView):
def get_file(self):
"""Return wrapper on ``six.StringIO`` object."""
file_obj = StringIO(u"Hello world!\n")
file_obj = StringIO("Hello world!\n")
return VirtualFile(file_obj, name="hello-world.txt")
def generate_hello():
yield u"Hello "
yield u"world!"
yield u"\n"
yield "Hello "
yield "world!"
yield "\n"
class GeneratedDownloadView(VirtualDownloadView):

View file

@ -10,8 +10,8 @@ NAME = "django-downloadview-demo"
DESCRIPTION = "Serve files with Django and reverse-proxies."
README = open(os.path.join(here, "README.rst")).read()
VERSION = open(os.path.join(project_root, "VERSION")).read().strip()
AUTHOR = u"Benoît Bryon"
EMAIL = u"benoit@marmelune.net"
AUTHOR = "Benoît Bryon"
EMAIL = "benoit@marmelune.net"
URL = "https://django-downloadview.readthedocs.io/"
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",

View file

@ -153,7 +153,7 @@ class StorageFile(File):
class VirtualFile(File):
"""Wrapper for files that live in memory."""
def __init__(self, file=None, name=u"", url="", size=None):
def __init__(self, file=None, name="", url="", size=None):
"""Constructor.
file:
@ -224,7 +224,7 @@ class HTTPFile(File):
"""
def __init__(self, request_factory=requests.get, url="", name=u"", **kwargs):
def __init__(self, request_factory=requests.get, url="", name="", **kwargs):
self.request_factory = request_factory
self.url = url
if name is None:

View file

@ -19,7 +19,7 @@ class TextIteratorIO(io.TextIOBase):
self._iter = iterator
#: Internal buffer.
self._left = u""
self._left = ""
def readable(self):
return True
@ -53,24 +53,24 @@ class TextIteratorIO(io.TextIOBase):
break
n -= len(m)
chunks.append(m)
return u"".join(chunks)
return "".join(chunks)
def readline(self):
chunks = []
while True:
i = self._left.find(u"\n")
i = self._left.find("\n")
if i == -1:
chunks.append(self._left)
try:
self._left = next(self._iter)
except StopIteration:
self._left = u""
self._left = ""
break
else:
chunks.append(self._left[: i + 1])
self._left = self._left[i + 1 :]
break
return u"".join(chunks)
return "".join(chunks)
class BytesIteratorIO(io.BytesIO):

View file

@ -9,7 +9,7 @@ class HTTPDownloadView(BaseDownloadView):
"""Proxy files that live on remote servers."""
#: URL to download (the one we are proxying).
url = u""
url = ""
#: Additional keyword arguments for request handler.
request_kwargs = {}

View file

@ -3,17 +3,17 @@ import unittest
from django_downloadview import BytesIteratorIO, TextIteratorIO
HELLO_TEXT = u"Hello world!\né\n"
HELLO_TEXT = "Hello world!\né\n"
HELLO_BYTES = b"Hello world!\n\xc3\xa9\n"
def generate_hello_text():
"""Generate u'Hello world!\n'."""
yield u"Hello "
yield u"world!"
yield u"\n"
yield u"é"
yield u"\n"
yield "Hello "
yield "world!"
yield "\n"
yield "é"
yield "\n"
def generate_hello_bytes():

View file

@ -10,7 +10,7 @@ class DownloadResponseTestCase(unittest.TestCase):
def test_content_disposition_encoding(self):
"""Content-Disposition header is encoded."""
response = DownloadResponse(
"fake file", attachment=True, basename=u"espacé .txt",
"fake file", attachment=True, basename="espacé .txt",
)
headers = response.default_headers
self.assertIn('filename="espace_.txt"', headers["Content-Disposition"])