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.
As we are producing a binary extension via Cython, the regular source-based mechanism of type discovery is not available. This makes using libzim a little less pleasant for those relying on types.
This adds type stubs that we will have to manually maintain.
I had to tweak a bit the wrapper to be able to expose the get_indexdata thing. Previously, we were relying on the fact that the Item had no
get_indexdata
method to decide whether to use the libzim auto-index feature (relied on heavily for HTML entries).Conditional method is not really compatible with static typing.
In order to retain functionality and API, I chose to add a
get_indexdata
variable on allItem
, set toNone
. If this variable isNone
(no action taken), then we run the auto-index. If it is not None but returns NULL, then no index (no auto neither) If it is set and returns a proper IndexData, it is used. If the variable is missing (not sub-classingItem
), run the auto-index.In other words, behavior stays the same but type checker have a
get_indexdata
variable to look-for.I don't see it as an API change and thus plan on including in 3.5.0 but please let me know what you thin
Nota: no test behavior change. changes are only to please type-checker or to silence it in cases we were not respecting it on purpose.