Skip to content

Commit

Permalink
fix: remove six (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 authored Sep 20, 2021
1 parent 978174f commit 95f94ef
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 25 deletions.
4 changes: 1 addition & 3 deletions google/cloud/dns/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

"""Define API ResourceRecordSets."""

import six

from google.cloud._helpers import _rfc3339_to_datetime
from google.cloud.exceptions import NotFound
from google.cloud.dns.resource_record_set import ResourceRecordSet
Expand Down Expand Up @@ -105,7 +103,7 @@ def name(self, value):
:type value: str
:param value: New name for the changeset.
"""
if not isinstance(value, six.string_types):
if not isinstance(value, str):
raise ValueError("Pass a string")
self._properties["id"] = value

Expand Down
6 changes: 2 additions & 4 deletions google/cloud/dns/zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

"""Define API ManagedZones."""

import six

from google.api_core import page_iterator
from google.cloud._helpers import _rfc3339_to_datetime
from google.cloud.exceptions import NotFound
Expand Down Expand Up @@ -143,7 +141,7 @@ def description(self, value):
:raises: ValueError for invalid value types.
"""
if not isinstance(value, six.string_types) and value is not None:
if not isinstance(value, str) and value is not None:
raise ValueError("Pass a string, or None")
self._properties["description"] = value

Expand All @@ -170,7 +168,7 @@ def name_server_set(self, value):
:raises: ValueError for invalid value types.
"""
if not isinstance(value, six.string_types) and value is not None:
if not isinstance(value, str) and value is not None:
raise ValueError("Pass a string, or None")
self._properties["nameServerSet"] = value

Expand Down
12 changes: 6 additions & 6 deletions tests/unit/test__http.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)

def test_build_api_url_no_extra_query_params(self):
from six.moves.urllib.parse import parse_qsl
from six.moves.urllib.parse import urlsplit
from urllib.parse import parse_qsl
from urllib.parse import urlsplit

conn = self._make_one(object())
uri = conn.build_api_url("/foo")
Expand All @@ -42,8 +42,8 @@ def test_build_api_url_no_extra_query_params(self):
self.assertEqual(parms, {})

def test_build_api_url_w_custom_endpoint(self):
from six.moves.urllib.parse import parse_qsl
from six.moves.urllib.parse import urlsplit
from urllib.parse import parse_qsl
from urllib.parse import urlsplit

custom_endpoint = "https://foo-dns.googleapis.com"
conn = self._make_one(object(), api_endpoint=custom_endpoint)
Expand All @@ -57,8 +57,8 @@ def test_build_api_url_w_custom_endpoint(self):
self.assertEqual(parms, {})

def test_build_api_url_w_extra_query_params(self):
from six.moves.urllib.parse import parse_qsl
from six.moves.urllib.parse import urlsplit
from urllib.parse import parse_qsl
from urllib.parse import urlsplit

conn = self._make_one(object())
uri = conn.build_api_url("/foo", {"bar": "baz"})
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def test_quotas_w_kind_key(self):
self.assertEqual(req["path"], "/%s" % PATH)

def test_list_zones_defaults(self):
import six
from google.cloud.dns.zone import ManagedZone

ID_1 = "123"
Expand Down Expand Up @@ -225,7 +224,7 @@ def test_list_zones_defaults(self):
conn = client._connection = _Connection(DATA)

iterator = client.list_zones()
page = six.next(iterator.pages)
page = next(iterator.pages)
zones = list(page)
token = iterator.next_page_token

Expand All @@ -243,7 +242,6 @@ def test_list_zones_defaults(self):
self.assertEqual(req["path"], "/%s" % PATH)

def test_list_zones_explicit(self):
import six
from google.cloud.dns.zone import ManagedZone

ID_1 = "123"
Expand Down Expand Up @@ -275,7 +273,7 @@ def test_list_zones_explicit(self):
conn = client._connection = _Connection(DATA)

iterator = client.list_zones(max_results=3, page_token=TOKEN)
page = six.next(iterator.pages)
page = next(iterator.pages)
zones = list(page)
token = iterator.next_page_token

Expand Down
12 changes: 4 additions & 8 deletions tests/unit/test_zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ def test_delete_w_alternate_client(self):
self.assertEqual(req["path"], "/%s" % PATH)

def test_list_resource_record_sets_defaults(self):
import six
from google.cloud.dns.resource_record_set import ResourceRecordSet

PATH = "projects/%s/managedZones/%s/rrsets" % (self.PROJECT, self.ZONE_NAME)
Expand Down Expand Up @@ -450,7 +449,7 @@ def test_list_resource_record_sets_defaults(self):

iterator = zone.list_resource_record_sets()
self.assertIs(zone, iterator.zone)
page = six.next(iterator.pages)
page = next(iterator.pages)
rrsets = list(page)
token = iterator.next_page_token

Expand All @@ -469,7 +468,6 @@ def test_list_resource_record_sets_defaults(self):
self.assertEqual(req["path"], "/%s" % PATH)

def test_list_resource_record_sets_explicit(self):
import six
from google.cloud.dns.resource_record_set import ResourceRecordSet

PATH = "projects/%s/managedZones/%s/rrsets" % (self.PROJECT, self.ZONE_NAME)
Expand Down Expand Up @@ -510,7 +508,7 @@ def test_list_resource_record_sets_explicit(self):
max_results=3, page_token=TOKEN, client=client2
)
self.assertIs(zone, iterator.zone)
page = six.next(iterator.pages)
page = next(iterator.pages)
rrsets = list(page)
token = iterator.next_page_token

Expand Down Expand Up @@ -574,7 +572,6 @@ def _get_changes(self, token, changes_name):
return result

def test_list_changes_defaults(self):
import six
from google.cloud.dns.changes import Changes
from google.cloud.dns.resource_record_set import ResourceRecordSet

Expand All @@ -590,7 +587,7 @@ def test_list_changes_defaults(self):

iterator = zone.list_changes()
self.assertIs(zone, iterator.zone)
page = six.next(iterator.pages)
page = next(iterator.pages)
changes = list(page)
token = iterator.next_page_token

Expand Down Expand Up @@ -625,7 +622,6 @@ def test_list_changes_defaults(self):
self.assertEqual(req["path"], "/%s" % (path,))

def test_list_changes_explicit(self):
import six
from google.cloud.dns.changes import Changes
from google.cloud.dns.resource_record_set import ResourceRecordSet

Expand All @@ -644,7 +640,7 @@ def test_list_changes_explicit(self):
max_results=3, page_token=page_token, client=client2
)
self.assertIs(zone, iterator.zone)
page = six.next(iterator.pages)
page = next(iterator.pages)
changes = list(page)
token = iterator.next_page_token

Expand Down

0 comments on commit 95f94ef

Please sign in to comment.