Skip to content

Commit ab173cb

Browse files
committed
Removed further six usage: six.string_types, six.integer_types, six.moves.urllib instances.
- Legacy-Id: 17390
1 parent 1c808bf commit ab173cb

30 files changed

Lines changed: 70 additions & 100 deletions

ietf/api/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
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

77
import datetime
88
import re
9-
import six
109

11-
from six.moves.urllib.parse import urlencode
10+
from urllib.parse import urlencode
1211

1312
from django.conf import settings
1413
from django.core.exceptions import ObjectDoesNotExist
@@ -82,7 +81,7 @@ def convert(self, value):
8281
if value is None:
8382
return None
8483

85-
if isinstance(value, six.string_types):
84+
if isinstance(value, str):
8685
match = TIMEDELTA_REGEX.search(value)
8786

8887
if match:
@@ -97,7 +96,7 @@ def hydrate(self, bundle):
9796
value = super(TimedeltaField, self).hydrate(bundle)
9897

9998
if value and not hasattr(value, 'seconds'):
100-
if isinstance(value, six.string_types):
99+
if isinstance(value, str):
101100
try:
102101
match = TIMEDELTA_REGEX.search(value)
103102

@@ -125,7 +124,7 @@ def dehydrate(self, bundle, for_list=True):
125124
if callable(self.attribute):
126125
previous_obj = bundle.obj
127126
foreign_obj = self.attribute(bundle)
128-
elif isinstance(self.attribute, six.string_types):
127+
elif isinstance(self.attribute, str):
129128
foreign_obj = bundle.obj
130129

131130
for attr in self._attrs:

ietf/doc/expire.py

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

@@ -8,10 +8,9 @@
88
from django.conf import settings
99

1010
import datetime, os, shutil, glob, re
11-
import six
1211
from pathlib import Path
13-
if six.PY3:
14-
from typing import List, Tuple # pyflakes:ignore
12+
13+
from typing import List, Tuple # pyflakes:ignore
1514

1615
from ietf.utils import log
1716
from ietf.utils.mail import send_mail

ietf/doc/factories.py

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

@@ -8,9 +8,8 @@
88
import factory
99
import factory.fuzzy
1010
import datetime
11-
import six
12-
if six.PY3:
13-
from typing import Optional # pyflakes:ignore
11+
12+
from typing import Optional # pyflakes:ignore
1413

1514
from django.conf import settings
1615

ietf/doc/fields.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 json
8-
import six
98

109
from django.utils.html import escape
1110
from django import forms
@@ -57,9 +56,9 @@ def parse_select2_value(self, value):
5756
def prepare_value(self, value):
5857
if not value:
5958
value = ""
60-
if isinstance(value, six.integer_types):
59+
if isinstance(value, int):
6160
value = str(value)
62-
if isinstance(value, six.string_types):
61+
if isinstance(value, str):
6362
items = self.parse_select2_value(value)
6463
# accept both names and pks here
6564
names = [ i for i in items if not i.isdigit() ]

ietf/doc/migrations/0016_set_document_docalias_fk.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Copyright The IETF Trust 2019, All Rights Reserved
1+
# Copyright The IETF Trust 2019-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
33
# Generated by Django 1.11.20 on 2019-05-08 14:04
44

55

66
from __future__ import absolute_import, print_function, unicode_literals
77

8-
import six
8+
99
import sys
1010

1111
from tqdm import tqdm
@@ -18,7 +18,7 @@ def add_id_fk(o, a, nameid):
1818
n = getattr(o, a+'_id')
1919
if n:
2020
i = nameid[n]
21-
if not isinstance(i, six.integer_types):
21+
if not isinstance(i, int):
2222
raise ValueError("Inappropriate value: %s: nameid[%s]: %s" % (o.__class__.__name__, n, i))
2323
if getattr(o, a+'2_id') != i:
2424
setattr(o, a+'2_id', i)

ietf/doc/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import io
88
import os
99
import rfc2html
10-
import six
1110

1211
from django.db import models
1312
from django.core import checks
@@ -412,7 +411,7 @@ def meeting_related(self):
412411

413412
def relations_that(self, relationship):
414413
"""Return the related-document objects that describe a given relationship targeting self."""
415-
if isinstance(relationship, six.string_types):
414+
if isinstance(relationship, str):
416415
relationship = ( relationship, )
417416
if not isinstance(relationship, tuple):
418417
raise TypeError("Expected a string or tuple, received %s" % type(relationship))
@@ -435,7 +434,7 @@ def all_relations_that(self, relationship, related=None):
435434

436435
def relations_that_doc(self, relationship):
437436
"""Return the related-document objects that describe a given relationship from self to other documents."""
438-
if isinstance(relationship, six.string_types):
437+
if isinstance(relationship, str):
439438
relationship = ( relationship, )
440439
if not isinstance(relationship, tuple):
441440
raise TypeError("Expected a string or tuple, received %s" % type(relationship))

ietf/doc/tests.py

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

@@ -19,7 +19,7 @@
1919

2020
from six.moves.http_cookies import SimpleCookie
2121
from pyquery import PyQuery
22-
from six.moves.urllib.parse import urlparse, parse_qs
22+
from urllib.parse import urlparse, parse_qs
2323
from tempfile import NamedTemporaryFile
2424

2525
from django.urls import reverse as urlreverse

ietf/doc/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
import math
1212
import os
1313
import re
14-
import six
1514

1615
from collections import defaultdict
17-
from six.moves.urllib.parse import quote
16+
from urllib.parse import quote
1817

1918
from django.conf import settings
2019
from django.contrib import messages
@@ -705,7 +704,7 @@ def get_initial_notify(doc,extra=None):
705704
receivers = []
706705

707706
if extra:
708-
if isinstance(extra, six.string_types):
707+
if isinstance(extra, str):
709708
extra = extra.split(', ')
710709
receivers.extend(extra)
711710

ietf/doc/views_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import os
4444
import re
4545

46-
from six.moves.urllib.parse import quote
46+
from urllib.parse import quote
4747

4848
from django.http import HttpResponse, Http404 , HttpResponseForbidden
4949
from django.shortcuts import render, get_object_or_404, redirect

ietf/doc/views_status_change.py

Lines changed: 3 additions & 4 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

@@ -8,9 +8,8 @@
88
import io
99
import os
1010
import re
11-
import six
12-
if six.PY3:
13-
from typing import Dict # pyflakes:ignore
11+
12+
from typing import Dict # pyflakes:ignore
1413

1514
from django import forms
1615
from django.shortcuts import render, get_object_or_404, redirect

0 commit comments

Comments
 (0)