@@ -137,7 +137,6 @@ def __init__(
137137 self ._with_jump_fixers : dict [TArc , TArc | None ] = {}
138138
139139 self ._first_line_cache : dict [TLineNo , TLineNo ] = {}
140- self ._exit_counts : dict [TLineNo , int ] | None = None
141140
142141 def lines_matching (self , regex : str ) -> set [TLineNo ]:
143142 """Find the lines matching a regex.
@@ -399,20 +398,18 @@ def exit_counts(self) -> dict[TLineNo, int]:
399398 Excluded lines are excluded.
400399
401400 """
402- if self ._exit_counts is None :
403- exit_counts : dict [TLineNo , int ] = collections .defaultdict (int )
404- for l1 , l2 in self .arcs ():
405- assert l1 > 0 , f"{ l1 = } should be greater than zero in { self .filename } "
406- if l1 in self .excluded :
407- # Don't report excluded lines as line numbers.
408- continue
409- if l2 in self .excluded :
410- # Arcs to excluded lines shouldn't count.
411- continue
412- exit_counts [l1 ] += 1
413- self ._exit_counts = exit_counts
414-
415- return self ._exit_counts
401+ exit_counts : dict [TLineNo , int ] = collections .defaultdict (int )
402+ for l1 , l2 in self .arcs ():
403+ assert l1 > 0 , f"{ l1 = } should be greater than zero in { self .filename } "
404+ if l1 in self .excluded :
405+ # Don't report excluded lines as line numbers.
406+ continue
407+ if l2 in self .excluded :
408+ # Arcs to excluded lines shouldn't count.
409+ continue
410+ exit_counts [l1 ] += 1
411+
412+ return exit_counts
416413
417414 def _finish_action_msg (self , action_msg : str | None , end : TLineNo ) -> str :
418415 """Apply some defaulting and formatting to an arc's description."""
@@ -445,10 +442,7 @@ def missing_arc_description(self, start: TLineNo, end: TLineNo) -> str:
445442
446443 def arc_description (self , start : TLineNo , end : TLineNo ) -> str :
447444 """Provide an English description of an arc's effect."""
448- if self ._missing_arc_fragments is None :
449- self ._analyze_ast ()
450- assert self ._missing_arc_fragments is not None
451-
445+ assert self ._missing_arc_fragments is not None
452446 fragment_pairs = self ._missing_arc_fragments .get ((start , end ), [(None , None )])
453447 action_msg = self ._finish_action_msg (fragment_pairs [0 ][1 ], end )
454448 return action_msg
0 commit comments