mirror of
https://github.com/elastic/eland.git
synced 2025-07-11 00:02:14 +08:00
Fix missing method str.removeprefix in Python 3.8 (#695)
This commit is contained in:
parent
116416b3e8
commit
35a96ab3f0
@ -1059,5 +1059,8 @@ def elasticsearch_model_id(model_id: str) -> str:
|
|||||||
|
|
||||||
id = re.sub(r"[\s\\/]", "__", model_id).lower()[-64:]
|
id = re.sub(r"[\s\\/]", "__", model_id).lower()[-64:]
|
||||||
if id.startswith("__"):
|
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
|
return id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user