Skip to content

Commit 7c7bdec

Browse files
committed
Avoid get() on dict after checking existence of key
Reported by mypy
1 parent 2cabd62 commit 7c7bdec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

testinfra/backend/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ def parse_hostspec(hostspec):
6262
"context",
6363
):
6464
if key in query:
65-
kw[key] = query.get(key)[0]
65+
kw[key] = query[key][0]
6666
for key in (
6767
"ssh_config",
6868
"ansible_inventory",
6969
"ssh_identity_file",
7070
):
7171
if key in query:
72-
kw[key] = os.path.expanduser(query.get(key)[0])
72+
kw[key] = os.path.expanduser(query[key][0])
7373
else:
7474
host = hostspec
7575
return host, kw

0 commit comments

Comments
 (0)