aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--infra/utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/infra/utils.py b/infra/utils.py
index d8ade3891..fe5dd8730 100644
--- a/infra/utils.py
+++ b/infra/utils.py
@@ -163,4 +163,9 @@ def gs_url_to_https(url):
def remove_prefix(string, prefix):
"""Returns |string| without the leading substring |prefix|."""
- return string[len(prefix):]
+ # Match behavior of removeprefix from python3.9:
+ # https://www.python.org/dev/peps/pep-0616/
+ if string.startswith(prefix):
+ return string[len(prefix):]
+
+ return string