Skip to content

Commit 1c808bf

Browse files
committed
Removed further six usage.
- Legacy-Id: 17387
1 parent 566971a commit 1c808bf

8 files changed

Lines changed: 19 additions & 29 deletions

File tree

ietf/group/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def latest_event(self, *args, **filter_args):
9696
return e[0] if e else None
9797

9898
def has_role(self, user, role_names):
99-
if isinstance(role_names, str):
99+
if not isinstance(role_names, (list, tuple)):
100100
role_names = [role_names]
101101
return user.is_authenticated and self.role_set.filter(name__in=role_names, person__user=user).exists()
102102

ietf/mailtrigger/forms.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Copyright The IETF Trust 2015-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
3-
from __future__ import absolute_import, print_function, unicode_literals
43

54

5+
from __future__ import absolute_import, print_function, unicode_literals
6+
67
from typing import Dict, List # pyflakes:ignore
78

89
from django import forms

ietf/utils/draft.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@
4545
import os
4646
import os.path
4747
import re
48-
import six
4948
import stat
5049
import sys
5150
import time
52-
if six.PY3:
53-
from typing import Dict, List # pyflakes:ignore
51+
52+
from typing import Dict, List # pyflakes:ignore
5453

5554
version = "0.35"
5655
program = os.path.basename(sys.argv[0])

ietf/utils/markup_txt.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
from __future__ import absolute_import, print_function, unicode_literals
3838

3939
import re
40-
import six # pyflakes:ignore
4140

4241
from django.utils.html import escape
4342

ietf/utils/test_smtpserver.py

Lines changed: 6 additions & 13 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

@@ -7,7 +7,6 @@
77
import smtpd
88
import threading
99
import asyncore
10-
import six
1110

1211
import debug # pyflakes:ignore
1312

@@ -39,25 +38,19 @@ class SMTPTestChannel(smtpd.SMTPChannel):
3938
# mail_options = ['BODY=8BITMIME', 'SMTPUTF8']
4039

4140
def smtp_RCPT(self, arg):
42-
if (six.PY2 and not self._SMTPChannel__mailfrom) or (six.PY3 and not self.mailfrom):
41+
if not self.mailfrom:
4342
self.push(str('503 Error: need MAIL command'))
4443
return
45-
if six.PY2:
46-
address = self._SMTPChannel__getaddr('TO:', arg) if arg else None
47-
else:
48-
arg = self._strip_command_keyword('TO:', arg)
49-
address, __ = self._getaddr(arg)
44+
arg = self._strip_command_keyword('TO:', arg)
45+
address, __ = self._getaddr(arg)
5046
if not address:
5147
self.push(str('501 Syntax: RCPT TO: <address>'))
5248
return
5349
if "poison" in address:
5450
self.push(str('550 Error: Not touching that'))
5551
return
56-
if six.PY2:
57-
self._SMTPChannel__rcpttos.append(address)
58-
else:
59-
self.rcpt_options = []
60-
self.rcpttos.append(address)
52+
self.rcpt_options = []
53+
self.rcpttos.append(address)
6154
self.push(str('250 Ok'))
6255

6356
class SMTPTestServer(smtpd.SMTPServer):

ietf/utils/tests_restapi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
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

55
from __future__ import absolute_import, print_function, unicode_literals
66

7-
import six
87
import sys
98

109
import debug
@@ -84,6 +83,6 @@ def test_json_doc_relationships(self):
8483
for doc in doclist:
8584
for key in doc:
8685
value = doc[key]
87-
if isinstance(value, six.string_types) and value.startswith('%s/'%apitop):
86+
if isinstance(value, str) and value.startswith('%s/'%apitop):
8887
self.api_client.get(value, format='json')
8988

ietf/utils/text.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from __future__ import absolute_import, print_function, unicode_literals
66

77
import re
8-
import six
98
import textwrap
109
import unicodedata
1110

@@ -60,7 +59,7 @@ def fill(text, width):
6059
def wordwrap(text, width=80):
6160
"""Wraps long lines without loosing the formatting and indentation
6261
of short lines"""
63-
if not isinstance(text, six.string_types):
62+
if not isinstance(text, str):
6463
return text
6564
def block_separator(s):
6665
"Look for lines of identical symbols, at least three long"
@@ -142,7 +141,7 @@ def maybe_split(text, split=True, pos=5000):
142141
return text
143142

144143
def decode(raw):
145-
assert isinstance(raw, six.binary_type)
144+
assert isinstance(raw, bytes)
146145
try:
147146
text = raw.decode('utf-8')
148147
except UnicodeDecodeError:

ietf/utils/urls.py

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

44

55
from __future__ import absolute_import, print_function, unicode_literals
66

77
import debug # pyflakes:ignore
8-
import six
98

109
from inspect import isclass
1110

1211
from django.conf.urls import url as django_url
1312
from django.views.generic import View
13+
from django.utils.encoding import force_str
1414

1515
def url(regex, view, kwargs=None, name=None):
1616
if callable(view) and hasattr(view, '__name__'):
@@ -22,9 +22,9 @@ def url(regex, view, kwargs=None, name=None):
2222
branch = 'name'
2323
elif isinstance(view, (list, tuple)):
2424
branch = 'list'
25-
elif isinstance(view, six.string_types):
25+
elif isinstance(view, (str, bytes)):
2626
branch = 'string'
27-
name = view
27+
name = force_str(view)
2828
elif callable(view) and hasattr(view, '__name__'):
2929
branch = 'callable'
3030
name = view_name

0 commit comments

Comments
 (0)