Skip to content

Commit

Permalink
Remove type ignore from undeprecated path
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkin committed Aug 4, 2021
1 parent 775e4ac commit 3ba0caa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tomli/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,17 @@ class TOMLDecodeError(ValueError):

def load(fp: BinaryIO, *, parse_float: ParseFloat = float) -> Dict[str, Any]:
"""Parse TOML from a binary file object."""
s = fp.read()
s_bytes = fp.read()
try:
s = s.decode() # type: ignore[assignment]
s = s_bytes.decode()
except AttributeError:
warnings.warn(
"Text file object support is deprecated in favor of binary file objects."
' Use `open("foo.toml", "rb")` to open the file in binary mode.',
DeprecationWarning,
)
return loads(s, parse_float=parse_float) # type: ignore[arg-type]
s = s_bytes # type: ignore[assignment]
return loads(s, parse_float=parse_float)


def loads(s: str, *, parse_float: ParseFloat = float) -> Dict[str, Any]: # noqa: C901
Expand Down

0 comments on commit 3ba0caa

Please sign in to comment.