Filter the lines from comments and non code lines.
320009
def filter_lines_from_comments(lines):
    
    for line_nb, raw_line in enumerate(lines):
        clean_line = remove_comments_from_line(raw_line)
        if clean_line == '':
            continue
        yield line_nb, clean_line, raw_line
415483
def lookup_comments(self, reverse=False):
        ""

        comments = []
        if self.thread_id is None:
            self.thread_id = self.lookup_thread_id()
        path = self.thread_id
        with open(self.thread_id, 'r', newline='') as fdesc:
            reader = csv.reader(fdesc)
            header = reader.__next__()
            assert header == self.header
            for num, line in enumerate(reader):
                if not line:
                    continue
                assert len(line) == len(header), (
                    'Line %i in path %s misformatted' % (num+1, path))
                line_kw = dict(zip(header, line))
                comments.append(SingleComment(**line_kw))
        if reverse:
            comments = list(reversed(comments))

        return CommentSection(comments)
982863
function commentStrip(string) {
  // Remove commented lines
  string = string.replace(RE_COMMENT_SINGLE_LINE, '');
  string = string.replace(RE_COMMENT_MULTI_LINES, '');
  return string;
}
244913
def uncomment_line(line, prefix):
    """"""
    if not prefix:
        return line
    if line.startswith(prefix + ' '):
        return line[len(prefix) + 1:]
    if line.startswith(prefix):
        return line[len(prefix):]
    return line
964998
def comment_lines(lines):
    """"""
    ret = []
    for line in lines:
        ws_prefix, rest, ignore = RE_LINE_SPLITTER_COMMENT.match(line).groups()
        ret.append(ws_prefix + '#' + rest)
    return ''.join(ret)
1355578
def comment_line(comment)
      # Take care of annotation only if matched
      if comment.match(ProbeDockProbe::Annotation::ANNOTATION_REGEXP)
        # If the feature already started, the annotations are for scenarios
        if @current_feature_started
          @annotation = ProbeDockProbe::Annotation.new(comment)
        else
          @feature_annotation = ProbeDockProbe::Annotation.new(comment)
        end
      end
    end
763051
def __parse_comments():
    ''''''
    filename = get_file('comments.tsv')

    with io.open(filename, 'r', encoding='cp1252') as textfile:
        next(textfile)

        for line in textfile:
            tokens = line.strip().split('\t')
            chebi_id = int(tokens[1])

            if chebi_id not in __COMMENTS:
                __COMMENTS[chebi_id] = []

            # Append Comment:
            com = Comment(tokens[3],
                          tokens[4],
                          tokens[5],
                          datetime.datetime.strptime(tokens[2], '%Y-%M-%d'))

            __COMMENTS[chebi_id].append(com)
992519
def parse_comments_for_file(filename):
    
    return [parse_comment(strip_stars(comment), next_line)
            for comment, next_line in get_doc_comments(read_file(filename))]
364103
def CleanComments(line, quote=False):
    
    if line.find('#') == -1 and line.find('"') == -1:
        if quote:
            return '', quote
        else:
            return line, quote
    # else have to check for comment
    prior = []
    prev = ''
    for char in line:
        try:
            if char == '"':
                if prev != '\\':
                    quote = not quote
                    prior.append(char)
                continue
            elif char == '#' and not quote:
                break
            if not quote:
                prior.append(char)
        finally:
            prev = char

    # rstrip removes trailing space between end of command and the comment # start

    return ''.join(prior).rstrip(), quote
1117585
def is_code?(lineno)
      unless @is_begin_comment
        @is_begin_comment = Array.new(@lines.size, false)
        pending = []
        state = :code
        @lines.each_with_index do |line, index|
          case state
          when :code
            if /^=begin\b/ =~ line
              state = :comment
              pending << index
            end
          when :comment
            pending << index
            if /^=end\b/ =~ line
              state = :code
              pending.each{|idx| @is_begin_comment[idx] = true}
              pending.clear
            end
          end
        end
      end
      @lines[lineno] && !@is_begin_comment[lineno] && @lines[lineno] !~ /^\s*(#|$)/ 
    end
872250
def _remove_comment(line):
    
    # First find just quotes and their indexes.
    quote_indexes = []
    hash_indexes = []
    for i, ch in enumerate(line):
        if ch == '"':
            quote_indexes.append(i)
            if i > 0 and line[i - 1] == "\\":
                quote_indexes.pop()
        elif ch == '#':
            hash_indexes.append(i)

    comment_marker_index = -1
    for hash_index in hash_indexes:
        quote_index_ranges = [quote_indexes[i:i + 2] for i in range(0, len(quote_indexes), 2)]
        if not _check_index_within_index_pairs(hash_index, quote_index_ranges):
            comment_marker_index = hash_index
            break

    if comment_marker_index >= 0:
        line = line[:comment_marker_index]
    return line
831178
function getCommentLineNums(comments) {
    const lines = [];

    comments.forEach(token => {
        const start = token.loc.start.line;
        const end = token.loc.end.line;

        lines.push(start, end);
    });
    return lines;
}
1077792
def _extract_comments(self):
        """"""
        self._det_file.seek(0, 0)
        for line in self._det_file.readlines():
            line = line.strip()
            if line.startswith('#'):
                self.add_comment(line[1:])
1315798
def comments_of_file(file)
      File.readlines(file).map { |s| s[2..-1].rstrip if s.start_with?('# ') }.compact
    end
637477
def split_comment(cls, code):
        
        if '#' not in code: return code
        #: Remove comments only (leave quoted strings as they are)
        subf = lambda m: '' if m.group(0)[0]=='#' else m.group(0)
        return re.sub(cls.re_pytokens, subf, code)
867267
function filter_lines_for_parsing(lines)
{
	// filter out blank lines
	lines = lines.filter(line => !is_blank(line.line))

	lines.forEach(function(line)
	{
		// remove single line comments
		line.line = line.line.replace(/^\s*\/\/.*/, '')
		// remove any trailing whitespace
		line.line = line.line.trim()
	})

	return lines
}
180270
def filter_out?(line)
      # "./lib" in project dir, or "/usr/local/blahblah" if installed
      assert_lib_path    = File.expand_path("../..", __FILE__)
      assert_macros_path = File.join(assert_lib_path, "assert/macros")
      assert_bin_regex = /bin\/assert\:/
      ( line.rindex(assert_lib_path, 0) &&
        !line.rindex(assert_macros_path, 0)
      ) ||
      line =~ assert_bin_regex
    end