[riot-notifications] [RIOT-OS/RIOT] dist/tools: use f-strings where possible (#16867)

chrysn notifications at github.com
Fri Sep 17 12:00:53 CEST 2021


@chrysn approved this pull request.

For all I can tell this is equivalent Python code in releases from 3.6 -- and the few remaining 3.5 environments RIOT is used on are not where these are typically run.

tox passes as advertised, including a pylint run.

Thanks, ACK.

>              return remote
-    raise ValueError("Could not find remote with URL ending in {}/{}.git"
-                     .format(user, repo_name))
+    raise ValueError(f"Could not find remote with URL ending in "

```suggestion
    raise ValueError("Could not find remote with URL ending in "
```

(Needless f here, future linter might complain unless there's a style rule I don't know about)

> @@ -169,21 +169,19 @@ def main():
     username = user['login']
     status, pulldata = github_api.repos[ORG][REPO].pulls[args.PR].get()
     if status != 200:
-        print("Commit #{} not found: {}".format(args.PR, pulldata['message']))
+        print(f'Commit #{args.PR} not found: {pulldata["message"]}')

Funny how you changed both quotes even though they'd have worked as they are, but whatever you prefer :-)

>              'maintainer_can_modify': True,
         }
         status, new_pr = github_api.repos[ORG][REPO].pulls.post(
             body=pull_request)
         if status != 201:
-            print("Error creating the new pr: \"{}\". Is \"Public Repo\""
-                  " access enabled for the token"
-                  .format(new_pr['message']))
+            print(f'Error creating the new pr: "{new_pr["message"]}". '
+                  f'Is "Public Repo" access enabled for the token?')

```suggestion
                  'Is "Public Repo" access enabled for the token?')
```

(as above)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16867#pullrequestreview-757275446
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210917/a181909e/attachment.htm>


More information about the notifications mailing list