Skip to content

Commit

Permalink
Merge pull request #9 from teonat/develop
Browse files Browse the repository at this point in the history
Remove false positive FS003 for pure regex-strings containing curly brackets
  • Loading branch information
MichaelKim0407 authored Oct 21, 2021
2 parents f3b22b5 + 1501cf1 commit dcfcaed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion flake8_use_fstring/prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

FSTRING_REGEX = _re.compile(r'^([a-zA-Z]*?[fF][a-zA-Z]*?){1}["\']')
NON_FSTRING_REGEX = _re.compile(
r'^[a-zA-Z]*(?:\'\'\'|\'|"""|")(.*?{.+?}.*)(?:\'|\'\'\'|"|""")$',
r'^[a-zA-Z]*(?<!\b[rR])(?:\'\'\'|\'|"""|")'
r'(.*?{.+?}.*)(?:\'|\'\'\'|"|""")$',
)


Expand Down
3 changes: 2 additions & 1 deletion tests/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def format(self): # noqa: A003

# match missing prefix
o = ('{n}'
'{{m}} {n}')
'{{m}} {n}'
r'[a-z]{1,3}') # Should not be matched.

# no errors below; coverage
''.strip()

0 comments on commit dcfcaed

Please sign in to comment.