Commit 82281442 authored by Petr Špaček's avatar Petr Špaček

fix typing errors reported by mypy 0.650

parent cfed1905
......@@ -56,8 +56,11 @@ def load_nsname2ipset() -> Dict[dns.name.Name, Set[str]]:
def update_mapping(nsnames: Set[dns.name.Name],
mapping: Dict[dns.name.Name, Set[str]]) -> None:
dns.resolver.reset_default_resolver()
dns.resolver.default_resolver.lifetime = 5 # seconds
# workaround for mypy 0.650 which thinks that call to
# reset_default_resolver() does not guarantee existence
# of a default_resolver instance
dns.resolver.default_resolver = dns.resolver.Resolver()
dns.resolver.default_resolver.lifetime = 5
#dns.resolver.default_resolver.nameservers = ['193.29.206.206']
with multiprocessing.Pool(processes=128) as p:
......
......@@ -8,14 +8,14 @@ import argparse
import logging
import pickle
import sys
from typing import Dict, Set
from typing import Dict, Optional, Set
import dns.name
from evalzone import EDNSResult
def print_domain(mode: str, result: EDNSResult, domain: dns.name.Name,
nsset: Set[dns.name.Name], reason) \
nsset: Optional[Set[dns.name.Name]], reason) \
-> None:
if not nsset:
print(mode, result, domain, ';', reason)
......@@ -24,7 +24,7 @@ def print_domain(mode: str, result: EDNSResult, domain: dns.name.Name,
print(mode, result, domain, nsname, ';', reason)
def new_domains(permissive, strict,
args, domain2ns: Dict[dns.name.Name, dns.name.Name]) -> None:
args, domain2ns: Dict[dns.name.Name, Set[dns.name.Name]]) -> None:
logging.info('computing domains with NS which are going to stop working')
edns_broken_domains = set(strict[EDNSResult.dead].keys()) \
- set(permissive[EDNSResult.dead].keys())
......
......@@ -12,7 +12,7 @@ import dns.zone
import dataapi
def domain2nsset(zoneobj: dns.zone.Zone) -> Dict[dns.name.Name, Set[str]]:
def domain2nsset(zoneobj: dns.zone.Zone) -> Dict[dns.name.Name, Set[dns.name.Name]]:
'''
generator!
TODO: optimize, currently it requires whole zone in single object'''
......@@ -20,7 +20,7 @@ def domain2nsset(zoneobj: dns.zone.Zone) -> Dict[dns.name.Name, Set[str]]:
for domain, node in zoneobj.items()
if node.get_rdataset(dns.rdataclass.IN, dns.rdatatype.NS)}
def uniq_nslist(nssets: Iterable[Set[str]]) -> Set[dns.name.Name]:
def uniq_nslist(nssets: Iterable[Set[dns.name.Name]]) -> Set[dns.name.Name]:
'''TODO: optimize, it could be done together with domain2nsset transformation'''
uniq_ns = set() # type: Set[dns.name.Name]
for nsset in nssets:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment