instead of checking if item is list or tuple, just check if it's iterable

This commit is contained in:
dieser-niko 2024-10-13 22:23:57 +02:00
parent ef69d4dde4
commit 77b2bd90bc

View File

@ -6,6 +6,7 @@ __all__ = ["CLIENT_CREDS_ENV_VARS", "get_host_port", "normalize_scope", "Retry"]
import logging import logging
from types import TracebackType from types import TracebackType
from collections.abc import Iterable
import urllib3 import urllib3
@ -48,7 +49,8 @@ def normalize_scope(scope):
if scope: if scope:
if isinstance(scope, str): if isinstance(scope, str):
scopes = scope.split(',') scopes = scope.split(',')
elif isinstance(scope, list) or isinstance(scope, tuple):
elif isinstance(scope, Iterable):
scopes = scope scopes = scope
else: else:
raise Exception( raise Exception(