get asset version content using pg large object streams

        :param bool force: False by default, forces get content from database
            instead of using cached value
        :rtype: str
        :return: content in raw format
11968
def get_blob_data(self, tag_target='asset', force=False):
        
        if hasattr(self, '_blob_data') and not force:
            return self._blob_data

        if six.PY2:
            self._blob_data = six.binary_type('')
        elif six.PY3:
            self._blob_data = six.binary_type('', encoding='ascii')
        asset_contents = self.contents.filter(tag=tag_target)
        for asset_content in asset_contents:
            blobs = asset_content.stream.get_blobs()
            for blob in blobs:
                self._blob_data += six.binary_type(blob.data)
        return self._blob_data
273444
def versions(ctx, archive_name):
    '''
    
    '''

    _generate_api(ctx)

    var = ctx.obj.api.get_archive(archive_name)
    click.echo(pprint.pformat(map(str, var.get_versions())))
1356818
def _get_ui_content(self, cli, width, height):
        
        def get_content():
            return self.content.create_content(cli, width=width, height=height)

        key = (cli.render_counter, width, height)
        return self._ui_content_cache.get(key, get_content)
76964
def get(self, sid):
        
        return AssetVersionContext(
            self._version,
            service_sid=self._solution['service_sid'],
            asset_sid=self._solution['asset_sid'],
            sid=sid,
        )
1277593
def pull(rebase=True, refspec=None):
    
    options = rebase and '--rebase' or ''
    output = run('pull %s %s' % (options, refspec or ''))
    return not re.search('up.to.date', output)
928061
def get_assets(self):
        
        if self.retrieved:
            raise errors.IllegalState('List has already been retrieved.')
        self.retrieved = True
        return objects.AssetList(self._results, runtime=self._runtime)
1250635
def _load(content_or_fp):
    
    try:
        data = yaml.load(content_or_fp, Loader=yaml.loader.BaseLoader)
    except Exception as e:
        raise type(e)('Malformed yaml file:\n%r' % format_exc())

    try:
        ver = data['spec']
    except:
        raise ValueError('The file does not specify a spec version')

    try:
        ver = tuple(map(int, (ver.split("."))))
    except:
        raise ValueError("Invalid spec version format. Expect 'X.Y'"
                         " (X and Y integers), found %s" % ver)

    if ver > SPEC_VERSION_TUPLE:
        raise ValueError('The spec version of the file is '
                         '%s but the parser is %s. '
                         'Please update pyvisa-sim.' % (ver, SPEC_VERSION))

    return data
687321
def reload(force=false)
      raise ArgumentError, 'Argument must be true or false.' unless [true, false].include?(force)
      if force || reload?
        flush_cache
        return true
      end
      false
    end
635289
public static function getAssetsUrl($forceCopyAssets = false, $cdn = false)
    {
        if (!isset(static::$assetsUrl)) {
            if ($cdn) {
                static::$assetsUrl = '//cdn.jsdelivr.net/foundation/4.3.1/';
            } else {
                $assetsPath        = static::getAssetsPath();
                static::$assetsUrl = \Yii::app()->assetManager->publish($assetsPath, true, -1, $forceCopyAssets);
            }
        }
        return static::$assetsUrl;
    }
1129173
def get_content(self, r):
        """"""
        if self.type == 'exp_file':
            # don't use the decoded r.text
            return r.content
        elif self.type == 'version':
            return r.content
        else:
            if self.fmt == 'json':
                content = {}
                # Decode
                try:
                    # Watch out for bad/empty json
                    content = json.loads(r.text, strict=False)
                except ValueError as e:
                    if not self.expect_empty_json():
                        # reraise for requests that shouldn't send empty json
                        raise ValueError(e)
                finally:
                    return content
            else:
                return r.text
1323416
def fetch(self, is_dl_forced=False):
        
        # check if config exists; if it doesn't, error out and let user know
        if 'dbauth' not in config.get_config() and 'mgi' \
                not in config.get_config()['dbauth']:
            LOG.error("not configured with PG user/password.")

        # create the connection details for MGI
        cxn = config.get_config()['dbauth']['mgi']

        self.dataset.setFileAccessUrl(''.join((
            'jdbc:postgresql://', cxn['host'], ':', str(cxn['port']), '/',
            cxn['database'])), is_object_literal=True)

        # process the tables
        # self.fetch_from_pgdb(self.tables, cxn, 100)  # for testing only
        # self.fetch_from_pgdb(self.tables, cxn, None, is_dl_forced)

        for query_map in self.resources['query_map']:
            query_fh = open(os.path.join(
                os.path.dirname(__file__), query_map['query']), 'r')
            query = query_fh.read()
            force = False
            if 'Force' in query_map:
                force = query_map['Force']
            self.fetch_query_from_pgdb(
                query_map['outfile'], query, None, cxn, force=force)
        # always get this - it has the verion info
        self.fetch_transgene_genes_from_db(cxn)

        datestamp = ver = None
        # get the resource version information from
        # table mgi_dbinfo, already fetched above
        outfile = '/'.join((self.rawdir, 'mgi_dbinfo'))

        if os.path.exists(outfile):
            with open(outfile, 'r') as f:
                f.readline()  # read the header row; skip
                info = f.readline()
                cols = info.split('\t')
                ver = cols[0]  # col 0 is public_version
                ver = ver.replace('MGI ', '')  # MGI 5.20 --> 5.20
                # MGI has a datestamp for the data within the database;
                # use it instead of the download date
                # datestamp in the table: 2014-12-23 00:14:20[.12345]
                # modification date without micro seconds
                dat = cols[1].strip().split('.')[0]
                datestamp = datetime.strptime(
                    dat, "%Y-%m-%d %H:%M:%S").strftime("%Y-%m-%d")
                f.close()
        self.dataset.setVersion(datestamp, ver)

        return
805275
def fetch(self, force=False):
        
        tmpdir = tempfile.mkdtemp()
        fetch_results = {
            'core': os.path.join(tmpdir, 'insights-core.egg'),
            'gpg_sig': os.path.join(tmpdir, 'insights-core.egg.asc')
        }

        logger.debug("Beginning core fetch.")

        # guess the URLs based on what legacy setting is
        egg_url = self.config.egg_path
        egg_gpg_url = self.config.egg_gpg_path
        if egg_url is None:
            if self.config.legacy_upload:
                egg_url = '/v1/static/core/insights-core.egg'
            else:
                egg_url = '/static/insights-core.egg'
        if egg_gpg_url is None:
            if self.config.legacy_upload:
                egg_gpg_url = '/v1/static/core/insights-core.egg.asc'
            else:
                egg_gpg_url = '/static/insights-core.egg.asc'
        # run fetch for egg
        updated = self._fetch(egg_url,
                              constants.core_etag_file,
                              fetch_results['core'],
                              force)

        # if new core was fetched, get new core sig
        if updated:
            logger.debug("New core was fetched.")
            logger.debug("Beginning fetch for core gpg signature.")
            self._fetch(egg_gpg_url,
                        constants.core_gpg_sig_etag_file,
                        fetch_results['gpg_sig'],
                        force)

            return fetch_results
231015
def get_asset_ddo(self, did):
        
        response = self.requests_session.get(f'{self.url}/{did}').content
        if not response:
            return {}
        try:
            parsed_response = json.loads(response)
        except TypeError:
            parsed_response = None
        except ValueError:
            raise ValueError(response.decode('UTF-8'))
        if parsed_response is None:
            return {}
        return Asset(dictionary=parsed_response)
135664
def decode(self, value, force=False):
        ""
        if (self.decode_responses or force) and isinstance(value, bytes):
            value = value.decode(self.encoding, self.encoding_errors)
        return value
1278679
def fw_version(self):
        
        (self._fw_version, value) = self.get_cached_attr_string(self._fw_version, 'fw_version')
        return value
985727
def get_version(self, is_full: bool = False) -> dict or str:
        
        payload = self.generate_json_rpc_payload(RpcMethod.GET_VERSION)
        response = self.__post(self.__url, payload)
        if is_full:
            return response
        return response['result']
115571
def asset_versions(self):
        
        if self._asset_versions is None:
            self._asset_versions = AssetVersionList(
                self._version,
                service_sid=self._solution['service_sid'],
                asset_sid=self._solution['sid'],
            )
        return self._asset_versions