mirror of https://github.com/zulip/zulip.git
ruff: Fix B034 `re.split`, `re.sub` should pass keyword arguments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
50e6cba1af
commit
d87eea1a67
|
@ -311,7 +311,7 @@ def filter_footer(text: str) -> str:
|
||||||
# isn't a trivial footer structure.
|
# isn't a trivial footer structure.
|
||||||
return text
|
return text
|
||||||
|
|
||||||
return re.split(r"^\s*--\s*$", text, 1, flags=re.MULTILINE)[0].strip()
|
return re.split(r"^\s*--\s*$", text, maxsplit=1, flags=re.MULTILINE)[0].strip()
|
||||||
|
|
||||||
|
|
||||||
def extract_and_upload_attachments(message: EmailMessage, realm: Realm, sender: UserProfile) -> str:
|
def extract_and_upload_attachments(message: EmailMessage, realm: Realm, sender: UserProfile) -> str:
|
||||||
|
|
|
@ -33,7 +33,7 @@ def get_extra_data_from_widget_type(content: str, widget_type: Optional[str]) ->
|
||||||
for line in lines:
|
for line in lines:
|
||||||
# If someone is using the list syntax, we remove it
|
# If someone is using the list syntax, we remove it
|
||||||
# before adding an option.
|
# before adding an option.
|
||||||
option = re.sub(r"(\s*[-*]?\s*)", "", line.strip(), 1)
|
option = re.sub(r"(\s*[-*]?\s*)", "", line.strip(), count=1)
|
||||||
if len(option) > 0:
|
if len(option) > 0:
|
||||||
options.append(option)
|
options.append(option)
|
||||||
extra_data = {
|
extra_data = {
|
||||||
|
|
|
@ -11,7 +11,7 @@ attachment_url_re = re.compile(r"[/\-]user[\-_]uploads[/\.-].*?(?=[ )]|\Z)")
|
||||||
def attachment_url_to_path_id(attachment_url: str) -> str:
|
def attachment_url_to_path_id(attachment_url: str) -> str:
|
||||||
path_id_raw = re.sub(r"[/\-]user[\-_]uploads[/\.-]", "", attachment_url)
|
path_id_raw = re.sub(r"[/\-]user[\-_]uploads[/\.-]", "", attachment_url)
|
||||||
# Remove any extra '.' after file extension. These are probably added by the user
|
# Remove any extra '.' after file extension. These are probably added by the user
|
||||||
return re.sub("[.]+$", "", path_id_raw, re.M)
|
return re.sub("[.]+$", "", path_id_raw, flags=re.M)
|
||||||
|
|
||||||
|
|
||||||
def check_and_create_attachments(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
|
def check_and_create_attachments(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
|
||||||
|
|
|
@ -89,7 +89,9 @@ def get_issue_created_event_body(payload: WildValue, include_title: bool) -> str
|
||||||
# Filter out multiline hidden comments
|
# Filter out multiline hidden comments
|
||||||
if description:
|
if description:
|
||||||
stringified_description = description.tame(check_string)
|
stringified_description = description.tame(check_string)
|
||||||
stringified_description = re.sub("<!--.*?-->", "", stringified_description, 0, re.DOTALL)
|
stringified_description = re.sub(
|
||||||
|
"<!--.*?-->", "", stringified_description, count=0, flags=re.DOTALL
|
||||||
|
)
|
||||||
stringified_description = stringified_description.rstrip()
|
stringified_description = stringified_description.rstrip()
|
||||||
else:
|
else:
|
||||||
stringified_description = None
|
stringified_description = None
|
||||||
|
|
Loading…
Reference in New Issue