From 22c09c67ff321835a79e00fa234086b216e3d8d0 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
- coverage.py v7.5.3,
- created at 2024-05-28 09:37 -0400
+ coverage.py v7.5.4,
+ created at 2024-06-22 17:11 -0400
Classes
141 return ""
143 prologue = "import " + cog.cogmodulename + " as cog\n"
-144 if self.options.prologue: 144 ↛ 145line 144 didn't jump to line 145, because the condition on line 144 was never true
+144 if self.options.prologue: 144 ↛ 145line 144 didn't jump to line 145 because the condition on line 144 was never true
145 prologue += self.options.prologue + "\n"
146 code = compile(prologue + intext, str(fname), "exec")
@@ -236,13 +236,13 @@152 cog.cogmodule.error = self.error
154 real_stdout = sys.stdout
-155 if self.options.print_output: 155 ↛ 156line 155 didn't jump to line 156, because the condition on line 155 was never true
+155 if self.options.print_output: 155 ↛ 156line 155 didn't jump to line 156 because the condition on line 155 was never true
156 sys.stdout = captured_stdout = io.StringIO()
158 self.outstring = ""
159 try:
160 eval(code, globals)
-161 except CogError: 161 ↛ 162line 161 didn't jump to line 162, because the exception caught by line 161 didn't happen
+161 except CogError: 161 ↛ 162line 161 didn't jump to line 162 because the exception caught by line 161 didn't happen
162 raise
163 except: # noqa: E722 (we're just wrapping in CogUserException and rethrowing)
164 typ, err, tb = sys.exc_info()
@@ -254,7 +254,7 @@170 finally:
171 sys.stdout = real_stdout
-173 if self.options.print_output: 173 ↛ 174line 173 didn't jump to line 174, because the condition on line 173 was never true
+173 if self.options.print_output: 173 ↛ 174line 173 didn't jump to line 174 because the condition on line 173 was never true
174 self.outstring = captured_stdout.getvalue()
176 # We need to make sure that the last line in the output
@@ -488,11 +488,11 @@404 file_name_out = fname or ""
405 file_in_to_close = file_out_to_close = None
406 # Convert filenames to files.
-407 if isinstance(file_in, (bytes, str)): 407 ↛ 409line 407 didn't jump to line 409, because the condition on line 407 was never true
+407 if isinstance(file_in, (bytes, str)): 407 ↛ 409line 407 didn't jump to line 409 because the condition on line 407 was never true
408 # Open the input file.
409 file_name_in = file_in
410 file_in = file_in_to_close = self.open_input_file(file_in)
-411 if isinstance(file_out, (bytes, str)): 411 ↛ 413line 411 didn't jump to line 413, because the condition on line 411 was never true
+411 if isinstance(file_out, (bytes, str)): 411 ↛ 413line 411 didn't jump to line 413 because the condition on line 411 was never true
412 # Open the output file.
413 file_name_out = file_out
414 file_out = file_out_to_close = self.open_output_file(file_out)
@@ -510,7 +510,7 @@426 sys.modules["cog"] = self.cogmodule
428 # The globals dict we'll use for this file.
-429 if globals is None: 429 ↛ 433line 429 didn't jump to line 433, because the condition on line 429 was always true
+429 if globals is None: 429 ↛ 433line 429 didn't jump to line 433 because the condition on line 429 was always true
430 globals = {}
432 # If there are any global defines, put them in the globals.
@@ -521,13 +521,13 @@437 while line:
438 # Find the next spec begin
439 while line and not self.is_begin_spec_line(line):
-440 if self.is_end_spec_line(line): 440 ↛ 441line 440 didn't jump to line 441, because the condition on line 440 was never true
+440 if self.is_end_spec_line(line): 440 ↛ 441line 440 didn't jump to line 441 because the condition on line 440 was never true
441 raise CogError(
442 f"Unexpected {self.options.end_spec!r}",
443 file=file_name_in,
444 line=file_in.linenumber(),
445 )
-446 if self.is_end_output_line(line): 446 ↛ 447line 446 didn't jump to line 447, because the condition on line 446 was never true
+446 if self.is_end_output_line(line): 446 ↛ 447line 446 didn't jump to line 447 because the condition on line 446 was never true
447 raise CogError(
448 f"Unexpected {self.options.end_output!r}",
449 file=file_name_in,
@@ -537,7 +537,7 @@453 line = file_in.readline()
454 if not line:
455 break
-456 if not self.options.delete_code: 456 ↛ 460line 456 didn't jump to line 460, because the condition on line 456 was always true
+456 if not self.options.delete_code: 456 ↛ 460line 456 didn't jump to line 460 because the condition on line 456 was always true
457 file_out.write(line)
459 # l is the begin spec
@@ -567,30 +567,30 @@484 # Get all the lines in the spec
485 while line and not self.is_end_spec_line(line):
-486 if self.is_begin_spec_line(line): 486 ↛ 487line 486 didn't jump to line 487, because the condition on line 486 was never true
+486 if self.is_begin_spec_line(line): 486 ↛ 487line 486 didn't jump to line 487 because the condition on line 486 was never true
487 raise CogError(
488 f"Unexpected {self.options.begin_spec!r}",
489 file=file_name_in,
490 line=file_in.linenumber(),
491 )
-492 if self.is_end_output_line(line): 492 ↛ 493line 492 didn't jump to line 493, because the condition on line 492 was never true
+492 if self.is_end_output_line(line): 492 ↛ 493line 492 didn't jump to line 493 because the condition on line 492 was never true
493 raise CogError(
494 f"Unexpected {self.options.end_output!r}",
495 file=file_name_in,
496 line=file_in.linenumber(),
497 )
-498 if not self.options.delete_code: 498 ↛ 500line 498 didn't jump to line 500, because the condition on line 498 was always true
+498 if not self.options.delete_code: 498 ↛ 500line 498 didn't jump to line 500 because the condition on line 498 was always true
499 file_out.write(line)
500 gen.parse_line(line)
501 line = file_in.readline()
-502 if not line: 502 ↛ 503line 502 didn't jump to line 503, because the condition on line 502 was never true
+502 if not line: 502 ↛ 503line 502 didn't jump to line 503 because the condition on line 502 was never true
503 raise CogError(
504 "Cog block begun but never ended.",
505 file=file_name_in,
506 line=first_line_num,
507 )
-509 if not self.options.delete_code: 509 ↛ 511line 509 didn't jump to line 511, because the condition on line 509 was always true
+509 if not self.options.delete_code: 509 ↛ 511line 509 didn't jump to line 511 because the condition on line 509 was always true
510 file_out.write(line)
511 gen.parse_marker(line)
@@ -601,13 +601,13 @@517 previous = []
518 hasher = md5()
519 while line and not self.is_end_output_line(line):
-520 if self.is_begin_spec_line(line): 520 ↛ 521line 520 didn't jump to line 521, because the condition on line 520 was never true
+520 if self.is_begin_spec_line(line): 520 ↛ 521line 520 didn't jump to line 521 because the condition on line 520 was never true
521 raise CogError(
522 f"Unexpected {self.options.begin_spec!r}",
523 file=file_name_in,
524 line=file_in.linenumber(),
525 )
-526 if self.is_end_spec_line(line): 526 ↛ 527line 526 didn't jump to line 527, because the condition on line 526 was never true
+526 if self.is_end_spec_line(line): 526 ↛ 527line 526 didn't jump to line 527 because the condition on line 526 was never true
527 raise CogError(
528 f"Unexpected {self.options.end_spec!r}",
529 file=file_name_in,
@@ -618,7 +618,7 @@534 line = file_in.readline()
535 cur_hash = hasher.hexdigest()
-537 if not line and not self.options.eof_can_be_end: 537 ↛ 539line 537 didn't jump to line 539, because the condition on line 537 was never true
+537 if not line and not self.options.eof_can_be_end: 537 ↛ 539line 537 didn't jump to line 539 because the condition on line 537 was never true
538 # We reached end of file before we found the end output line.
539 raise CogError(
540 f"Missing {self.options.end_output!r} before end of file.",
@@ -632,7 +632,7 @@548 # Write the output of the spec to be the new output if we're
549 # supposed to generate code.
550 hasher = md5()
-551 if not self.options.no_generate: 551 ↛ 557line 551 didn't jump to line 557, because the condition on line 551 was always true
+551 if not self.options.no_generate: 551 ↛ 557line 551 didn't jump to line 557 because the condition on line 551 was always true
552 fname = f"<cog {file_name_in}:{first_line_num}>"
553 gen = gen.evaluate(cog=self, globals=globals, fname=fname)
554 gen = self.suffix_lines(gen)
@@ -644,7 +644,7 @@561 # Write the ending output line
562 hash_match = self.re_end_output.search(line)
-563 if self.options.hash_output: 563 ↛ 564line 563 didn't jump to line 564, because the condition on line 563 was never true
+563 if self.options.hash_output: 563 ↛ 564line 563 didn't jump to line 564 because the condition on line 563 was never true
564 if hash_match:
565 old_hash = hash_match["hash"]
566 if old_hash != cur_hash:
@@ -662,19 +662,19 @@578 else:
579 # We don't want hashes output, so if there was one, get rid of
580 # it.
-581 if hash_match: 581 ↛ 582line 581 didn't jump to line 582, because the condition on line 581 was never true
+581 if hash_match: 581 ↛ 582line 581 didn't jump to line 582 because the condition on line 581 was never true
582 line = line.replace(hash_match["hashsect"], "", 1)
-584 if not self.options.delete_code: 584 ↛ 586line 584 didn't jump to line 586, because the condition on line 584 was always true
+584 if not self.options.delete_code: 584 ↛ 586line 584 didn't jump to line 586 because the condition on line 584 was always true
585 file_out.write(line)
586 line = file_in.readline()
-588 if not saw_cog and self.options.warn_empty: 588 ↛ 589line 588 didn't jump to line 589, because the condition on line 588 was never true
+588 if not saw_cog and self.options.warn_empty: 588 ↛ 589line 588 didn't jump to line 589 because the condition on line 588 was never true
589 self.show_warning(f"no cog code found in {file_name_in}")
590 finally:
-591 if file_in_to_close: 591 ↛ 592line 591 didn't jump to line 592, because the condition on line 591 was never true
+591 if file_in_to_close: 591 ↛ 592line 591 didn't jump to line 592 because the condition on line 591 was never true
592 file_in_to_close.close()
-593 if file_out_to_close: 593 ↛ 594line 593 didn't jump to line 594, because the condition on line 593 was never true
+593 if file_out_to_close: 593 ↛ 594line 593 didn't jump to line 594 because the condition on line 593 was never true
594 file_out_to_close.close()
596 # A regex for non-empty lines, used by suffixLines.
@@ -686,7 +686,7 @@602 `text` is many lines, as a single string.
604 """
-605 if self.options.suffix: 605 ↛ 607line 605 didn't jump to line 607, because the condition on line 605 was never true
+605 if self.options.suffix: 605 ↛ 607line 605 didn't jump to line 607 because the condition on line 605 was never true
606 # Find all non-blank lines, and add the suffix to the end.
607 repl = r"\g<0>" + self.options.suffix.replace("\\", "\\\\")
608 text = self.re_non_empty_lines.sub(repl, text)
@@ -900,9 +900,9 @@816 """
817 prolines = prologue.splitlines()
818 for filename, lineno, funcname, source in frame_summary:
-819 if not source: 819 ↛ 833line 819 didn't jump to line 833, because the condition on line 819 was always true
+819 if not source: 819 ↛ 833line 819 didn't jump to line 833 because the condition on line 819 was always true
820 m = re.search(r"^<cog ([^:]+):(\d+)>$", filename)
-821 if m: 821 ↛ 822line 821 didn't jump to line 822, because the condition on line 821 was never true
+821 if m: 821 ↛ 822line 821 didn't jump to line 822 because the condition on line 821 was never true
822 if lineno <= len(prolines):
823 filename = "<prologue>"
824 source = prolines[lineno - 1]
@@ -928,8 +928,8 @@2234 """,
2235 }
-2237 if os.name == "nt": 2237 ↛ 2239line 2237 didn't jump to line 2239, because the condition on line 2237 was never true
+2237 if os.name == "nt": 2237 ↛ 2239line 2237 didn't jump to line 2239 because the condition on line 2237 was never true
2238 # for Windows
2239 cmd_w_args = "attrib -R %s"
2240 cmd_w_asterisk = "attrib -R *"
@@ -2737,8 +2737,8 @@25 def set_output(self, stdout=None, stderr=None):
26 """Assign new files for standard out and/or standard error."""
-27 if stdout: 27 ↛ 29line 27 didn't jump to line 29, because the condition on line 27 was always true
+27 if stdout: 27 ↛ 29line 27 didn't jump to line 29 because the condition on line 27 was always true
28 self.stdout = stdout
-29 if stderr: 29 ↛ 30line 29 didn't jump to line 30, because the condition on line 29 was never true
+29 if stderr: 29 ↛ 30line 29 didn't jump to line 30 because the condition on line 29 was never true
30 self.stderr = stderr
32 def prout(self, s, end="\n"):
@@ -159,8 +159,8 @@14 # Find initial whitespace chunk in the first line.
15 # This is the best prefix we can hope for.
16 pat = r"\s*"
-17 if isinstance(strings[0], bytes): 17 ↛ 18line 17 didn't jump to line 18, because the condition on line 17 was never true
+17 if isinstance(strings[0], bytes): 17 ↛ 18line 17 didn't jump to line 18 because the condition on line 17 was never true
18 pat = pat.encode("utf-8")
19 prefix = re.match(pat, strings[0]).group(0)
@@ -106,7 +106,7 @@22 # the prefix as matches each string.
23 for s in strings:
24 for i in range(len(prefix)):
-25 if prefix[i] != s[i]: 25 ↛ 26line 25 didn't jump to line 26, because the condition on line 25 was never true
+25 if prefix[i] != s[i]: 25 ↛ 26line 25 didn't jump to line 26 because the condition on line 25 was never true
26 prefix = prefix[:i]
27 break
28 return prefix
@@ -121,7 +121,7 @@38 """
39 sep, nothing = "\n", ""
-40 if isinstance(lines, bytes): 40 ↛ 41line 40 didn't jump to line 41, because the condition on line 40 was never true
+40 if isinstance(lines, bytes): 40 ↛ 41line 40 didn't jump to line 41 because the condition on line 40 was never true
41 sep, nothing = b"\n", b""
42 if isinstance(lines, (bytes, str)):
43 lines = lines.split(sep)
@@ -138,7 +138,7 @@55def common_prefix(strings):
56 """Find the longest string that is a prefix of all the strings."""
-57 if not strings: 57 ↛ 58line 57 didn't jump to line 58, because the condition on line 57 was never true
+57 if not strings: 57 ↛ 58line 57 didn't jump to line 58 because the condition on line 57 was never true
58 return ""
59 prefix = strings[0]
60 for s in strings:
@@ -159,8 +159,8 @@