wbolster / plyvel

Plyvel, a fast and feature-rich Python interface to LevelDB
https://plyvel.readthedocs.io/
Other
531 stars 76 forks source link

Allow using plyvel.DB as a context manager #151

Closed Necklaces closed 1 year ago

Necklaces commented 1 year ago

Allows for using with on plyvel.DB, like this:

with plyvel.DB(...) as db:
    ...

I'm not too familiar with the codebase, but I added a test and it seems to work.

wbolster commented 1 year ago

thanks, lgtm mostly. left a few comments.

note that you can already do this today using contextlib.closing() from the python stdlib

Necklaces commented 1 year ago

Neat, I might've been a little too fast so those were great suggestions.

I amended the commit with those changes to keep history clean

wbolster commented 1 year ago

thanks, lgtm. merged