Skip to content

Apply pyupgrade fixes missing from ruff #597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions pytensor/compile/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,8 @@ def min_memory_generator(executable_nodes, viewed_by, view_of):
viewof_change = []
# Use to track view_of changes

viewedby_add = defaultdict(lambda: [])
viewedby_remove = defaultdict(lambda: [])
viewedby_add = defaultdict(list)
viewedby_remove = defaultdict(list)
# Use to track viewed_by changes

for var in node.outputs:
Expand Down
4 changes: 2 additions & 2 deletions pytensor/graph/rewriting/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,8 @@ class MetaNodeRewriter(NodeRewriter):

def __init__(self):
self.verbose = config.metaopt__verbose
self.track_dict = defaultdict(lambda: [])
self.tag_dict = defaultdict(lambda: [])
self.track_dict = defaultdict(list)
self.tag_dict = defaultdict(list)
self._tracks = []
self.rewriters = []

Expand Down
2 changes: 1 addition & 1 deletion pytensor/link/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ def get_destroy_dependencies(fgraph: FunctionGraph) -> dict[Apply, list[Variable
in destroy_dependencies.
"""
order = fgraph.orderings()
destroy_dependencies = defaultdict(lambda: [])
destroy_dependencies = defaultdict(list)
for node in fgraph.apply_nodes:
for prereq in order.get(node, []):
destroy_dependencies[node].extend(prereq.outputs)
Expand Down
2 changes: 1 addition & 1 deletion pytensor/tensor/rewriting/elemwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def apply(self, fgraph):
"nb_call_replace": 0,
"nb_call_validate": 0,
"nb_inconsistent": 0,
"ndim": defaultdict(lambda: 0),
"ndim": defaultdict(int),
}

check_each_change = config.tensor__insert_inplace_optimizer_validate_nb
Expand Down