encode vote into protobuf
163282
def to_protobuf(self) -> str:
        ''''''

        vote = pavoteproto.Vote()
        vote.version = self.version
        vote.description = self.description
        vote.count_mode = vote.MODE.Value(self.count_mode)
        vote.start_block = self.start_block
        vote.end_block = self.end_block
        vote.choices.extend(self.choices)

        if not isinstance(self.vote_metainfo, bytes):
            vote.vote_metainfo = self.vote_metainfo.encode()
        else:
            vote.vote_metainfo = self.vote_metainfo

        proto = vote.SerializeToString()

        if len(proto) > 80:
            warnings.warn('\nMetainfo size exceeds maximum of 80 bytes allowed by OP_RETURN.')

        return proto
1347017
function postEncode(encoded, options) {
  if (options === null)
    return encoded

  return bytewise.postEncode(encoded, options)
}
1323756
def convert_protodef_to_editable(proto):
    
    class Editable(object):
        def __init__(self, prot):
            self.kind = type(prot)
            self.name = prot.name
            self.comment = ""
            self.options = dict([(key.name, value) for (key, value) in prot.options.ListFields()])
            if isinstance(prot, EnumDescriptorProto):
                self.value = [convert_protodef_to_editable(x) for x in prot.value]
            elif isinstance(prot, DescriptorProto):
                self.field = [convert_protodef_to_editable(x) for x in prot.field]
                self.enum_type = [convert_protodef_to_editable(x) for x in prot.enum_type]
                self.nested_type = prot.nested_type
                self.oneof_decl = prot.oneof_decl
            elif isinstance(prot, EnumValueDescriptorProto):
                self.number = prot.number
            elif isinstance(prot, FieldDescriptorProto):
                if prot.type in [11, 14]:
                    self.ref_type = prot.type_name[1:]
                self.type = prot.type
                self.label = prot.label
            elif isinstance(prot, ServiceDescriptorProto):
                self.method = [convert_protodef_to_editable(x) for x in prot.method]
            elif isinstance(prot, MethodDescriptorProto):
                self.input_type = prot.input_type
                self.output_type = prot.output_type
            else:
                raise Exception, type(prot)

    return Editable(proto)
244730
private int generateEncodeDecode(
        final StringBuilder sb,
        final String typeName,
        final List<Token> tokens,
        final boolean isMessage,
        final boolean isExtensible)
    {
        final char varName = Character.toLowerCase(typeName.charAt(0));
        final StringBuilder encode = new StringBuilder();
        final StringBuilder decode = new StringBuilder();
        final StringBuilder init = new StringBuilder();
        final StringBuilder rangeCheck = new StringBuilder();
        final StringBuilder nested = new StringBuilder();
        int currentOffset = 0;
        int gap;
        boolean extensionStarted = false;

        // Open all our methods
        generateEncodeDecodeOpen(encode, decode, rangeCheck, init, varName, typeName, isMessage, isExtensible);

        for (int i = 0; i < tokens.size(); i++)
        {
            final Token signalToken = tokens.get(i);
            final String propertyName = formatPropertyName(signalToken.name());

            switch (signalToken.signal())
            {
                case BEGIN_MESSAGE: // Check range *before* we encode setting the acting version to schema version
                    encode.append(String.format(
                        "\tif doRangeCheck {\n" +
                        "\t\tif err := %1$s.RangeCheck(%1$s.SbeSchemaVersion(), %1$s.SbeSchemaVersion());" +
                        " err != nil {\n" +
                        "\t\t\treturn err\n" +
                        "\t\t}\n" +
                        "\t}\n",
                        varName));
                    break;

                case END_MESSAGE:
                    // Newer version extra fields check
                    if (isExtensible && !extensionStarted)
                    {
                        generateExtensionCheck(decode, varName);
                        extensionStarted = true;
                    }

                    // Check range *after* we decode using the acting
                    // version of the encoded message
                    decode.append(String.format(
                        "\tif doRangeCheck {\n" +
                        "\t\tif err := %1$s.RangeCheck(actingVersion, %1$s.SbeSchemaVersion()); err != nil {\n" +
                        "\t\t\treturn err\n" +
                        "\t\t}\n" +
                        "\t}\n",
                        varName));
                    break;

                case BEGIN_ENUM:
                case BEGIN_SET:
                    currentOffset += generatePropertyEncodeDecode(
                        signalToken, typeName, encode, decode, currentOffset);
                    i += signalToken.componentTokenCount() - 1;
                    break;

                case BEGIN_COMPOSITE:
                    currentOffset += generatePropertyEncodeDecode(
                        signalToken, typeName, encode, decode, currentOffset);
                    i += signalToken.componentTokenCount() - 1;

                    rangeCheck.append(String.format(
                        "\tif err := %1$s.%2$s.RangeCheck(actingVersion, schemaVersion); err != nil {\n" +
                        "\t\treturn err\n" +
                        "\t}\n",
                        varName, propertyName));
                    break;

                case BEGIN_FIELD:
                    if (tokens.size() >= i + 1)
                    {
                        currentOffset += generateFieldEncodeDecode(
                            tokens.subList(i, tokens.size() - 1),
                            varName, currentOffset, encode, decode, rangeCheck, init);

                        // Encodings just move past the encoding token
                        if (tokens.get(i + 1).signal() == Signal.ENCODING)
                        {
                            i += 1;
                        }
                        else
                        {
                            i += signalToken.componentTokenCount() - 1;
                        }
                    }
                    break;

                case ENCODING:
                    gap = signalToken.offset() - currentOffset;
                    encode.append(generateEncodeOffset(gap, ""));
                    decode.append(generateDecodeOffset(gap, ""));
                    currentOffset += signalToken.encodedLength() + gap;
                    final String primitive = varName + "." + propertyName;

                    // Encode of a constant is a nullop and we want to
                    // initialize constant values.
                    if (signalToken.isConstantEncoding())
                    {
                        generateConstantInitPrimitive(init, primitive, signalToken);
                    }
                    else
                    {
                        generateEncodePrimitive(encode, varName, formatPropertyName(signalToken.name()), signalToken);
                    }

                    // Optional tokens also get initialized
                    if (signalToken.isOptionalEncoding())
                    {
                        generateOptionalInitPrimitive(init, primitive, signalToken);
                    }

                    generateDecodePrimitive(decode, primitive, signalToken);
                    generateRangeCheckPrimitive(rangeCheck, primitive, signalToken, signalToken.isOptionalEncoding());
                    break;

                case BEGIN_GROUP:
                    // Newer version extra fields check
                    if (isExtensible && !extensionStarted)
                    {
                        generateExtensionCheck(decode, varName);
                        extensionStarted = true;
                    }

                    // Write the group, saving any extra offset we need to skip
                    currentOffset += generateGroupEncodeDecode(
                        tokens.subList(i, tokens.size() - 1),
                        typeName,
                        encode, decode, rangeCheck, currentOffset);

                    // Recurse
                    gap = Math.max(0,
                        signalToken.encodedLength() -
                            generateEncodeDecode(
                                nested,
                                typeName + toUpperFirstChar(signalToken.name()),
                                tokens.subList(i + 5, tokens.size() - 1),
                                false, true));

                    // Group gap block length handling
                    encode.append(generateEncodeOffset(gap, "\t")).append("\t}\n");
                    decode.append(generateDecodeOffset(gap, "\t")).append("\t}\n");

                    // And we can move over this group to the END_GROUP
                    i += signalToken.componentTokenCount() - 1;
                    break;

                case END_GROUP:
                    // Newer version extra fields check
                    if (isExtensible && !extensionStarted)
                    {
                        generateExtensionCheck(decode, varName);
                    }
                    // Close out this group and unwind
                    generateEncodeDecodeClose(encode, decode, rangeCheck, init);
                    sb.append(encode).append(decode).append(rangeCheck).append(init).append(nested);
                    return currentOffset; // for gap calculations

                case BEGIN_VAR_DATA:
                    // Newer version extra fields check
                    if (isExtensible && !extensionStarted)
                    {
                        generateExtensionCheck(decode, varName);
                        extensionStarted = true;
                    }
                    currentOffset += generateVarDataEncodeDecode(
                        tokens.subList(i, tokens.size() - 1),
                        typeName,
                        encode, decode, rangeCheck, currentOffset);
                    // And we can move over this group
                    i += signalToken.componentTokenCount() - 1;
                    break;
            }
        }

        // You can use blockLength on both messages and groups (handled above)
        // to leave some space (akin to an offset).
        final Token endToken = tokens.get(tokens.size() - 1);
        if (endToken.signal() == Signal.END_MESSAGE)
        {
            gap = endToken.encodedLength() - currentOffset;
            encode.append(generateEncodeOffset(gap, ""));
            decode.append(generateDecodeOffset(gap, ""));
        }

        // Close out the methods and append
        generateEncodeDecodeClose(encode, decode, rangeCheck, init);
        sb.append(encode).append(decode).append(rangeCheck).append(init).append(nested);

        return currentOffset;
    }
170615
def _encode_mapping(name, value, check_keys, opts):
    """"""
    data = b"".join([_element_to_bson(key, val, check_keys, opts)
                     for key, val in iteritems(value)])
    return b"\x03" + name + _PACK_INT(len(data) + 5) + data + b"\x00"
1319731
function(values, var_args) {
                    ProtoBuf.Builder.Message.call(this);

                    // Create virtual oneof properties
                    for (var i=0, k=oneofs.length; i<k; ++i)
                        this[oneofs[i].name] = null;
                    // Create fields and set default values
                    for (i=0, k=fields.length; i<k; ++i) {
                        var field = fields[i];
                        this[field.name] =
                            field.repeated ? [] :
                            (field.map ? new ProtoBuf.Map(field) : null);
                        if ((field.required || T.syntax === 'proto3') &&
                            field.defaultValue !== null)
                            this[field.name] = field.defaultValue;
                    }

                    if (arguments.length > 0) {
                        var value;
                        // Set field values from a values object
                        if (arguments.length === 1 && values !== null && typeof values === 'object' &&
                            /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
                            /* not a repeated field */ !Array.isArray(values) &&
                            /* not a Map */ !(values instanceof ProtoBuf.Map) &&
                            /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
                            /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
                            /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
                            this.$set(values);
                        } else // Set field values from arguments, in declaration order
                            for (i=0, k=arguments.length; i<k; ++i)
                                if (typeof (value = arguments[i]) !== 'undefined')
                                    this.$set(fields[i].name, value); // May throw
                    }
                }
1233289
def converts_to_proto(value, msg, raise_err=False):
    
    result = True
    try:
        dict_to_protobuf.dict_to_protobuf(value, msg)
    except TypeError as type_error:
        if raise_err:
            raise type_error
        result = False
    return result
167944
def submit(self):
        """"""
        self._newflg = False
        ret = list()
        for buf in self._buffer.values():
            buf = copy.deepcopy(buf)
            if self._fdpext:
                buf['fpout'] = f"{self._fproot}/{buf['label']}.{self._fdpext}"
            else:
                del buf['fpout']
            buf['index'] = tuple(buf['index'])
            ret.append(Info(buf))
        ret += self._stream
        return tuple(ret)
988980
function processString(content = '', options = defaultOptions) {

    const comments = []
    const preservedTokens = []

    let pattern

    content = extractDataUrls(content, preservedTokens)
    content = convertRelativeUrls(content, options, preservedTokens)
    content = collectComments(content, comments)

    // preserve strings so their content doesn't get accidentally minified
    pattern = /("([^\\"]|\\.|\\)*")|('([^\\']|\\.|\\)*')/g
    content = content.replace(pattern, token => {
        const quote = token.substring(0, 1)
        token = token.slice(1, -1)
        // maybe the string contains a comment-like substring or more? put'em back then
        if (token.indexOf('___PRESERVE_CANDIDATE_COMMENT_') >= 0) {
            for (let i = 0, len = comments.length; i < len; i += 1) {
                token = token.replace('___PRESERVE_CANDIDATE_COMMENT_' + i + '___', comments[i])
            }
        }
        // minify alpha opacity in filter strings
        token = token.replace(/progid:DXImageTransform.Microsoft.Alpha\(Opacity=/gi, 'alpha(opacity=')
        preservedTokens.push(token)
        return quote + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___' + quote
    })

    // strings are safe, now wrestle the comments
    for (let i = 0, len = comments.length; i < len; i += 1) {

        let token = comments[i]
        let placeholder = '___PRESERVE_CANDIDATE_COMMENT_' + i + '___'

        // ! in the first position of the comment means preserve
        // so push to the preserved tokens keeping the !
        if (token.charAt(0) === '!') {
            if (options.cuteComments) {
                preservedTokens.push(token.substring(1).replace(/\r\n/g, '\n'))
            } else if (options.uglyComments) {
                preservedTokens.push(token.substring(1).replace(/[\r\n]/g, ''))
            } else {
                preservedTokens.push(token)
            }
            content = content.replace(placeholder, ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___')
            continue
        }

        // \ in the last position looks like hack for Mac/IE5
        // shorten that to /*\*/ and the next one to /**/
        if (token.charAt(token.length - 1) === '\\') {
            preservedTokens.push('\\')
            content = content.replace(placeholder, ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___')
            i = i + 1 // attn: advancing the loop
            preservedTokens.push('')
            content = content.replace(
                '___PRESERVE_CANDIDATE_COMMENT_' + i + '___',
                ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___'
            )
            continue
        }

        // keep empty comments after child selectors (IE7 hack)
        // e.g. html >/**/ body
        if (token.length === 0) {
            let startIndex = content.indexOf(placeholder)
            if (startIndex > 2) {
                if (content.charAt(startIndex - 3) === '>') {
                    preservedTokens.push('')
                    content = content.replace(placeholder, ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___')
                }
            }
        }

        // in all other cases kill the comment
        content = content.replace(`/*${placeholder}*/`, '')
    }

    // parse simple @variables blocks and remove them
    if (options.expandVars) {
        const vars = {}
        pattern = /@variables\s*\{\s*([^\}]+)\s*\}/g
        content = content.replace(pattern, (_, f1) => {
            pattern = /\s*([a-z0-9\-]+)\s*:\s*([^;\}]+)\s*/gi
            f1.replace(pattern, (_, f1, f2) => {
                if (f1 && f2) {
                    vars[f1] = f2
                }
                return ''
            })
            return ''
        })

        // replace var(x) with the value of x
        pattern = /var\s*\(\s*([^\)]+)\s*\)/g
        content = content.replace(pattern, (_, f1) => {
            return vars[f1] || 'none'
        })
    }

    // normalize all whitespace strings to single spaces. Easier to work with that way.
    content = content.replace(/\s+/g, ' ')

    // preserve formulas in calc() before removing spaces
    pattern = /calc\(([^;}]*)\)/g
    content = content.replace(pattern, (_, f1) => {
        preservedTokens.push(
            'calc(' +
            f1.replace(/(^\s*|\s*$)/g, '')
                .replace(/\( /g, '(')
                .replace(/ \)/g, ')') +
            ')'
        )
        return ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___'
    })

    // preserve matrix
    pattern = /\s*filter:\s*progid:DXImageTransform.Microsoft.Matrix\(([^\)]+)\);/g
    content = content.replace(pattern, (_, f1) => {
        preservedTokens.push(f1)
        return 'filter:progid:DXImageTransform.Microsoft.Matrix(' + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___);'
    })

    // remove the spaces before the things that should not have spaces before them.
    // but, be careful not to turn 'p :link {...}' into 'p:link{...}'
    // swap out any pseudo-class colons with the token, and then swap back.
    pattern = /(^|\})(([^\{:])+:)+([^\{]*\{)/g
    content = content.replace(pattern, token => token.replace(/:/g, '___PSEUDOCLASSCOLON___'))

    // remove spaces before the things that should not have spaces before them.
    content = content.replace(/\s+([!{};:>+\(\)\],])/g, '$1')

    // restore spaces for !important
    content = content.replace(/!important/g, ' !important')

    // bring back the colon
    content = content.replace(/___PSEUDOCLASSCOLON___/g, ':')

    // preserve 0 followed by a time unit for properties using time units
    pattern = /\s*(animation|animation-delay|animation-duration|transition|transition-delay|transition-duration):\s*([^;}]+)/gi
    content = content.replace(pattern, (_, f1, f2) => {

        f2 = f2.replace(/(^|\D)0?\.?0(m?s)/gi, (_, g1, g2) => {
            preservedTokens.push('0' + g2)
            return g1 + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___'
        })

        return f1 + ':' + f2
    })

    // preserve unit for flex-basis within flex and flex-basis (ie10 bug)
    pattern = /\s*(flex|flex-basis):\s*([^;}]+)/gi
    content = content.replace(pattern, (_, f1, f2) => {
        let f2b = f2.split(/\s+/)
        preservedTokens.push(f2b.pop())
        f2b.push(___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___')
        f2b = f2b.join(' ')
        return `${f1}:${f2b}`
    })

    // preserve 0% in hsl and hsla color definitions
    content = content.replace(/(hsla?)\(([^)]+)\)/g, (_, f1, f2) => {
        var f0 = []
        f2.split(',').forEach(part => {
            part = part.replace(/(^\s+|\s+$)/g, '')
            if (part === '0%') {
                preservedTokens.push('0%')
                f0.push(___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___')
            } else {
                f0.push(part)
            }
        })
        return f1 + '(' + f0.join(',') + ')'
    })

    // preserve 0 followed by unit in keyframes steps (WIP)
    content = keyframes(content, preservedTokens)

    // retain space for special IE6 cases
    content = content.replace(/:first-(line|letter)(\{|,)/gi, (_, f1, f2) => ':first-' + f1.toLowerCase() + ' ' + f2)

    // newlines before and after the end of a preserved comment
    if (options.cuteComments) {
        content = content.replace(/\s*\/\*/g, '___PRESERVED_NEWLINE___/*')
        content = content.replace(/\*\/\s*/g, '*/___PRESERVED_NEWLINE___')
        // no space after the end of a preserved comment
    } else {
        content = content.replace(/\*\/\s*/g, '*/')
    }

    // If there are multiple @charset directives, push them to the top of the file.
    pattern = /^(.*)(@charset)( "[^"]*";)/gi
    content = content.replace(pattern, (_, f1, f2, f3) => f2.toLowerCase() + f3 + f1)

    // When all @charset are at the top, remove the second and after (as they are completely ignored).
    pattern = /^((\s*)(@charset)( [^;]+;\s*))+/gi
    content = content.replace(pattern, (_, __, f2, f3, f4) => f2 + f3.toLowerCase() + f4)

    // lowercase some popular @directives (@charset is done right above)
    pattern = /@(font-face|import|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?keyframe|media|page|namespace)/gi
    content = content.replace(pattern, (_, f1) => '@' + f1.toLowerCase())

    // lowercase some more common pseudo-elements
    pattern = /:(active|after|before|checked|disabled|empty|enabled|first-(?:child|of-type)|focus|hover|last-(?:child|of-type)|link|only-(?:child|of-type)|root|:selection|target|visited)/gi
    content = content.replace(pattern, (_, f1) => ':' + f1.toLowerCase())

    // if there is a @charset, then only allow one, and push to the top of the file.
    content = content.replace(/^(.*)(@charset \"[^\"]*\";)/g, '$2$1')
    content = content.replace(/^(\s*@charset [^;]+;\s*)+/g, '$1')

    // lowercase some more common functions
    pattern = /:(lang|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?any)\(/gi
    content = content.replace(pattern, (_, f1) => ':' + f1.toLowerCase() + '(')

    // lower case some common function that can be values
    // NOTE: rgb() isn't useful as we replace with #hex later, as well as and() is already done for us right after this
    pattern = /([:,\( ]\s*)(attr|color-stop|from|rgba|to|url|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?(?:calc|max|min|(?:repeating-)?(?:linear|radial)-gradient)|-webkit-gradient)/gi
    content = content.replace(pattern, (_, f1, f2) => f1 + f2.toLowerCase())

    // put the space back in some cases, to support stuff like
    // @media screen and (-webkit-min-device-pixel-ratio:0){
    content = content.replace(/\band\(/gi, 'and (')

    // remove the spaces after the things that should not have spaces after them.
    content = content.replace(/([!{}:;>+\(\[,])\s+/g, '$1')

    // remove unnecessary semicolons
    content = content.replace(/;+\}/g, '}')

    // replace 0(px,em,%) with 0.
    content = content.replace(/(^|[^.0-9\\])(?:0?\.)?0(?:ex|ch|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|g?rad|turn|m?s|k?Hz|dpi|dpcm|dppx|%)/gi, '$10')

    // Replace x.0(px,em,%) with x(px,em,%).
    content = content.replace(/([0-9])\.0(ex|ch|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|g?rad|turn|m?s|k?Hz|dpi|dpcm|dppx|%| |;)/gi, '$1$2')

    // replace 0 0 0 0; with 0.
    content = content.replace(/:0 0 0 0(;|\})/g, ':0$1')
    content = content.replace(/:0 0 0(;|\})/g, ':0$1')
    content = content.replace(/:0 0(;|\})/g, ':0$1')

    // replace background-position:0; with background-position:0 0;
    // same for transform-origin and box-shadow
    pattern = /(background-position|transform-origin|webkit-transform-origin|moz-transform-origin|o-transform-origin|ms-transform-origin|box-shadow):0(;|\})/gi
    content = content.replace(pattern, (_, f1, f2) => f1.toLowerCase() + ':0 0' + f2)

    // replace 0.6 to .6, but only when preceded by : or a white-space
    content = content.replace(/(:|\s)0+\.(\d+)/g, '$1.$2')

    // shorten colors from rgb(51,102,153) to #336699
    // this makes it more likely that it'll get further compressed in the next step.
    pattern = /rgb\s*\(\s*([0-9,\s]+)\s*\)/gi
    content = content.replace(pattern, (_, f1) => {
        const rgbcolors = f1.split(',')
        let hexcolor = '#'
        for (let i = 0; i < rgbcolors.length; i += 1) {
            let val = parseInt(rgbcolors[i], 10)
            if (val < 16) {
                hexcolor += '0'
            }
            if (val > 255) {
                val = 255
            }
            hexcolor += val.toString(16)
        }
        return hexcolor
    })

    // Shorten colors from #AABBCC to #ABC.
    content = compressHexColors(content)

    // Replace #f00 -> red
    content = content.replace(/(:|\s)(#f00)(;|})/g, '$1red$3')

    // Replace other short color keywords
    content = content.replace(/(:|\s)(#000080)(;|})/g, '$1navy$3')
    content = content.replace(/(:|\s)(#808080)(;|})/g, '$1gray$3')
    content = content.replace(/(:|\s)(#808000)(;|})/g, '$1olive$3')
    content = content.replace(/(:|\s)(#800080)(;|})/g, '$1purple$3')
    content = content.replace(/(:|\s)(#c0c0c0)(;|})/g, '$1silver$3')
    content = content.replace(/(:|\s)(#008080)(;|})/g, '$1teal$3')
    content = content.replace(/(:|\s)(#ffa500)(;|})/g, '$1orange$3')
    content = content.replace(/(:|\s)(#800000)(;|})/g, '$1maroon$3')

    // border: none -> border:0
    pattern = /(border|border-top|border-right|border-bottom|border-left|outline|background):none(;|\})/gi
    content = content.replace(pattern, (_, f1, f2) => f1.toLowerCase() + ':0' + f2)

    // shorter opacity IE filter
    content = content.replace(/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/gi, 'alpha(opacity=')

    // Find a fraction that is used for Opera's -o-device-pixel-ratio query
    // Add token to add the '\' back in later
    content = content.replace(/\(([\-A-Za-z]+):([0-9]+)\/([0-9]+)\)/g, '($1:$2___QUERY_FRACTION___$3)')

    // remove empty rules.
    content = content.replace(/[^\};\{\/]+\{\}/g, '')

    // Add '\' back to fix Opera -o-device-pixel-ratio query
    content = content.replace(/___QUERY_FRACTION___/g, '/')

    // some source control tools don't like it when files containing lines longer
    // than, say 8000 characters, are checked in. The linebreak option is used in
    // that case to split long lines after a specific column.
    if (options.maxLineLen > 0) {
        const lines = []
        let line = []
        for (let i = 0, len = content.length; i < len; i += 1) {
            let ch = content.charAt(i)
            line.push(ch)
            if (ch === '}' && line.length > options.maxLineLen) {
                lines.push(line.join(''))
                line = []
            }
        }
        if (line.length) {
            lines.push(line.join(''))
        }

        content = lines.join('\n')
    }

    // replace multiple semi-colons in a row by a single one
    // see SF bug #1980989
    content = content.replace(/;;+/g, ';')

    // trim the final string (for any leading or trailing white spaces)
    content = content.replace(/(^\s*|\s*$)/g, '')

    // restore preserved tokens
    for (let i = preservedTokens.length - 1; i >= 0; i--) {
        content = content.replace(___PRESERVED_TOKEN_ + i + '___', preservedTokens[i], 'g')
    }

    // restore preserved newlines
    content = content.replace(/___PRESERVED_NEWLINE___/g, '\n')

    // return
    return content
}
1355242
def to_protobuf(self):
        
        return latlng_pb2.LatLng(latitude=self.latitude, longitude=self.longitude)
569009
function encodeArray(array, proto, offset, buffer, protos){
    let i = 0;

    if(util.isSimpleType(proto.type)){
      offset = writeBytes(buffer, offset, encodeTag(proto.type, proto.tag));
      offset = writeBytes(buffer, offset, codec.encodeUInt32(array.length));
      for(i = 0; i < array.length; i++){
        offset = encodeProp(array[i], proto.type, offset, buffer);
      }
    }else{
      for(i = 0; i < array.length; i++){
        offset = writeBytes(buffer, offset, encodeTag(proto.type, proto.tag));
        offset = encodeProp(array[i], proto.type, offset, buffer, protos);
      }
    }

    return offset;
  }
903605
private byte[] encode(Message msg, String apiVersion, String kind) {
    // It is unfortunate that we have to include apiVersion and kind,
    // since we should be able to extract it from the Message, but
    // for now at least, those fields are missing from the proto-buffer.
    Unknown u =
        Unknown.newBuilder()
            .setTypeMeta(TypeMeta.newBuilder().setApiVersion(apiVersion).setKind(kind))
            .setRaw(msg.toByteString())
            .build();
    return Bytes.concat(MAGIC, u.toByteArray());
  }
16724
private static void encodeTabAnchorTag(FacesContext context, ResponseWriter writer, Tab tab,
			String hiddenInputFieldID, int tabindex, boolean disabled) throws IOException {
		writer.startElement("a", tab);
		writer.writeAttribute("id", tab.getClientId().replace(":", "_") + "_tab", "id");
		writer.writeAttribute("role", "tab", "role");
		if (tab.isDisabled() || disabled) {
			writer.writeAttribute("onclick", "event.preventDefault(); return false;", null);
		} else {
			writer.writeAttribute("data-toggle", "tab", "data-toggle");
			writer.writeAttribute("href", "#" + tab.getClientId().replace(":", "_") + "_pane", "href");
			String onclick = "document.getElementById('" + hiddenInputFieldID + "').value='" + String.valueOf(tabindex)
					+ "';";
			AJAXRenderer.generateBootsFacesAJAXAndJavaScript(context, tab, writer, "click", onclick, false, true);
		}
		R.encodeHTML4DHTMLAttrs(writer, tab.getAttributes(), new String[] { "style", "tabindex" });

		UIComponent iconFacet = tab.getFacet("anchor");
		if (null != iconFacet) {
			iconFacet.encodeAll(FacesContext.getCurrentInstance());
			if (null != tab.getTitle()) {
				writer.writeText(" " + tab.getTitle(), null);
			}
		} else {
			writer.writeText(tab.getTitle(), null);
		}
		writer.endElement("a");
	}
1131456
function encode(data) {
  $.checkArgument(data instanceof Array, 'Must be Array');
  var base32 = '';
  for (var i=0; i<data.length; i++) {
    var value = data[i];
    $.checkArgument(0 <= value && value < 32, 'Non-base32, value ' + value);
    base32 += CHARSET[value];
  }
  return base32;
}
351828
function OnTimeoutPropose(){
    console.log("byllllogg timeout broadcastPrevote OnTimeoutPropose1:" + h_p + ":" + p_p + ":" + h_propose_timeout + ":" + p_propose_timeout + ":" + step_p);
    if(h_propose_timeout === h_p && p_propose_timeout === p_p && step_p === constants.BYZANTINE_PROPOSE){
        pushByzantinePrevote(h_propose_timeout, p_propose_timeout, null, address_p, 0);
        console.log("byllllogg timeout broadcastPrevote OnTimeoutPropose2:" + h_p + ":" + p_p + ":" + h_propose_timeout + ":" + p_propose_timeout + ": null");
        broadcastPrevote(h_propose_timeout, p_propose_timeout, null);
        step_p = constants.BYZANTINE_PREVOTE;
    }
    h_propose_timeout = -1;
    p_propose_timeout = -1;
    
    handleByzantine();
    
    // if proposer down
    // if(!assocByzantinePhase[h_p].phase[p_p].proposal || 
    //     typeof assocByzantinePhase[h_p].phase[p_p].proposal === 'undefined' || 
    //     Object.keys(assocByzantinePhase[h_p].phase[p_p].proposal).length === 0 ||
    //     !assocByzantinePhase[h_p].phase[p_p].proposal.idv ||
    //     typeof assocByzantinePhase[h_p].phase[p_p].proposal.idv === 'undefined'){
    //         console.log("byllllogg timeout startPhase OnTimeoutPropose:" + h_p + ":" + p_p + ":" + h_precommit_timeout + ":" + p_precommit_timeout);
    //     h_prevote_timeout   = -1;
    //     p_prevote_timeout   = -1;
    //     h_precommit_timeout = -1;
    //     p_precommit_timeout = -1; 
    //     startPhase(h_p, p_p+1);        
    // }
}
23826
public void encodeData(AsnOutputStream asnOs) throws MAPException {

        try {
            if (this.choice == null)
                throw new MAPException("Error while encoding the " + _PrimitiveName + ": choice is not defined");

            if ((this.choice == PSSubscriberStateChoice.psPDPActiveNotReachableForPaging || this.choice == PSSubscriberStateChoice.psPDPActiveReachableForPaging)
                    && this.pdpContextInfoList == null)
                throw new MAPException(
                        "Error while encoding the "
                                + _PrimitiveName
                                + ": for choice psPDPActiveNotReachableForPaging or psPDPActiveReachableForPaging - pdpContextInfoList must not be null");

            if ((this.choice == PSSubscriberStateChoice.netDetNotReachable) && this.netDetNotReachable == null)
                throw new MAPException("Error while encoding the " + _PrimitiveName
                        + ": for choice netDetNotReachable - netDetNotReachable must not be null");

            switch (this.choice) {
                case notProvidedFromSGSNorMME:
                case psDetached:
                case psAttachedNotReachableForPaging:
                case psAttachedReachableForPaging:
                    asnOs.writeNullData();
                    break;
                case psPDPActiveNotReachableForPaging:
                case psPDPActiveReachableForPaging:

                    if (this.pdpContextInfoList.size() < 1 || this.pdpContextInfoList.size() > 50)
                        throw new MAPException("Error while encoding " + _PrimitiveName
                                + ": pdpContextInfoList size must be from 1 to 50");

                    for (PDPContextInfo cii : this.pdpContextInfoList) {
                        PDPContextInfoImpl ci = (PDPContextInfoImpl) cii;
                        ci.encodeAll(asnOs);
                    }
                    break;
                case netDetNotReachable:
                    asnOs.writeIntegerData(this.netDetNotReachable.getCode());
                    break;
            }

        } catch (IOException e) {
            throw new MAPException("IOException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
        }
    }
615965
def parse_protobuf(self, proto_type):
        """"""
        if 'protobuf' not in self.environ.get('CONTENT_TYPE', ''):
            raise BadRequest('Not a Protobuf request')

        obj = proto_type()
        try:
            obj.ParseFromString(self.data)
        except Exception:
            raise BadRequest("Unable to parse Protobuf request")

        # Fail if not all required fields are set
        if self.protobuf_check_initialization and not obj.IsInitialized():
            raise BadRequest("Partial Protobuf request")

        return obj