From 994bcc76a7984328e95397139addc28e815211e7 Mon Sep 17 00:00:00 2001 From: Frederik Hennig <frederik.hennig@fau.de> Date: Mon, 18 Dec 2023 13:50:26 +0100 Subject: [PATCH] rename PsTypedSymbol -> PsTypedVariable --- pystencils/nbackend/ast/nodes.py | 6 +++--- pystencils/nbackend/ast/transformations.py | 6 +++--- pystencils/nbackend/typed_expressions.py | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pystencils/nbackend/ast/nodes.py b/pystencils/nbackend/ast/nodes.py index 16a7bd299..584455db4 100644 --- a/pystencils/nbackend/ast/nodes.py +++ b/pystencils/nbackend/ast/nodes.py @@ -5,7 +5,7 @@ from abc import ABC import pymbolic.primitives as pb -from ..typed_expressions import PsTypedSymbol, PsLvalue +from ..typed_expressions import PsTypedVariable, PsLvalue class PsAstNode(ABC): @@ -77,8 +77,8 @@ class PsLvalueExpr(PsExpression): class PsSymbolExpr(PsLvalueExpr): """Wrapper around PsTypedSymbols""" - def __init__(self, symbol: PsTypedSymbol): - if not isinstance(symbol, PsTypedSymbol): + def __init__(self, symbol: PsTypedVariable): + if not isinstance(symbol, PsTypedVariable): raise TypeError("Not a symbol!") super(PsLvalueExpr, self).__init__(symbol) diff --git a/pystencils/nbackend/ast/transformations.py b/pystencils/nbackend/ast/transformations.py index 41a4d9e27..91c3850f2 100644 --- a/pystencils/nbackend/ast/transformations.py +++ b/pystencils/nbackend/ast/transformations.py @@ -5,7 +5,7 @@ from typing import Dict from pymbolic.primitives import Expression from pymbolic.mapper.substitutor import CachedSubstitutionMapper -from ..typed_expressions import PsTypedSymbol +from ..typed_expressions import PsTypedVariable from .dispatcher import ast_visitor from .nodes import PsAstNode, PsAssignment, PsLoop, PsExpression @@ -21,7 +21,7 @@ class PsAstTransformer(ABC): class PsSymbolsSubstitutor(PsAstTransformer): - def __init__(self, subs_dict: Dict[PsTypedSymbol, Expression]): + def __init__(self, subs_dict: Dict[PsTypedVariable, Expression]): self._subs_dict = subs_dict self._mapper = CachedSubstitutionMapper(lambda s: self._subs_dict.get(s, None)) @@ -33,7 +33,7 @@ class PsSymbolsSubstitutor(PsAstTransformer): @visit.case(PsAssignment) def assignment(self, asm: PsAssignment): lhs_expr = asm.lhs.expression - if isinstance(lhs_expr, PsTypedSymbol) and lhs_expr in self._subs_dict: + if isinstance(lhs_expr, PsTypedVariable) and lhs_expr in self._subs_dict: raise ValueError(f"Cannot substitute symbol {lhs_expr} that occurs on a left-hand side of an assignment.") self.transform_children(asm) return asm diff --git a/pystencils/nbackend/typed_expressions.py b/pystencils/nbackend/typed_expressions.py index d418e875d..761f2eba3 100644 --- a/pystencils/nbackend/typed_expressions.py +++ b/pystencils/nbackend/typed_expressions.py @@ -7,9 +7,9 @@ import pymbolic.primitives as pb from ..typing import AbstractType, BasicType -class PsTypedSymbol(pb.Variable): +class PsTypedVariable(pb.Variable): def __init__(self, name: str, dtype: AbstractType): - super(PsTypedSymbol, self).__init__(name) + super(PsTypedVariable, self).__init__(name) self._dtype = dtype @property @@ -17,7 +17,7 @@ class PsTypedSymbol(pb.Variable): return self._dtype -class PsArrayBasePointer(PsTypedSymbol): +class PsArrayBasePointer(PsTypedVariable): def __init__(self, name: str, base_type: AbstractType): super(PsArrayBasePointer, self).__init__(name, base_type) @@ -27,7 +27,7 @@ class PsArrayAccess(pb.Subscript): super(PsArrayAccess, self).__init__(base_ptr, index) -PsLvalue: TypeAlias = Union[PsTypedSymbol, PsArrayAccess] +PsLvalue: TypeAlias = Union[PsTypedVariable, PsArrayAccess] class PsTypedConstant: -- GitLab