Skip to content

Commit

Permalink
fix issues with ruff 0.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl committed Aug 9, 2024
1 parent 9feb80b commit 9fa15c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pymbolic/imperative/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions pymbolic/mapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9fa15c0

Please sign in to comment.