mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
python: Simplify with str.removeprefix, str.removesuffix.
These are available in Python ≥ 3.9. https://docs.python.org/3/library/stdtypes.html#str.removeprefix Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
1ec4539550
commit
91ade25ba3
@@ -120,8 +120,7 @@ def get_requests_headers(integration_name: str, fixture_name: str) -> dict[str,
|
||||
headers = get_fixture_http_headers(integration_name, fixture_name)
|
||||
|
||||
def fix_name(header: str) -> str:
|
||||
header = header if not header.startswith("HTTP_") else header[len("HTTP_") :]
|
||||
return header.replace("_", "-")
|
||||
return header.removeprefix("HTTP_").replace("_", "-")
|
||||
|
||||
return {fix_name(k): v for k, v in headers.items()}
|
||||
|
||||
|
Reference in New Issue
Block a user