MCPcopy Index your code
hub / github.com/python/cpython / _sort_to_mode

Function _sort_to_mode

Lib/profiling/sampling/cli.py:549–560  ·  view source on GitHub ↗

Convert sort choice string to SORT_MODE constant.

(sort_choice)

Source from the content-addressed store, hash-verified

547
548
549def _sort_to_mode(sort_choice):
550 """Convert sort choice string to SORT_MODE constant."""
551 sort_map = {
552 "nsamples": SORT_MODE_NSAMPLES,
553 "tottime": SORT_MODE_TOTTIME,
554 "cumtime": SORT_MODE_CUMTIME,
555 "sample-pct": SORT_MODE_SAMPLE_PCT,
556 "cumul-pct": SORT_MODE_CUMUL_PCT,
557 "nsamples-cumul": SORT_MODE_NSAMPLES_CUMUL,
558 "name": -1,
559 }
560 return sort_map.get(sort_choice, SORT_MODE_NSAMPLES)
561
562def _create_collector(format_type, sample_interval_usec, skip_idle, opcodes=False,
563 output_file=None, compression='auto', diff_baseline=None):

Callers 2

_handle_outputFunction · 0.85
_handle_replayFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…