Get a region (e.g. us-west-2) from a zone (e.g. us-west-1c).
337675
def zoneToRegion(zone):
    """"""
    from toil.lib.context import Context
    return Context.availability_zone_re.match(zone).group(1)
1098844
@Pure
	public N getChildAt(QuadTreeZone zone) {
		switch (zone) {
		case NORTH_WEST:
			return this.nNorthWest;
		case NORTH_EAST:
			return this.nNorthEast;
		case SOUTH_WEST:
			return this.nSouthWest;
		case SOUTH_EAST:
			return this.nSouthEast;
		default:
		}
		return null;
	}
1120104
def _region_to_coords(region):
    
    chrom, coords = region.split(":")
    start, end = coords.split("-")
    return (chrom, int(start), int(end))
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),
            ]
286784
def get_local_tzone():
    """"""
    if localtime().tm_isdst:
        if altzone < 0:
            tzone = '+' + \
                    str(int(float(altzone) / 60 // 60)).rjust(2,
                            '0') + \
                            str(int(float(
                                altzone) / 60 % 60)).ljust(2, '0')
        else:
            tzone = '-' + \
                    str(int(float(altzone) / 60 // 60)).rjust(2,
                            '0') + \
                            str(int(float(
                                altzone) / 60 % 60)).ljust(2, '0')
    else:
        if altzone < 0:
            tzone = \
                    '+' + str(int(float(timezone) / 60 // 60)).rjust(2,
                            '0') + \
                            str(int(float(
                                timezone) / 60 % 60)).ljust(2, '0')
        else:
            tzone = \
                    '-' + str(int(float(timezone) / 60 // 60)).rjust(2,
                            '0') + \
                            str(int(float(
                                timezone) / 60 % 60)).ljust(2, '0')

    return tzone
379397
def get_region_products(self, region):
        

        regions, retInfo = self.list_regions()
        if regions is None:
            return None

        for r in regions:
            if r.get('name') == region:
                return r.get('products')
174049
def _obtain_region(self, a, offset, size, flags, is_recursive):
        """"""
        if self._memory_size + size > self._max_memory_size:
            self._collect_lru_region(size)
        # END handle collection

        r = None
        if a:
            assert len(a) == 1
            r = a[0]
        else:
            try:
                r = self.MapRegionCls(a.path_or_fd(), 0, sys.maxsize, flags)
            except Exception:
                # apparently we are out of system resources or hit a limit
                # As many more operations are likely to fail in that condition (
                # like reading a file from disk, etc) we free up as much as possible
                # As this invalidates our insert position, we have to recurse here
                if is_recursive:
                    # we already tried this, and still have no success in obtaining
                    # a mapping. This is an exception, so we propagate it
                    raise
                # END handle existing recursion
                self._collect_lru_region(0)
                return self._obtain_region(a, offset, size, flags, True)
            # END handle exceptions

            self._handle_count += 1
            self._memory_size += r.size()
            a.append(r)
        # END handle array

        assert r.includes_ofs(offset)
        return r
1316490
def regions(self):
        
        json = self.request('/regions', method='GET')
        status = json.get('status')
        if status == 'OK':
            regions_json = json.get('regions', [])
            regions = [Region.from_json(region) for region in regions_json]
            return regions
        else:
            message = json.get('message')
            raise DOPException('[%s]: %s' % (status, message))
961050
def Regions(self,
              skip_mapped_files=False,
              skip_shared_regions=False,
              skip_executable_regions=False,
              skip_readonly_regions=False):
    """"""
    try:
      maps_file = open("/proc/" + str(self.pid) + "/maps", "r")
    except OSError as e:
      raise process_error.ProcessError(e)

    with maps_file:
      for line in maps_file:
        m = self.maps_re.match(line)
        if not m:
          continue
        start = int(m.group(1), 16)
        end = int(m.group(2), 16)
        region_protec = m.group(3)
        inode = int(m.group(6))

        if "r" in region_protec:
          if skip_mapped_files and inode != 0:
            continue
          if skip_shared_regions and "s" in region_protec:
            continue
          if skip_executable_regions and "x" in region_protec:
            continue
          if skip_readonly_regions and "w" not in region_protec:
            continue
          yield start, end - start
277895
public static String getRegion() throws IOException {
        String url = getMetadataUrl() + "/placement/availability-zone";
        String zone = invokeUrl(url);
        zone = zone.trim();

        // In case of AWS, the zone includes an extra character
        // at the end such as "us-east-1a", "us-east-1b", "eu-west-1a",
        // etc. We have to strip that last character to get the
        // correct region.
        String region = zone.substring(0, zone.length() - 1);
        assert region != null;
        return region;
    }
962554
def get(provider_name, region_name, az_name)
      provider_az = "#{provider_name}/#{region_name}/#{az_name}"
      response = http_get(resource_url(provider_az))
      format_object(response, TYPE)
    end
1139475
def _get_zone_id_from_name(self, name):
        """"""
        results = self.client['Account'].getDomains(
            filter={"domains": {"name": utils.query_filter(name)}})
        return [x['id'] for x in results]
387981
def parse_region(self):
        """"""

        try:
            auth_url = self.job_args['os_auth_url']
            if 'tokens' not in auth_url:
                if not auth_url.endswith('/'):
                    auth_url = '%s/' % auth_url
                auth_url = urlparse.urljoin(auth_url, 'tokens')
            return auth_url
        except KeyError:
            raise exceptions.AuthenticationProblem(
                'You Are required to specify an Auth URL, Region or Plugin'
            )
198726
private String getRegion(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException,
          InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException,
          ErrorResponseException, InternalException {
    String region;
    if (this.region == null || "".equals(this.region)) {
      updateRegionCache(bucketName);
      region = BucketRegionCache.INSTANCE.region(bucketName);
    } else {
      region = this.region;
    }
    return region;
  }
893064
def get_zone(self, id=None, name=None):
        
        log.info("Picking zone: %s (%s)" % (name, id))
        return self.zones[id or name]
1357066
def get_utm_from_wgs84(lng, lat):
        
        _, _, zone, _ = utm.from_latlon(lat, lng)
        direction = 'N' if lat >= 0 else 'S'
        return CRS['UTM_{}{}'.format(str(zone), direction)]
1106372
def discover_region(self, move_x, move_y):
        """"""
        field_list = deque([(move_y, move_x)])

        while len(field_list) != 0:
            field = field_list.popleft()

            (tl_idx, br_idx, region_sum) = self.get_region(field[1], field[0])
            if region_sum == 0:
                self.info_map[field[0], field[1]] = region_sum
                # get surrounding to queue
                region_mat = self.info_map[tl_idx[0]:br_idx[0]+1,
                                           tl_idx[1]:br_idx[1]+1]
                x_list, y_list = np.nonzero(region_mat == 11)

                for x_idx, y_idx in zip(x_list, y_list):
                    field_temp = (x_idx+max(field[0]-1, 0),
                                  y_idx+max(field[1]-1, 0))
                    if field_temp not in field_list:
                        field_list.append(field_temp)
            elif region_sum > 0:
                self.info_map[field[0], field[1]] = region_sum