Removed further six usage.
- Legacy-Id: 17386
This commit is contained in:
parent
e9a37d8ac8
commit
566971a6ae
|
@ -1,11 +1,9 @@
|
|||
# Copyright The IETF Trust 2018-2019, All Rights Reserved
|
||||
# Copyright The IETF Trust 2018-2020, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.10 on 2018-02-20 10:52
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
from typing import List, Tuple # pyflakes:ignore
|
||||
from typing import List, Tuple # pyflakes:ignore
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
|
|
@ -7,9 +7,8 @@ import email.utils
|
|||
import jsonfield
|
||||
import os
|
||||
import re
|
||||
import six
|
||||
|
||||
from six.moves.urllib.parse import urljoin
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.validators import RegexValidator
|
||||
|
@ -97,7 +96,7 @@ class Group(GroupInfo):
|
|||
return e[0] if e else None
|
||||
|
||||
def has_role(self, user, role_names):
|
||||
if isinstance(role_names, six.string_types):
|
||||
if isinstance(role_names, str):
|
||||
role_names = [role_names]
|
||||
return user.is_authenticated and self.role_set.filter(name__in=role_names, person__user=user).exists()
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright The IETF Trust 2009-2019, All Rights Reserved
|
||||
# Copyright The IETF Trust 2009-2020, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
|
||||
import io
|
||||
import os, shutil, time, datetime
|
||||
from six.moves.urllib.parse import urlsplit
|
||||
from urllib.parse import urlsplit
|
||||
from pyquery import PyQuery
|
||||
from unittest import skipIf
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# Copyright The IETF Trust 2015-2019, All Rights Reserved
|
||||
# Copyright The IETF Trust 2015-2020, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
from typing import Dict, List # pyflakes:ignore
|
||||
|
||||
from typing import Dict, List # pyflakes:ignore
|
||||
|
||||
from django import forms
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
# Copyright The IETF Trust 2018-2019, All Rights Reserved
|
||||
# Copyright The IETF Trust 2018-2020, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.10 on 2018-02-20 10:52
|
||||
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
from typing import List, Tuple # pyflakes:ignore
|
||||
from typing import List, Tuple # pyflakes:ignore
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright The IETF Trust 2015-2019, All Rights Reserved
|
||||
# Copyright The IETF Trust 2015-2020, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
|
@ -8,7 +8,6 @@ from ietf.doc.factories import WgDraftFactory
|
|||
from ietf.mailtrigger.models import MailTrigger
|
||||
from .utils import gather_address_lists
|
||||
from ietf.utils.test_utils import TestCase
|
||||
import six
|
||||
|
||||
|
||||
class GatherAddressListsTests(TestCase):
|
||||
|
@ -19,15 +18,15 @@ class GatherAddressListsTests(TestCase):
|
|||
def test_regular_trigger(self):
|
||||
to, cc = gather_address_lists('doc_pulled_from_rfc_queue', doc=self.doc)
|
||||
# Despite its name, assertCountEqual also compares content, but does not care for ordering
|
||||
six.assertCountEqual(self, to, ['iana@iana.org', 'rfc-editor@rfc-editor.org'])
|
||||
six.assertCountEqual(self, cc, ['The IESG <iesg@ietf.org>', self.author_address,
|
||||
self.assertCountEqual(to, ['iana@iana.org', 'rfc-editor@rfc-editor.org'])
|
||||
self.assertCountEqual(cc, ['The IESG <iesg@ietf.org>', self.author_address,
|
||||
'mars-chairs@ietf.org', 'iesg-secretary@ietf.org'])
|
||||
|
||||
def test_skipped_recipient(self):
|
||||
to, cc = gather_address_lists('doc_pulled_from_rfc_queue', doc=self.doc,
|
||||
skipped_recipients=['mars-chairs@ietf.org', 'iana@iana.org'])
|
||||
six.assertCountEqual(self, to, ['rfc-editor@rfc-editor.org'])
|
||||
six.assertCountEqual(self, cc, ['The IESG <iesg@ietf.org>', self.author_address,
|
||||
self.assertCountEqual(to, ['rfc-editor@rfc-editor.org'])
|
||||
self.assertCountEqual(cc, ['The IESG <iesg@ietf.org>', self.author_address,
|
||||
'iesg-secretary@ietf.org'])
|
||||
|
||||
def test_trigger_does_not_exist(self):
|
||||
|
@ -39,8 +38,8 @@ class GatherAddressListsTests(TestCase):
|
|||
new_desc = 'Autocreated mailtrigger from doc_pulled_from_rfc_queue'
|
||||
to, cc = gather_address_lists(new_slug, doc=self.doc, desc_if_not_exists=new_desc,
|
||||
create_from_slug_if_not_exists='doc_pulled_from_rfc_queue')
|
||||
six.assertCountEqual(self, to, ['iana@iana.org', 'rfc-editor@rfc-editor.org'])
|
||||
six.assertCountEqual(self, cc, ['The IESG <iesg@ietf.org>', self.author_address,
|
||||
self.assertCountEqual(to, ['iana@iana.org', 'rfc-editor@rfc-editor.org'])
|
||||
self.assertCountEqual(cc, ['The IESG <iesg@ietf.org>', self.author_address,
|
||||
'mars-chairs@ietf.org', 'iesg-secretary@ietf.org'])
|
||||
new_trigger = MailTrigger.objects.get(slug=new_slug)
|
||||
self.assertEqual(new_trigger.desc, new_desc)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright The IETF Trust 2013-2019, All Rights Reserved
|
||||
# Copyright The IETF Trust 2013-2020, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
|
||||
import datetime
|
||||
|
||||
from six.moves.urllib.parse import urlsplit
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
from django.urls import reverse as urlreverse
|
||||
|
||||
|
|
|
@ -10,14 +10,13 @@ import os
|
|||
import random
|
||||
import re
|
||||
import shutil
|
||||
import six
|
||||
|
||||
from unittest import skipIf
|
||||
from mock import patch
|
||||
from pyquery import PyQuery
|
||||
from io import StringIO, BytesIO
|
||||
from bs4 import BeautifulSoup
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from django.urls import reverse as urlreverse
|
||||
from django.conf import settings
|
||||
|
@ -438,7 +437,7 @@ class MeetingTests(TestCase):
|
|||
|
||||
@patch('urllib.request.urlopen')
|
||||
def test_proceedings_attendees(self, mock_urlopen):
|
||||
mock_urlopen.return_value = six.BytesIO(b'[{"LastName":"Smith","FirstName":"John","Company":"ABC","Country":"US"}]')
|
||||
mock_urlopen.return_value = BytesIO(b'[{"LastName":"Smith","FirstName":"John","Company":"ABC","Country":"US"}]')
|
||||
make_meeting_test_data()
|
||||
meeting = MeetingFactory(type_id='ietf', date=datetime.date(2016,7,14), number="96")
|
||||
finalize(meeting)
|
||||
|
@ -453,7 +452,7 @@ class MeetingTests(TestCase):
|
|||
'''Test proceedings IETF Overview page.
|
||||
Note: old meetings aren't supported so need to add a new meeting then test.
|
||||
'''
|
||||
mock_urlopen.return_value = six.BytesIO(b'[{"LastName":"Smith","FirstName":"John","Company":"ABC","Country":"US"}]')
|
||||
mock_urlopen.return_value = BytesIO(b'[{"LastName":"Smith","FirstName":"John","Company":"ABC","Country":"US"}]')
|
||||
make_meeting_test_data()
|
||||
meeting = MeetingFactory(type_id='ietf', date=datetime.date(2016,7,14), number="96")
|
||||
finalize(meeting)
|
||||
|
|
|
@ -8,7 +8,7 @@ import datetime
|
|||
import json
|
||||
import urllib.request
|
||||
|
||||
from six.moves.urllib.error import HTTPError
|
||||
from urllib.error import HTTPError
|
||||
from django.conf import settings
|
||||
from django.template.loader import render_to_string
|
||||
from django.db.models.expressions import Subquery, OuterRef
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
from typing import List, Tuple # pyflakes:ignore
|
||||
from typing import List, Tuple # pyflakes:ignore
|
||||
|
||||
from django.conf import settings
|
||||
from django import forms
|
||||
|
|
|
@ -8,7 +8,6 @@ import datetime
|
|||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import six
|
||||
import tempfile
|
||||
|
||||
from email import message_from_string
|
||||
|
@ -409,7 +408,7 @@ def getheader(header_text, default="ascii"):
|
|||
"""Decode the specified header"""
|
||||
|
||||
tuples = decode_header(header_text)
|
||||
header_sections = [ text.decode(charset or default) if isinstance(text, six.binary_type) else text for text, charset in tuples]
|
||||
header_sections = [ text.decode(charset or default) if isinstance(text, bytes) else text for text, charset in tuples]
|
||||
return "".join(header_sections)
|
||||
|
||||
|
||||
|
|
|
@ -9,10 +9,9 @@ import sys
|
|||
import os
|
||||
import os.path
|
||||
import argparse
|
||||
import six
|
||||
import time
|
||||
if six.PY3:
|
||||
from typing import Set, Optional # pyflakes:ignore
|
||||
|
||||
from typing import Set, Optional # pyflakes:ignore
|
||||
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
|
|
Loading…
Reference in a new issue