blob: aa78ae77869b40eeb35659560a9d15870d395da6 [file] [log] [blame]
Peter Pentchevb91fc932023-01-19 15:27:13 +02001# SPDX-FileCopyrightText: StorPool <support@storpool.com>
2# SPDX-License-Identifier: BSD-2-Clause
3"""Common utilities for the gifn-apply modules."""
4
5
6# This will go away with Python 3.9's str.removeprefix().
7def str_removeprefix(value: str, prefix: str) -> str:
8 """Return the value with the prefix stripped if it was there, otherwise unchanged."""
9 if not value.startswith(prefix):
10 return value
11
12 return value[len(prefix) :]