Skip to content

Commit 07d070f

Browse files
committed
make docstrings more concise
1 parent ce688a2 commit 07d070f

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

libzim/libzim.pyx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ cdef class _Creator:
284284
pass
285285

286286
def config_verbose(self, bool verbose: bool) -> Creator:
287-
"""Set creator verbosity (inside libzim). Default is off.
287+
"""Set creator verbosity inside libzim (default: off).
288288

289289
Args:
290290
verbose (bool): Whether to enable verbosity.
@@ -348,7 +348,7 @@ cdef class _Creator:
348348
return self
349349
350350
def config_nbworkers(self, int nbWorkers: pyint) -> Creator:
351-
"""Configures the number of threads to use for internal workers.
351+
"""Configures the number of threads to use for internal workers (default: 4).
352352

353353
Args:
354354
nbWorkers (int): The number of threads to allocate.
@@ -379,11 +379,11 @@ cdef class _Creator:
379379
Refer to https://wiki.openzim.org/wiki/Metadata for more details.
380380

381381
Args:
382-
size (int): The size of the illustration in bytes.
382+
size (int): The width of the square PNG illustration in pixels.
383383
content (bytes): The binary content of the PNG illustration.
384384

385385
Raises:
386-
RuntimeError: If an illustration with the same size already exists.
386+
RuntimeError: If an illustration with the same width already exists.
387387
"""
388388
cdef string _content = content
389389
self.c_creator.addIllustration(size, _content)
@@ -496,7 +496,7 @@ cdef class _Creator:
496496
497497
@property
498498
def filename(self) -> pathlib.Path:
499-
"""pathlib.Path: Path of the ZIM Archive."""
499+
"""pathlib.Path: Path of the ZIM Archive on the filesystem."""
500500
return self._filename
501501
502502
class ContentProvider:
@@ -581,7 +581,7 @@ class FileProvider(ContentProvider):
581581
class IndexData:
582582
"""IndexData stub to override.
583583

584-
Return a subclass of it in `Item.get_indexdata()`.
584+
A subclass of it should be returned in `Item.get_indexdata()`.
585585
"""
586586
__module__ = writer_module_name
587587
@@ -596,7 +596,7 @@ class IndexData:
596596
def get_title(self) -> str:
597597
"""Get the title to use when indexing an Item.
598598

599-
Might be the same as `Item.get_title` or not.
599+
Might be the same as Item's title or not.
600600

601601
Returns:
602602
str: The title to use.
@@ -606,7 +606,7 @@ class IndexData:
606606
def get_content(self) -> str:
607607
"""Get the content to use when indexing an Item.
608608

609-
Might be the same as Item.get_title or not.
609+
Might be the same as Item's content or not.
610610

611611
Returns:
612612
str: The content to use.
@@ -617,14 +617,15 @@ class IndexData:
617617
"""Get the keywords used to index the item.
618618

619619
Returns:
620-
Must be a string containing keywords separated by a space"""
620+
Space-separated string containing keywords to index for.
621+
"""
621622
raise NotImplementedError("get_keywords must be implemented.")
622623
623624
def get_wordcount(self) -> int:
624625
"""Get the number of word in content.
625626

626627
Returns:
627-
The number of words in the item.
628+
Number of words in the item's content.
628629
"""
629630
630631
raise NotImplementedError("get_wordcount must be implemented.")
@@ -633,7 +634,8 @@ class IndexData:
633634
"""GeoPosition used to index the item.
634635

635636
Returns:
636-
Must be a tuple (latitude, longitude) or None"""
637+
A (latitude, longitude) tuple or None.
638+
"""
637639
638640
return None
639641
@@ -656,23 +658,23 @@ class BaseWritingItem:
656658
The path must be absolute and unique.
657659

658660
Returns:
659-
The path of the item.
661+
Path of the item.
660662
"""
661663
raise NotImplementedError("get_path must be implemented.")
662664
663665
def get_title(self) -> str:
664666
"""Item title. Might be indexed and used in suggestions.
665667

666668
Returns:
667-
The title of the item.
669+
Title of the item.
668670
"""
669671
raise NotImplementedError("get_title must be implemented.")
670672
671673
def get_mimetype(self) -> str:
672674
"""MIME-type of the item's content.
673675

674676
Returns:
675-
The mimetype of the item.
677+
Mimetype of the item.
676678
"""
677679
raise NotImplementedError("get_mimetype must be implemented.")
678680
@@ -687,8 +689,10 @@ class BaseWritingItem:
687689
def get_hints(self) -> Dict[Hint, pyint]:
688690
"""Get the Hints that help the Creator decide how to handle this item.
689691

692+
Hints affects compression, presence in suggestion, random and search.
693+
690694
Returns:
691-
Hints to help the Creator decided how to handle this item.
695+
Hints to help the Creator decide how to handle this item.
692696
"""
693697
raise NotImplementedError("get_hints must be implemented.")
694698
@@ -826,7 +830,7 @@ cdef class Entry:
826830
"""Creates a python Entry from a C++ Entry (zim::).
827831

828832
Args:
829-
ent (Entry): (A C++ Entry
833+
ent (Entry): A C++ Entry
830834

831835
Returns:
832836
Entry: Casted entry

mkdocs.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ plugins:
8787
- https://typing-extensions.readthedocs.io/en/latest/objects.inv
8888
options:
8989
heading_level: 2
90-
# Do not show the source code as python-libzim is just a wrapper
91-
show_source: false
9290
load_external_modules: false
9391
show_submodules: false
9492
# force dynamic analysis from compiled module when loading data
@@ -101,7 +99,6 @@ plugins:
10199
- '!_module_'
102100
# *_public_objects for internal libzim-only vars that expose submodules
103101
- '!_public_objects$'
104-
paths: [libzim]
105102
# List all inherited members without further filtering
106103
inherited_members: true
107104
# Put the signature in a code-block below the heading and modernize annotations

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ build = [
7575
]
7676
docs = [
7777
"mkdocs==1.6.1",
78-
"mkdocstrings[python]==0.27.0",
78+
"mkdocstrings-python==1.14.5",
7979
"mkdocs-material==9.5.49",
8080
"pymdown-extensions==10.14",
8181
"mkdocs-gen-files==0.5.0",

0 commit comments

Comments
 (0)