mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 19:13:53 +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
@@ -165,8 +165,8 @@ class BaseDocumentationSpider(scrapy.Spider):
|
||||
if split_url.hostname == "github.com" and f"{split_url.path}/".startswith(
|
||||
f"{ZULIP_SERVER_GITHUB_FILE_PATH_PREFIX}/"
|
||||
):
|
||||
file_path = (
|
||||
DEPLOY_ROOT + split_url.path[len(ZULIP_SERVER_GITHUB_FILE_PATH_PREFIX) :]
|
||||
file_path = DEPLOY_ROOT + split_url.path.removeprefix(
|
||||
ZULIP_SERVER_GITHUB_FILE_PATH_PREFIX
|
||||
)
|
||||
if not os.path.isfile(file_path):
|
||||
self.logger.error(
|
||||
@@ -176,8 +176,8 @@ class BaseDocumentationSpider(scrapy.Spider):
|
||||
elif split_url.hostname == "github.com" and f"{split_url.path}/".startswith(
|
||||
f"{ZULIP_SERVER_GITHUB_DIRECTORY_PATH_PREFIX}/"
|
||||
):
|
||||
dir_path = (
|
||||
DEPLOY_ROOT + split_url.path[len(ZULIP_SERVER_GITHUB_DIRECTORY_PATH_PREFIX) :]
|
||||
dir_path = DEPLOY_ROOT + split_url.path.removeprefix(
|
||||
ZULIP_SERVER_GITHUB_DIRECTORY_PATH_PREFIX
|
||||
)
|
||||
if not os.path.isdir(dir_path):
|
||||
self.logger.error(
|
||||
|
||||
Reference in New Issue
Block a user