diff --git a/pymbolic/imperative/utils.py b/pymbolic/imperative/utils.py index 6df33a69..5041ef1f 100644 --- a/pymbolic/imperative/utils.py +++ b/pymbolic/imperative/utils.py @@ -94,9 +94,9 @@ def get_node_attrs(stmt): if 0: for dep in stmt.then_depends_on: - annotation_dep_graph[(stmt.id, dep)] = "then" + annotation_dep_graph[stmt.id, dep] = "then" for dep in stmt.else_depends_on: - annotation_dep_graph[(stmt.id, dep)] = "else" + annotation_dep_graph[stmt.id, dep] = "else" # {{{ O(n^3) (i.e. slow) transitive reduction diff --git a/pymbolic/mapper/__init__.py b/pymbolic/mapper/__init__.py index 034cc755..56b34a82 100644 --- a/pymbolic/mapper/__init__.py +++ b/pymbolic/mapper/__init__.py @@ -1063,11 +1063,12 @@ def map_common_subexpression(self, expr, *args): except AttributeError: ccd = self._cse_cache_dict = {} + key = (expr, *args) try: - return ccd[(expr, *args)] + return ccd[key] except KeyError: result = self.map_common_subexpression_uncached(expr, *args) - ccd[(expr, *args)] = result + ccd[key] = result return result @abstractmethod diff --git a/pyproject.toml b/pyproject.toml index 3e4435dd..f416506d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,7 @@ extend-select = [ "W", # pycodestyle ] extend-ignore = [ + "C409", # remove comprehension within tuple call "C90", # McCabe complexity "E226", # missing whitespace around arithmetic operator "E241", # multiple spaces after comma