Convert a single region or multiple region specification into multiregion list.

    If a single region (chrom, start, end), returns [(chrom, start, end)]
    otherwise returns multiregion.
330877
def to_multiregion(region):
    
    assert isinstance(region, (list, tuple)), region
    if isinstance(region[0], (list, tuple)):
        return region
    else:
        assert len(region) == 3
        return [tuple(region)]
682598
def _region_code_for_number_from_list(numobj, regions):
    """"""
    national_number = national_significant_number(numobj)
    for region_code in regions:
        # If leading_digits is present, use this. Otherwise, do full
        # validation.
        # Metadata cannot be None because the region codes come from
        # the country calling code map.
        metadata = PhoneMetadata.metadata_for_region(region_code.upper(), None)
        if metadata is None:
            continue
        if metadata.leading_digits is not None:
            leading_digit_re = re.compile(metadata.leading_digits)
            match = leading_digit_re.match(national_number)
            if match:
                return region_code
        elif _number_type_helper(national_number, metadata) != PhoneNumberType.UNKNOWN:
            return region_code
    return None
584828
def get_region (self, rs,cs, re,ce):
        '''
        '''

        rs = constrain (rs, 1, self.rows)
        re = constrain (re, 1, self.rows)
        cs = constrain (cs, 1, self.cols)
        ce = constrain (ce, 1, self.cols)
        if rs > re:
            rs, re = re, rs
        if cs > ce:
            cs, ce = ce, cs
        sc = []
        for r in range (rs, re+1):
            line = u''
            for c in range (cs, ce + 1):
                ch = self.get_abs (r,c)
                line = line + ch
            sc.append (line)
        return sc
48797
def find_regions(self, word):
        
        length = len(word)

        for index, match in enumerate(re.finditer("[aeiouy][^aeiouy]", word)):
            if index == 0:
                if match.end() < length:
                    self.r1 = match.end()
            if index == 1:
                if match.end() < length:
                    self.r2 = match.end()
                break
786877
def parse(region_string):
    
    rp = RegionParser()
    ss = rp.parse(region_string)
    sss1 = rp.convert_attr(ss)
    sss2 = _check_wcs(sss1)

    shape_list, comment_list = rp.filter_shape2(sss2)
    return ShapeList(shape_list, comment_list=comment_list)
716755
def _decode_region(decoder, region, corrections, shrink):
    
    with _decoded_matrix_region(decoder, region, corrections) as msg:
        if msg:
            # Coordinates
            p00 = DmtxVector2()
            p11 = DmtxVector2(1.0, 1.0)
            dmtxMatrix3VMultiplyBy(
                p00,
                region.contents.fit2raw
            )
            dmtxMatrix3VMultiplyBy(p11, region.contents.fit2raw)
            x0 = int((shrink * p00.X) + 0.5)
            y0 = int((shrink * p00.Y) + 0.5)
            x1 = int((shrink * p11.X) + 0.5)
            y1 = int((shrink * p11.Y) + 0.5)
            return Decoded(
                string_at(msg.contents.output),
                Rect(x0, y0, x1 - x0, y1 - y0)
            )
        else:
            return None
225673
def has_variant_regions(items, base_file, chrom=None):
    
    if chrom:
        all_vrs = _get_variant_regions(items)
        if len(all_vrs) > 0:
            test = shared.subset_variant_regions(tz.first(all_vrs), chrom, base_file, items)
            if test == chrom:
                return False
    return True
1254050
def as_bits( region_start, region_length, intervals ):
    
    bits = BitSet( region_length )
    for chr, start, stop in intervals:
        bits.set_range( start - region_start, stop - start )
    return bits
500029
def get_all_regions_with_tiles(self):
        
        for key in self.get_all_keys():
            (layer, rx, ry) = struct.unpack('>BHH', key)
            if layer == 1:
                yield (rx, ry)
1081827
function (options, cb) {
		let response = {
			"regions": []
		};
		response.regions = [
			{v: 'us-east-1', 'l': 'US East (N. Virginia)'},
			{v: 'us-east-2', 'l': 'US East (Ohio)'},
			{v: 'us-west-1', 'l': 'US West (N. California)'},
			{v: 'us-west-2', 'l': 'US West (Oregon)'},
			{v: 'ca-central-1', 'l': 'Canada (Central)'},
			{v: 'eu-west-1', 'l': 'EU (Ireland)'},
			{v: 'eu-west-2', 'l': 'EU (London)'},
			{v: 'eu-central-1', 'l': 'EU (Frankfurt)'},
			{v: 'ap-northeast-1', 'l': 'Asia Pacific (Tokyo)'},
			{v: 'ap-northeast-2', 'l': 'Asia Pacific (Seoul)'},
			{v: 'ap-south-1', 'l': 'Asia Pacific (Mumbai)'},
			{v: 'ap-southeast-1', 'l': 'Asia Pacific (Singapore)'},
			{v: 'ap-southeast-2', 'l': 'Asia Pacific (Sydney)'},
			{v: 'sa-east-1', 'l': 'South America (São Paulo)'}
		];

		return cb(null, response);
	}
720364
def regions():
    
    return [RegionInfo(name='us-east-1',
                       endpoint='sns.us-east-1.amazonaws.com',
                       connection_cls=SNSConnection),
            RegionInfo(name='eu-west-1',
                       endpoint='sns.eu-west-1.amazonaws.com',
                       connection_cls=SNSConnection),
            RegionInfo(name='us-west-1',
                       endpoint='sns.us-west-1.amazonaws.com',
                       connection_cls=SNSConnection),
            RegionInfo(name='sa-east-1',
                       endpoint='sns.sa-east-1.amazonaws.com',
                       connection_cls=SNSConnection),
            RegionInfo(name='us-west-2',
                       endpoint='sns.us-west-2.amazonaws.com',
                       connection_cls=SNSConnection),
            RegionInfo(name='ap-northeast-1',
                       endpoint='sns.ap-northeast-1.amazonaws.com',
                       connection_cls=SNSConnection),
            RegionInfo(name='ap-southeast-1',
                       endpoint='sns.ap-southeast-1.amazonaws.com',
                       connection_cls=SNSConnection),
            ]
1231630
private static List<String> convertSqref(final CellRangeAddressList region) {

        List<String> sqref = new ArrayList<>();
        for(CellRangeAddress range : region.getCellRangeAddresses()) {
            sqref.add(range.formatAsString());
        }

        return sqref;

    }
993355
function listRegionKeys() {
  const regionKeys = new Array(regionKeysByRegion.size);
  const iter = regionKeysByRegion.values();
  let v = iter.next();
  let i = -1;
  while (!v.done) {
    regionKeys[++i] = v.value;
    v = iter.next();
  }
  return regionKeys;
}
1018465
def process_tectonic_regionalisation(self):
        '''
        
        '''

        if 'tectonic_regionalisation' in self.data.keys():
            tectonic_reg = TectonicRegionalisation()
            tectonic_reg.populate_regions(
                parse_tect_region_dict_to_tuples(
                    self.data['tectonic_regionalisation']))
        else:
            tectonic_reg = None
        return tectonic_reg
682110
def get_variants_in_region(self, chrom, start, end):
        """"""
        region = self.get_vcf()(
            "{}:{}-{}".format(chrom, start, end)
        )
        for v in region:
            for coded_allele, g in self._make_genotypes(v.ALT, v.genotypes):
                variant = Variant(
                    v.ID, v.CHROM, v.POS, [v.REF, coded_allele]
                )
                yield Genotypes(variant, g, v.REF, coded_allele,
                                multiallelic=len(v.ALT) > 1)
1312196
def find_region_end(self, lines):
        """"""
        if self.metadata and 'cell_type' in self.metadata:
            self.cell_type = self.metadata.pop('cell_type')
        else:
            self.cell_type = 'code'

        parser = StringParser(self.language or self.default_language)
        for i, line in enumerate(lines):
            # skip cell header
            if self.metadata is not None and i == 0:
                continue

            if parser.is_quoted():
                parser.read_line(line)
                continue

            parser.read_line(line)

            # New code region
            # Simple code pattern in LightScripts must be preceded with a blank line
            if self.start_code_re.match(line) or (
                    self.simple_start_code_re and self.simple_start_code_re.match(line) and
                    (self.cell_marker_start or i == 0 or _BLANK_LINE.match(lines[i - 1]))):

                if self.explicit_end_marker_required:
                    # Metadata here was conditioned on finding an explicit end marker
                    # before the next start marker. So we dismiss it.
                    self.metadata = None
                    self.language = None

                if i > 0 and _BLANK_LINE.match(lines[i - 1]):
                    if i > 1 and _BLANK_LINE.match(lines[i - 2]):
                        return i - 2, i, False
                    return i - 1, i, False
                return i, i, False

            if not self.ignore_end_marker and self.end_code_re:
                if self.end_code_re.match(line):
                    return i, i + 1, True
            elif _BLANK_LINE.match(line):
                if not next_code_is_indented(lines[i:]):
                    if i > 0:
                        return i, i + 1, False
                    if len(lines) > 1 and not _BLANK_LINE.match(lines[1]):
                        return 1, 1, False
                    return 1, 2, False

        return len(lines), len(lines), False
397858
def regions(self):
        """"""
        url = "%s/regions" % self.root
        params = {"f": "json"}
        return self._get(url=url,
                            param_dict=params,
                            proxy_url=self._proxy_url,
                            proxy_port=self._proxy_port)