Fix missing method str.removeprefix in Python 3.8 (#695)

This commit is contained in:
Bart Broere 2024-05-24 08:25:04 +02:00 committed by GitHub
parent 116416b3e8
commit 35a96ab3f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1059,5 +1059,8 @@ def elasticsearch_model_id(model_id: str) -> str:
id = re.sub(r"[\s\\/]", "__", model_id).lower()[-64:]
if id.startswith("__"):
id = id.removeprefix("__")
# This check is only needed as long as Eland supports Python 3.8
# str.removeprefix was introduced in Python 3.9 and can be used
# once 3.8 support is dropped
id = id[2:]
return id