proxy for the helpers.tileset_download method
193840
def download(self, request, **kwargs):
        

        # method check to avoid bad requests
        self.method_check(request, allowed=['get'])

        # create a basic bundle object for self.get_cached_obj_get.
        basic_bundle = self.build_bundle(request=request)

        # using the primary key defined in the url, obtain the tileset
        tileset = self.cached_obj_get(
            bundle=basic_bundle,
            **self.remove_api_resource_names(kwargs))

        filename = helpers.get_tileset_filename(tileset)
        filename = os.path.abspath(filename)
        if os.path.isfile(filename):
            response = serve(request, os.path.basename(filename), os.path.dirname(filename))
            response['Content-Disposition'] = 'attachment; filename="{}"'.format(os.path.basename(filename))
        else:
            response = self.create_response(request, {'status': 'not generated'})
        return response
1161301
def _proxy(method):
    
    @functools.wraps(method)
    def memoizer(self, context):
        return method(context)

    return memoizer
1232323
def tile_sprite(self, out_format="sprite.json", out_folder=None):
        
        url = "{url}/resources/sprites/{f}".format(url=self._url,
                                                   f=out_format)
        if out_folder is None:
            out_folder = tempfile.gettempdir()
        return self._get(url=url,
                         param_dict={},
                         out_folder=out_folder,
                         securityHandler=self._securityHandler,
                         proxy_port=self._proxy_port,
                         proxy_url=self._proxy_host)
538547
def tileset_info(self, uid):
        
        url = "http://{host}:{port}/api/v1/tileset_info/?d={uid}".format(
            host=self.host, port=self.port, uid=uid
        )

        req = requests.get(url)
        if req.status_code != 200:
            raise ServerError("Error fetching tileset_info:", req.content)

        content = json.loads(req.content)
        return content[uid]
1026858
def mine_get(tgt, fun, tgt_type='glob', opts=None):
    '''
    
    '''
    ret = {}
    serial = salt.payload.Serial(opts)
    checker = CkMinions(opts)
    _res = checker.check_minions(
            tgt,
            tgt_type)
    minions = _res['minions']
    cache = salt.cache.factory(opts)

    if isinstance(fun, six.string_types):
        functions = list(set(fun.split(',')))
        _ret_dict = len(functions) > 1
    elif isinstance(fun, list):
        functions = fun
        _ret_dict = True
    else:
        return {}

    for minion in minions:
        mdata = cache.fetch('minions/{0}'.format(minion), 'mine')

        if not isinstance(mdata, dict):
            continue

        if not _ret_dict and functions and functions[0] in mdata:
            ret[minion] = mdata.get(functions)
        elif _ret_dict:
            for fun in functions:
                if fun in mdata:
                    ret.setdefault(fun, {})[minion] = mdata.get(fun)

    return ret
976456
def generate(self, request, **kwargs):
        

        # method check to avoid bad requests
        self.method_check(request, allowed=['get'])

        # create a basic bundle object for self.get_cached_obj_get.
        basic_bundle = self.build_bundle(request=request)

        # using the primary key defined in the url, obtain the tileset
        tileset = self.cached_obj_get(
            bundle=basic_bundle,
            **self.remove_api_resource_names(kwargs))

        # Return what the method output, tastypie will handle the serialization
        return self.create_response(request, tileset.generate())
373140
def get_tiles(self):
        """"""
        for x, y in griditer(self.root_tile.x, self.root_tile.y, ncol=self.tiles_per_row):
            yield TileCoordinate(self.root_tile.zoom, x, y)
843883
def download(cls, url, filename=None):
        
        return utility.download(url, cls.directory(), filename)
1176910
def download_and_compile(self):
        """"""

        def _progress_hook(count, block_size, total_size):
            if total_size < 0:
                sys.stdout.write("\rDownloading %s... please wait." % local_file)
            else:
                percentage = count * block_size * 100.0 / total_size
                percentage = min(percentage, 100.0)
                sys.stdout.write("\rDownloading %s... %.2f%%" % (local_file, percentage))
            sys.stdout.flush()

        # Determine the remote URL if needed
        if self.remote_url is None:
            self.version, remote_url = self.find_first_version()
            if not self.version:
                print("Version %s of the C core of igraph is not found among the "
                        "nightly builds." % self.versions_to_try[0])
                print("Use the --c-core-version switch to try a different version.")
                print("")
                return False
            local_file = "igraph-%s.tar.gz" % self.version
        else:
            remote_url = self.remote_url
            local_file = remote_url.rsplit("/", 1)[1]

        # Now determine the full path where the C core will be downloaded
        local_file_full_path = os.path.join(self.tmpdir, local_file)

        # Download the C core
        if self.show_progress_bar:
            urlretrieve(remote_url, local_file_full_path, reporthook=_progress_hook)
            print("")
        else:
            print("Downloading %s... " % local_file)
            urlretrieve(remote_url, local_file_full_path)

        # Extract it in the temporary directory
        print("Extracting %s..." % local_file)
        archive = tarfile.open(local_file_full_path, "r:gz")
        archive.extractall(self.tmpdir)

        # Determine the name of the build directory
        self.builddir = None
        for name in os.listdir(self.tmpdir):
            full_path = os.path.join(self.tmpdir, name)
            if name.startswith("igraph") and os.path.isdir(full_path):
                self.builddir = full_path
                break

        if not self.builddir:
            print("Downloaded tarball did not contain a directory whose name "
                    "started with igraph; giving up build.")
            return False

        # Try to compile
        cwd = os.getcwd()
        try:
            print("Configuring igraph...")
            os.chdir(self.builddir)
            retcode = subprocess.call("CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --disable-tls --disable-gmp",
                    shell=True)
            if retcode:
                return False

            retcode = subprocess.call("make", shell=True)
            if retcode:
                return False

            libraries = []
            for line in open(os.path.join(self.builddir, "igraph.pc")):
                if line.startswith("Libs: ") or line.startswith("Libs.private: "):
                    words = line.strip().split()
                    libraries.extend(word[2:] for word in words if word.startswith("-l"))

            if not libraries:
                # Educated guess
                libraries = ["igraph"]

        finally:
            os.chdir(cwd)

        # Compilation succeeded; copy everything into igraphcore
        create_dir_unless_exists("igraphcore")
        ensure_dir_does_not_exist("igraphcore", "include")
        ensure_dir_does_not_exist("igraphcore", "lib")
        shutil.copytree(os.path.join(self.builddir, "include"),
                os.path.join("igraphcore", "include"))
        shutil.copytree(os.path.join(self.builddir, "src", ".libs"),
                os.path.join("igraphcore", "lib"))
        f = open(os.path.join("igraphcore", "build.cfg"), "w")
        f.write(repr(libraries))
        f.close()

        return True
266274
def GetElevation(self, latitude, longitude, timeout=0):
        ''''''
        if latitude is None or longitude is None:
            return None
        if self.database == 'srtm':
            TileID = (numpy.floor(latitude), numpy.floor(longitude))
            if TileID in self.tileDict:
                alt = self.tileDict[TileID].getAltitudeFromLatLon(latitude, longitude)
            else:
                tile = self.downloader.getTile(numpy.floor(latitude), numpy.floor(longitude))
                if tile == 0:
                    if timeout > 0:
                        t0 = time.time()
                        while time.time() < t0+timeout and tile == 0:
                            tile = self.downloader.getTile(numpy.floor(latitude), numpy.floor(longitude))
                            if tile == 0:
                                time.sleep(0.1)
                if tile == 0:
                    return None
                self.tileDict[TileID] = tile
                alt = tile.getAltitudeFromLatLon(latitude, longitude)
        if self.database == 'geoscience':
             alt = self.mappy.getAltitudeAtPoint(latitude, longitude)
        return alt
950652
function (tilesets) {
            // get the corresponding tileset
            var tileset = tilesets.getTilesetByGid(this.gid);

            if (tileset.isCollection === false) {
                // set width and height equal to tile size
                this.width = this.framewidth = tileset.tilewidth;
                this.height = this.frameheight = tileset.tileheight;
            }

            // the object corresponding tile object
            this.tile = new me.Tile(this.x, this.y, this.gid, tileset);
        }
1364058
def extract_metatile(io, fmt, offset=None):
    

    ext = fmt.extension
    if offset is None:
        tile_name = '0/0/0.%s' % ext
    else:
        tile_name = '%d/%d/%d.%s' % (offset.zoom, offset.column, offset.row,
                                     ext)

    with zipfile.ZipFile(io, mode='r') as zf:
        if tile_name in zf.namelist():
            return zf.read(tile_name)
        else:
            return None
63249
public static String resolveProxyUrl(String relativeUrl, TileMap tileMap, String baseTmsUrl) {
		TileCode tc = parseTileCode(relativeUrl);
		return buildUrl(tc, tileMap, baseTmsUrl);
	}
1040662
def getTile(self, lat, lon):
        """"""
        global childFileListDownload
        if childFileListDownload is not None and childFileListDownload.is_alive():
            '''print "Getting file list"'''
            return 0
        elif not self.filelist:
            '''print "Filelist download complete, loading data"'''
            data = open(self.filelist_file, 'rb')
            self.filelist = pickle.load(data)
            data.close()

        try:
            continent, filename = self.filelist[(int(lat), int(lon))]
        except KeyError:
            '''print "here??"'''
            if len(self.filelist) > self.min_filelist_len:
                # we appear to have a full filelist - this must be ocean
                return SRTMOceanTile(int(lat), int(lon))
            return 0

        global childTileDownload
        if not os.path.exists(os.path.join(self.cachedir, filename)):
            if childTileDownload is None or not childTileDownload.is_alive():
                try:
                    childTileDownload = multiprocessing.Process(target=self.downloadTile, args=(str(continent), str(filename)))
                    childTileDownload.start()
                except Exception as ex:
                    childTileDownload = None
                    return 0
                '''print "Getting Tile"'''
            return 0
        elif childTileDownload is not None and childTileDownload.is_alive():
            '''print "Still Getting Tile"'''
            return 0
        # TODO: Currently we create a new tile object each time.
        # Caching is required for improved performance.
        try:
            return SRTMTile(os.path.join(self.cachedir, filename), int(lat), int(lon))
        except InvalidTileError:
            return 0
610531
async def request(
            self,
            method: str,
            endpoint: str,
            *,
            headers: dict = None,
            params: dict = None,
            data: dict = None) -> dict:
        """"""
        if (self._session_expiry
                and self._session_expiry <= current_epoch_time()):
            raise SessionExpiredError('Session has expired; make a new one!')

        url = '{0}/{1}'.format(API_URL_SCAFFOLD, endpoint)

        if not headers:
            headers = {}
        headers.update({
            'Tile_app_id': DEFAULT_APP_ID,
            'Tile_app_version': DEFAULT_APP_VERSION,
            'Tile_client_uuid': self.client_uuid,
        })

        async with self._websession.request(method, url, headers=headers,
                                            params=params, data=data) as resp:
            try:
                resp.raise_for_status()
                return await resp.json(content_type=None)
            except client_exceptions.ClientError as err:
                raise RequestError(
                    'Error requesting data from {0}: {1}'.format(
                        endpoint, err)) from None
65191
function (bounds) {
        bounds = this.adjustBounds(bounds);
        var res = this.getServerResolution();
        var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
        var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h));
        var z = this.getZoomForResolution( res );

        var tileIndex = x + y * this.tierSizeInTiles[z].w + this.tileCountUpToTier[z];
        var path = "TileGroup" + Math.floor( (tileIndex) / 256 ) +
            "/" + z + "-" + x + "-" + y + ".jpg";
        var url = this.url;
        if (OpenLayers.Util.isArray(url)) {
            url = this.selectUrl(path, url);
        }
        return url + path;
    }
804231
function downloadNode(next) {
        _downloadNode(
          version,
          options.nodeTempDir,
          options.nodeConfigureArgs,
          options.nodeMakeArgs,
          options.nodeVCBuildArgs,
          next,
        );
      }