Skip to content

Commit

Permalink
Un-type symbolic.flatten
Browse files Browse the repository at this point in the history
This restores compatibility with pymbolic 2022.2

x-ref: firedrakeproject/loopy#27
  • Loading branch information
inducer committed Nov 6, 2024
1 parent 7ac9fa6 commit da84302
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions loopy/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
Mapping,
Sequence,
Tuple,
TypeVar,
cast,
)

import immutables
Expand All @@ -49,7 +47,6 @@
import pymbolic.primitives as p
import pytools.lex
from islpy import dim_type
from pymbolic import ArithmeticExpressionT
from pymbolic.mapper import (
CachedCombineMapper as CombineMapperBase,
CachedIdentityMapper as IdentityMapperBase,
Expand Down Expand Up @@ -211,14 +208,8 @@ class FlattenMapper(FlattenMapperBase, IdentityMapperMixin):
pass


ArithmeticOrExpressionT = TypeVar(
"ArithmeticOrExpressionT",
ArithmeticExpressionT,
ExpressionT)


def flatten(expr: ArithmeticOrExpressionT) -> ArithmeticOrExpressionT:
return cast(ArithmeticOrExpressionT, FlattenMapper()(expr))
def flatten(expr):
return FlattenMapper()(expr)


class IdentityMapper(IdentityMapperBase, IdentityMapperMixin):
Expand Down

0 comments on commit da84302

Please sign in to comment.