rocky / python-filecache

module for Python module for reading and caching lines. This may be useful for example in a debugger where the same lines are shown many times.
GNU General Public License v3.0
4 stars 4 forks source link

open-like access #4

Open jayvdb opened 7 years ago

jayvdb commented 7 years ago

Another feature I would like is an API like the builtin open. This is less urgent, and does not even need to be part of this package. If you are not keen, it can exist only in coala.

It might seem a little strange to rewrap the cache in a file open-like API, but it helps ensure our access is strictly an iteraror, and it means the semantics are familiar and not tied to this implementation. The iterator needs to ensure one version of the file is processed, even if the file has been modified, and thus the cache is invalidated.

It can, and should, raise exceptions such as NotImplementedError for open parameters that are not able to be provided for the wrapped file cache object, or the operation is possible but not yet built because it is non-trivial to build properly.

Again, I am happy to build if you are happy for this feature to reside in your package.

rocky commented 7 years ago

Yes, please build. Thanks.