Skip to content

Commit 52e9e38

Browse files
author
renaud gaudin
committed
Cleaner reader API
- 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
1 parent 94882c2 commit 52e9e38

File tree

2 files changed

+222
-237
lines changed

2 files changed

+222
-237
lines changed

libzim/reader.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
# flake8: noqa
1+
""" libzim reader module
2+
3+
- File to open and read ZIM files
4+
- Article are returned by File on get_article() and get_article_by_id()
5+
- NotFound is raised on incorrect article URL query
6+
7+
Usage:
28
9+
with File(pathlib.Path("myfile.zim")) as zf:
10+
article = zf.get_article(zf.main_page_url)
11+
print(f"Article {article.title} at {article.url} is {article.content.nbytes}b")
12+
"""
13+
14+
# flake8: noqa
315
from .wrapper import FilePy as File, NotFound
416
from .wrapper import ReadArticle as Article

0 commit comments

Comments
 (0)