Debian Codegraph @

tests/data/lotsoflines.py

raw
1 # ruff: file-ignore[implicit-namespace-package]
2 # Generates 100,000 lines of output (about 4 MB of data).
3 # The first argument says where to put the lines.
4 # "stdout" goes to stdout
5 # "stderr" goes to stdrer
6 # "both" duplicates the line to both stdout and stderr
7
8 import sys
9
10 where = "both"
11 if len(sys.argv) > 1:
12 where = sys.argv[1]
13
14 for i in range(1, 100000 + 1):
15 if where == "both":
16 sys.stdout.write("This is line %d.\n" % i)
17 sys.stderr.write("This is line %d.\n" % i)
18 elif where == "stdout":
19 sys.stdout.write("This is line %d.\n" % i)
20 elif where == "stderr":
21 sys.stderr.write("This is line %d.\n" % i)