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 would like to pass an io.IOBase (or a subclass, such as botocore.response.StreamingBody) to functions that accept one of the various "buffer" classes (ReadBuffer, ReadCsvBuffer, etc.)
Currently, this does not type-check (or, at least not with Pyright), because the BaseBuffer protocol defines a mode property:
Type "IOBase" is not assignable to declared type "ReadCsvBuffer[bytes]"
"IOBase" is incompatible with protocol "ReadCsvBuffer[bytes]"
"mode" is not present
Feature Description
AFAICT, the only place the BaseBuffer.mode property is accessed is this getattr call, which can handle the property not existing (due to the default value).
Can we just remove the mode property from BaseBuffer, since (AFAICT) it's not actually required by any Pandas code that handles BaseBuffer instances (and/or instances of BaseBuffer subclasses)?
Alternative Solutions
If python/typing#601 ever becomes a reality, BaseBuffer.mode could be marked as an "optional" property.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
I would like to pass an
io.IOBase
(or a subclass, such asbotocore.response.StreamingBody
) to functions that accept one of the various "buffer" classes (ReadBuffer
,ReadCsvBuffer
, etc.)Currently, this does not type-check (or, at least not with Pyright), because the
BaseBuffer
protocol defines amode
property:pandas/pandas/_typing.py
Lines 271 to 274 in 1be2637
Feature Description
AFAICT, the only place the
BaseBuffer.mode
property is accessed is thisgetattr
call, which can handle the property not existing (due to the default value).pandas/pandas/io/common.py
Lines 1196 to 1198 in 1be2637
Can we just remove the
mode
property fromBaseBuffer
, since (AFAICT) it's not actually required by any Pandas code that handlesBaseBuffer
instances (and/or instances ofBaseBuffer
subclasses)?Alternative Solutions
If python/typing#601 ever becomes a reality,
BaseBuffer.mode
could be marked as an "optional" property.Additional Context
No response
The text was updated successfully, but these errors were encountered: