Build the headers
437447
public function build()
    {
        $headers = array();
        foreach (get_object_vars($this) as $header => $value) {
            $headers[] = $header . ": " . (string)$value;
        }
        return $headers;
    }
59043
protected function buildRequestHeader()
  {
    // Create header
    $headerlines = array();
    
    // Methode(GET or POST)
    if (count($this->post_data) > 0) $request_type = "POST";
    else $request_type = "GET";
    
    // HTTP protocol
    if ($this->http_protocol_version == PHPCrawlerHTTPProtocols::HTTP_1_1) $http_protocol_verison = "1.1";
    else $http_protocol_verison = "1.0";
    
    if ($this->proxy != null)
    {
      // A Proxy needs the full qualified URL in the GET or POST headerline.
      $headerlines[] = $request_type." ".$this->UrlDescriptor->url_rebuild ." HTTP/1.0\r\n";
    }
    else
    {
      $query = $this->prepareHTTPRequestQuery($this->url_parts["path"].$this->url_parts["file"].$this->url_parts["query"]);
      $headerlines[] = $request_type." ".$query." HTTP/".$http_protocol_verison."\r\n";
    }
    
    $headerlines[] = "Host: ".$this->url_parts["host"]."\r\n";
    
    $headerlines[] = "User-Agent: ".str_replace("\n", "", $this->userAgentString)."\r\n";
    $headerlines[] = "Accept: */*\r\n";
    
    // Request GZIP-content
    if ($this->request_gzip_content == true)
    {
      $headerlines[] = "Accept-Encoding: gzip, deflate\r\n";
    }
    
    // Referer
    if ($this->UrlDescriptor->refering_url != null)
    {
      $headerlines[] = "Referer: ".$this->UrlDescriptor->refering_url."\r\n";
    }
    
    // Cookies
    $cookie_header = $this->buildCookieHeader();
    if ($cookie_header != null) 
      $headerlines[] = $this->buildCookieHeader();
    
    // Authentication
    if ($this->url_parts["auth_username"] != "" && $this->url_parts["auth_password"] != "")
    {
      $auth_string = base64_encode($this->url_parts["auth_username"].":".$this->url_parts["auth_password"]);
      $headerlines[] = "Authorization: Basic ".$auth_string."\r\n";
    }
    
    // Proxy authentication
    if ($this->proxy != null && $this->proxy["proxy_username"] != null)
    {
      $auth_string = base64_encode($this->proxy["proxy_username"].":".$this->proxy["proxy_password"]);
      $headerlines[] = "Proxy-Authorization: Basic ".$auth_string."\r\n";
    }
    
    $headerlines[] = "Connection: close\r\n";
    
    // Wenn POST-Request
    if ($request_type == "POST")
    {
      // Post-Content bauen
      $post_content = $this->buildPostContent();
      
      $headerlines[] = "Content-Type: multipart/form-data; boundary=---------------------------10786153015124\r\n";
      $headerlines[] = "Content-Length: ".strlen($post_content)."\r\n\r\n";
      $headerlines[] = $post_content;
    }
    else
    {
      $headerlines[] = "\r\n";
    }

    return $headerlines;
  }
672420
def headers_to_use(self):
        '''
        
        '''
        headers = OrderedDict()

        headers['total.reads'] = {
            'title': 'Total reads',
            'description': 'Total number of reads',
            'format': '{:,.0f}',
            'scale': 'Greys'
        }
        headers['total.gigabases'] = {
            'title': 'Total bases (GB)',
            'description': 'Total bases',
            'format': '{:,.2f}',
            'scale': 'Blues'
        }
        headers['N50.length'] = {
            'title': 'Reads N50',
            'description': 'Minimum read length needed to cover 50% of all reads',
            'format': '{:,.0f}',
            'scale': 'Purples',
        }
        headers['mean.q'] = {
            'title': 'Mean Q score',
            'description': 'Mean quality of reads',
            'min': 0,
            'max': 15,
            'format': '{:,.1f}',
            'hidden': True,
            'scale': 'Greens',
        }
        headers['median.q'] = {
            'title': 'Median Q score',
            'description': 'Median quality of reads',
            'min': 0,
            'max': 15,
            'format': '{:,.1f}',
            'scale': 'Greens',
        }
        headers['mean.length'] = {
            'title': 'Mean length (bp)',
            'description': 'Mean read length',
            'format': '{:,.0f}',
            'hidden': True,
            'scale': 'Blues',
        }
        headers['median.length'] = {
            'title': 'Median length (bp)',
            'description': 'Median read length',
            'format': '{:,.0f}',
            'scale': 'Blues',
        }

        # Add row ID to avoid duplicates
        for k in headers:
            h_id = re.sub('[^0-9a-zA-Z]+', '_', headers[k]['title'])
            headers[k]['rid'] = "rid_{}".format(h_id)

        return headers
100048
protected function prepareHeaders()
    {
        $headers = array();

        foreach ($this->headers as $header => $value) {
            $headers[] = $header.': '.$value;
        }

        return $headers;
    }
1072948
def _write_headers(self, headers):
        
        if headers:
            for name in sorted(headers.keys()):
                yield name.encode("ascii")
                yield b': '
                yield headers[name].encode("ascii")
                yield CRLF
        yield CRLF
1347086
protected function buildHeaders()
    {
        $headers = array();
        foreach ($this->headers as $key => $value) {
            if ($key == 'CC' || $key == 'BCC') {
                $value = implode(', ', $value);
            }
            array_push($headers, sprintf('%s: %s', $key, $value));
        }

        if (!empty($this->attachments)) {
            array_push(
                $headers,
                "Content-Type: multipart/mixed; boundary=\"{$this->boundaryMixed}\""
            );
        } elseif (!empty($this->plainMessage) && !empty($this->htmlMessage)) {
            array_push(
                $headers,
                "Content-Type: multipart/alternative; boundary=\"{$this->boundaryAlternative}\""
            );
        } elseif (!empty($this->htmlMessage)) {
            array_push(
                $headers,
                'Content-type: text/html; charset="iso-8859-1"'
            );
        }

        return implode(self::LINE_BREAK, $headers);
    }
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')
995819
def build(self):
        '''
        
        '''
        header = self.build_header()
        body = self.build_body()
        tail = self.build_tail()
        return header + body + tail
1353478
function Headers(options) {
  if (!(this instanceof Headers))
    return new Headers(options);

  AbstractBlock.call(this);

  if (options)
    this.parseOptions(options);
}
973675
def buildhtmlheader(self):
        """"""
        
        if self.drilldown_flag:
            self.add_JSsource('http://code.highcharts.com/modules/drilldown.js')



        if self.offline:
            opener = urllib.request.build_opener()
            opener.addheaders = [('User-Agent', 'Mozilla/5.0')]

            self.header_css = [
                '<style>%s</style>' % opener.open(h).read() for h in self.CSSsource
            ]

            self.header_js = [
                '<script type="text/javascript">%s</script>' % opener.open(h).read() for h in self.JSsource
            ]
        else:
            self.header_css = [
                '<link href="%s" rel="stylesheet" />' % h for h in self.CSSsource
            ]

            self.header_js = [
                '<script type="text/javascript" src="%s"></script>' % h for h in self.JSsource
            ]

        self.htmlheader = ''
        for css in self.header_css:
            self.htmlheader += css
        for js in self.header_js:
            self.htmlheader += js
246589
def echo_headers(headers, file=None):
    """"""
    for k, v in sorted(headers.items()):
        click.echo("{0}: {1}".format(k.title(), v), file=file)
    click.echo(file=file)
178942
def _SetHeader(self, values):
    """"""
    if self._values and len(values) != len(self._values):
      raise ValueError('Header values not equal to existing data width.')
    if not self._values:
      for _ in range(len(values)):
        self._values.append(None)
    self._keys = list(values)
    self._BuildIndex()
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');
    }
1519
def headers(h = nil)
      if h
        raise ArgumentError, 'Headers must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
        default_options[:headers] ||= {}
        default_options[:headers].merge!(h.to_hash)
      else
        default_options[:headers] || {}
      end
    end
587717
def write_headers(self):
        
        h1 = []
        h2 = []
        for m in self.values():
            h2.append(m.render_subtitle())
            h1.append(m.render_title())

        stdout.write(" ".join(h1))
        stdout.write("\n\r")
        c = _ansi["gray"] + "|" + _ansi["reset"]
        stdout.write(c.join(h2))
        stdout.write("\n\r")
        stdout.flush()

        if self._csvfile:
            header_row = []
            for m in self.values():
                if isinstance(m, MultiMetric):
                    for subm in m.values():
                        header_row.append(
                            "{}_{}".format(m.title, subm.title)
                        )
                else:
                    if m.subtitle:
                        header_row.append(
                            "{}_{}".format(m.title, m.subtitle)
                        )
                    else:
                        header_row.append(m.title)
            self._write_csv_row(header_row, rewrite=True)
1194742
public function setHeaders($headers)
    {
        // Set horizontal size of element
        $this->hSize = count($headers);
        $this->data('grid-size', $this->hSize);

        // Add headers
        $gridHeader = $this->appendSimpleRow($headers, 'DataTableHeader', $header = true);

        // Add checkable headers
        if ($this->checkable) {
            $this->appendCheckRow($gridHeader, null, false);
        }

        // Create new grid content wrapper
        $gridListContentWrapper = $this->getFormFactory()->buildHtmlElement('div', '', '', 'DataTableContentWrapper');
        $this->gridList->append($gridListContentWrapper);
        $this->gridList = $gridListContentWrapper;
    }
1064037
def write_headers(self):
        
        hlist = []
        for h in self.headers:
            hlist.append("{}: {}".format(h.key, h.value))
        return hlist