aboutsummaryrefslogblamecommitdiffstats
path: root/slack/python_compatibility.py
blob: 15908947453461554b9962c8499cf538395233be (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                            
# Copied from https://peps.python.org/pep-0616/ for support for Python < 3.9
def removeprefix(self: str, prefix: str) -> str:
    if self.startswith(prefix):
        return self[len(prefix) :]
    else:
        return self[:]


# Copied from https://peps.python.org/pep-0616/ for support for Python < 3.9
def removesuffix(self: str, suffix: str) -> str:
    if suffix and self.endswith(suffix):
        return self[: -len(suffix)]
    else:
        return self[:]