You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Line of code which save msgpack to binary file, cause mypy to raise typing error. How can I fix typing here? Save/load works fine, by the way.
@attr.s(auto_attribs=True)
class Phrase(DataClassMessagePackMixin):
some_data: str
....
with open(base_data_path / "my_data", "wb") as f:
f.write(phrase.to_msgpack())
Here, mypy raises typing error:
error: Argument 1 to "write" of "IO" has incompatible type "Union[str, bytes, bytearray]"; expected "bytes"
mypy --version
mypy 0.930
The text was updated successfully, but these errors were encountered:
At first glance it seems like to_msgpack method in DataClassMessagePackMixin should return bytes. I will see if we can change it from Union[str, bytes, bytearray] without problems. As a workaround you can use cast:
Line of code which save msgpack to binary file, cause mypy to raise typing error. How can I fix typing here? Save/load works fine, by the way.
Here, mypy raises typing error:
error: Argument 1 to "write" of "IO" has incompatible type "Union[str, bytes, bytearray]"; expected "bytes"
mypy --version
mypy 0.930
The text was updated successfully, but these errors were encountered: