Skip to content

Commit

Permalink
Deal with a type issue (and solve another)
Browse files Browse the repository at this point in the history
python/mypy#13627 now causes spurious errors
involving numpy but another type issue is solved.
  • Loading branch information
calpaterson committed Oct 8, 2022
1 parent f75ac42 commit f1a42e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 1 addition & 4 deletions csvbase/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,10 +1087,7 @@ def byte_buf_to_str_buf(byte_buf: UserSubmittedBytes) -> codecs.StreamReader:
logger.warning("unable to detect charset, assuming utf-8")
encoding = "utf-8"
Reader = codecs.getreader(encoding)
# FIXME: the issue here seems to be that StreamReader is typed to want
# specifically an IO[bytes] but will actually work with other things that
# are file-like enough
return Reader(byte_buf) # type: ignore
return Reader(byte_buf)


def set_current_user_for_session(user: User, session: Optional[Any] = None) -> None:
Expand Down
5 changes: 4 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[mypy]
python_version = 3.7
# work around https://github.com/python/mypy/issues/13627
# (3.7 would be preferred)
python_version = 3.8

plugins = sqlmypy
check_untyped_defs = True
no_implicit_optional = True
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"black==22.3.0",
"bpython~=0.22.1",
"feedparser==6.0.2",
"mypy==0.910",
"mypy==0.982",
"pandas==1.3.5",
"pytest-flask==1.2.0",
"pytest==7.1.1",
Expand Down

0 comments on commit f1a42e5

Please sign in to comment.