-
-
Notifications
You must be signed in to change notification settings - Fork 29
Various improvements #47
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
Conversation
mgautierfr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of few things to change, and some other that may lead to discussion.
It may be better to split the changes in several PR to not block everything while we are discussing only one or two points.
1e65ca5 to
036e3a7
Compare
|
@mgautierfr , all your comments have been addressed. There isn't much actual code You can look at individual commits for a quick lookup. What's changed since last review:
|
mgautierfr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The final code is good.
However, I would prefer to merge the "review changes" into the other commits. At least :
- It is useless to add a default value to the main page and remove it later.
- Same for changing the behavior of
mandotory_data_ok(or moveMANDOTORY_METADATA_KEYS) and remove it.
I think it is pretty difficult to understand correctly the changes when you are exploring the git history to find a bug with this kind of commits in "contradiction".
|
OK thanks ; will do soon |
b062ce6 to
b1d3aa3
Compare
|
Sorry about the delay, was a bit of a pain to reconcile but it's now clean and ready. |
|
I'm sorry but it is not totally clean yet :) About the execption, maybe we could return |
|
Ah! right, don't be sorry for my mistakes. Will do. |
b1d3aa3 to
26d98ba
Compare
raise RuntimeError on out-of-bound get_article_by_id() changed get_article_by_id signature to not use the reserved python keyword `id`
mandatory metadata references gone, as per the spec
Creator converts passed filename to str before passing it to wrapper. This allows transparent use of pathlib.Path Also, Creator.filename now returns a pathlib.Path, created on __init__ from the wrapper returned filename. Tests updated to use pathlib by default and check .filename type. Test ensures passing regular str still works.
- fixed, added or updated docstrings - added type annotations to ease self-discovery - made `mandatory_metadata_ok` a property - added a `_closed` boolean prop in creator to record finalization status - fixed the deletion issue after a contextmanager auto-close (using `self._closed`) - simplify public API by moving single-use method: - `_get_counter_string()` and `write_metadata()` to `close()` - `_update_article_counter()` to `add_article()` - `pascalize()` to `update_metadata()` - `write_metadata()` to autmatically convert Date from datetime.datetime as well
- added types annotations in docstring as cython doesn't forward it to gen code - added a dummy __enter__ and __exit__ so user can use it as a contextmanager for clarity
26d98ba to
52e9e38
Compare
|
@mgautierfr That should be good now. Rebased on master. Tests pass on every single commit. |
|
We are good ! |
Here's a collection of individual small fixes for identified issues:
__repr__for ReadArticle and File, added on Articlethis might not be wanted as per discussion on get_article shouldn't raise RuntimeError #38 and matthieu's suggestion to leave that to new libzim's. I believe this might be forward compatible but we can strip this out if we think it won't.
Currently uses the
NotFoundexception but could be changed to useRuntimeErrorshould we opt NotFound out.Didn't receive comment on that issue so I impl. what made sense to me.
._closedprop to avoid the double-close issue we'd get on exiting the contextmanager and (auto) deletion.Please look at them individually and let me know which would make sense to push as separate PRs.