Created
September 29, 2022 22:25
-
-
Save davidhozic/bb954c2812dda2661f7ade24d5ba6dda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Documentation | |
DOCUMENTATION_MODE = "DOCUMENTATION" in sys.argv | |
if DOCUMENTATION_MODE: | |
doc_titles: Dict[str, list] = {} | |
def doc_category(cat: str, manual: Optional[bool] = False, path: Optional[str]=None): | |
""" | |
Used for marking under which category this should | |
be put when auto generating documentation. | |
Parameters | |
------------ | |
cat: str | |
The name of the category to put this in. | |
manual: Optional[bool] | |
Should documentation be manually generated | |
path: Optional[str] | |
Custom path to the object. | |
Returns | |
---------- | |
Decorator | |
Returns decorator which marks the object | |
to the category. | |
""" | |
def _category(item): | |
if DOCUMENTATION_MODE: | |
doc_titles[cat].append((item, manual, path)) | |
return item | |
if DOCUMENTATION_MODE: | |
if cat not in doc_titles: | |
doc_titles[cat] = [] | |
return _category | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment