drop removeprefix as it's only available in python3.9 (#4844)

This commit is contained in:
Dave Protasowski 2022-03-17 16:49:34 -04:00 committed by GitHub
parent c443120633
commit eea675cfa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -9,9 +9,15 @@ from github import Github
def print_to_stdout(*vargs):
print(*vargs, file = sys.stdout)
def removeprefix(s, prefix):
if s.startswith(prefix):
return s[len(prefix):]
else:
return s[:]
def drop_prefix(tag):
tag = tag.removeprefix("knative-")
tag = tag.removeprefix("v")
tag = removeprefix(tag, "knative-")
tag = removeprefix(tag, "v")
return tag
def is_major_minor(tag, version):