Skip to content

Commit

Permalink
docs: add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnsilva committed Dec 24, 2024
1 parent e478e8c commit 8df03c1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
]

def clean_generated_rst(app: Sphinx, exception: Exception):
'''
Remove generated .rst files after the build is finished.
'''
if exception is None:
base_dir = os.path.abspath(os.path.dirname(__file__))
for pattern in generated_rst_files:
Expand All @@ -42,6 +45,9 @@ def clean_generated_rst(app: Sphinx, exception: Exception):
print(f"Error removing {file_path}: {e}")

def setup(app: Sphinx):
'''
Connect the clean_generated_rst function to the build-finished event.
'''
app.connect('build-finished', clean_generated_rst)

# -- Project information -----------------------------------------------------
Expand Down Expand Up @@ -125,7 +131,9 @@ def setup(app: Sphinx):
# -- SemanticScholar objects -------------------------------------------------

def find_subclasses(module, base_class):
'''Return all subclasses of a base class within a module.'''
'''
Return all subclasses of a base class within a module.
'''
subclasses = []
for _, obj in vars(module).items():
if (isinstance(obj, type) and
Expand Down Expand Up @@ -182,6 +190,9 @@ def find_subclasses(module, base_class):
# -- Convert Markdown to reStructuredText ------------------------------------

def convert_md_to_rst(md_file_path, rst_file_path):
'''
Convert a Markdown file to reStructuredText.
'''
if not os.path.exists(md_file_path):
return
with open(md_file_path, 'r', encoding='utf-8') as md_file:
Expand Down

0 comments on commit 8df03c1

Please sign in to comment.