Skip to content

Commit 078bea3

Browse files
committed
Removed recursive nonsense; docstring for exclude()
1 parent a273422 commit 078bea3

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

TODO.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ x Tricky swapping of collector like figleaf, pycov, et al. (Don't need to do
109109
+ Use enumerate
110110
+ Use sets instead of dicts
111111
- Switch from getopt to optparse.
112-
- Get rid of the recursive nonsense.
112+
+ Get rid of the recursive nonsense.
113113
- Docstrings.
114114
+ Remove huge document-style comments.
115115
- Better names:

coverage/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def call_singleton_method(name, args, kwargs):
3131
return getattr(the_coverage, name)(*args, **kwargs)
3232

3333
mod_funcs = """
34-
use_cache start stop erase begin_recursive end_recursive exclude
34+
use_cache start stop erase exclude
3535
analysis analysis2 report annotate annotate_file
3636
"""
3737

coverage/control.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ def __init__(self):
1818
self.parallel_mode = False
1919
self.exclude_re = ''
2020
self.nesting = 0
21-
self.cstack = []
22-
self.xstack = []
2321
self.file_locator = FileLocator()
2422

2523
self.collector = Collector(self.should_trace)
@@ -78,18 +76,18 @@ def erase(self):
7876
self.data.erase()
7977

8078
def exclude(self, regex):
79+
"""Exclude source lines from execution consideration.
80+
81+
`regex` is a regular expression. Lines matching this expressions are
82+
not considered executable when reporting code coverage. A list of
83+
regexes is maintained; this function adds a new regex to the list.
84+
Matching any of the regexes excludes a source line.
85+
86+
"""
8187
if self.exclude_re:
8288
self.exclude_re += "|"
8389
self.exclude_re += "(" + regex + ")"
8490

85-
def begin_recursive(self):
86-
#self.cstack.append(self.c)
87-
self.xstack.append(self.exclude_re)
88-
89-
def end_recursive(self):
90-
#self.c = self.cstack.pop()
91-
self.exclude_re = self.xstack.pop()
92-
9391
def save(self):
9492
self.group_collected_data()
9593
self.data.write()

0 commit comments

Comments
 (0)