Return a tuple containing the unicode text snippets read from the snippet file having `name`. Snippets are delimited by a blank line. If specified, `count` snippets starting at `offset` are returned.
(name: str, offset: int = 0, count: int = 1024)
| 25 | |
| 26 | |
| 27 | def snippet_seq(name: str, offset: int = 0, count: int = 1024): |
| 28 | """ |
| 29 | Return a tuple containing the unicode text snippets read from the snippet |
| 30 | file having `name`. Snippets are delimited by a blank line. If specified, |
| 31 | `count` snippets starting at `offset` are returned. |
| 32 | """ |
| 33 | path = os.path.join(test_file_dir, "snippets", "%s.txt" % name) |
| 34 | with open(path, "rb") as f: |
| 35 | text = f.read().decode("utf-8") |
| 36 | snippets = text.split("\n\n") |
| 37 | start, end = offset, offset + count |
| 38 | return tuple(snippets[start:end]) |
| 39 | |
| 40 | |
| 41 | def snippet_text(snippet_file_name: str): |
searching dependent graphs…