Skip to content

Commit

Permalink
Formatting fixes?
Browse files Browse the repository at this point in the history
  • Loading branch information
LonelyCat124 committed Jan 31, 2025
1 parent 6ece06f commit 3ff7f40
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/psyclone/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get_inherited_parameters(cls):
param_str = re.search(":[a-zA-Z0-9\\s]*:", line)
if param_str is None or param_str.group() in docs:
continue
added_docs += "\n" + line
added_docs += line + "\n"
z = x+1
type_found = False
while z < len(parent_lines):
Expand Down Expand Up @@ -119,12 +119,12 @@ def get_inherited_parameters(cls):
)
type_doc = " "
type_doc += f":type {param_name}: {type_string}"
added_docs += "\n" + type_doc
added_docs += type_doc + "\n"
break
if ":type" in parent_lines[z]:
type_found = True
if not parent_lines[z].isspace():
added_docs += "\n" + parent_lines[z]
added_docs += parent_lines[z] + "\n"
z = z + 1
else:
# If we don't break out of the loop we still need to check
Expand Down Expand Up @@ -152,7 +152,7 @@ def get_inherited_parameters(cls):
)
type_doc = " "
type_doc += f":type {param_name}: {type_string}"
added_docs += "\n" + type_doc
added_docs += type_doc + "\n"
return added_docs

def update_apply(cls, added_parameters):
Expand All @@ -164,6 +164,8 @@ def update_apply(cls, added_parameters):
last_instance = i
x = i+1
while x < len(doc_lines):
if(doc_lines[x].isspace()):
break
if not (":param" in doc_lines[x] or ":type" in
doc_lines[x] or ":raise" in doc_lines[x]):
# This is part of the previous section.
Expand All @@ -174,15 +176,13 @@ def update_apply(cls, added_parameters):
new_docs = ""
for i in range(last_instance+1):
new_docs += doc_lines[i] + "\n"

# Remove any trailing whitespace, then add a newline
new_docs = new_docs.rstrip() + "\n"
new_docs += added_parameters + "\n"

for i in range(last_instance+1, len(doc_lines)):
new_docs += doc_lines[i] + "\n"

# Add a blank line at the end of the docs to avoid a warning.
new_docs += "\n"

cls.apply.__doc__ = new_docs

def wrapper():
Expand Down

0 comments on commit 3ff7f40

Please sign in to comment.