Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #119 #120

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions flake8_quotes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,11 @@ def get_quotes_errors(self, file_contents):
yield from self._check_string(token_string, fstring_start, is_docstring)
continue

# otherwise, we check nested strings and f-strings, we don't
# check FSTRING_END since it should be legal if tokenize.FSTRING_START succeeded
if token.type in (tokenize.STRING, tokenize.FSTRING_START,):
if fstring_nesting > 0:
if self.config['check_inside_f_strings']:
yield from self._check_string(token.string, token.start, is_docstring)
else:
yield from self._check_string(token.string, token.start, is_docstring)
# we check strings normally if-and-only-if check_inside_f_strings is True,
# otherwise, we check the entire glued top-level f-string in the block above
if token.type in (tokenize.STRING,) and self.config['check_inside_f_strings']:
yield from self._check_string(token.string, token.start, is_docstring)
continue

def _check_string(self, token_string, token_start, is_docstring):
# Remove any prefixes in strings like `u` from `u"foo"`
Expand Down