Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix not shown heading Attributes in docs, and update the docs #99

Merged
merged 1 commit into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/about_us.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ Core Development Team

Wenjie Du
**********
- Initialized the project in 2022
- `Wenjie's Homepage <https://github.com/WenjieDu>`_
- Initialized the project in March 2022
- `GitHub (WenjieDu) <https://github.com/WenjieDu>`_
- `LinkedIn (Wenjie Du) <https://www.linkedin.com/in/wenjie-du>`_

Maciej Skrabski
***************
- Joined as a maintainer in May 2023
- `GitHub (MaciejSkrabski) <https://github.com/MaciejSkrabski>`_
- `LinkedIn (Maciej Skrabski) <https://www.linkedin.com/in/maciej-skrabski-75595525a>`_


All Contributors
""""""""""""""""
Expand Down
36 changes: 36 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import os
import sys

from sphinx.ext.napoleon.docstring import NumpyDocstring

try:
sys.path.insert(0, os.path.abspath(".."))
except IndexError:
Expand Down Expand Up @@ -97,3 +99,37 @@
gtagjs_ids = [
"G-HT18SK09XE", # PyPOTS docs site
]


# the code below is for fixing the display of `Attributes` heading,
# refer to https://github.com/ivadomed/ivadomed/issues/315
# adds extensions to the Napoleon NumpyDocstring class
def parse_keys_section(self, section):
return self._format_fields("Keys", self._consume_fields())


NumpyDocstring._parse_keys_section = parse_keys_section


def parse_attributes_section(self, section):
return self._format_fields("Attributes", self._consume_fields())


NumpyDocstring._parse_attributes_section = parse_attributes_section


def parse_class_attributes_section(self, section):
return self._format_fields("Class Attributes", self._consume_fields())


NumpyDocstring._parse_class_attributes_section = parse_class_attributes_section


def patched_parse(self):
self._sections["keys"] = self._parse_keys_section
self._sections["class attributes"] = self._parse_class_attributes_section
self._unpatched_parse()


NumpyDocstring._unpatched_parse = NumpyDocstring._parse
NumpyDocstring._parse = patched_parse