diff options
author | Jason R. Coombs <jaraco@google.com> | 2023-09-29 11:04:49 -0400 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-10-31 16:03:54 +0000 |
commit | b32ccbb66bb16965ecb8b4e266c4e45186636c1b (patch) | |
tree | 1c1eda32af709f0cbf822de56f696ccd531ce6de /hooks.py | |
parent | b99272c601bc5f466c3cfc782bb852c2c967ad27 (diff) | |
download | git-repo-b32ccbb66bb16965ecb8b4e266c4e45186636c1b.tar.gz |
cleanup: Update codebase to expect Python 3.6
- Bump minimum version to Python 3.6.
- Use f-strings in a lot of places.
Change-Id: I2aa70197230fcec2eff8e7c8eb754f20c08075bb
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389034
Tested-by: Jason R. Coombs <jaraco@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Jason R. Coombs <jaraco@google.com>
Diffstat (limited to 'hooks.py')
-rw-r--r-- | hooks.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -180,7 +180,7 @@ class RepoHook: | |||
180 | abort_if_user_denies was passed to the consturctor. | 180 | abort_if_user_denies was passed to the consturctor. |
181 | """ | 181 | """ |
182 | hooks_config = self._hooks_project.config | 182 | hooks_config = self._hooks_project.config |
183 | git_approval_key = "repo.hooks.%s.%s" % (self._hook_type, subkey) | 183 | git_approval_key = f"repo.hooks.{self._hook_type}.{subkey}" |
184 | 184 | ||
185 | # Get the last value that the user approved for this hook; may be None. | 185 | # Get the last value that the user approved for this hook; may be None. |
186 | old_val = hooks_config.GetString(git_approval_key) | 186 | old_val = hooks_config.GetString(git_approval_key) |
@@ -193,7 +193,7 @@ class RepoHook: | |||
193 | else: | 193 | else: |
194 | # Give the user a reason why we're prompting, since they last | 194 | # Give the user a reason why we're prompting, since they last |
195 | # told us to "never ask again". | 195 | # told us to "never ask again". |
196 | prompt = "WARNING: %s\n\n" % (changed_prompt,) | 196 | prompt = f"WARNING: {changed_prompt}\n\n" |
197 | else: | 197 | else: |
198 | prompt = "" | 198 | prompt = "" |
199 | 199 | ||
@@ -241,9 +241,8 @@ class RepoHook: | |||
241 | return self._CheckForHookApprovalHelper( | 241 | return self._CheckForHookApprovalHelper( |
242 | "approvedmanifest", | 242 | "approvedmanifest", |
243 | self._manifest_url, | 243 | self._manifest_url, |
244 | "Run hook scripts from %s" % (self._manifest_url,), | 244 | f"Run hook scripts from {self._manifest_url}", |
245 | "Manifest URL has changed since %s was allowed." | 245 | f"Manifest URL has changed since {self._hook_type} was allowed.", |
246 | % (self._hook_type,), | ||
247 | ) | 246 | ) |
248 | 247 | ||
249 | def _CheckForHookApprovalHash(self): | 248 | def _CheckForHookApprovalHash(self): |
@@ -262,7 +261,7 @@ class RepoHook: | |||
262 | "approvedhash", | 261 | "approvedhash", |
263 | self._GetHash(), | 262 | self._GetHash(), |
264 | prompt % (self._GetMustVerb(), self._script_fullpath), | 263 | prompt % (self._GetMustVerb(), self._script_fullpath), |
265 | "Scripts have changed since %s was allowed." % (self._hook_type,), | 264 | f"Scripts have changed since {self._hook_type} was allowed.", |
266 | ) | 265 | ) |
267 | 266 | ||
268 | @staticmethod | 267 | @staticmethod |