mirror of https://github.com/google/oss-fuzz.git
match behavior of removeprefix
This commit is contained in:
parent
64aeebf94f
commit
63925e0e0d
|
@ -163,4 +163,9 @@ def gs_url_to_https(url):
|
||||||
|
|
||||||
def remove_prefix(string, prefix):
|
def remove_prefix(string, prefix):
|
||||||
"""Returns |string| without the leading substring |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
|
||||||
|
|
Loading…
Reference in New Issue