Skip to content

"No overload variant of sub" Issue with re.compile after upgrading to mypy 0.4 #1492

Closed
@timabbott

Description

@timabbott

On upgrading to mypy 0.4 I get this new error:

/home/tabbott/foo.py:4: error: No overload variant of "sub" matches argument types [typing.Pattern[builtins.str*], builtins.str, builtins.str]

when using a compiled regular expression:

content = "test"
import re
quote_re = re.compile(r'{quote}(.*?){quote}', re.DOTALL)
content = re.sub(quote_re, r'~~~ quote\n\1\n~~~', content)

Haven't had a chance to investigate whether this is caused be a change in typeshed or mypy itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions