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

Incorrectly removes double curly braces in f-string #215

Closed
johanneskoester opened this issue Jan 28, 2024 · 2 comments · Fixed by #216
Closed

Incorrectly removes double curly braces in f-string #215

johanneskoester opened this issue Jan 28, 2024 · 2 comments · Fixed by #216
Labels
bug Something isn't working

Comments

@johanneskoester
Copy link
Contributor

The following:

def get_test_regions(wildcards):
    benchmark = config["variant-calls"][wildcards.callset]["benchmark"]
    return f"resources/regions/{benchmark}/test-regions.cov-{{cov}}.bed"

get incorrectly reformatted to

def get_test_regions(wildcards):
    benchmark = config["variant-calls"][wildcards.callset]["benchmark"]
    return f"resources/regions/{benchmark}/test-regions.cov-{cov}.bed"

(double curly braces are removed)
This is a pretty severe bug as it alters the logic of the code and leads to unexpected errors.

@mbhall88 mbhall88 added the bug Something isn't working label Jan 29, 2024
@mbhall88
Copy link
Member

This isn't precisely a snakefmt problem. I relates to #207 and python the way in which python 3.12 tokenizes f-strings (this is formatted correctly in python 3.10).

Nevertheless, it is a bug. I'll try and get on to it ASAP. I started a discussion in the development channel on the snakemake discord about the future of dealing with bugs etc in this repo and it would be good to have your input @johanneskoester

@johanneskoester
Copy link
Contributor Author

Somebody who can probably give valuable input here could be @Hocnonsense who fixed f-string handling for Python 3.12 in Snakemake itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants