Skip to content

Commit

Permalink
work around old typeshed stubs for importlib.metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Mar 15, 2022
1 parent 3e59283 commit 266c14e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion distributed/comm/registry.py
Expand Up @@ -4,9 +4,18 @@
import sys
from abc import ABC, abstractmethod
from collections.abc import Iterable
from typing import Protocol


class _EntryPoints(Protocol):
def __call__(self, **kwargs: str) -> Iterable[importlib.metadata.EntryPoint]:
...


if sys.version_info >= (3, 10):
_entry_points = importlib.metadata.entry_points
# py3.10 importlib.metadata type annotations are not in mypy yet
# https://github.com/python/typeshed/pull/7331
_entry_points: _EntryPoints = importlib.metadata.entry_points # type: ignore[assignment]
else:

def _entry_points(
Expand Down

0 comments on commit 266c14e

Please sign in to comment.