Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change isinstance(..., frozenset) to isinstance(..., abc.Set) #823

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading