Download benchmarks/quixbugs/python/wrap.py from SevdanurGenc/LLM-Automated-Test-Generation-Agent: direct link, hf CLI and curl.
- Browser
- Download file 948 Bytes
-
https://huggingface.co/SevdanurGenc/LLM-Automated-Test-Generation-Agent/resolve/main/benchmarks/quixbugs/python/wrap.py
- Command line
-
hf download hf://SevdanurGenc/LLM-Automated-Test-Generation-Agent/benchmarks/quixbugs/python/wrap.py
-
curl -L -o wrap.py https://huggingface.co/SevdanurGenc/LLM-Automated-Test-Generation-Agent/resolve/main/benchmarks/quixbugs/python/wrap.py
948 Bytes
| def wrap(text, cols): | |
| lines = [] | |
| while len(text) > cols: | |
| end = text.rfind(' ', 0, cols + 1) | |
| if end == -1: | |
| end = cols | |
| line, text = text[:end], text[end:] | |
| lines.append(line) | |
| lines.append(text) | |
| return lines | |
| """ | |
| Wrap Text | |
| Given a long string and a column width, break the string on spaces into a list of lines such that each line is no longer than the column width. | |
| Input: | |
| text: The starting text. | |
| cols: The target column width, i.e. the maximum length of any single line after wrapping. | |
| Precondition: | |
| cols > 0. | |
| Output: | |
| An ordered list of strings, each no longer than the column width, such that the concatenation of the strings returns the original text, | |
| and such that no word in the original text is broken into two parts unless necessary. The original amount of spaces are preserved (e.g. spaces | |
| at the start or end of each line aren't trimmed.),Wrapping Text | |
| """ | |