Skip to content

Commit e9a37d8

Browse files
committed
Removed six.text_type(), changed six.moves.urllib to plain urllib, and removed now unused six imports.
- Legacy-Id: 17385
1 parent edbe42e commit e9a37d8

47 files changed

Lines changed: 109 additions & 197 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ietf/api/serializer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# Copyright The IETF Trust 2018-2019, All Rights Reserved
1+
# Copyright The IETF Trust 2018-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

55
from __future__ import absolute_import, print_function, unicode_literals
66

77
import hashlib
88
import json
9-
import six
109

1110
from django.core.cache import cache
1211
from django.core.exceptions import ObjectDoesNotExist, FieldError
@@ -154,7 +153,7 @@ def end_object(self, obj):
154153
if hasattr(field_value, "_meta"):
155154
self._current[name] = self.expand_related(field_value, name)
156155
else:
157-
self._current[name] = six.text_type(field_value)
156+
self._current[name] = str(field_value)
158157
except ObjectDoesNotExist:
159158
pass
160159
except AttributeError:

ietf/bin/rfc-editor-index-updates

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import sys
1111
import syslog
1212
import traceback
1313

14-
from six.moves.urllib.request import urlopen
14+
from urllib.request import urlopen
1515

1616
# boilerplate
1717
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))

ietf/bin/rfc-editor-queue-updates

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import socket
55
import sys
6-
from six.moves.urllib.request import urlopen
6+
from urllib.request import urlopen
77

88
# boilerplate
99
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))

ietf/checks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
from __future__ import absolute_import, print_function, unicode_literals
66

77
import os
8-
import six
98
import sys
109
import time
1110
from textwrap import dedent
12-
if six.PY3:
13-
from typing import List, Tuple # pyflakes:ignore
11+
from typing import List, Tuple # pyflakes:ignore
1412

1513
import debug # pyflakes:ignore
1614
debug.debug = True

ietf/community/views.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2012-2019, All Rights Reserved
1+
# Copyright The IETF Trust 2012-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

@@ -7,7 +7,6 @@
77
import csv
88
import datetime
99
import json
10-
import six
1110
import uuid
1211

1312
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect, Http404
@@ -204,7 +203,7 @@ def export_to_csv(request, username=None, acronym=None, group_type=None):
204203
row.append(e.time.strftime("%Y-%m-%d") if e else "")
205204
row.append(strip_tags(doc.friendly_state()))
206205
row.append(doc.group.acronym if doc.group else "")
207-
row.append(six.text_type(doc.ad) if doc.ad else "")
206+
row.append(str(doc.ad) if doc.ad else "")
208207
e = doc.latest_event()
209208
row.append(e.time.strftime("%Y-%m-%d") if e else "")
210209
writer.writerow([v.encode("utf-8") for v in row])

ietf/doc/feeds.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# Copyright The IETF Trust 2007-2019, All Rights Reserved
1+
# Copyright The IETF Trust 2007-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

55
from __future__ import absolute_import, print_function, unicode_literals
66

77
import datetime
8-
import six
98

109
from django.contrib.syndication.views import Feed, FeedDoesNotExist
1110
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
@@ -50,7 +49,7 @@ def item_pubdate(self, item):
5049
return item.time
5150

5251
def item_author_name(self, item):
53-
return six.text_type(item.by)
52+
return str(item.by)
5453

5554
def item_link(self, item):
5655
return urlreverse('ietf.doc.views_doc.document_history', kwargs=dict(name=item.doc.canonical_name())) + "#history-%s" % item.pk

ietf/doc/fields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2014-2019, All Rights Reserved
1+
# Copyright The IETF Trust 2014-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

@@ -83,7 +83,7 @@ def prepare_value(self, value):
8383
"model_name": self.model.__name__.lower()
8484
})
8585

86-
return ",".join(six.text_type(o.pk) for o in value)
86+
return ",".join(str(o.pk) for o in value)
8787

8888
def clean(self, value):
8989
value = super(SearchableDocumentsField, self).clean(value)

ietf/doc/mails.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from __future__ import absolute_import, print_function, unicode_literals
77

88
import datetime
9-
import six
109
import textwrap
1110

1211
from django.template.loader import render_to_string
@@ -288,7 +287,7 @@ def generate_publication_request(request, doc):
288287
approving_body = "IRSG"
289288
consensus_body = doc.group.acronym.upper()
290289
else:
291-
approving_body = six.text_type(doc.stream)
290+
approving_body = str(doc.stream)
292291
consensus_body = approving_body
293292

294293
e = doc.latest_event(WriteupDocEvent, type="changed_rfc_editor_note_text")

ietf/doc/templatetags/ietf_filters.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222

2323
import debug # pyflakes:ignore
2424

25+
from ietf.doc.models import BallotDocEvent
2526
from ietf.doc.models import ConsensusDocEvent
26-
from ietf.utils.text import wordwrap, fill, wrap_text_if_unwrapped
2727
from ietf.utils.html import sanitize_fragment
28-
from ietf.doc.models import BallotDocEvent
28+
from ietf.utils import log
29+
from ietf.utils.text import wordwrap, fill, wrap_text_if_unwrapped
2930

3031
register = template.Library()
3132

@@ -70,7 +71,7 @@ def parse_email_list(value):
7071
7172
7273
"""
73-
if value and isinstance(value, (six.binary_type, six.text_type)): # testing for 'value' being true isn't necessary; it's a fast-out route
74+
if value and isinstance(value, str): # testing for 'value' being true isn't necessary; it's a fast-out route
7475
addrs = re.split(", ?", value)
7576
ret = []
7677
for addr in addrs:
@@ -79,6 +80,8 @@ def parse_email_list(value):
7980
name = email
8081
ret.append('<a href="mailto:%s">%s</a>' % ( email.replace('&', '&amp;'), escape(name) ))
8182
return mark_safe(", ".join(ret))
83+
elif value and isinstance(value, bytes):
84+
log.assertion('isinstance(value, str)')
8285
else:
8386
return value
8487

@@ -151,10 +154,12 @@ def sanitize(value):
151154
@register.filter(name='bracket')
152155
def square_brackets(value):
153156
"""Adds square brackets around text."""
154-
if isinstance(value, (six.binary_type, six.text_type)):
157+
if isinstance(value, str):
155158
if value == "":
156159
value = " "
157160
return "[ %s ]" % value
161+
elif isinstance(value, bytes):
162+
log.assertion('isinstance(value, str)')
158163
elif value > 0:
159164
return "[ X ]"
160165
elif value < 0:
@@ -344,7 +349,7 @@ def expires_soon(x,request):
344349

345350
@register.filter(name='startswith')
346351
def startswith(x, y):
347-
return six.text_type(x).startswith(y)
352+
return str(x).startswith(y)
348353

349354
@register.filter
350355
def has_role(user, role_names):

ietf/doc/views_doc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import json
4343
import os
4444
import re
45-
import six
4645

4746
from six.moves.urllib.parse import quote
4847

@@ -1397,7 +1396,7 @@ def add_sessionpresentation(request,name):
13971396
if doc.group:
13981397
sessions = sorted(sessions,key=lambda x:0 if x.group==doc.group else 1)
13991398

1400-
session_choices = [(s.pk, six.text_type(s)) for s in sessions]
1399+
session_choices = [(s.pk, str(s)) for s in sessions]
14011400

14021401
if request.method == 'POST':
14031402
version_form = VersionForm(request.POST,choices=version_choices)

0 commit comments

Comments
 (0)