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
It would be useful if HistogramLogReader would accept file-like objects (and not just filenames) as input. This would allow reading a log directly from a zip file, for example.
Here is an example of the desired usage.
# here using zipfile from the python stdlibwithzipfile.ZipFile(file="my_filename.zip",mode='r') asarchive:
fd=archive.open('my_hist.hlog')
accumulated_histogram=hdrh.histogram.HdrHistogram(LOWEST, HIGHEST, SIGNIFICANT)
log_reader=HistogramLogReader(fd, accumulated_histogram)
The text was updated successfully, but these errors were encountered:
I agree this would be a good enhancement and be more consistent with HistogramLogWriter which takes a File object.
We just need to be backward compatible (the api should take either a file pathname of a file descriptor as first arg).
If @astraw or anybody else would like to contribute this small/easy change, I'd be happy to review/merge any PR.
It will require adding the small check on arg type in the init and handle the close appropriately (ie only close if the file was opened by the class).
Otherwise I'll see when I have a bit of time to do it.
Thanks
It would be useful if HistogramLogReader would accept file-like objects (and not just filenames) as input. This would allow reading a log directly from a zip file, for example.
Here is an example of the desired usage.
The text was updated successfully, but these errors were encountered: