check if we need to write header return true if we should also write a row could be false if headers is true and the header row(first item) is passed in
487071
function checkHeaders(stream, item) {
    var headers, ret = true;
    if (!stream.parsedHeaders) {
        stream.parsedHeaders = true;
        headers = stream.headers = gatherHeaders(item);
        stream.headersLength = headers.length;
    }
    if (!stream.hasWrittenHeaders) {
        stream.totalCount++;
        stream.push(Buffer.from(stream.formatter(stream.headers, true), "utf8"));
        stream.hasWrittenHeaders = true;
        ret = isHashArray(item) || !isArray(item);
    }
    return ret;
}
935163
function tableDoesNotHaveHeaderRow(rows) {
        var headerRow = rows[0];

        var headerCells = headerRow.children;

        for (var i = 0; i < headerCells.length; i++) {
            if (headerCells[i].tagName != 'TH') {
                return true;
            }
        }
        return false;
    }
50584
protected function writeHeaders()
    {
        if (headers_sent() === false) {
            $status = static::RESPONSE_STATUSES[$this->status];

            header("{$this->request->protocol} {$status}");

            foreach ($this->headers->all() as $key => $value) {
                header("{$key}: {$value}", false);
            }
        }
    }
177242
function isHeadingRow (tr) {
  var parentNode = tr.parentNode
  return (
    parentNode.nodeName === 'THEAD' ||
    (
      parentNode.firstChild === tr &&
      (parentNode.nodeName === 'TABLE' || isFirstTbody(parentNode)) &&
      every.call(tr.childNodes, function (n) { return n.nodeName === 'TH' })
    )
  )
}
559519
def assert_headers(context):
    
    expected_headers = [(k, v) for k, v in row_table(context).items()]
    request = httpretty.last_request()
    actual_headers = request.headers.items()

    for expected_header in expected_headers:
        assert_in(expected_header, actual_headers)
224046
private function _checkMandatoryHeader() {
		if ($this->_isActive('mandatoryHeader')) {

			$expectedHeader = $this->_config->getTestProperty('mandatoryHeader', 'header');
			$expectedHeader = trim($expectedHeader);
			$expectedHeader = preg_replace('~[\r\n\t ]+~', '', $expectedHeader);

			$filecontent = $this->tokenizer->content;
			$filecontent = preg_replace('~[\r\n\t ]+~', '', $filecontent);

			if (strpos($filecontent, $expectedHeader) === FALSE) {
				$this->_writeError('mandatoryHeader', $this->_getMessage('MANDATORY_HEADER'));
			}
		}
	}
467333
private function writeHeaders()
    {
        $headers = $this->response->getHeaders();
        foreach ($headers as $name => $list) {
            header("$name: " . implode(', ', $list));
        }
    }
1276962
def write_table(page, headers, data, cl=''):

    

    page.table(class_=cl)

    # list
    if cl=='list':
        for i in range(len(headers)):

            page.tr()
            page.th()
            page.add('%s' % headers[i])
            page.th.close()
            page.td()
            page.add('%s' % data[i])
            page.td.close()
            page.tr.close()

    else:
        page.tr()
        for n in headers:
            page.th()
            page.add('%s' % n)
            page.th.close()
        page.tr.close()

        if data and not re.search('list',str(type(data[0]))):
            data = [data]

        for row in data:
            page.tr()
            for item in row:
                page.td()
                page.add('%s' % item)
                page.td.close()
            page.tr.close()

    page.table.close()

    return page
1314479
def _should_sign_response_header(header_name):
    

    if header_name == _HEADER_SERVER_SIGNATURE:
        return False

    if re.match(_PATTERN_HEADER_PREFIX_BUNQ, header_name):
        return True

    return False
1268834
def is_header(line):
    
    if len(line) == 1:
        return True
    for idx, val in enumerate(line):
        if idx > 0 and val:
            return False
    return True
652683
def _write_header(self):
        """"""
        for line in self.header.lines:
            print(line.serialize(), file=self.stream)
        if self.header.samples.names:
            print(
                "\t".join(list(parser.REQUIRE_SAMPLE_HEADER) + self.header.samples.names),
                file=self.stream,
            )
        else:
            print("\t".join(parser.REQUIRE_NO_SAMPLE_HEADER), file=self.stream)
666891
public void write(Map<?, ?> row) throws IOException {
      if (row != null) {
         if (header.isEmpty()) {
            List<?> entries = row.values().stream().map(o -> Convert.convert(o, String.class)).collect(
               Collectors.toList());
            writer.write(formatter.format(entries));
            writer.write(SystemInfo.LINE_SEPARATOR);
         } else {
            writer.write(
               formatter.format(
                  Stream.concat(
                     header.stream()
                           .map(
                              h -> row.containsKey(h) ? Convert.convert(row.get(h), String.class) : StringUtils.EMPTY),
                     row.keySet().stream()
                        .map(k -> Convert.convert(k, String.class))
                        .filter(h -> !header.contains(h))
                        .map(h -> Convert.convert(row.get(h), String.class))
                               )
                        .collect(Collectors.toList())
                               )
                        );
            writer.write(SystemInfo.LINE_SEPARATOR);
         }

      }

   }
1112692
protected function isAllHeadingValuesPresentInRow(?array $row){

        if (true === empty($row)) {
            return false;
        }

        foreach($this->targettedHeadingValues as $headerValue){

            if (false === in_array(trim($headerValue), $row)) {
                //print($headerValue . ' not in ' . print_r($row,true));
                return false;
            }

        }

        return true;
    }
602856
def empty_row?(row)
    is_empty = true
    row.each do |item|
      is_empty = false if item && !item.empty?
    end
    is_empty
  end
869896
def write(self, rows, keyed=False):
        
        for row in rows:
            keyed_row = row
            if not keyed:
                keyed_row = dict(zip(self.__schema.field_names, row))
            keyed_row = self.__convert_row(keyed_row)
            if self.__check_existing(keyed_row):
                for wr in self.__insert():
                    yield wr
                ret = self.__update(keyed_row)
                if ret is not None:
                    yield WrittenRow(keyed_row, True, ret if self.__autoincrement else None)
                    continue
            self.__buffer.append(keyed_row)
            if len(self.__buffer) > BUFFER_SIZE:
                for wr in self.__insert():
                    yield wr
        for wr in self.__insert():
            yield wr
1018216
def write_header(self):
        

        self.output.seek(0)
        self.output.write(struct.pack('!HHHHHH', self.id, self.flags,
                                      self.counts[0], self.counts[1],
                                      self.counts[2], self.counts[3]))
        self.output.seek(0, 2)
236786
def validate_row(self, row):
        
        clean_row = {}
        if isinstance(row, (tuple, list)):
            assert self.header_order, "No attribute order specified."
            assert len(row) == len(self.header_order), \
                "Row length does not match header length."
            itr = zip(self.header_order, row)
        else:
            assert isinstance(row, dict)
            itr = iteritems(row)
        for el_name, el_value in itr:
            if self.header_types[el_name] == ATTR_TYPE_DISCRETE:
                clean_row[el_name] = int(el_value)
            elif self.header_types[el_name] == ATTR_TYPE_CONTINUOUS:
                clean_row[el_name] = float(el_value)
            else:
                clean_row[el_name] = el_value
        return clean_row