Show the available localized internet anonymization countries.
559054
def server_lia_countries(self):
        
        response = self._post(self.apiurl + "/v2/server/lia_countries", data={'apikey': self.apikey})

        return self._raise_or_extract(response)
450751
def anonymize(remote_addr):
    
    if not isinstance(remote_addr, text_type) and isinstance(remote_addr, str):
        remote_addr = remote_addr.decode('ascii', 'ignore')
    try:
        ipv4 = ipaddress.IPv4Address(remote_addr)
        return u''.join(ipv4.exploded.rsplit('.', 1)[0]) + '.' + '0'
    except ipaddress.AddressValueError:
        try:
            ipv6 = ipaddress.IPv6Address(remote_addr)
            if ipv6.ipv4_mapped is not None:
                return anonymize(text_type(ipv6.ipv4_mapped))
            return u'' + ipv6.exploded.rsplit(':', 5)[0] + ':' + ':'.join(['0000'] * 5)
        except ipaddress.AddressValueError:
            return u'0.0.0.0'
739676
def avail_locations(conn=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option'
        )

    datacenters = []

    if not conn:
        conn = get_conn()

    for datacenter in conn.list_datacenters():
        datacenters.append({datacenter['country_code']: datacenter})

    return {'Locations': datacenters}
1155067
def make_country_nationality_list(cts, ct_file):
    """"""
    countries = pd.read_csv(ct_file)
    nationality = dict(zip(countries.nationality,countries.alpha_3_code))
    both_codes = {**nationality, **cts}
    return both_codes
68665
def country_choices(first=None, default_country_first=True):
    
    locale = _get_locale()
    territories = [
        (code, name) for code, name in locale.territories.items() if len(code) == 2
    ]  # skip 3-digit regions

    if first is None and default_country_first:
        first = default_country()

    def sortkey(item):
        if first is not None and item[0] == first:
            return "0"
        return to_lower_ascii(item[1])

    territories.sort(key=sortkey)
    return territories
23020
def action_listlocal(all_details=True):
    "  "

    options = get_localontologies()

    counter = 1
    # printDebug("------------------", 'comment')
    if not options:
        printDebug(
            "Your local library is empty. Use 'ontospy lib --bootstrap' to add some ontologies to it."
        )
        return
    else:
        if all_details:
            _print_table_ontologies()
        else:
            _print2cols_ontologies()

        while True:
            printDebug(
                "------------------\nSelect a model by typing its number: (enter=quit)",
                "important")
            var = input()
            if var == "" or var == "q":
                return None
            else:
                try:
                    _id = int(var)
                    ontouri = options[_id - 1]
                    # printDebug("\nYou selected:", "comment")
                    printDebug(
                        "---------\nYou selected: " + ontouri + "\n---------",
                        "green")
                    return ontouri
                except:
                    printDebug("Please enter a valid option.", "comment")
                    continue
1334750
def country_prefix(country)
      country = country.to_s.upcase
      Phonelib.phone_data[country] && \
        Phonelib.phone_data[country][Core::COUNTRY_CODE]
    end
870829
def get_country(self):
        """"""

        doc = self._request(self.ws_prefix + ".getInfo", True)

        country = _extract(doc, "country")

        if country is None or country == "None":
            return None
        else:
            return Country(country, self.network)
861642
protected function actionListCountry()
    {
        list($selected, $action, $value) = $this->getPostedAction();

        $updated = $deleted = 0;

        foreach ($selected as $code) {

            if ($action === 'status' && $this->access('country_edit')) {
                $updated += (int) $this->country->update($code, array('status' => $value));
            }

            if ($action === 'delete' && $this->access('country_delete')) {
                $deleted += (int) $this->country->delete($code);
            }
        }

        if ($updated > 0) {
            $message = $this->text('Updated %num item(s)', array('%num' => $updated));
            $this->setMessage($message, 'success');
        }

        if ($deleted > 0) {
            $message = $this->text('Deleted %num item(s)', array('%num' => $deleted));
            $this->setMessage($message, 'success');
        }
    }
706384
public function getDisplayLocales()
    {
        $locales = array();

        foreach ($this->allowedLocales as $locale) {
            $locales[$locale] = \Locale::getDisplayName($locale);
        }

        return $locales;
    }
506096
def countries(self) -> typing.Iterator['Country']:
        
        for coalition in self.coalitions:
            for country in coalition.countries:

                yield country
224205
def avail_locations(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option'
        )

    params = {'Action': 'DescribeRegions'}
    items = query(params=params)

    ret = {}
    for region in items['Regions']['Region']:
        ret[region['RegionId']] = {}
        for item in region:
            ret[region['RegionId']][item] = six.text_type(region[item])

    return ret
470692
def vanity? number
      country, _, national = partial_split number
      country.vanity? national
    end
1352955
def filter_country_locations(api_response, is_country=True):
    
    return [item for item in api_response if item[ISCOUNTRY]==is_country]
716725
def ocsp_urls(self):
        

        if not self.authority_information_access_value:
            return []

        output = []
        for entry in self.authority_information_access_value:
            if entry['access_method'].native == 'ocsp':
                location = entry['access_location']
                if location.name != 'uniform_resource_identifier':
                    continue
                url = location.native
                if url.lower().startswith(('http://', 'https://', 'ldap://', 'ldaps://')):
                    output.append(url)
        return output
493326
def locate_ip(ip):
    """"""
    ip=map(int,ip.split("."))
    ip = ip[3]+(ip[2]<<8)+(ip[1]<<16)+(ip[0]<<24)

    cloc = country_loc_kdb.get_base()
    db = IP_country_kdb.get_base()

    d=0
    f=len(db)-1
    while (f-d) > 1:
        guess = (d+f)/2
        if ip > db[guess][0]:
            d = guess
        else:
            f = guess
    s,e,c = db[guess]
    if  s <= ip and ip <= e:
        return cloc.get(c,None)
422211
def _passes_filter(self, proxy):


        '''  '''
        
        ''' validate proxy based on provided filters '''
        if self.allowed_countries is not None and proxy['country'] not in self.allowed_countries:
            return False
        if self.denied_countries is not None and  proxy['country'] in self.denied_countries:
            return False
        if self.https_only and proxy['https'] == False:
            return False

        if not self.all_ports and str(proxy.port) not in self.ports:
            return False

        return True