Skip to content

Commit

Permalink
adding the first sentence from the docstring of each plan to the prin…
Browse files Browse the repository at this point in the history
…ted definition
  • Loading branch information
awalter-bnl committed Jun 26, 2024
1 parent 29c708b commit 3e00b89
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Binary file modified src/ari_sxn_common/__pycache__/common_bluesky.cpython-312.pyc
Binary file not shown.
16 changes: 12 additions & 4 deletions src/ari_sxn_common/common_bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ def __str__(self):
A formatted string that should be printed when using print(self)
"""
output = f'\n{self.name}:'
for name in self.__dict__.keys():
for name, plan in self.__dict__.items():
if name not in ['name', 'parent']:
output += f'\n {name}'
description = plan.__doc__.split('\n')[0].strip() \
if plan.__doc__.split('\n')[0] else (
plan.__doc__.split('\n')[1].strip())

output += f'\n {name}: {description}'

return output

Expand Down Expand Up @@ -230,12 +234,16 @@ def __str__(self):
output = f'\n{self.name}:'
for name, plan in self.__dict__.items():
if name not in ['name', 'parent']:
if plan.__dict__:
if plan.__dict__: #if plan has attributes
output += f'\n {plan.__str__().replace(
'\n', '\n ').replace(
f'{self.name}_', '')}'
else:
output += f'\n {name}'
description = plan.__doc__.split('\n')[0].strip() \
if plan.__doc__.split('\n')[0] else (
plan.__doc__.split('\n')[1].strip())

output += f'\n {name}: {description}'

return output

Expand Down

0 comments on commit 3e00b89

Please sign in to comment.