I have no idea why both exist. But this centralized one (current_version) is declared on
most swh modules vs the other method which is not [2]
[1]
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/db.py: current_version = 133 $SWH_ENVIRONMENT_HOME/swh-scheduler/swh/scheduler/backend.py: current_version = 33 $SWH_ENVIRONMENT_HOME/swh-scrubber/swh/scrubber/db.py: current_version = 2 $SWH_ENVIRONMENT_HOME/swh-storage/swh/storage/postgresql/db.py: current_version = 182 $SWH_ENVIRONMENT_HOME/swh-vault/swh/vault/backend.py: current_version = 4
[2]
grep -r "get_current_version(" $SWH_ENVIRONMENT_HOME/*/swh/ $SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/__init__.py: def get_current_version(self, *, db=None, cur=None): $SWH_ENVIRONMENT_HOME/swh-scheduler/swh/scheduler/backend.py: def get_current_version(self): $SWH_ENVIRONMENT_HOME/swh-storage/swh/storage/postgresql/storage.py: def get_current_version(self, *, db: Db, cur=None):
I would like this class to be more pythonic by working as a context manager. For me, the sqlite3 connection should probably happen in an __enter__() function, and closing it in an __exit__() function. I know you cannot use a with block in the Fuse operation class (a shame...), but at least it keeps the quirky aspect of this solely in the Fuse class.