Skip to content

Commit

Permalink
mypy: disallow_untyped_calls
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed May 9, 2024
1 parent 5734e5e commit 9da5071
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ disallow_subclassing_any = true

check_untyped_defs = true
disallow_incomplete_defs = true
# disallow_untyped_calls = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true

Expand Down
7 changes: 4 additions & 3 deletions tests/mocked_dns_response.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any, Dict, Iterator, Optional

import dns.exception
import dns.rdataset
import dns.resolver
import json
Expand Down Expand Up @@ -91,7 +92,7 @@ def save(self) -> None:
def get(self, key: dns.resolver.CacheKey) -> Optional[Ans]:
# Special-case a domain to create a timeout.
if key[0].to_text() == "timeout.com.":
raise dns.exception.Timeout()
raise dns.exception.Timeout() # type: ignore [no-untyped-call]

# When building the DNS response database, return
# a cache miss.
Expand All @@ -101,13 +102,13 @@ def get(self, key: dns.resolver.CacheKey) -> Optional[Ans]:
# Query the data for a matching record.
if key in self.data:
if not self.data[key]:
raise dns.resolver.NoAnswer()
raise dns.resolver.NoAnswer() # type: ignore [no-untyped-call]
return self.data[key]

# Query the data for a response to an ANY query.
ANY = dns.rdatatype.from_text("ANY")
if (key[0], ANY, key[2]) in self.data and self.data[(key[0], ANY, key[2])] is None:
raise dns.resolver.NXDOMAIN()
raise dns.resolver.NXDOMAIN() # type: ignore [no-untyped-call]

raise ValueError(f"Saved DNS data did not contain query: {key}")

Expand Down

0 comments on commit 9da5071

Please sign in to comment.