check heading discrepancy
334525
def check_heading(self, m):
        ''''''
        if 'GPS_RAW' in self.status.msgs:
            gps = self.status.msgs['GPS_RAW']
            if gps.v < 3:
                return
            diff = math.fabs(angle_diff(m.heading, gps.hdg))
        elif 'GPS_RAW_INT' in self.status.msgs:
            gps = self.status.msgs['GPS_RAW_INT']
            if gps.vel < 300:
                return
            diff = math.fabs(angle_diff(m.heading, gps.cog / 100.0))
        else:
            return
        self.report('heading', diff < 20, 'heading error %u' % diff)
851307
function(one, two) {
        if (one.tag != two.tag) {
            return false;
        } else if (one.text.trim() != two.text.trim()) {
            return false;
        } else if (one._children.length != two._children.length) {
            return false;
        }

        if (!attribMatch(one, two)) return false;

        for (var i = 0; i < one._children.length; i++) {
            if (!module.exports.equalNodes(one._children[i], two._children[i])) {
                return false;
            }
        }

        return true;
    }
1258511
function tableDoesNotHaveHeaderColumn(rows) {
        for (var i = 0; i < rows.length; i++) {
            if (rows[i].children[0].tagName != 'TH') {
                return true;
            }
        }
        return false;
    }
241389
def _correct_splitlines_in_headers(markers, lines):
    
    updated_markers = ""
    i = 0
    in_header_block = False
    for m in markers:
        # Only set in_header_block flag when we hit an 's' and line is a header
        if m == 's':
            if not in_header_block:
                if bool(re.search(RE_HEADER, lines[i])):
                    in_header_block = True
            else:
                if QUOT_PATTERN.match(lines[i]):
                    m = 'm'
                else:
                    m = 't'

        # If the line is not a header line, set in_header_block false.
        if not bool(re.search(RE_HEADER, lines[i])):
            in_header_block = False

        # Add the marker to the new updated markers string.
        updated_markers += m
        i += 1

    return updated_markers
600215
def _handle_heading(self, token):
        """"""
        level = token.level
        self._push()
        while self._tokens:
            token = self._tokens.pop()
            if isinstance(token, tokens.HeadingEnd):
                title = self._pop()
                return Heading(title, level)
            else:
                self._write(self._handle_token(token))
        raise ParserError("_handle_heading() missed a close token")
90640
def typos(self):
        """"""
        return (self._deletes() | self._transposes() |
                self._replaces() | self._inserts())
90878
def h_v_t(header, key):
        
        if key not in header:
            key = key.title()

            if key not in header:
                raise ValueError("Unexpected header in response, missing: " + key + " headers:\n" + str(header))

        return header[key]
276201
function detectHeadingLevel(node, hostConfig) {
    var fontWeight = node && node.style.fontWeight;
    var fontSize = node && node.style.fontSize;
    if (fontSize === `${hostConfig.fontSizes.extraLarge}px`  && 
        fontWeight == hostConfig.fontWeights.bolder) {
        return 1;
    }
    if (fontSize === `${hostConfig.fontSizes.large}px` && 
        fontWeight == hostConfig.fontWeights.bolder) {
        return 2;
    }
    if (fontSize === `${hostConfig.fontSizes.medium}px` && 
        fontWeight == hostConfig.fontWeights.bolder) {
        return 3;
    }
    if (fontSize === `${hostConfig.fontSizes.medium}px` && 
        fontWeight == hostConfig.fontWeights.default) {
        return 4;
    }
    if (fontSize === `${hostConfig.fontSizes.default}px` && 
        fontWeight == hostConfig.fontWeights.bolder) {
        return 5;
    }
    if (fontSize === `${hostConfig.fontSizes.small}px` && 
        fontWeight == hostConfig.fontWeights.bolder) {
        return 6;
    }
    return null;
}
1234340
def is_header(self, elem, font_size, node, style=None):
        
        
        # This logic has been disabled for now. Mark this as header if it has
        # been marked during the parsing or mark.
        # if hasattr(elem, 'possible_header'):
        #     if elem.possible_header:                
        #         return True

        # if not style:
        #     return False

        if hasattr(style, 'style_id'):
            fnt_size = _get_font_size(self.doc, style)

            from .importer import calculate_weight
            weight = calculate_weight(self.doc, elem)
            
            if weight > 50:
                return False

            if fnt_size in self.doc.possible_headers_style:                
                return True

            return font_size in self.doc.possible_headers
        else:
            list_of_sizes = {}
            for el in elem.elements:
                try:
                    fs = get_style_fontsize(el)
                    weight = len(el.value()) if el.value() else 0

                    list_of_sizes[fs] = list_of_sizes.setdefault(fs, 0) + weight
                except:
                    pass

            sorted_list_of_sizes = list(collections.OrderedDict(sorted(six.iteritems(list_of_sizes), key=lambda t: t[0])))
            font_size_to_check = font_size

            if len(sorted_list_of_sizes) > 0:
                if sorted_list_of_sizes[0] != font_size:
                    return sorted_list_of_sizes[0] in self.doc.possible_headers

            return font_size in self.doc.possible_headers
974170
function getHeadingMarkdown(text, size) {
  const foundedHeading = text.match(FIND_HEADING_RX);
  let heading = '';

  do {
    heading += '#';
    size -= 1;
  } while (size > 0);

  if (foundedHeading) {
    [, text] = text.split(foundedHeading[0]);
  }

  return `${heading} ${text}`;
}
591233
function selectHeadings (contentSelector, headingSelector) {
    var selectors = headingSelector
    if (options.ignoreSelector) {
      selectors = headingSelector.split(',')
        .map(function mapSelectors (selector) {
          return selector.trim() + ':not(' + options.ignoreSelector + ')'
        })
    }
    try {
      return document.querySelector(contentSelector)
        .querySelectorAll(selectors)
    } catch (e) {
      console.warn('Element not found: ' + contentSelector); // eslint-disable-line
      return null
    }
  }
343913
def set_heading(self, value):
        """"""
        return self.write(request.SetHeading(self.seq, value))
1266333
private void ensureValidLookahead(CharType... expected) {
        if (!chars.positiveLookahead(expected)) {
            throw new UnexpectedCharacterException(
                chars.lookahead(1),
                chars.currentOffset(),
                expected
            );
        }
    }
1125609
def render_heading(self, token):
        
        rendered = super().render_heading(token)
        content = self.parse_rendered_heading(rendered)
        if not (self.omit_title and token.level == 1
                or token.level > self.depth
                or any(cond(content) for cond in self.filter_conds)):
            self._headings.append((token.level, content))
        return rendered
367192
def _get_heading_level(self, element):
        
        # pylint: disable=no-self-use

        tag = element.get_tag_name()
        if tag == 'H1':
            return 1
        elif tag == 'H2':
            return 2
        elif tag == 'H3':
            return 3
        elif tag == 'H4':
            return 4
        elif tag == 'H5':
            return 5
        elif tag == 'H6':
            return 6
        return -1
1116038
function matchEndOfHeadersHyphen (stream, line) {
  const isEnd = END_OF_STAGE_HYPHEN.test(line)
  if (isEnd) {
    stream._columnsPositions = Array.from(line)
      .map(getSpacesPosition)
      .filter(Number.isInteger)
    return line
  } else {
    return null
  }
}
934057
function isOpeningHeading(node, depth, expression) {
  return (
    depth === null &&
    node &&
    node.type === HEADING &&
    expression.test(toString(node))
  )
}