# Path: uamobile/cidr.py
# def get_ip_addrs(carrier):
# def get_ip(carrier, _memo={}):


from uamobile.cidr import IP, get_ip
from uamobile.factory.docomo import *
from uamobile.factory.ezweb import *
from uamobile.factory.softbank import *
from uamobile.factory.willcom import *
    return carrier.lower()

class Context(object):
    def __init__(self, proxy_ips=None,
                 extra_docomo_ips=None, extra_ezweb_ips=None, extra_softbank_ips=None, extra_willcom_ips=None,
                 extra_crawler_ips=None,
                 docomo_factory=None, ezweb_factory=None, softbank_factory=None, willcom_factory=None):
        # extra IPs
        self._extra_ips = {}
        for carrier, ips in (('docomo', extra_docomo_ips),
                             ('ezweb', extra_ezweb_ips),
                             ('softbank', extra_softbank_ips),
                             ('willcom', extra_willcom_ips),
                             ('crawler', extra_crawler_ips),
                             ('nonmobile', None),
                             ):
            extra = self._extra_ips.setdefault(carrier, [])
            if not ips:
                # extra_ip is None or empty sequence
                continue

            if not isinstance(ips, (list, tuple)):
                ips = [ips]
            for addr in ips:
                self.add_ip(carrier, addr)

        # factary classes
        self.docomo_factory = docomo_factory or DoCoMoUserAgentFactory
        self.ezweb_factory = ezweb_factory or EZwebUserAgentFactory
        self.softbank_factory = softbank_factory or SoftBankUserAgentFactory

# Path: uamobile/cidr.py
# def get_ip_addrs(carrier):
# def get_ip(carrier, _memo={}):


# Path: uamobile/context.py
from uamobile.cidr import IP, get_ip
from uamobile.factory.docomo import *
from uamobile.factory.ezweb import *
from uamobile.factory.softbank import *
from uamobile.factory.willcom import *

    return carrier.lower()

class Context(object):
    def __init__(self, proxy_ips=None,
                 extra_docomo_ips=None, extra_ezweb_ips=None, extra_softbank_ips=None, extra_willcom_ips=None,
                 extra_crawler_ips=None,
                 docomo_factory=None, ezweb_factory=None, softbank_factory=None, willcom_factory=None):
        # extra IPs
        self._extra_ips = {}
        for carrier, ips in (('docomo', extra_docomo_ips),
                             ('ezweb', extra_ezweb_ips),
                             ('softbank', extra_softbank_ips),
                             ('willcom', extra_willcom_ips),
                             ('crawler', extra_crawler_ips),
                             ('nonmobile', None),
                             ):
            extra = self._extra_ips.setdefault(carrier, [])
            if not ips:
                # extra_ip is None or empty sequence
                continue

            if not isinstance(ips, (list, tuple)):
                ips = [ips]
            for addr in ips:
                self.add_ip(carrier, addr)

        # factary classes
        self.docomo_factory = docomo_factory or DoCoMoUserAgentFactory
        self.ezweb_factory = ezweb_factory or EZwebUserAgentFactory
        self.softbank_factory = softbank_factory or SoftBankUserAgentFactory

        self.willcom_factory = willcom_factory or WillcomUserAgentFactory