[Git][reproducible-builds/reproducible-misc][master] 2 commits: Use str.format over %s and %r.

Chris Lamb gitlab at salsa.debian.org
Fri Aug 30 07:57:42 UTC 2019



Chris Lamb pushed to branch master at Reproducible Builds / reproducible-misc


Commits:
76937501 by Chris Lamb at 2019-08-30T07:56:49Z
Use str.format over %s and %r.

- - - - -
de0974fb by Chris Lamb at 2019-08-30T07:57:21Z
Run the black reformatter over edit-notes.

- - - - -


1 changed file:

- edit-notes


Changes:

=====================================
edit-notes
=====================================
@@ -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")
+parser.add_argument(
+    "-u",
+    "--remove",
+    dest="remove",
+    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)
     to_fix.update(to_remove)
@@ -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' % add)
+            raise ValueError("{!r} is not a valid issue".format(add))
 
     if args.fix_deterministic:
-        to_fix.update(
-            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():
         try:
@@ -48,26 +51,30 @@ if __name__ == '__main__':
             try:
                 status = testedpkgs[package]
             except KeyError:
-                print("package %s appears not to exist; skipping" % package)
+                print("package {} appears not to exist; skipping".format(package))
                 continue
 
-            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('https://reproducible.debian.net/%s seems to be fixed' % package)
+                        print(
+                            "https://reproducible.debian.net/{} seems to be fixed".format(
+                                package
+                            )
+                        )
                     package_issues.remove(fix)
 
-        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__':
                     data[dst].append(x)
 
         if args.set_comment:
-            data['comments'] = args.set_comment
+            data["comments"] = args.set_comment
 
     if args.remove:
         for pkg in args.packages:
             try:
                 notes.pop(pkg)
             except KeyError:
-                print('W: {} is not in the notes, skipping removing'.format(pkg))
+                print("W: {} is not in the notes, skipping removing".format(pkg))
 
     yamlfiles.write_out(notes)



View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-misc/compare/6583a90fd4915b7892328473d3e793a0cf770e90...de0974fbe37e9bbb39a7a7a97ba6af1daacf4554

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-misc/compare/6583a90fd4915b7892328473d3e793a0cf770e90...de0974fbe37e9bbb39a7a7a97ba6af1daacf4554
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20190830/524d9ed6/attachment.html>


More information about the rb-commits mailing list