# SPDX-FileCopyrightText: StorPool <support@storpool.com> | |
# SPDX-License-Identifier: BSD-2-Clause | |
"""Common utilities for the gifn-apply modules.""" | |
# This will go away with Python 3.9's str.removeprefix(). | |
def str_removeprefix(value: str, prefix: str) -> str: | |
"""Return the value with the prefix stripped if it was there, otherwise unchanged.""" | |
if not value.startswith(prefix): | |
return value | |
return value[len(prefix) :] |