DB usability improvements#385
Merged
Merged
Conversation
util.DB is a wrapper class to manipulate data in tabular format. before this commit, it was not possible to read or write the entire table in one go. this commit introduces support for such operations. the rationale of these operations is to have the ability to operate on the entire table in the same way it is possible to operate on the single rows, without requiring external iteration.
implement keys(), items(), __contains__() methods for the DB class with dict-like semantics. implement an export() method, flattening the entire structure (DB and DB_Row's), with semantics akin to DB_Row.export(). document in more detail the existing dict-like semantics of the DB class, detailing in particular the instances where the existing behaviour diverges from Python dicts. introduce an unit test for the new DB.export() method.
vmsh0
force-pushed
the
db-usability-improvements
branch
from
August 22, 2022 15:15
b8a2f84 to
f02a8c5
Compare
the existing type hints make some attributes Optional, while a None value for any of those attribute would be in fact an error. there might be more esuch cases in the DB class: this commit is not meant to be exhaustive.
vmsh0
force-pushed
the
db-usability-improvements
branch
from
August 22, 2022 15:19
f02a8c5 to
16035e3
Compare
Contributor
Author
|
As you can see, I also added some static typing fixes that seemed appropriate. Existing code, as well as some of my new code, failed static typechecks without those fixes. In particular,
|
gijzelaerr
self-requested a review
September 21, 2022 06:45
gijzelaerr
approved these changes
Sep 21, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In reference to Issues #379 and #380, I'm opening this PR with proposed improvements for the
DBclass.Please let me know whether there's anything I can change/improve to get this pulled.