diff options
Diffstat (limited to 'slack/python_compatibility.py')
-rw-r--r-- | slack/python_compatibility.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/slack/python_compatibility.py b/slack/python_compatibility.py new file mode 100644 index 0000000..1590894 --- /dev/null +++ b/slack/python_compatibility.py @@ -0,0 +1,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[:] |