How to use the covimerage.__init__.Line function in covimerage

To help you get started, we’ve selected a few covimerage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Vimjas / covimerage / covimerage / __init__.py View on Github external
if in_script:
                    if count is None and RE_CONTINUING_LINE.match(source_line):
                        count = in_script.lines[lnum-1].count
                    in_script.lines[lnum] = Line(
                        line=source_line, count=count,
                        total_time=total_time, self_time=self_time)
                    if count or lnum == 1:
                        # Parse line 1 always, as a workaround for
                        # https://github.com/vim/vim/issues/2103.
                        in_script.parse_function(lnum, source_line)
                else:
                    if count is None:
                        if is_executable_line(source_line):
                            # Functions do not have continued lines, assume 0.
                            count = 0
                    line = Line(line=source_line, count=count,
                                total_time=total_time, self_time=self_time)
                    in_function.lines[lnum] = line

            elif line.startswith('SCRIPT  '):
                fname = line[8:]
                in_script = Script(fname)
                logger.debug('Parsing script %s', in_script)
                self.scripts.append(in_script)
                self.scripts_by_fname[fname] = in_script

                next_line = next(file_object)
                m = RE_SOURCED_TIMES.match(next_line)
                in_script.sourced_count = int(m.group(1))

                plnum += skip_to_count_header() + 1
                lnum = 0
github Vimjas / covimerage / covimerage / __init__.py View on Github external
def merge_lines(line1, line2):
            assert line1.line == line2.line
            new = Line(line1.line)
            if line1.count is None:
                new.count = line2.count
            elif line2.count is None:
                new.count = line1.count
            else:
                new.count = line1.count + line2.count
            return new
github Vimjas / covimerage / covimerage / __init__.py View on Github external
if in_script or in_function:
                lnum += 1
                try:
                    count, total_time, self_time = parse_count_and_times(line)
                except Exception as exc:
                    logger.warning(
                        'Could not parse count/times (%s:%d, %r): %r.',
                        self._fstr, plnum, line, exc)
                    continue
                source_line = line[28:]

                if in_script:
                    if count is None and RE_CONTINUING_LINE.match(source_line):
                        count = in_script.lines[lnum-1].count
                    in_script.lines[lnum] = Line(
                        line=source_line, count=count,
                        total_time=total_time, self_time=self_time)
                    if count or lnum == 1:
                        # Parse line 1 always, as a workaround for
                        # https://github.com/vim/vim/issues/2103.
                        in_script.parse_function(lnum, source_line)
                else:
                    if count is None:
                        if is_executable_line(source_line):
                            # Functions do not have continued lines, assume 0.
                            count = 0
                    line = Line(line=source_line, count=count,
                                total_time=total_time, self_time=self_time)
                    in_function.lines[lnum] = line

            elif line.startswith('SCRIPT  '):