Skip to content

Fix re.sub() DeprecationWarning#530

Open
cclauss wants to merge 1 commit into
ywangd:masterfrom
cclauss:fix-re.sub-count-vs-flag
Open

Fix re.sub() DeprecationWarning#530
cclauss wants to merge 1 commit into
ywangd:masterfrom
cclauss:fix-re.sub-count-vs-flag

Conversation

@cclauss

@cclauss cclauss commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

pytest generates DeprecationWarning: 'count' is passed as positional argument because re.UNICODE is being sent as count instead of flags in re.sub().

-    return re.sub(r"[^\w\d.]+", "_", fragment, re.UNICODE)
+    return re.sub(r"[^\w\d.]+", "_", fragment, flags=re.UNICODE)

https://docs.astral.sh/ruff/rules/re-sub-positional-args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant