# Path: dyndnsc/common/load.py
# def load_class(module_name, class_name):
#     """Return class object specified by module name and class name.
# 
#     Return None if module failed to be imported.
# 
#     :param module_name: string module name
#     :param class_name: string class name
#     """
#     try:
#         plugmod = import_module(module_name)
#     except Exception as exc:
#         warn("Importing built-in plugin %s.%s raised an exception: %r" %
#              (module_name, class_name, repr(exc)), ImportWarning)
#         return None
#     else:
#         return getattr(plugmod, class_name)


from ..common.load import load_class as _load_plugin
# -*- coding: utf-8 -*-

"""
All built-in detector plugins are listed here and will be dynamically imported.

If importing a plugin fails, it will be ignored.
"""


_BUILTINS = (
    ("dyndnsc.detector.command", "IPDetector_Command"),
    ("dyndnsc.detector.dns", "IPDetector_DNS"),
    ("dyndnsc.detector.dnswanip", "IPDetector_DnsWanIp"),
    ("dyndnsc.detector.iface", "IPDetector_Iface"),
    ("dyndnsc.detector.socket_ip", "IPDetector_Socket"),
    ("dyndnsc.detector.rand", "IPDetector_Random"),
    ("dyndnsc.detector.teredo", "IPDetector_Teredo"),
    ("dyndnsc.detector.webcheck", "IPDetectorWebCheck"),
    ("dyndnsc.detector.webcheck", "IPDetectorWebCheck6"),
    ("dyndnsc.detector.webcheck", "IPDetectorWebCheck46"),
    ("dyndnsc.detector.null", "IPDetector_Null")
)


# Path: dyndnsc/common/load.py
# def load_class(module_name, class_name):
#     """Return class object specified by module name and class name.
# 
#     Return None if module failed to be imported.
# 
#     :param module_name: string module name
#     :param class_name: string class name
#     """
#     try:
#         plugmod = import_module(module_name)
#     except Exception as exc:
#         warn("Importing built-in plugin %s.%s raised an exception: %r" %
#              (module_name, class_name, repr(exc)), ImportWarning)
#         return None
#     else:
#         return getattr(plugmod, class_name)


# Path: dyndnsc/detector/builtin.py
from ..common.load import load_class as _load_plugin

# -*- coding: utf-8 -*-

"""
All built-in detector plugins are listed here and will be dynamically imported.

If importing a plugin fails, it will be ignored.
"""


_BUILTINS = (
    ("dyndnsc.detector.command", "IPDetector_Command"),
    ("dyndnsc.detector.dns", "IPDetector_DNS"),
    ("dyndnsc.detector.dnswanip", "IPDetector_DnsWanIp"),
    ("dyndnsc.detector.iface", "IPDetector_Iface"),
    ("dyndnsc.detector.socket_ip", "IPDetector_Socket"),
    ("dyndnsc.detector.rand", "IPDetector_Random"),
    ("dyndnsc.detector.teredo", "IPDetector_Teredo"),
    ("dyndnsc.detector.webcheck", "IPDetectorWebCheck"),
    ("dyndnsc.detector.webcheck", "IPDetectorWebCheck6"),
    ("dyndnsc.detector.webcheck", "IPDetectorWebCheck46"),
    ("dyndnsc.detector.null", "IPDetector_Null")
)


PLUGINS = {plug for plug in (_load_plugin(m, c) for m, c in _BUILTINS) if plug is not None}