diff --git a/opentelemetry-api/src/opentelemetry/context/__init__.py b/opentelemetry-api/src/opentelemetry/context/__init__.py index 3e85b64fe48..b8b0ee6445b 100644 --- a/opentelemetry-api/src/opentelemetry/context/__init__.py +++ b/opentelemetry-api/src/opentelemetry/context/__init__.py @@ -22,7 +22,7 @@ # pylint: disable=wrong-import-position from opentelemetry.context.context import Context, _RuntimeContext # noqa from opentelemetry.environment_variables import OTEL_PYTHON_CONTEXT -from opentelemetry.util._importlib_metadata import entry_points +from opentelemetry.util._importlib_metadata import entry_points # type: ignore logger = logging.getLogger(__name__) _RUNTIME_CONTEXT = None # type: typing.Optional[_RuntimeContext] diff --git a/opentelemetry-api/src/opentelemetry/propagate/__init__.py b/opentelemetry-api/src/opentelemetry/propagate/__init__.py index 56f217f282d..fb45bd2e0dd 100644 --- a/opentelemetry-api/src/opentelemetry/propagate/__init__.py +++ b/opentelemetry-api/src/opentelemetry/propagate/__init__.py @@ -75,7 +75,7 @@ def example_route(): from opentelemetry.context.context import Context from opentelemetry.environment_variables import OTEL_PROPAGATORS from opentelemetry.propagators import composite, textmap -from opentelemetry.util._importlib_metadata import entry_points +from opentelemetry.util._importlib_metadata import entry_points # type: ignore logger = getLogger(__name__) diff --git a/opentelemetry-api/src/opentelemetry/util/_importlib_metadata.py b/opentelemetry-api/src/opentelemetry/util/_importlib_metadata.py index 71bc92e60ad..09c626cd940 100644 --- a/opentelemetry-api/src/opentelemetry/util/_importlib_metadata.py +++ b/opentelemetry-api/src/opentelemetry/util/_importlib_metadata.py @@ -12,8 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# type: ignore + from sys import version_info -from typing import Dict, List, Union +from typing import Dict, Tuple, Union # This is a cache to avoid going through creating a dictionary for all entry # points for 3.7 every time the entry points function is called. @@ -24,11 +26,13 @@ # pylint: disable=import-error from importlib_metadata import EntryPoint from importlib_metadata import ( - entry_points as importlib_metadata_entry_points, # type: ignore + entry_points as importlib_metadata_entry_points, ) from importlib_metadata import version - def entry_points(group: str = None, name: str = None) -> Union[List, Dict]: + def entry_points( + group: str = None, name: str = None + ) -> Union[Tuple, Dict]: if group is None and name is None: @@ -84,7 +88,9 @@ def entry_points(group: str = None, name: str = None) -> Union[List, Dict]: ) from importlib.metadata import version - def entry_points(group: str = None, name: str = None) -> Union[List, Dict]: + def entry_points( + group: str = None, name: str = None + ) -> Union[Tuple, Dict]: result_key_entry_points = importlib_metadata_entry_points() @@ -130,7 +136,9 @@ def entry_points(group: str = None, name: str = None) -> Union[List, Dict]: ) from importlib.metadata import version - def entry_points(group: str = None, name: str = None) -> Union[List, Dict]: + def entry_points( + group: str = None, name: str = None + ) -> Union[Tuple, Dict]: if group is None and name is None: result_entry_points = {} diff --git a/opentelemetry-api/src/opentelemetry/util/_providers.py b/opentelemetry-api/src/opentelemetry/util/_providers.py index d255ac999f0..6d1d5f3b782 100644 --- a/opentelemetry-api/src/opentelemetry/util/_providers.py +++ b/opentelemetry-api/src/opentelemetry/util/_providers.py @@ -16,7 +16,7 @@ from os import environ from typing import TYPE_CHECKING, TypeVar, cast -from opentelemetry.util._importlib_metadata import entry_points +from opentelemetry.util._importlib_metadata import entry_points # type: ignore if TYPE_CHECKING: from opentelemetry.metrics import MeterProvider diff --git a/opentelemetry-api/tests/util/test__importlib_metadata.py b/opentelemetry-api/tests/util/test__importlib_metadata.py index 137b5d8882c..7e60654f7de 100644 --- a/opentelemetry-api/tests/util/test__importlib_metadata.py +++ b/opentelemetry-api/tests/util/test__importlib_metadata.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# type: ignore + from typing import Dict, Tuple from unittest import TestCase