Skip to content

Commit

Permalink
First pass formatting changes to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniscirpons committed Dec 1, 2024
1 parent c1d68ad commit 8be0578
Show file tree
Hide file tree
Showing 2 changed files with 645 additions and 318 deletions.
29 changes: 23 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def doc_only_run(self):
docstring = list(node.findall(condition=desc_content))

if not docstring:
logger.warning(f"The docstring for {self.arguments[0]} cannot be found.")
logger.warning(
f"The docstring for {self.arguments[0]} cannot be found."
)
return []

return docstring
Expand Down Expand Up @@ -101,7 +103,9 @@ def no_doc_run(self):
source_suffix = ".rst"
master_doc = "index"
project = "libsemigroups_pybind11"
copyright = "2021-2024, Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte"
copyright = (
"2021-2024, Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte"
)
author = "Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte"
version = "1.0.0"
release = "1.0.0"
Expand Down Expand Up @@ -158,6 +162,8 @@ def no_doc_run(self):
r"libsemigroups::IntegerProd<long long>, libsemigroups::IntegerZero"
r"<long long>, libsemigroups::IntegerOne<long long>, long long>"
): r"Matrix",
r"libsemigroups::Sims1": r"Sims1",
r"SimsSettingsSims1": r"Sims1",
}

# This dictionary should be of the form class_name -> (pattern, repl), where
Expand All @@ -181,6 +187,10 @@ def no_doc_run(self):
"FroidurePinPBR": [(r"\bPBR\b", "Element")],
"SchreierSimsPerm1": [(r"\bPerm1\b", "Element")],
"ReversiblePaths": [(r"\bPaths\b", "ReversiblePaths")],
"Sims1": [("SubclassType", "Sims1")],
"Sims2": [("SubclassType", "Sims2")],
"RepOrc": [("SubclassType", "RepOrc")],
"MinimalRepOrc": [("SubclassType", "MinimalRepOrc")],
}

# This is what sphinx considers to be a signature
Expand Down Expand Up @@ -302,7 +312,8 @@ def make_only_doc(lines):
if not called_correctly:
raise RuntimeError(
":only-document-once: has been invoked in a function where "
"documentation has not been repeated. Invoked in:\n" + "\n".join(lines)
"documentation has not been repeated. Invoked in:\n"
+ "\n".join(lines)
)

# If the new doc shouldn't be overloaded, remove the "Overloaded
Expand All @@ -312,7 +323,9 @@ def make_only_doc(lines):
del lines[0]


def only_doc_once(app, what, name, obj, options, lines): # pylint:disable=too-many-arguments,too-many-positional-arguments
def only_doc_once(
app, what, name, obj, options, lines
): # pylint:disable=too-many-arguments,too-many-positional-arguments
"""
Edit docstring to only include one version of the doc for an overloaded
function if necessary
Expand All @@ -322,7 +335,9 @@ def only_doc_once(app, what, name, obj, options, lines): # pylint:disable=too-m
make_only_doc(lines)


def fix_overloads(app, what, name, obj, options, lines): # pylint:disable=too-many-arguments,too-many-positional-arguments
def fix_overloads(
app, what, name, obj, options, lines
): # pylint:disable=too-many-arguments,too-many-positional-arguments
"""Indent overloaded function documentation and format signatures"""
overloading = False
overloaded_function = ""
Expand Down Expand Up @@ -395,7 +410,9 @@ def fix_overloads(app, what, name, obj, options, lines): # pylint:disable=too-m
}


def remove_doc_annotations(app, what, name, obj, options, lines): # pylint:disable=too-many-arguments,too-many-positional-arguments
def remove_doc_annotations(
app, what, name, obj, options, lines
): # pylint:disable=too-many-arguments,too-many-positional-arguments
"""Remove any special decorations from the documentation"""
for i in range(len(lines) - 1, -1, -1):
for bad, good in docstring_replacements.items():
Expand Down
Loading

0 comments on commit 8be0578

Please sign in to comment.