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
I've had typing issues with rtoml.load accepting TextIO twice by now. Can't fully recreate the first situation, but the second is loading a TOML config file in Flask.
Argument "load" to "from_file" of "Config" has incompatible type "Callable[[Union[str, Path, TextIO]], Dict[str, Any]]"; expected "Callable[[IO[Any]], Mapping[Any, Any]]"
Since type TextIO is a subclass of IO[str] with a few additional methods that rtoml does not use I suggest to change the signature to use IO[str] (or maybe even IO[Any] plus encoding handling?) instead of TextIO.
I've had typing issues with
rtoml.load
acceptingTextIO
twice by now. Can't fully recreate the first situation, but the second is loading a TOML config file in Flask.Flask's
flask.Config.from_file
has aload
parameter whose type is documented asand implemented as
Callable[[IO[Any]], Mapping]
.Trying to use rtoml with it like so:
makes mypy unhappy:
Since type
TextIO
is a subclass ofIO[str]
with a few additional methods that rtoml does not use I suggest to change the signature to useIO[str]
(or maybe evenIO[Any]
plus encoding handling?) instead ofTextIO
.For comparison,
IO[bytes]
, andIO
.What do you think?
The text was updated successfully, but these errors were encountered: