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

Function generate_slices

extra_tests/test_snippets.py:100–120  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

98
99
100def generate_slices(path):
101 # loop used to build slices_res.py with cpython
102 ll = [0, 1, 2, 3]
103 start = list(range(-7, 7))
104 end = list(range(-7, 7))
105 step = list(range(-5, 5))
106 step.pop(step.index(0))
107 for i in [start, end, step]:
108 i.append(None)
109
110 slices_res = []
111 for s in start:
112 for e in end:
113 for t in step:
114 slices_res.append(ll[s:e:t])
115
116 path.write_text(
117 "SLICES_RES={}\nSTART= {}\nEND= {}\nSTEP= {}\nLL={}\n".format(
118 slices_res, start, end, step, ll
119 )
120 )
121
122
123@populate("cpython")

Callers 1

setUpClassMethod · 0.85

Calls 6

listClass · 0.85
popMethod · 0.45
indexMethod · 0.45
appendMethod · 0.45
write_textMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected