Skip to content

Commit f8a97ba

Browse files
authored
Merge pull request #1240 from onekey-sec/fix-doc-generator
fix(doc): only generate documentation for handler with a valid DOC attribute
2 parents b7c2762 + f223a61 commit f8a97ba

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

python/unblob/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ def build_handlers_doc(
106106
extra_dir_handlers = plugin_manager.load_dir_handlers_from_plugins()
107107
dir_handlers = ctx.params["dir_handlers"] + tuple(extra_dir_handlers)
108108

109-
all_handlers = handlers + dir_handlers
109+
# we only want handler with a valid DOC entry
110+
all_handlers = [
111+
handler for handler in handlers + dir_handlers if handler.DOC is not None
112+
]
110113

111114
slugifier = slugs.slugify(case="lower", percent_encode=True)
112115
format_table_headers = """ | Format | Type | Fully supported? |\n | :------------ | :----------------------------------- | :-----------------: |\n"""

python/unblob/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ class DirectoryHandler(abc.ABC):
448448

449449
PATTERN: DirectoryPattern
450450

451-
DOC: HandlerDoc
451+
DOC: Union[HandlerDoc, None]
452452

453453
@classmethod
454454
def get_dependencies(cls):
@@ -486,7 +486,7 @@ class Handler(abc.ABC, Generic[TExtractor]):
486486

487487
EXTRACTOR: TExtractor
488488

489-
DOC: HandlerDoc
489+
DOC: Union[HandlerDoc, None]
490490

491491
@classmethod
492492
def get_dependencies(cls):

0 commit comments

Comments
 (0)