Skip to content

Commit 5bffeb7

Browse files
committed
Remove six package and its usage since Python 2 is no longer supported
- Removed six dependency from pyproject.toml - Replaced six.text_type and six.string_types with str in base_span.py - Replaced six.string_types with str in test_google-cloud-pubsub.py - Replaced six.moves.http_client with http.client in test_google-cloud-storage.py Signed-off-by: Varsha GS <[email protected]>
1 parent e9820b9 commit 5bffeb7

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ dependencies = [
4747
"autowrapt>=1.0",
4848
"fysom>=2.1.2",
4949
"requests>=2.6.0",
50-
"six>=1.12.0",
5150
"urllib3>=1.26.5",
5251
"opentelemetry-api>=1.27.0",
5352
"opentelemetry-semantic-conventions>=0.48b0",

src/instana/span/base_span.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# (c) Copyright IBM Corp. 2024
22

33
from typing import TYPE_CHECKING, Type
4-
import six
54

65
from instana.log import logger
76
from instana.util import DictionaryOfStan
@@ -83,12 +82,12 @@ def _validate_attribute(self, key, value):
8382

8483
try:
8584
# Attribute keys must be some type of text or string type
86-
if isinstance(key, (six.text_type, six.string_types)):
85+
if isinstance(key, str):
8786
validated_key = key[0:1024] # Max key length of 1024 characters
8887

8988
if isinstance(
9089
value,
91-
(bool, float, int, list, dict, six.text_type, six.string_types),
90+
(bool, float, int, list, dict, str),
9291
):
9392
validated_value = value
9493
else:

tests/clients/test_google-cloud-pubsub.py

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

99
import pytest
10-
import six
1110
from google.api_core.exceptions import AlreadyExists
1211
from google.cloud.pubsub_v1 import PublisherClient, SubscriberClient
1312
from google.cloud.pubsub_v1.publisher import exceptions
@@ -51,7 +50,7 @@ def test_publish(self) -> None:
5150
)
5251
time.sleep(2.0) # for sanity
5352
result = future.result()
54-
assert isinstance(result, six.string_types)
53+
assert isinstance(result, str)
5554

5655
spans = self.recorder.queued_spans()
5756
gcps_span, test_span = spans[0], spans[1]
@@ -80,7 +79,7 @@ def test_publish_as_root_exit_span(self) -> None:
8079
)
8180
time.sleep(2.0) # for sanity
8281
result = future.result()
83-
assert isinstance(result, six.string_types)
82+
assert isinstance(result, str)
8483

8584
spans = self.recorder.queued_spans()
8685
assert len(spans) == 1
@@ -161,7 +160,7 @@ def test_subscribe(self) -> None:
161160
future = self.publisher.publish(
162161
self.topic_path, b"Test Message to PubSub", origin="instana"
163162
)
164-
assert isinstance(future.result(), six.string_types)
163+
assert isinstance(future.result(), str)
165164

166165
time.sleep(2.0) # for sanity
167166

tests/clients/test_google-cloud-storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from opentelemetry.trace import SpanKind
1515

1616
from mock import patch, Mock
17-
from six.moves import http_client
17+
import http.client as http_client
1818

1919
from google.cloud import storage
2020
from google.api_core import iam, page_iterator

0 commit comments

Comments
 (0)