MCPcopy Index your code
hub / github.com/RustPython/RustPython / choose_lines

Function choose_lines

Lib/test/test_zlib.py:869–874  ·  view source on GitHub ↗

Return a list of number lines randomly chosen from the source

(source, number, seed=None, generator=random)

Source from the content-addressed store, hash-verified

867 self.assertEqual(expected, actual)
868
869def choose_lines(source, number, seed=None, generator=random):
870 """Return a list of number lines randomly chosen from the source"""
871 if seed is not None:
872 generator.seed(seed)
873 sources = source.split('\n')
874 return [generator.choice(sources) for n in range(number)]
875
876
877HAMLET_SCENE = b"""

Callers

nothing calls this directly

Calls 3

choiceMethod · 0.80
seedMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected