Utilty to create a new region - for more information on the parameters,
        see MapCursor.use_region.
        :param a: A regions (a)rray
        :return: The newly created region
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
183590
def create_area(self, area_uuid):
        
        result = self.api_client.create_area(area_uuid=area_uuid)
        area_uri = UploadAreaURI(uri=result['uri'])
        return UploadArea(uri=area_uri, upload_service=self)
1326001
def setROI(self, *args):
        
        if len(args) == 4:
            x, y, w, h = args
        elif len(args) == 1:
            if isinstance(args[0], Region):
                x, y, w, h = args[0].getTuple()
            elif isinstance(args[0], tuple):
                x, y, w, h = args[0]
            else:
                raise TypeError("Unrecognized argument for Region()")
        else:
            raise TypeError("Unrecognized argument(s) for Region()")
        self.setX(x)
        self.setY(y)
        self.setW(w)
        self.setH(h)
694725
def region(region)
      if(region.to_s == 'us')
        config['api_host'] = US_API_HOST
      elsif(region.to_s == 'eu')
        config['api_host'] = EU_API_HOST
      else
        raise "Region Unknown"
      end
    end
1237640
def process_region_file(region, start, stop):
    """"""
    rx = region.loc.x
    rz = region.loc.z

    # Does the region overlap the bounding box at all?
    if (start != None):
        if ( (rx+1)*512-1 < int(start[0]) or (rz+1)*512-1 < int(start[2]) ):
            return
    elif (stop != None):
        if ( rx*512-1 > int(stop[0]) or rz*512-1 > int(stop[2]) ):
            return

    # Get all chunks
    print("Parsing region %s..." % os.path.basename(region.filename))
    for c in region.iter_chunks_class():
        cx, cz = c.get_coords();
        # Does the chunk overlap the bounding box at all?
        if (start != None):
            if ( (cx+1)*16 + rx*512 - 1 < int(start[0]) or (cz+1)*16 + rz*512 - 1 < int(start[2]) ):
                continue
        elif (stop != None):
            if ( cx*16 + rx*512 - 1 > int(stop[0]) or cz*16 + rz*512 - 1 > int(stop[2]) ):
                continue

        #print("Parsing chunk (" + str(cx) + ", " + str(cz) + ")...")

        # Fast code if no start or stop coordinates are specified
        # TODO: also use this code if start/stop is specified, but the complete chunk is included
        if (start == None and stop == None):
            stats_per_chunk(c)
        else:
            # Slow code that iterates through each coordinate
            bounded_stats_per_chunk(c, start, stop)
486249
def regions
      # When regions come back in an include, the method still gets called, to return the object from the attributes.
      return attributes['regions'] if attributes['regions'].present?
      return [] unless respond_to? :region_ids
      ESP::Region.where(id_in: region_ids)
    end
540435
def do_region(self, x, y, w, h):
        """"""
        if (x is None):
            self.logger.debug("region: full (nop)")
        else:
            self.logger.debug("region: (%d,%d,%d,%d)" % (x, y, w, h))
            self.image = self.image.crop((x, y, x + w, y + h))
            self.width = w
            self.height = h
405190
def do_region(self, x, y, w, h):
        """"""
        infile = self.tmpfile
        outfile = self.basename + '.reg'
        # simeon@ice ~>cat m.pnm | pnmcut 10 10 100 200 > m1.pnm
        if (x is None):
            # print "region: full"
            self.tmpfile = infile
        else:
            # print "region: (%d,%d,%d,%d)" % (x,y,w,h)
            if (self.shell_call('cat ' + infile + ' | ' + self.pnmcut + ' ' + str(x) + ' ' + str(y) + ' ' + str(w) + ' ' + str(h) + '  > ' + outfile)):
                raise IIIFError(text="Oops... got nonzero output from pnmcut.")
            self.width = w
            self.height = h
            self.tmpfile = outfile
1123166
function (originRegionArr, mapName, nameMap) {
        // Not use the original
        var regionsArr = (originRegionArr || []).slice();

        var dataNameMap = zrUtil.createHashMap();
        for (var i = 0; i < regionsArr.length; i++) {
            dataNameMap.set(regionsArr[i].name, regionsArr[i]);
        }

        var source = geoSourceManager.load(mapName, nameMap);
        zrUtil.each(source.regions, function (region) {
            var name = region.name;
            !dataNameMap.get(name) && regionsArr.push({name: name});
        });

        return regionsArr;
    }
6925
def format(self, **kwargs):
        """"""
        attrs = self._attrs.copy()
        attrs.update(kwargs)
        return Region(self._geojson, **attrs)
1226962
def get_region(cls, resource=None):
        
        if resource:
            resource_info = cls.parse_remote(resource)
            if resource_info.region:
                return resource_info.region

        return os.environ.get("AWS_DEFAULT_REGION", cls._DEFAULT_REGION)
231252
def regions():
    
    regions = []
    for region_name in RegionData:
        region = RegionInfo(name=region_name,
                            endpoint=RegionData[region_name],
                            connection_cls=CloudWatchConnection)
        regions.append(region)
    return regions
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
880398
def render_region(self, request):
        ''''''

        page = self.get_object()

        try:
            region = request.POST['region']
        except KeyError:
            region = request.GET['region']

        request.query_string = None

        from leonardo.utils.widgets import render_region

        result = render_region(page=page, request=request, region=region)

        return JsonResponse({'result': result, 'region': region})
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')
353218
def initialize_regions
      # regions cacher
      @initialized_regions ||= []
      # get included and extended modules
      modules = self.class.included_modules + (class << self; self end).included_modules
      modules.uniq!
      # initialize each module
      modules.each do |m|
        # check that constructor is defined and we haven't called it before
        next if @initialized_regions.include?(m) || !m.instance_methods.include?(:initialize_region)

        m.instance_method(:initialize_region).bind(self).call
        # cache region
        @initialized_regions << m
      end
    end
1168488
def set_default_region(self, region):
        
        region = _convert_to_charp(region)
        self._set_default_region_func(self.alpr_pointer, region)