py3.8 compat
This commit is contained in:
parent
eeaded23f9
commit
40ae09dca8
2 changed files with 19 additions and 2 deletions
16
src/util/compat.py
Normal file
16
src/util/compat.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
import sys
|
||||
|
||||
if sys.version_info.major == 3 and sys.version_info.minor < 9:
|
||||
def removeprefix(s, prefix, /):
|
||||
if s.startswith(prefix):
|
||||
return s[len(prefix):]
|
||||
return s
|
||||
def removesuffix(s, suffix, /):
|
||||
if s.endswith(suffix):
|
||||
return s[:-len(suffix)]
|
||||
return s
|
||||
else:
|
||||
def removeprefix(s, prefix, /):
|
||||
return s.removeprefix(prefix)
|
||||
def removesuffix(s, suffix, /):
|
||||
return s.removesuffix(suffix)
|
Loading…
Add table
Add a link
Reference in a new issue