1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #34233 -- Used str.removeprefix()/removesuffix().

This commit is contained in:
Mariusz Felisiak
2023-01-18 19:11:18 +01:00
committed by GitHub
parent fd21f82aa8
commit 23e8868862
30 changed files with 42 additions and 53 deletions

View File

@@ -9,9 +9,7 @@ PATH = os.path.dirname(os.path.abspath(__file__))
def fix_os_paths(x):
if isinstance(x, str):
if x.startswith(PATH):
x = x[len(PATH) :]
return x.replace("\\", "/")
return x.removeprefix(PATH).replace("\\", "/")
elif isinstance(x, tuple):
return tuple(fix_os_paths(list(x)))
elif isinstance(x, list):