(self, sel, list, msg)
| 327 | # Optional "amount" is either a line count, or a percentage of lines. |
| 328 | |
| 329 | def eval_print_amount(self, sel, list, msg): |
| 330 | new_list = list |
| 331 | if isinstance(sel, str): |
| 332 | try: |
| 333 | rex = re.compile(sel) |
| 334 | except re.error: |
| 335 | msg += " <Invalid regular expression %r>\n" % sel |
| 336 | return new_list, msg |
| 337 | new_list = [] |
| 338 | for func in list: |
| 339 | if rex.search(func_std_string(func)): |
| 340 | new_list.append(func) |
| 341 | else: |
| 342 | count = len(list) |
| 343 | if isinstance(sel, float) and 0.0 <= sel < 1.0: |
| 344 | count = int(count * sel + .5) |
| 345 | new_list = list[:count] |
| 346 | elif isinstance(sel, int) and 0 <= sel < count: |
| 347 | count = sel |
| 348 | new_list = list[:count] |
| 349 | if len(list) != len(new_list): |
| 350 | msg += " List reduced from %r to %r due to restriction <%r>\n" % ( |
| 351 | len(list), len(new_list), sel) |
| 352 | |
| 353 | return new_list, msg |
| 354 | |
| 355 | def get_stats_profile(self): |
| 356 | """This method returns an instance of StatsProfile, which contains a mapping |
no test coverage detected