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(driver): doc string if not found returns blank. If multiple, tak… #238

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 14 additions & 5 deletions pyscan/drivers/instrument_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,22 @@ def get_property_docstring(self, prop_name):

doc = self.__doc__.split('\n')

r = re.compile(" {} :".format(prop_name))
match = list(filter(r.match, doc))
r = " {} :".format(prop_name)

assert len(match) > 0, "No matches for {} documentation".format(prop_name)
assert len(match) == 1, "Too many matches for {} documentation".format(prop_name)
match = match[0]
def find_match(str):
if r in str:
return True
else:
return False

match = list(filter(find_match, doc))

assert not len(match) > 1, "Too many matches for {} documentation".format(prop_name)

if len(match) == 0:
match = ''
else:
match = match[0]
for i, string in enumerate(doc):
if string == match:
break
Expand Down
Loading