From 1d2ed1827efe401108c3585aecc51287dd485330 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Tue, 21 May 2024 13:08:01 -0500 Subject: [PATCH] Improve to_identifier --- arraycontext/impl/pytato/compile.py | 12 ++++-------- setup.py | 4 +--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/arraycontext/impl/pytato/compile.py b/arraycontext/impl/pytato/compile.py index dd21ad4c..6adea7a2 100644 --- a/arraycontext/impl/pytato/compile.py +++ b/arraycontext/impl/pytato/compile.py @@ -39,7 +39,7 @@ from immutabledict import immutabledict import pytato as pt -from pytools import ProcessLogger +from pytools import ProcessLogger, to_identifier from pytools.tag import Tag from arraycontext.container import ArrayContainer, is_array_container_type @@ -52,19 +52,15 @@ logger = logging.getLogger(__name__) -def _to_identifier(s: str) -> str: - return "".join(ch for ch in s if ch.isidentifier()) - - def _prg_id_to_kernel_name(f: Any) -> str: if callable(f): - name = getattr(f, "__name__", "") + name = getattr(f, "__name__", "anonymous") if not name.isidentifier(): - return "actx_compiled_" + _to_identifier(name) + return "actx_compiled_" + to_identifier(name) else: return name else: - return _to_identifier(str(f)) + return to_identifier(str(f)) class FromArrayContextCompile(Tag): diff --git a/setup.py b/setup.py index 65631303..0dd5c696 100644 --- a/setup.py +++ b/setup.py @@ -39,9 +39,7 @@ def main(): python_requires="~=3.8", install_requires=[ "numpy", - - # https://github.com/inducer/arraycontext/pull/147 - "pytools>=2022.1.3", + "pytools>=2024.1.3", "immutabledict", "loopy>=2019.1", ],