:return: Configuration file as BytesIO - we only access it through the respective blob's data
559693
def _sio_modules(cls, parent_commit):
        """"""
        sio = BytesIO(parent_commit.tree[cls.k_modules_file].data_stream.read())
        sio.name = cls.k_modules_file
        return sio
679136
def xlsx_blob(self):
        
        xlsx_file = BytesIO()
        with self._open_worksheet(xlsx_file) as (workbook, worksheet):
            self._populate_worksheet(workbook, worksheet)
        return xlsx_file.getvalue()
919380
def GetByteSize(self):
    
    if self.size == definitions.SIZE_NATIVE or self.units != 'bytes':
      return None

    return self.size
381484
def bytes(self):
        """"""
        addrbyte = b'\x00\x00\x00'
        if self.addr is not None:
            addrbyte = self.addr
        return addrbyte
989903
def bytes2zip(bytes):
    
    if hasattr(bytes, "read"):
        buff = TemporaryFile()
        archive = gzip.GzipFile(fileobj=buff, mode='w')
        for b in bytes:
            archive.write(b)
        archive.close()
        buff.seek(0)
        from pyLibrary.env.big_data import FileString, safe_size
        return FileString(buff)

    buff = BytesIO()
    archive = gzip.GzipFile(fileobj=buff, mode='w')
    archive.write(bytes)
    archive.close()
    return buff.getvalue()
515344
def as_bin(self, *args, **kwargs):
        
        f = io.BytesIO()
        self.stream(f, *args, **kwargs)
        return f.getvalue()
1220719
def fileobj_name(fileobj):
    

    value = getattr(fileobj, "name", u"")
    if not isinstance(value, (text_type, bytes)):
        value = text_type(value)
    return value
908872
def read_bytes(fo, writer_schema=None, reader_schema=None):
    """"""
    size = read_long(fo)
    return fo.read(size)
210344
def open_as_pillow(filename):
    
    with __sys_open(filename, 'rb') as f:
        data = BytesIO(f.read())
        return Image.open(data)
953900
def get_file(self, index, doc_type, id=None):
        
        data = self.get(index, doc_type, id)
        return data['_name'], base64.standard_b64decode(data['content'])
404662
def encoded(self):
        
        self.update_preferences()
        fp = BytesIO()
        zipped = zipfile.ZipFile(fp, 'w', zipfile.ZIP_DEFLATED)
        path_root = len(self.path) + 1  # account for trailing slash
        for base, dirs, files in os.walk(self.path):
            for fyle in files:
                filename = os.path.join(base, fyle)
                zipped.write(filename, filename[path_root:])
        zipped.close()
        return base64.b64encode(fp.getvalue()).decode('UTF-8')
883659
def create_file_api(conf):
    
    api_key = conf.config.get('api-key', os.environ.get('SMARTLING_API_KEY'))
    project_id = conf.config.get('project-id', os.environ.get('SMARTLING_PROJECT_ID'))

    if not project_id or not api_key:
        raise SmarterlingError('config.api-key and config.project-id are required configuration items')
    proxy_settings=None
    if conf.config.has_key('proxy-settings'):
        proxy_settings = ProxySettings(
            conf.config.get('proxy-settings').get('username', ''),
            conf.config.get('proxy-settings').get('password', ''),
            conf.config.get('proxy-settings').get('host', ''),
            int(conf.config.get('proxy-settings').get('port', '80')))
    return SmartlingFileApiFactory().getSmartlingTranslationApi(
        not conf.config.get('sandbox', False),
        api_key,
        project_id,
        proxySettings=proxy_settings)
93991
def to_bytes(self):
        '''
        
        '''
        raw = b''
        if not self._options:
            return raw
        for ipopt in self._options:
            raw += ipopt.to_bytes()
        padbytes = 4 - (len(raw) % 4)
        raw += b'\x00'*padbytes
        return raw
1193845
def get_data(self) -> bytes:
        
        data = {
            "_class_name": self.__class__.__name__,
            "version": 1,
            "segments_bin": SegmentSequence([self.command_seg, self.tan_request]).render_bytes(),
            "resume_method": self.resume_method,
            "tan_request_structured": self.tan_request_structured,
        }
        return compress_datablob(DATA_BLOB_MAGIC_RETRY, 1, data)
261480
def _get(self, key):
        
        buf = BytesIO()

        self._get_file(key, buf)

        return buf.getvalue()
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()
1127560
def to_bytes(self):
        '''
        
        '''
        header = self._make_header(self._checksum)
        return header + self._options.to_bytes()