MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / eval_print_amount

Method eval_print_amount

tools/python-3.11.9-amd64/Lib/pstats.py:329–353  ·  view source on GitHub ↗
(self, sel, list, msg)

Source from the content-addressed store, hash-verified

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

Callers 1

get_print_listMethod · 0.95

Calls 4

func_std_stringFunction · 0.85
compileMethod · 0.45
searchMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected