| # Copyright (c) 2022 Nordic Semiconductor ASA |
| # SPDX-License-Identifier: Apache-2.0 |
| from github.Issue import Issue |
| def parse_args() -> argparse.Namespace: |
| parser = argparse.ArgumentParser( |
| formatter_class=argparse.RawDescriptionHelpFormatter) |
| parser.add_argument('pickle_file', metavar='PICKLE-FILE', type=Path, |
| help='pickle file containing list of issues') |
| return parser.parse_args() |
| def issue_has_label(issue: Issue, label: str) -> bool: |
| def is_open_bug(issue: Issue) -> bool: |
| return (issue.pull_request is None and |
| issue.state == 'open' and |
| issue_has_label(issue, 'bug')) |
| def get_bugs(args: argparse.Namespace) -> List[Issue]: |
| '''Get the bugs to use for analysis, given command line arguments.''' |
| with open(args.pickle_file, 'rb') as f: |
| return [issue for issue in pickle.load(f) if |
| for bug in sorted(bugs, key=lambda bug: bug.number): |
| print(f'- :github:`{bug.number}` - {bug.title}') |
| if __name__ == '__main__': |