Skip to content

Commit 63a77fd

Browse files
author
Kareem Zidane
authored
Merge pull request #70 from cs50/develop
removes Reader
2 parents f7d7961 + 23c420e commit 63a77fd

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: python
22
python:
33
- '2.7'
4-
- '3.4'
4+
- '3.6'
55
branches:
66
except: "/^v\\d/"
77
services:
@@ -20,7 +20,7 @@ after_script: rm -f test.db
2020
jobs:
2121
include:
2222
- stage: deploy
23-
python: '3.4'
23+
python: '3.6'
2424
install: skip
2525
before_script: skip
2626
script: skip

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
package_dir={"": "src"},
1717
packages=["cs50"],
1818
url="https://github.com/cs50/python-cs50",
19-
version="3.0.1"
19+
version="3.1.0"
2020
)

src/cs50/cs50.py

+12-21
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,22 @@ def write(self, x):
2828
self.f.flush()
2929

3030

31-
class Reader:
32-
"""
33-
Disable buffering for input() as well.
34-
35-
https://bugs.python.org/issue24402
36-
"""
37-
38-
def __init__(self, f):
39-
self.f = f
40-
41-
def __getattr__(self, name):
42-
return getattr(self.f, name)
43-
44-
def fileno():
45-
raise OSError()
46-
47-
def read(self, size):
48-
return self.f.read(size)
49-
50-
5131
sys.stderr = flushfile(sys.stderr)
52-
sys.stdin = Reader(sys.stdin)
5332
sys.stdout = flushfile(sys.stdout)
5433

5534

35+
def eprint(*args, **kwargs):
36+
"""
37+
Print an error message to standard error, prefixing it with
38+
file name and line number from which method was called.
39+
"""
40+
end = kwargs.get("end", "\n")
41+
sep = kwargs.get("sep", " ")
42+
(filename, lineno) = inspect.stack()[1][1:3]
43+
print("{}:{}: ".format(filename, lineno), end="")
44+
print(*args, end=end, file=sys.stderr, sep=sep)
45+
46+
5647
def formatException(type, value, tb):
5748
"""
5849
Format traceback, darkening entries from global site-packages directories

0 commit comments

Comments
 (0)