Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
10 changes: 5 additions & 5 deletions ufl/corealg/dag_traverser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from functools import singledispatchmethod, wraps
from typing import overload
from typing import Any, overload

from ufl.classes import Expr
from ufl.form import BaseForm
Expand Down Expand Up @@ -32,7 +32,7 @@ def __init__(
self._visited_cache = {} if visited_cache is None else visited_cache
self._result_cache = {} if result_cache is None else result_cache

def __call__(self, node: Expr, **kwargs) -> Expr:
def __call__(self, node: Expr, **kwargs) -> Any:
"""Perform memoised DAG traversal with ``process`` singledispatch method.

Args:
Expand All @@ -42,7 +42,7 @@ def __call__(self, node: Expr, **kwargs) -> Expr:
keyword arguments for the ``process`` singledispatchmethod.

Returns:
Processed Expression.
Result from processing the Expression.

"""
cache_key = (node, tuple((k, v) for k, v in kwargs.items()))
Expand All @@ -65,7 +65,7 @@ def __call__(self, node: Expr, **kwargs) -> Expr:
return result

@singledispatchmethod
def process(self, o: Expr, **kwargs) -> Expr:
def process(self, o: Expr, **kwargs) -> Any:
"""Process node by type.

Args:
Expand All @@ -75,7 +75,7 @@ def process(self, o: Expr, **kwargs) -> Expr:
Keyword arguments for the ``process`` singledispatchmethod.

Returns:
Processed :py:class:`Expr`.
Result from processing the Expression.
"""
raise AssertionError(f"Rule not set for {type(o)}")

Expand Down
Loading