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

nbqa-pyupgrade fails on f-string with curly brace #857

Open
christian-steinmeyer opened this issue Jul 26, 2024 · 1 comment
Open

nbqa-pyupgrade fails on f-string with curly brace #857

christian-steinmeyer opened this issue Jul 26, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@christian-steinmeyer
Copy link

christian-steinmeyer commented Jul 26, 2024

I'm using this pre-commit config:

  - repo: https://github.com/nbQA-dev/nbQA
    rev: 1.8.5
    hooks:
      - id: nbqa-pyupgrade
        args: ["--py310-plus"]

and get a failed hook on a notebook cell with this content:

sql = f"""
  SELECT
      A,
      B,
      `SOME_ÜMLAUT`
  FROM MY_TABLE
    WHERE `SOME_ÜMLAUT` >= '{SOME_VARIABLE}'
""" 

where it autofixes the last line to

WHERE `SOME_ÜMLAUT` >= '{{SOME_VARIABLE}'  # note the second opening curly bracket

Pyupgrade (@ v3.16.0) itself doesn't have this issue, when run on an equivalent python file.

@MarcoGorelli
Copy link
Collaborator

thanks @christian-steinmeyer for the report

@MarcoGorelli MarcoGorelli added bug Something isn't working help wanted Extra attention is needed labels Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants