diff --git a/doc/conf.py b/doc/conf.py index 068615d4a494bf9a3c624b51288ed6f806491853..70a55f0c8b0af0ad56a6b73303ef6393b33fc99c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -31,7 +31,6 @@ intersphinx_mapping = { "https://documen.tician.de/loopy/": None, } - nitpick_ignore_regex = [ ["py:class", r"typing_extensions\.(.+)"], ] diff --git a/pytools/tag.py b/pytools/tag.py index 032a85070f19dc7ccb63b291c58db90e3718adc4..ce05f48137b1a118ac3b0ba8dcf2104886eb08cf 100644 --- a/pytools/tag.py +++ b/pytools/tag.py @@ -18,9 +18,9 @@ Supporting Functionality Internal stuff that is only here because the documentation tool wants it ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. class:: TagsOfTypeT +.. class:: TagT - A type variable used in :meth:`Taggable.tags_of_type`. + A type variable with lower bound :class:`Tag`. """ import sys @@ -166,7 +166,7 @@ class UniqueTag(Tag): ToTagSetConvertible = Union[Iterable[Tag], Tag, None] -TagsOfTypeT = TypeVar("TagsOfTypeT", bound="Type[Tag]") +TagT = TypeVar("TagT", bound="Tag") # {{{ UniqueTag rules checking @@ -313,15 +313,13 @@ class Taggable: return self._with_new_tags(tags=check_tag_uniqueness(new_tags)) @memoize_method - def tags_of_type(self, tag_t: TagsOfTypeT) -> FrozenSet[TagsOfTypeT]: + def tags_of_type(self, tag_t: Type[TagT]) -> FrozenSet[TagT]: """ Returns *self*'s tags of type *tag_t*. """ - # type-ignore reason: mypy can't tell the generator has elements of - # type 'TagsOfTypeT' (infers it as elements of type 'Tag') - return frozenset(tag # type: ignore[misc] + return frozenset({tag for tag in self.tags - if isinstance(tag, tag_t)) + if isinstance(tag, tag_t)}) # }}}