Skip to content

Commit 393752c

Browse files
committed
Remove core.readlines_stdin() and core.readlines_stdin_raw()
Turns out, they're useless when you can simply iterate over `sys.stdin` and `sys.stdin.buffer`.
1 parent e70f2a4 commit 393752c

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

userland/core/io.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,11 @@ def perror(*errors: Any) -> None:
1010
)
1111

1212

13-
def readlines_stdin() -> Generator[str]:
14-
while line := sys.stdin.readline():
15-
yield line
16-
17-
18-
def readlines_stdin_raw() -> Generator[bytes]:
19-
while line := sys.stdin.buffer.readline():
20-
yield line
21-
22-
2313
def readwords_stdin() -> Generator[str]:
24-
for line in readlines_stdin():
14+
for line in sys.stdin:
2515
yield from line.split()
2616

2717

2818
def readwords_stdin_raw() -> Generator[bytes]:
29-
for line in readlines_stdin_raw():
19+
for line in sys.stdin.buffer:
3020
yield from line.split()

userland/utilities/cat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def python_userland_cat(opts, args: list[str]) -> int:
151151

152152
for name in args or ["-"]:
153153
if name == "-":
154-
streams.append(core.readlines_stdin_raw())
154+
streams.append(sys.stdin.buffer)
155155
else:
156156
try:
157157
# pylint: disable=consider-using-with

0 commit comments

Comments
 (0)