Closed kevinmarsh closed 2 years ago
Works for me... but can you remove the underscore prefix of the method name so it's clear it's available for overriding in a subclass, and not a protected internal implementation detail?
Works for me... but can you remove the underscore prefix of the method name so it's clear it's available for overriding in a subclass, and not a protected internal implementation detail?
Yup have force pushed a new version without the underscore prefix
Cool! That's merged. I'll make a new release next week, hopefully.
Potentially a bit of a niche change in structure but shouldn't really add any complexity. I've run into a workflow* where I need to the
_temporary_file
to be atempfile.TemporaryFile
and not atempfile.SpooledTemporaryFile
.Moving
_temporary_file
into a method makes it a lot easier to subclassS3Storage
likeas opposed to either mocking
_temporary_file
when opening/saving fromS3Storage
or having to convert the resultingmy_model.my_file_field.field.field
into a non "spooled" object (callingSpooledTemporaryFile.rollover()
won't help my situation either)*For reference the workflow is passing in a file stored on S3 into
pandas.read_csv
which handlesSpooledTemporaryFile
differently thanTemporaryFile
(which implements__next__
) when converting the file to apandas.DataFrame
since it just assumes thatSpooledTemporaryFile
is always a buffer and not a real file.