Skip to content

Commit 497d192

Browse files
committed
Remove six as a dependency (closes #435)
This completes the work to deprecate Python 2.x that began with #430 (closes #409).
1 parent 9e7650c commit 497d192

8 files changed

Lines changed: 19 additions & 29 deletions

File tree

hca/upload/upload_area_uri.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from six.moves.urllib.parse import urlparse
1+
# -*- coding: utf-8 -*-
2+
import urllib.parse
23

34

45
class UploadAreaURI:
@@ -11,7 +12,7 @@ class UploadAreaURI:
1112

1213
def __init__(self, uri):
1314
self.uri = uri
14-
self.parsed = urlparse(self.uri)
15+
self.parsed = urllib.parse.urlparse(self.uri)
1516

1617
def __str__(self):
1718
return self.uri

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ PyJWT >= 1.6.4
1717
requests >= 2.20.0, < 3
1818
rsa<=3.5.0,>=3.1.2
1919
s3transfer<0.3.0,>=0.2.0
20-
six >= 1.10, < 2
2120
tenacity >=5.0.2, < 5.1
2221
tweak >= 1.0.2, < 2

test/integration/upload/cli/test_creds.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from argparse import Namespace
88

99
import responses
10-
import six
1110

1211
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')) # noqa
1312
sys.path.insert(0, pkg_root) # noqa
@@ -30,9 +29,9 @@ def test_creds(self):
3029

3130
non_blank_lines = [s for s in stdout.captured().split("\n") if s]
3231
self.assertEqual(3, len(non_blank_lines))
33-
six.assertRegex(self, stdout.captured(), "AWS_ACCESS_KEY_ID=")
34-
six.assertRegex(self, stdout.captured(), "AWS_SECRET_ACCESS_KEY=")
35-
six.assertRegex(self, stdout.captured(), "AWS_SESSION_TOKEN=")
32+
self.assertRegex(stdout.captured(), "AWS_ACCESS_KEY_ID=")
33+
self.assertRegex(stdout.captured(), "AWS_SECRET_ACCESS_KEY=")
34+
self.assertRegex(stdout.captured(), "AWS_SESSION_TOKEN=")
3635

3736

3837
if __name__ == "__main__":

test/integration/upload/cli/test_forget.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import unittest
77
from argparse import Namespace
88

9-
import six
10-
119
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..")) # noqa
1210
sys.path.insert(0, pkg_root) # noqa
1311

@@ -38,7 +36,7 @@ def test_when_given_an_alias_that_matches_no_areas_it_prints_a_warning(self):
3836
args = Namespace(uuid_or_alias='bogo-uuid')
3937
ForgetCommand(args)
4038

41-
six.assertRegex(self, stdout.captured(), "don't recognize area")
39+
self.assertRegex(stdout.captured(), "don't recognize area")
4240

4341
def test_when_given_an_alias_that_matches_more_than_one_area_it_prints_a_warning(self):
4442
self.mock_upload_area('deadbeef-dead-dead-dead-beeeeeeeeeef')
@@ -49,7 +47,7 @@ def test_when_given_an_alias_that_matches_more_than_one_area_it_prints_a_warning
4947
args = Namespace(uuid_or_alias='dea')
5048
ForgetCommand(args)
5149

52-
six.assertRegex(self, stdout.captured(), "matches more than one")
50+
self.assertRegex(stdout.captured(), "matches more than one")
5351

5452

5553
if __name__ == "__main__":

test/integration/upload/cli/test_list_area.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import unittest
88

99
import responses
10-
import six
1110

1211
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..")) # noqa
1312
sys.path.insert(0, pkg_root) # noqa
@@ -57,9 +56,9 @@ def test_list_area_command_with_long_option(self):
5756
with CapturingIO('stdout') as stdout:
5857
ListAreaCommand(Namespace(long=True))
5958

60-
six.assertRegex(self, stdout.captured(), "size\s+123")
61-
six.assertRegex(self, stdout.captured(), "Content-Type\s+binary/octet-stream; dcp-type=data")
62-
six.assertRegex(self, stdout.captured(), "SHA1\s+shaaa")
59+
self.assertRegex(stdout.captured(), "size\s+123")
60+
self.assertRegex(stdout.captured(), "Content-Type\s+binary/octet-stream; dcp-type=data")
61+
self.assertRegex(stdout.captured(), "SHA1\s+shaaa")
6362

6463

6564
if __name__ == "__main__":

test/integration/upload/cli/test_list_areas.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import unittest
77
from argparse import Namespace
88

9-
import six
10-
119
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')) # noqa
1210
sys.path.insert(0, pkg_root) # noqa
1311

@@ -34,8 +32,8 @@ def test_it_lists_areas_when_there_are_some(self):
3432
with CapturingIO('stdout') as stdout:
3533
ListAreasCommand(Namespace())
3634

37-
six.assertRegex(self, stdout.captured(), "%s <- selected" % a_uuid)
38-
six.assertRegex(self, stdout.captured(), b_uuid)
35+
self.assertRegex(stdout.captured(), "%s <- selected" % a_uuid)
36+
self.assertRegex(stdout.captured(), b_uuid)
3937

4038

4139
if __name__ == "__main__":

test/integration/upload/cli/test_select.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import unittest
88
from argparse import Namespace
99

10-
import six
11-
1210
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..")) # noqa
1311
sys.path.insert(0, pkg_root) # noqa
1412

@@ -63,7 +61,7 @@ def test_when_given_a_uri_it_prints_an_alias(self):
6361
args = Namespace(uri_or_alias=new_area_uri)
6462
SelectCommand(args)
6563

66-
six.assertRegex(self, stdout.captured(), "alias \"{}\"".format('deaf'))
64+
self.assertRegex(stdout.captured(), "alias \"{}\"".format('deaf'))
6765

6866
def test_when_given_an_alias_that_matches_no_areas_it_prints_a_warning(self):
6967

@@ -75,7 +73,7 @@ def test_when_given_an_alias_that_matches_no_areas_it_prints_a_warning(self):
7573
args = Namespace(uri_or_alias='aaa')
7674
SelectCommand(args)
7775

78-
six.assertRegex(self, stdout.captured(), "don't recognize area")
76+
self.assertRegex(stdout.captured(), "don't recognize area")
7977

8078
def test_when_given_an_alias_that_matches_more_than_one_area_it_prints_a_warning(self):
8179
config = hca.get_config()
@@ -91,7 +89,7 @@ def test_when_given_an_alias_that_matches_more_than_one_area_it_prints_a_warning
9189
args = Namespace(uri_or_alias='dea')
9290
SelectCommand(args)
9391

94-
six.assertRegex(self, stdout.captured(), "matches more than one")
92+
self.assertRegex(stdout.captured(), "matches more than one")
9593

9694
def test_when_given_an_alias_that_matches_one_area_it_selects_it(self):
9795
a_uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'

test/unit/test_dss_client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
import os
55
import platform
66
import shutil
7-
import sys
87
import tempfile
98
import threading
109
import unittest
1110
import uuid
12-
import six
1311

1412
from mock import patch
1513
from hca.util.compat import walk
@@ -82,9 +80,9 @@ def _fake_do_download_file_with_barrier(*args, **kwargs):
8280
"""
8381
barrier.wait()
8482
fh = args[1]
85-
fh.write(six.b('Here we write some stuff so that the fake download takes some time. '
86-
'This helps ensure that multiple threads are writing at once and thus '
87-
'allows us to test for race conditions.'))
83+
fh.write(b'Here we write some stuff so that the fake download takes some time. '
84+
b'This helps ensure that multiple threads are writing at once and thus '
85+
b'allows us to test for race conditions.')
8886
return 'FAKEhash'
8987

9088

0 commit comments

Comments
 (0)