Exemple #1
0
def _patch_dns():
    top = import_patched('dns')
    for pkg in ('dns', 'dns.rdtypes', 'dns.rdtypes.IN', 'dns.rdtypes.ANY'):
        mod = import_patched(pkg)
        for name in mod.__all__:
            setattr(mod, name, import_patched(pkg + '.' + name))
    return top
Exemple #2
0
def _patch_dns():
    top = import_patched('dns')
    for pkg in ('dns',
                'dns.rdtypes',
                'dns.rdtypes.IN',
                'dns.rdtypes.ANY'):
        mod = import_patched(pkg)
        for name in mod.__all__:
            setattr(mod, name, import_patched(pkg + '.' + name))
    return top
Exemple #3
0
def _patch_dns():
    import platform
    result = platform.architecture()
    orig_arch = platform.architecture

    def arch(*args, **kwargs):
        if not args and not kwargs:
            return result
        return orig_arch(*args, **kwargs)

    platform.architecture = arch
    try:
        top = import_patched('dns')
        for pkg in ('dns', 'dns.rdtypes', 'dns.rdtypes.IN', 'dns.rdtypes.ANY'):
            mod = import_patched(pkg)
            for name in mod.__all__:
                setattr(mod, name, import_patched(pkg + '.' + name))
    finally:
        platform.architecture = orig_arch
    return top
Exemple #4
0
def _patch_dns():
    import platform
    result = platform.architecture()
    orig_arch = platform.architecture
    def arch(*args, **kwargs):
        if not args and not kwargs:
            return result
        return orig_arch(*args, **kwargs)
    platform.architecture = arch
    try:
        top = import_patched('dns')
        for pkg in ('dns',
                    'dns.rdtypes',
                    'dns.rdtypes.IN',
                    'dns.rdtypes.ANY'):
            mod = import_patched(pkg)
            for name in mod.__all__:
                setattr(mod, name, import_patched(pkg + '.' + name))
    finally:
        platform.architecture = orig_arch
    return top
Exemple #5
0
def _dns_import_patched(name):
    assert name.startswith('dns')
    import_patched(name)
    return dns