Skip to content

Commit

Permalink
change script to prepend when empty; draft at #4691
Browse files Browse the repository at this point in the history
  • Loading branch information
kltm committed Aug 11, 2023
1 parent 6790261 commit 0069120
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion scripts/annotation-review-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import logging
import sys
import os
import re
import requests
import json
Expand Down Expand Up @@ -225,6 +226,9 @@ def sorter(line: str):
outfile = args.output + '/' + file_prefix + outfile
LOG.info('output to file: ' + outfile)

## Flag to detect whether or not we saw results.
saw_a_result_p = False

## Final writeout to files of the same name as the term.
with open(outfile, 'w+') as fhandle:

Expand All @@ -236,10 +240,18 @@ def sorter(line: str):
for t in collected_issues:
LOG.info(t)

## Print out header line:
## Print out lines.
issue_output = get_term_annotation_data(args.field, t)
if issue_output == "":
LOG.info("No annotations for: " + t)
else:
saw_a_result_p = True
fhandle.write(issue_output)
fhandle.write("\n")

## Rename as empty if did not see any results.
if saw_a_result_p == False:
LOG.info('No results found, so renaming as EMPTY.')
os.rename(outfile, 'EMPTY_' + outfile)
else:
LOG.info('Results found, no renaming.')

0 comments on commit 0069120

Please sign in to comment.