Retrieve a file from the RCSB.
188447
def retrieve_file_from_RCSB(http_connection, resource, silent = True):
    ''''''
    if not silent:
        colortext.printf("Retrieving %s from RCSB" % os.path.split(resource)[1], color = "aqua")
    return http_connection.get(resource)
684191
def get_binary(self):
        """"""

        content_disp = 'Content-Disposition: form-data; name="file"; filename="{}"'

        stream = io.BytesIO()
        stream.write(_string_to_binary('--{}'.format(self.boundary)))
        stream.write(_crlf())
        stream.write(_string_to_binary(content_disp.format(self.file_name)))
        stream.write(_crlf())
        stream.write(_crlf())
        stream.write(self.body)
        stream.write(_crlf())
        stream.write(_string_to_binary('--{}--'.format(self.boundary)))
        stream.write(_crlf())

        return stream.getvalue()
1163385
def get_file(self, file_key):
		'''
		'''
		uri = '/'.join([
						self.api_uri,
						self.files_suffix,
						file_key
						])

		return self._req('get', uri)
48833
def get_file_contents(filename: str = None, blob: bytes = None) -> bytes:
    
    if not filename and not blob:
        raise ValueError("no filename and no blob")
    if filename and blob:
        raise ValueError("specify either filename or blob")
    if blob:
        return blob
    with open(filename, 'rb') as f:
        return f.read()
164922
def static_get_pdb_object(pdb_id, bio_cache = None, cache_dir = None):
        ''''''
        pdb_id = pdb_id.upper()

        if bio_cache:
            return bio_cache.get_pdb_object(pdb_id)

        if cache_dir:
            # Check to see whether we have a cached copy of the PDB file
            filepath = os.path.join(cache_dir, '{0}.pdb'.format(pdb_id))
            if os.path.exists(filepath):
                return PDB.from_filepath(filepath)

        # Get any missing files from the RCSB and create cached copies if appropriate
        pdb_contents = retrieve_pdb(pdb_id)
        if cache_dir:
            write_file(os.path.join(cache_dir, "%s.pdb" % pdb_id), pdb_contents)
        return PDB(pdb_contents)
319362
def retrieve_file(options)
        file_uri = options.fetch(:url)
        file_size = options.fetch(:file_size)

        retrieved = 0
        File.open(file_uri.path, 'rb') do |f|
          until f.eof?
            chunk = f.read(chunk_size)
            retrieved += chunk.length
            yield(chunk, retrieved, file_size)
          end
        end
      end
1058187
def get_file(self, attr_name):
        ''''''
        return os.path.abspath(os.path.join(self.folder, "{}.log"
                                            .format(attr_name)))
920982
def retrieve(pdb_id, cache_dir = None, acceptable_sequence_percentage_match = 70.0, require_uniprot_residue_mapping = True, bio_cache = None):
        '''
        '''

        pdb_contents = None
        xml_contents = None
        pdb_id = pdb_id.upper()

        l_pdb_id = pdb_id.lower()

        if len(pdb_id) != 4 or not pdb_id.isalnum():
            raise Exception("Bad PDB identifier '%s'." % pdb_id)

        if bio_cache:
            pdb_contents = bio_cache.get_pdb_contents(pdb_id)
            xml_contents = bio_cache.get_sifts_xml_contents(pdb_id)

        if cache_dir:
            if not pdb_contents:
                # Check to see whether we have a cached copy of the PDB file
                filename = os.path.join(cache_dir, "%s.pdb" % pdb_id)
                if os.path.exists(filename):
                    pdb_contents = read_file(filename)

            if not xml_contents:
                # Check to see whether we have a cached copy of the XML file
                filename = os.path.join(cache_dir, "%s.sifts.xml.gz" % l_pdb_id)
                if os.path.exists(filename):
                    xml_contents = read_file(filename)

        # Get any missing files from the RCSB and create cached copies if appropriate
        if not pdb_contents:
            pdb_contents = rcsb.retrieve_pdb(pdb_id)
            if cache_dir:
                write_file(os.path.join(cache_dir, "%s.pdb" % pdb_id), pdb_contents)

        if not xml_contents:
            try:
                xml_contents = retrieve_xml(pdb_id, silent = False)
                if cache_dir:
                    write_file(os.path.join(cache_dir, "%s.sifts.xml.gz" % l_pdb_id), xml_contents)
            except FTPException550:
                raise MissingSIFTSRecord('The file "%s.sifts.xml.gz" could not be found on the EBI FTP server.' % l_pdb_id)

        xml_contents = xml_contents

        # Return the object
        handler = SIFTS(xml_contents, pdb_contents, acceptable_sequence_percentage_match = acceptable_sequence_percentage_match, cache_dir = cache_dir, require_uniprot_residue_mapping = require_uniprot_residue_mapping, bio_cache = bio_cache, pdb_id = pdb_id)
        xml.sax.parseString(xml_contents, handler)
        return handler
969706
def find(self, relpath, rsc=None, useFilepath=None):
        
        self.init()
        
        # load the default resource information
        if rsc is None:
            try:
                key = relpath.replace('\\', '/').split('/')[0]
                rsc = self.default(key)
            except IndexError:
                return ''
        
        # determine the filepath location
        relpath = os.path.normpath(nativestring(relpath))
        rscpath = self.resourcePath()
        
        if useFilepath is None:
            useFilepath = self.useFilepath()
        
        # return from the filesystem
        if useFilepath and rscpath:
            if rsc and isinstance(rsc, XResourceManager):
                return rsc.find(relpath, useFilepath=useFilepath)
            elif rsc:
                filepath = os.path.join(rscpath, rsc, relpath)
            else:
                filepath = os.path.join(rscpath, relpath)
            
            if os.path.exists(filepath):
                return filepath
        
        # return resource
        if isinstance(rsc, XResourceManager):
            return rsc.find(relpath, useFilepath=useFilepath)
        elif rsc:
            return ':{0}/{1}'.format(rsc, relpath.replace(os.path.sep, '/'))
        else:
            return ':{0}'.format(relpath.replace(os.path.sep, '/'))
1303551
def retrieve(pdb_id, cache_dir = None):
        ''''''

        pdb_contents = None
        xml_contents = None
        pdb_id = pdb_id.upper()

        if cache_dir:
            # Check to see whether we have a cached copy of the PDB file
            filename = os.path.join(cache_dir, "%s.pdb" % pdb_id)
            if os.path.exists(filename):
                pdb_contents = read_file(filename)

            # Check to see whether we have a cached copy of the XML file
            filename = os.path.join(cache_dir, "%s.xml" % pdb_id)
            if os.path.exists(filename):
                xml_contents = read_file(filename)

        # Get any missing files from the RCSB and create cached copies if appropriate
        if not pdb_contents:
            pdb_contents = rcsb.retrieve_pdb(pdb_id)
            if cache_dir:
                write_file(os.path.join(cache_dir, "%s.pdb" % pdb_id), pdb_contents)

        if not xml_contents:
            xml_contents = rcsb.retrieve_xml(pdb_id)
            if cache_dir:
                write_file(os.path.join(cache_dir, "%s.xml" % pdb_id), xml_contents)

        # Return the object
        return PDBML_slow(xml_contents, pdb_contents)
1296620
def _retrieve_binary(self, file_name):
        """"""
        with open(file_name, 'wb') as f:
            return self.session.retrbinary('RETR ' + file_name, f.write)
574968
def __getFileObj(self, f):
        """"""
        if not f:
            raise ShapefileException("Shapefile Reader requires a shapefile or file-like object.")
        if self.shp and self.shpLength is None:
            self.load()
        if self.dbf and len(self.fields) == 0:
            self.load()
        return f
510161
def get_file(self, filename):
        
        log.debug('[%s]: reading: //%s/%s', self.name, self.name, filename)
        try:
            blob = self.repo.head.commit.tree/filename
            return blob.data_stream
        except KeyError as err:
            raise GitError(err)
455659
def from_filename(self, filename):
        '''
        
        '''
        if os.path.exists(filename):
            with open(filename) as fp:
                return IntentSchema(json.load(fp, object_pairs_hook=OrderedDict))
        else:
            print ('File does not exist')
            return IntentSchema()
135505
def get(method, hmc, uri, uri_parms, logon_required):
        """"""
        cpc_oid = uri_parms[0]
        query_str = uri_parms[1]
        try:
            cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
        except KeyError:
            raise InvalidResourceError(method, uri)
        result_lpars = []
        if not cpc.dpm_enabled:
            filter_args = parse_query_parms(method, uri, query_str)
            for lpar in cpc.lpars.list(filter_args):
                result_lpar = {}
                for prop in lpar.properties:
                    if prop in ('object-uri', 'name', 'status'):
                        result_lpar[prop] = lpar.properties[prop]
                result_lpars.append(result_lpar)
        return {'logical-partitions': result_lpars}
731308
def retrieve():
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x1c)  # 00011100
    packet = a / b
    return packet
274267
def _get_blob(self):
        """"""
        if not self.__blob:
            self.__blob = self.repo.get_object(self.id)
        return self.__blob