Build a C header from the front and body.
960371
def make_c_header(name, front, body):
    
    return """
{0}


# ifndef _GU_ZHENGXIONG_{1}_H
# define _GU_ZHENGXIONG_{1}_H


{2}


# endif /* {3}.h */
    """.strip().format(front, name.upper(), body, name) + '\n'
537071
def buildMessage(headers, parts):
    
    message = multipart.MIMEMultipart('alternative')

    for name, value in headers.iteritems():
        name = name.title()
        if name == "From":
            multipart[name] = _encodeAddress(value)
        elif name in ["To", "Cc", "Bcc"]:
            multipart[name] = _encodeAddresses(value)
        else:
            multipart[name] = _encodeHeader(value)

    for partType, part in parts.iteritems():
        mimeText = text.MIMEText(part.encode("utf-8"), partType, "UTF-8")
        message.attach(mimeText.encode())

    return message
776017
def _header_line(self, section):
        """"""

        token = self.tok.get()
        what = token.value
        if what == 'id':
            self.message.id = self.tok.get_int()
        elif what == 'flags':
            while True:
                token = self.tok.get()
                if not token.is_identifier():
                    self.tok.unget(token)
                    break
                self.message.flags = self.message.flags | \
                                     dns.flags.from_text(token.value)
            if dns.opcode.is_update(self.message.flags):
                self.updating = True
        elif what == 'edns':
            self.message.edns = self.tok.get_int()
            self.message.ednsflags = self.message.ednsflags | \
                                     (self.message.edns << 16)
        elif what == 'eflags':
            if self.message.edns < 0:
                self.message.edns = 0
            while True:
                token = self.tok.get()
                if not token.is_identifier():
                    self.tok.unget(token)
                    break
                self.message.ednsflags = self.message.ednsflags | \
                              dns.flags.edns_from_text(token.value)
        elif what == 'payload':
            self.message.payload = self.tok.get_int()
            if self.message.edns < 0:
                self.message.edns = 0
        elif what == 'opcode':
            text = self.tok.get_string()
            self.message.flags = self.message.flags | \
                      dns.opcode.to_flags(dns.opcode.from_text(text))
        elif what == 'rcode':
            text = self.tok.get_string()
            self.message.set_rcode(dns.rcode.from_text(text))
        else:
            raise UnknownHeaderField
        self.tok.get_eol()
189204
def construct_xray_header(headers):
    
    header_str = headers.get(http.XRAY_HEADER) or headers.get(http.ALT_XRAY_HEADER)
    if header_str:
        return TraceHeader.from_header_str(header_str)
    else:
        return TraceHeader()
341441
def header(self, definitions, parent, root):
        
        if root is None:
            return
        header = Facade('Header')
        parent.headers.append(header)
        header.use = root.get('use', default='literal')
        ns = root.get('namespace')
        if ns is None:
            header.namespace = definitions.tns
        else:
            prefix = root.findPrefix(ns, 'h0')
            header.namespace = (prefix, ns)
        msg = root.get('message')
        if msg is not None:
            header.message = msg
        part = root.get('part')
        if part is not None:
            header.part = part
931470
def _AddHeader(self, fp):
    
    text = textwrap.wrap(
        textwrap.dedent(self.config_header), break_on_hyphens=False)
    fp.write('\n'.join(['# ' + line for line in text]))
    fp.write('\n\n')
1295801
def header(self):
    """"""
    return struct.pack(
        self.HEADER_STRUCT_FORMAT, self._command, self.arg0, self.arg1,
        len(self.data), self.data_crc32, self.magic)
677187
function createHeader (type, size) {
  var header = new Buffer(8);
  header.writeUInt8(type, 0);
  header.writeUInt32BE(size, 4);
  return header;
}
1052468
def __create_header(self, command, command_string, session_id, reply_id):
        
        buf = pack('<4H', command, 0, session_id, reply_id) + command_string
        buf = unpack('8B' + '%sB' % len(command_string), buf)
        checksum = unpack('H', self.__create_checksum(buf))[0]
        reply_id += 1
        if reply_id >= const.USHRT_MAX:
            reply_id -= const.USHRT_MAX

        buf = pack('<4H', command, checksum, session_id, reply_id)
        return buf + command_string
1019816
def build_strings(self):
        """"""
        for idx, dev in enumerate(self.devices):
            header = 'system.' + dev
            self.gcalls[idx] = header + '.gcall(system.dae)\n'
            self.fcalls[idx] = header + '.fcall(system.dae)\n'
            self.gycalls[idx] = header + '.gycall(system.dae)\n'
            self.fxcalls[idx] = header + '.fxcall(system.dae)\n'
            self.jac0s[idx] = header + '.jac0(system.dae)\n'
1040299
def stream_header(self, f):
        """"""
        stream_struct("L##LLL", f, self.version, self.previous_block_hash,
                      self.merkle_root, self.timestamp, self.difficulty, self.nonce)
528550
protected function buildStructuredHeaders(): void
    {
        $this->structuredHeaders = array();
        $headers = $this->entry[PoTokens::TRANSLATED];
        $headers = ($headers === null) ? array() : $headers;
        $full = implode('', $headers);
        $headers = explode("\n", $full);
        // split on ':'
        $pattern = '/([a-z0-9\-]+):\s*(.*)/i';
        foreach ($headers as $h) {
            if (preg_match($pattern, trim($h), $matches)) {
                $this->structuredHeaders[strtolower($matches[1])] = array(
                    'key' => $matches[1],
                    'value' => $matches[2],
                );
            }
        }
    }
553925
public function buildDefaultHeader(): void
    {
        $this->set(PoTokens::MESSAGE, "");
        $this->set(PoTokens::TRANSLATOR_COMMENTS, 'SOME DESCRIPTIVE TITLE');
        $this->add(PoTokens::TRANSLATOR_COMMENTS, 'Copyright (C) YEAR HOLDER');
        $this->add(PoTokens::TRANSLATOR_COMMENTS, 'LICENSE');
        $this->add(PoTokens::TRANSLATOR_COMMENTS, 'FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.');
        $this->add(PoTokens::TRANSLATOR_COMMENTS, '');
        $this->set(PoTokens::FLAG, 'fuzzy');
        $this->setHeader('Project-Id-Version', 'PACKAGE VERSION');
        $this->setHeader('Report-Msgid-Bugs-To', 'FULL NAME <EMAIL@ADDRESS>');
        $this->setCreateDate();
        $this->setHeader('PO-Revision-Date', 'YEAR-MO-DA HO:MI+ZONE');
        $this->setHeader('Last-Translator', 'FULL NAME <EMAIL@ADDRESS>');
        $this->setHeader('Language-Team', 'LANGUAGE <EMAIL@ADDRESS>');
        $this->setHeader('MIME-Version', '1.0');
        $this->setHeader('Content-Type', 'text/plain; charset=UTF-8');
        $this->setHeader('Content-Transfer-Encoding', '8bit');
        $this->setHeader('Plural-Forms', 'nplurals=INTEGER; plural=EXPRESSION;');
        $this->setHeader('X-Generator', 'geekwright/po');
    }
1069355
def constructSpec(indentation, begin_block, end_block, begin_line, end_line, 
                  begin_action, end_action, 
                  begin_condition, end_condition, 
                  logical_and, logical_or):
    """"""
    return {
        INDENTATION   : indentation, 
        BEG_BLOCK     : begin_block,
        END_BLOCK     : end_block,
        BEG_LINE      : begin_line, 
        END_LINE      : end_line, 
        BEG_ACTION    : begin_action, 
        END_ACTION    : end_action, 
        BEG_CONDITION : begin_condition, 
        END_CONDITION : end_condition, 
        LOGICAL_AND   : logical_and, 
        LOGICAL_OR    : logical_or
    }
811661
def printheader(h=None):
    """"""
    writer = csv.writer(sys.stdout)
    writer.writerow(header_fields(h))
975897
def to_header(self):
        """"""
        if self.date is not None:
            return http_date(self.date)
        if self.etag is not None:
            return quote_etag(self.etag)
        return ""
157593
def assemble_cx():
    """"""
    if request.method == 'OPTIONS':
        return {}
    response = request.body.read().decode('utf-8')
    body = json.loads(response)
    stmts_json = body.get('statements')
    stmts = stmts_from_json(stmts_json)
    ca = CxAssembler(stmts)
    model_str = ca.make_model()
    res = {'model': model_str}
    return res