def createResolver(servers=None, resolvconf=None, hosts=None):
 from twisted.names import resolve, cache, root, hosts as hostsModule
 if (platform.getType() == 'posix'):
  if (resolvconf is None):
   resolvconf = '/etc/resolv.conf'
  if (hosts is None):
   hosts = '/etc/hosts'
  theResolver = Resolver(resolvconf, servers)
  hostResolver = hostsModule.Resolver(hosts)
 else:
  if (hosts is None):
   hosts = 'c:\\windows\\hosts'
  from twisted.internet import reactor
  bootstrap = _ThreadedResolverImpl(reactor)
  hostResolver = hostsModule.Resolver(hosts)
  theResolver = root.bootstrap(bootstrap)
 L = [hostResolver, cache.CacheResolver(), theResolver]
 return resolve.ResolverChain(L)

def createResolver ( servers = None , resolvconf = None , hosts = None ) : from twisted . names import resolve , cache , root , hosts as hostsModule if ( platform . getType ( ) == 'posix' ) : if ( resolvconf is None ) : resolvconf = '/etc/resolv.conf' if ( hosts is None ) : hosts = '/etc/hosts' theResolver = Resolver ( resolvconf , servers ) hostResolver = hostsModule . Resolver ( hosts ) else : if ( hosts is None ) : hosts = 'c:\\windows\\hosts' from twisted . internet import reactor bootstrap = _ThreadedResolverImpl ( reactor ) hostResolver = hostsModule . Resolver ( hosts ) theResolver = root . bootstrap ( bootstrap ) L = [ hostResolver , cache . CacheResolver ( ) , theResolver ] return resolve . ResolverChain ( L )
create and return a resolver .