Commit de0974fb authored by Chris Lamb's avatar Chris Lamb 💬

Run the black reformatter over edit-notes.

parent 76937501
......@@ -7,23 +7,28 @@ from rblib import remote
from rblib import yamlfiles
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', action='store_true')
parser.add_argument('-f', '--fix-note', action='append', default=[])
parser.add_argument('-r', '--remove-note', action='append', default=[])
parser.add_argument('-a', '--add-note', action='append', default=[])
parser.add_argument('-v', '--take-version', action='store_true')
parser.add_argument('-c', '--set-comment')
parser.add_argument('-b', '--add-bug', type=int, action='append', default=[])
parser.add_argument('-d', '--fix-deterministic', action='store_true')
parser.add_argument('-u', '--remove', dest='remove', action='store_true',
help='remove the whole note block')
parser.add_argument('packages', nargs='*')
parser.add_argument("--verbose", action="store_true")
parser.add_argument("-f", "--fix-note", action="append", default=[])
parser.add_argument("-r", "--remove-note", action="append", default=[])
parser.add_argument("-a", "--add-note", action="append", default=[])
parser.add_argument("-v", "--take-version", action="store_true")
parser.add_argument("-c", "--set-comment")
parser.add_argument("-b", "--add-bug", type=int, action="append", default=[])
parser.add_argument("-d", "--fix-deterministic", action="store_true")
help="remove the whole note block",
parser.add_argument("packages", nargs="*")
args = parser.parse_args()
with open('issues.yml') as fd:
with open("issues.yml") as fd:
issues = yaml.safe_load(fd)
if __name__ == '__main__':
if __name__ == "__main__":
to_fix = set(args.fix_note)
to_remove = set(args.remove_note)
......@@ -34,12 +39,10 @@ if __name__ == '__main__':
# Validate issues
for add in args.add_note:
if add not in issues.keys():
raise ValueError('{!r} is not a valid issue'.format(add))
raise ValueError("{!r} is not a valid issue".format(add))
if args.fix_deterministic:
k for (k, v) in issues.items() if v.get('deterministic', False)
to_fix.update(k for (k, v) in issues.items() if v.get("deterministic", False))
for package in args.packages or notes.keys():
......@@ -51,23 +54,27 @@ if __name__ == '__main__':
print("package {} appears not to exist; skipping".format(package))
data = notes[package] = {'version': status['version']}
data = notes[package] = {"version": status["version"]}
if args.take_version:
data['version'] = testedpkgs[package]['version']
data["version"] = testedpkgs[package]["version"]
for fix in to_fix:
if fix in to_remove or testedpkgs.get(package, {}).get('status', False) == 'reproducible':
package_issues = data.get('issues', [])
if (
fix in to_remove
or testedpkgs.get(package, {}).get("status", False) == "reproducible"
package_issues = data.get("issues", [])
if fix in package_issues:
if args.verbose:
print('{} seems to be fixed'.format(package))
"{} seems to be fixed".format(
for src, dst in (
(args.add_bug, 'bugs'),
(args.add_note, 'issues'),
for src, dst in ((args.add_bug, "bugs"), (args.add_note, "issues")):
for x in src:
if dst not in data:
data[dst] = []
......@@ -77,13 +84,13 @@ if __name__ == '__main__':
if args.set_comment:
data['comments'] = args.set_comment
data["comments"] = args.set_comment
if args.remove:
for pkg in args.packages:
except KeyError:
print('W: {} is not in the notes, skipping removing'.format(pkg))
print("W: {} is not in the notes, skipping removing".format(pkg))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment