Skip to content

Commit

Permalink
Merge pull request #258 from neutrinoceros/mnt/remove_suffix
Browse files Browse the repository at this point in the history
ENH: backport `str.removesuffix` from Python 3.9
  • Loading branch information
neutrinoceros authored Mar 22, 2024
2 parents 5407257 + d6c7dc7 commit ebc6fdf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nonos/_backports.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import sys

if sys.version_info >= (3, 9):
pass
else:

def removesuffix(base: str, suffix: str) -> str:
if base.endswith(suffix):
return base[: len(base) - len(suffix)]
return base


if sys.version_info >= (3, 11):
pass
else:
Expand Down

0 comments on commit ebc6fdf

Please sign in to comment.