Description: This routine takes as input a csr form and compresses it to return a compressed csr form
421475
public static int cusparseScsr2csr_compress(
        cusparseHandle handle, 
        int m, 
        int n, 
        cusparseMatDescr descrA, 
        Pointer csrSortedValA, 
        Pointer csrSortedColIndA, 
        Pointer csrSortedRowPtrA, 
        int nnzA, 
        Pointer nnzPerRow, 
        Pointer csrSortedValC, 
        Pointer csrSortedColIndC, 
        Pointer csrSortedRowPtrC, 
        float tol)
    {
        return checkResult(cusparseScsr2csr_compressNative(handle, m, n, descrA, csrSortedValA, csrSortedColIndA, csrSortedRowPtrA, nnzA, nnzPerRow, csrSortedValC, csrSortedColIndC, csrSortedRowPtrC, tol));
    }
597840
function Compressor() {
    var self = this;
    var regexps = [/[\n\r\t]+/g, /\s{2,}/g];

    /**
     * Remover of the html comment blocks
     * @param html
     * @returns {*}
     * @private
     */
    function _clearHTMLComments(html) {
        var cStart = '<!--',
            cEnd = '-->',
            beg = html.indexOf(cStart),
            end = 0;

        while (beg !== -1) {
            end = html.indexOf(cEnd, beg + 4);

            if (end === -1) {
                break;
            }

            var comment = html.substring(beg, end + 3);

            if (comment.indexOf("[if") !== -1 || comment.indexOf("![endif]") !== -1) { // skip
                beg = html.indexOf(cStart, end + 3);
                continue;
            }

            html = html.replace(comment, "");
            beg = html.indexOf(cStart, end + 3);
        }

        return html;
    }

    // ---- ---- ---- ---- ----

    /**
     * Compressor of the html string
     * @param {String} html
     * @returns {*}
     */
    self.compressHTML = function(html) {
        if (html === null || html === "")
            return html;

        html = _clearHTMLComments(html);

        var tags = ["script", "textarea", "pre", "code"],
            id = new Date().getTime() + "#",
            cache = {},
            index = 0;

        tags.forEach(function(tag, i) {
            var tagS = '<' + tag,
                tagE = '</' + tag + '>',
                start = html.indexOf(tagS),
                end = 0,
                len = tagE.length;

            while (start !== -1) {
                end = html.indexOf(tagE, start);
                if (end === -1) {
                    break;
                }

                var key = id + (index++),
                    value = html.substring(start, end + len);

                if (i === 0) {
                    end = value.indexOf(">");
                    len = value.indexOf('type="text/template"');
                    if (len < end && len !== -1) {
                        break;
                    }
                    len = value.indexOf('type="text/html"');
                    if (len < end && len !== -1) {
                        break;
                    }
                }
                cache[key] = value;
                html = html.replace(value, key);
                start = html.indexOf(tagS, start + tagS.length);
            }
        });

        regexps.forEach(function(regexp) {
            html = html.replace(regexp, "");
        });

        Object.keys(cache).forEach(function(key) {
            html = html.replace(key, cache[key]);
        });

        return html;
    };

    // api ----
    return self;
}
567819
def _init_from_csr(self, csr):
        
        if len(csr.indices) != len(csr.data):
            raise ValueError('length mismatch: {} vs {}'.format(len(csr.indices), len(csr.data)))
        self.handle = ctypes.c_void_p()
        _check_call(_LIB.XGDMatrixCreateFromCSR(c_array(ctypes.c_ulong, csr.indptr),
                                                c_array(ctypes.c_uint, csr.indices),
                                                c_array(ctypes.c_float, csr.data),
                                                len(csr.indptr), len(csr.data),
                                                ctypes.byref(self.handle)))
198003
def compressed(self):
        
        order = ecdsa.SECP256k1.generator.order()
        p = ecdsa.VerifyingKey.from_string(
            compat_bytes(self), curve=ecdsa.SECP256k1).pubkey.point
        x_str = ecdsa.util.number_to_string(p.x(), order)
        # y_str = ecdsa.util.number_to_string(p.y(), order)
        compressed = hexlify(
            compat_bytes(chr(2 + (p.y() & 1)), 'ascii') + x_str).decode(
            'ascii')
        return (compressed)
1373934
public static Dcs cs_compress(Dcs T) {
        int m, n, nz, p, k, Cp[], Ci[], w[], Ti[], Tj[];
        double Cx[], Tx[];
        Dcs C;
        if (!Dcs_util.CS_TRIPLET(T))
            return (null); /* check inputs */
        m = T.m;
        n = T.n;
        Ti = T.i;
        Tj = T.p;
        Tx = T.x;
        nz = T.nz;
        C = Dcs_util.cs_spalloc(m, n, nz, Tx != null, false); /* allocate result */
        w = new int[n]; /* get workspace */
        Cp = C.p;
        Ci = C.i;
        Cx = C.x;
        for (k = 0; k < nz; k++)
            w[Tj[k]]++; /* column counts */
        Dcs_cumsum.cs_cumsum(Cp, w, n); /* column pointers */
        for (k = 0; k < nz; k++) {
            Ci[p = w[Tj[k]]++] = Ti[k]; /* A(i,j) is the pth entry in C */
            if (Cx != null)
                Cx[p] = Tx[k];
        }
        return C;
    }
680511
def create_csr(key_file, organization_name, common_name, serial_number, file_):
    """"""
    key = crypto.load_privatekey(crypto.FILETYPE_PEM, key_file.read())

    req = crypto.X509Req()
    subj = req.get_subject()

    subj.O = organization_name  # noqa: E741 (we can't do anything about this)
    subj.CN = common_name
    subj.serialNumber = serial_number

    req.set_pubkey(key)
    req.sign(key, 'md5')

    file_.write(crypto.dump_certificate_request(crypto.FILETYPE_PEM, req))
475730
def _process(compressor, input_filename, output_filename):
    
    compressor(input_filename, output_filename)
    result_size = os.path.getsize(output_filename)

    return _CompressorResult(result_size, output_filename, compressor.__name__)
898008
def compressBuffer(buffer):
    
    # http://jython.xhaus.com/http-compression-in-python-and-jython/
    zbuf = cStringIO.StringIO()
    zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=9)
    zfile.write(buffer)
    zfile.close()
    return zbuf.getvalue()
81416
def compress(self):
        """"""
        for ast_token in self.ast_tokens:
            if type(ast_token) in self.dispatcher:  # pylint: disable=unidiomatic-typecheck
                self.dispatcher[type(ast_token)](ast_token)
            else:
                self.dispatcher['default'](ast_token)
1026609
def delete_rows_csr(mat, indices):
    
    if not isinstance(mat, scipy.sparse.csr_matrix):
        raise ValueError("works only for CSR format -- use .tocsr() first")
    indices = list(indices)
    mask = np.ones(mat.shape[0], dtype=bool)
    mask[indices] = False
    return mat[mask]
167848
def compress_monkey_patch():
    
    from compressor.templatetags import compress as compress_tags
    from compressor import base as compress_base

    compress_base.Compressor.filter_input = filter_input
    compress_base.Compressor.output = output
    compress_base.Compressor.hunks = hunks
    compress_base.Compressor.precompile = precompile

    compress_tags.CompressorMixin.render_compressed = render_compressed

    from django_pyscss import compressor as pyscss_compressor

    pyscss_compressor.DjangoScssFilter.input = input
352375
def _compress(self, cmd):
        """"""
        compressor = COMPRESSORS.get(self.compressor)
        if compressor is None:
            return cmd
        compress_cmd = compressor['compress']
        return "{} | {}".format(compress_cmd, cmd)
1224733
def decode_csr(self, csr):
        """"""

        response = self.request(E.decodeCsrSslCertRequest(
            E.csr(csr)
        ))

        return response.data
95852
def compressed_char(self, action):
        '''
        '''
        if action == 'on':
            action = 15
        elif action == 'off':
            action = 18
        else:
            raise RuntimeError('Invalid action for function compressedChar. Options are on and off')
        self.send(chr(action))
422557
def _tls_decompress(self, s):
        
        alg = self.tls_session.rcs.compression
        return alg.decompress(s)
1330296
def create(cls, csr, duration, package, altnames=None, dcv_method=None):
        
        params = {'csr': csr, 'package': package, 'duration': duration}
        if altnames:
            params['altnames'] = altnames
        if dcv_method:
            params['dcv_method'] = dcv_method

        try:
            result = cls.call('cert.create', params)
        except UsageError:
            params['--dry-run'] = True
            msg = '\n'.join(['%s (%s)' % (err['reason'], err['attr'])
                             for err in cls.call('cert.create', params)])
            cls.error(msg)
            raise

        if dcv_method in ('dns', 'file'):
            cls.advice_dcv_method(csr, package, altnames, dcv_method,
                                  cert_id=result['params'].get('cert_id'))
        return result
193159
function Request__compress(response) {
        var accept = this.getRequestHeader('Accept-Encoding'),
            isForCompress = (Type.isString(response) || response instanceof Buffer) && !this.isCompressed,
            that = this;

        if (this.isRendered) {
            // we have multiple recursion in parse for catching
            return false;
        }


        if (isForCompress && !!this.isCompressionEnabled && Type.isString(accept)) {
            if (!this.hasHeader('Vary')) {
                this.addHeader('Vary', 'Accept-Encoding');
            }
            if (accept.indexOf('gzip') > -1) {
                return new Promise(function (resolve, reject) {
                    zlib.gzip(response, function (err, data) {
                        if (err) {
                            return reject(err);
                        }
                        that.isCompressed = true;
                        that.addHeader('Content-Encoding', 'gzip');
                        resolve(data);
                    });
                });
            } else if (accept.indexOf('deflate') > -1) {
                return new Promise(function (resolve, reject) {
                    zlib.deflate(response, function (err, data) {
                        if (err) {
                            return reject(err);
                        }
                        that.isCompressed = true;
                        that.addHeader('Content-Encoding', 'deflate');
                        resolve(data);
                    });
                });
            }
        }

        return response;
    }