mirror of
https://github.com/MillironX/nfdocs-parser.git
synced 2024-11-22 00:56:04 +00:00
Make docstring dictionary more generic
Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>
This commit is contained in:
parent
f880f47b3d
commit
c481a04fc0
1 changed files with 7 additions and 10 deletions
|
@ -57,9 +57,11 @@ with open(nextflow_path) as nextflow_file:
|
||||||
docstring_positions.append(range(doc_start, doc_end))
|
docstring_positions.append(range(doc_start, doc_end))
|
||||||
|
|
||||||
# Create dictionaries for each of the block types
|
# Create dictionaries for each of the block types
|
||||||
workflow_docstrings = dict()
|
docstrings = {
|
||||||
process_docstrings = dict()
|
"process": {},
|
||||||
function_docstrings = dict()
|
"workflow": {},
|
||||||
|
"function": {}
|
||||||
|
}
|
||||||
|
|
||||||
# Parse out the docstrings and put them in the appropriate dictionary
|
# Parse out the docstrings and put them in the appropriate dictionary
|
||||||
for pos in docstring_positions:
|
for pos in docstring_positions:
|
||||||
|
@ -67,12 +69,7 @@ with open(nextflow_path) as nextflow_file:
|
||||||
doc_yaml = ""
|
doc_yaml = ""
|
||||||
for i in pos:
|
for i in pos:
|
||||||
doc_yaml = doc_yaml + nextflow_lines[i].replace(DOC_STARTER, "")
|
doc_yaml = doc_yaml + nextflow_lines[i].replace(DOC_STARTER, "")
|
||||||
if proc_type == "process":
|
docstrings[proc_type][proc_name] = yaml.safe_load(doc_yaml)
|
||||||
process_docstrings[proc_name] = yaml.load(doc_yaml, Loader=yaml.SafeLoader)
|
|
||||||
elif proc_type == "function":
|
|
||||||
function_docstrings[proc_name] = yaml.load(doc_yaml, Loader=yaml.SafeLoader)
|
|
||||||
elif proc_type == "workflow":
|
|
||||||
workflow_docstrings[proc_name] = yaml.load(doc_yaml, Loader=yaml.SafeLoader)
|
|
||||||
|
|
||||||
# Display the results so far
|
# Display the results so far
|
||||||
print(process_docstrings)
|
print(docstrings)
|
||||||
|
|
Loading…
Reference in a new issue