Skip to content

Commit 1e2684e

Browse files
committed
Track {set,fset}_union move to pytools
1 parent 4dd83e1 commit 1e2684e

File tree

7 files changed

+13
-23
lines changed

7 files changed

+13
-23
lines changed

loopy/check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import islpy as isl
3636
from islpy import dim_type
3737
from pymbolic.primitives import AlgebraicLeaf, Variable, is_arithmetic_expression
38-
from pytools import memoize_method
38+
from pytools import memoize_method, set_union
3939

4040
from loopy.diagnostic import (
4141
LoopyError,
@@ -72,7 +72,7 @@
7272
check_each_kernel,
7373
)
7474
from loopy.type_inference import TypeReader
75-
from loopy.typing import auto, not_none, set_union
75+
from loopy.typing import auto, not_none
7676

7777

7878
if TYPE_CHECKING:

loopy/kernel/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
from islpy import dim_type
5454
from pytools import (
5555
UniqueNameGenerator,
56+
fset_union,
5657
generate_unique_names,
5758
memoize_method,
5859
natsorted,
@@ -72,7 +73,7 @@
7273
)
7374
from loopy.tools import update_persistent_hash
7475
from loopy.types import LoopyType, NumpyType
75-
from loopy.typing import InsnId, PreambleGenerator, SymbolMangler, fset_union, not_none
76+
from loopy.typing import InsnId, PreambleGenerator, SymbolMangler, not_none
7677

7778

7879
if TYPE_CHECKING:

loopy/kernel/tools.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import pymbolic.primitives as p
4848
from islpy import dim_type
4949
from pymbolic import Expression
50-
from pytools import memoize_on_first_arg, natsorted
50+
from pytools import fset_union, memoize_on_first_arg, natsorted, set_union
5151

5252
from loopy.diagnostic import LoopyError, warn_with_kernel
5353
from loopy.kernel import LoopKernel
@@ -66,7 +66,6 @@
6666
TUnitOrKernelT,
6767
for_each_kernel,
6868
)
69-
from loopy.typing import fset_union, set_union
7069

7170

7271
if TYPE_CHECKING:

loopy/schedule/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@
7070
from constantdict import constantdict
7171

7272
import islpy as isl
73-
from pytools import memoize_method, memoize_on_first_arg
73+
from pytools import fset_union, memoize_method, memoize_on_first_arg
7474

7575
from loopy.diagnostic import LoopyError
7676
from loopy.kernel.data import AddressSpace, ArrayArg, TemporaryVariable
7777
from loopy.schedule.tree import Tree
78-
from loopy.typing import InameStr, InameStrSet, fset_union, not_none
78+
from loopy.typing import InameStr, InameStrSet, not_none
7979

8080

8181
if TYPE_CHECKING:

loopy/transform/loop_fusion.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from constantdict import constantdict
3333
from typing_extensions import override
3434

35-
from pytools import memoize_on_first_arg
35+
from pytools import fset_union, memoize_on_first_arg
3636

3737
from loopy.diagnostic import LoopyError
3838
from loopy.kernel import LoopKernel
@@ -42,7 +42,6 @@
4242
RuleAwareIdentityMapper,
4343
SubstitutionRuleMappingContext,
4444
)
45-
from loopy.typing import InsnId, fset_union
4645

4746

4847
if TYPE_CHECKING:
@@ -51,7 +50,7 @@
5150
from loopy.kernel.instruction import InstructionBase
5251
from loopy.match import RuleStack
5352
from loopy.schedule.tools import LoopNestTree
54-
from loopy.typing import InameStr, InameStrSet
53+
from loopy.typing import InameStr, InameStrSet, InsnId
5554

5655

5756
__doc__ = """

loopy/typing.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,16 @@
5050
"""
5151

5252

53-
from typing import TYPE_CHECKING, TypeAlias, TypeVar, cast
53+
from typing import TYPE_CHECKING, TypeAlias, TypeVar
5454

5555
import numpy as np
56-
from typing_extensions import TypeIs
57-
5856
from pymbolic.primitives import ExpressionNode
5957
from pymbolic.typing import ArithmeticExpression, Expression, Integer
58+
from typing_extensions import TypeIs
6059

6160

6261
if TYPE_CHECKING:
63-
from collections.abc import Callable, Iterable, Iterator
62+
from collections.abc import Callable, Iterator
6463

6564
from loopy.codegen import PreambleInfo
6665
from loopy.kernel import LoopKernel
@@ -124,11 +123,3 @@ def integer_expr_or_err(expr: Expression) -> Integer | ExpressionNode:
124123
def assert_tuple(obj: tuple[ElT, ...] | object) -> tuple[ElT, ...]:
125124
assert isinstance(obj, tuple)
126125
return obj
127-
128-
129-
def set_union(iterable: Iterable[Iterable[T]]):
130-
return cast("set[T]", set()).union(*iterable)
131-
132-
133-
def fset_union(iterable: Iterable[Iterable[T]]):
134-
return cast("frozenset[T]", frozenset()).union(*iterable)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ classifiers = [
2828
"Topic :: Utilities",
2929
]
3030
dependencies = [
31-
"pytools>=2025.1.6",
31+
"pytools>=2025.2.2",
3232
"pymbolic>=2024.2.2",
3333
"genpy>=2016.1.2",
3434

0 commit comments

Comments
 (0)