Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make easier to detect and remove bad keys from archive #67

Open
mmckerns opened this issue Jun 23, 2018 · 3 comments
Open

make easier to detect and remove bad keys from archive #67

mmckerns opened this issue Jun 23, 2018 · 3 comments

Comments

@mmckerns
Copy link
Member

Bad keys can come in the form of unhashable types... that can successfully be added to the underlying archive, but then certain methods fail when trying to use the dict interface to the archive. Failure can be that archive.__asdict__() throws an Error or appears empty.

See examples in #56, #64, #66.

@mmckerns
Copy link
Member Author

Bad keys can be often removed with del archive[bad_key] or one of the 'private' methods like archive._rmdir(bad_key).

Keys that can be added to the archive, but are (for example) unhashable and thus can't be used in a dict view of the archive... should either not be allowed, or possibly more favorably, the 'dict' view of the archive should allow unhashable types.

Keys that are bad (but in the archive) should have a method that enables them to be detected (like archive.unhashable_keys() or archive.bad_keys() or something similar.

We should also be able to identify bad entries with archive.bad_entries() or something similar.

More care needs to be taken to not allow bad keys to be added, or if bad keys/values/items are in the archive, then it should be easy to detect and purge them (i.e. archive.clean()).

@mmckerns mmckerns added this to the kept--0.1.6 milestone Jun 23, 2018
@mmckerns
Copy link
Member Author

For example, the key [1,2] can be accepted as a key by many of the archives, but it throws a TypeError when the archive is viewed as a dict (as the key is unhashable).

Another case might be a corrupt file/entry.... these cases should get mocked up in test code.

@mmckerns mmckerns modified the milestones: klepto-0.1.6, klepto-0.1.7 Jan 20, 2019
@mmckerns mmckerns modified the milestones: klepto-0.1.7, klepto-0.1.8 Jun 26, 2019
@mmckerns mmckerns modified the milestones: klepto-0.1.8, klepto-0.1.9 Sep 28, 2019
@mmckerns mmckerns modified the milestones: klepto-0.1.9, klepto-0.2.0 Jun 15, 2020
@mmckerns
Copy link
Member Author

mmckerns commented Nov 2, 2020

pushing this just into the next release, but on the short list.

@mmckerns mmckerns modified the milestones: klepto-0.2.0, klepto-0.2.1 Nov 2, 2020
@mmckerns mmckerns modified the milestones: klepto-0.2.1, klepto-0.2.2 Jun 13, 2021
@mmckerns mmckerns modified the milestones: klepto-0.2.2, klepto-0.2.3 May 20, 2022
@mmckerns mmckerns removed this from the klepto-0.2.3 milestone Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant