Skip to content

Commit

Permalink
change isinstance(..., frozenset) to isinstance(..., abc.Set)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener authored and inducer committed Feb 12, 2024
1 parent b62de69 commit 0b49c91
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions loopy/kernel/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

from loopy.diagnostic import LoopyError
from loopy.tools import Optional
from collections.abc import Set as abc_Set


# {{{ instruction tags
Expand Down Expand Up @@ -186,7 +187,7 @@ class InstructionBase(ImmutableRecord, Taggable):
A :class:`frozenset` of subclasses of :class:`pytools.tag.Tag` used to
provide metadata on this object. Legacy string tags are converted to
:class:`LegacyStringInstructionTag` or, if they used to carry
a functional meaning, the tag carrying that same fucntional meaning
a functional meaning, the tag carrying that same functional meaning
(e.g. :class:`UseStreamingStoreTag`).
.. automethod:: __init__
Expand Down Expand Up @@ -267,7 +268,7 @@ def __init__(self, id, depends_on, depends_on_is_final,
if depends_on_is_final is None:
depends_on_is_final = False

if depends_on_is_final and not isinstance(depends_on, frozenset):
if depends_on_is_final and not isinstance(depends_on, abc_Set):
raise LoopyError("Setting depends_on_is_final to True requires "
"actually specifying depends_on")

Expand All @@ -277,7 +278,7 @@ def __init__(self, id, depends_on, depends_on_is_final,
if priority is None:
priority = 0

if not isinstance(tags, frozenset):
if not isinstance(tags, abc_Set):
# was previously allowed to be tuple
tags = frozenset(tags)

Expand All @@ -292,10 +293,10 @@ def __init__(self, id, depends_on, depends_on_is_final,
# assert all(is_interned(iname) for iname in within_inames)
# assert all(is_interned(pred) for pred in predicates)

assert isinstance(within_inames, frozenset)
assert isinstance(depends_on, frozenset) or depends_on is None
assert isinstance(groups, frozenset)
assert isinstance(conflicts_with_groups, frozenset)
assert isinstance(within_inames, abc_Set)
assert isinstance(depends_on, abc_Set) or depends_on is None
assert isinstance(groups, abc_Set)
assert isinstance(conflicts_with_groups, abc_Set)

ImmutableRecord.__init__(self,
id=id,
Expand Down

0 comments on commit 0b49c91

Please sign in to comment.