Skip to content

Commit 738c452

Browse files
committed
fix SIM910, dict.get with value==None (which is the default value)
1 parent dd8dd3c commit 738c452

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

flake8_trio/visitors/visitor_utility.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ def visit_Assign(self, node: ast.Assign):
6868

6969
# `f = open(...)`
7070
if isinstance(node.value, ast.Call) and (
71-
vartype := self.typed_calls.get(ast.unparse(node.value.func), None)
71+
vartype := self.typed_calls.get(ast.unparse(node.value.func))
7272
):
7373
self.variables[node.targets[0].id] = vartype
7474

7575
# f = ff (and ff is a variable with known type)
7676
elif isinstance(node.value, ast.Name) and (
77-
value := self.variables.get(node.value.id, None)
77+
value := self.variables.get(node.value.id)
7878
):
7979
self.variables[node.targets[0].id] = value
8080

@@ -85,11 +85,7 @@ def visit_With(self, node: ast.With | ast.AsyncWith):
8585
if (
8686
isinstance(item.context_expr, ast.Call)
8787
and isinstance(item.optional_vars, ast.Name)
88-
and (
89-
vartype := self.typed_calls.get(
90-
ast.unparse(item.context_expr.func), None
91-
)
92-
)
88+
and (vartype := self.typed_calls.get(ast.unparse(item.context_expr.func)))
9389
):
9490
self.variables[item.optional_vars.id] = vartype
9591

0 commit comments

Comments
 (0)