Open jayvdb opened 5 years ago
i.e. we need this .getvalue
to exist on the TextIOWrapper
instances, but it isnt defined as existing there.
Agreed - we want this here, even if it's not found to be worth porting upstream into stdlib.
any naming suggestions?
AbstractIOValue?
Thinking out loud---there will probably be more than just .getvalue()
going into this, but it's hard to anticipate what it'll be at this point.
So, the name should be more general than just AbstractGetValueIO
.
AbstractIntrospectingIO
- might be a good balance?
AbstractReportingIO
? - doesn't do reporting automatically, but sort of describes what it'd be doing
AbstractFancyIO
? - Not very accurately descriptive, but shorter!
AbstractMockedIO
? - Accurate to what we're doing with the subclasses, but possibly too general?
stdio_mgr expects
getvalue
to exist onBytesIO
, and previously expected it to exist onStringIO
, and the docs still refer to StringIO.getvalue, but there is no base/abstract type which defines this.There is nothing in https://github.com/python/typing or title search on bpo
We should create our own temporary ABC for this, so we can hang features on it, add new ones (like
_PersistedFileIO
as aBytesIO
with afileno()
), and raise issues upstream about it. This is also 'needed' for bytes support (https://github.com/bskinn/stdio-mgr/issues/36) if we use strict type checking (https://github.com/bskinn/stdio-mgr/issues/60)e.g. https://github.com/bskinn/stdio-mgr/issues/80 is a feature that depends on
.getvalue
and little else.