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

[Sprint] Use f-strings instead .format() function on asv/config.py #1169

Closed
LucyJimenez opened this issue Mar 18, 2022 · 0 comments · Fixed by #1194
Closed

[Sprint] Use f-strings instead .format() function on asv/config.py #1169

LucyJimenez opened this issue Mar 18, 2022 · 0 comments · Fixed by #1194

Comments

@LucyJimenez
Copy link
Contributor

xref #909

Since we support Python > 3.7 now, we can make use of f-strings, to make code more readable.

As an example, the next asv code:
machine_env_name = "{}/{}".format(machine, env_name)
or the next, which is equivalent:
machine_env_name = "{0}/{1}".format(machine, env_name)
Could be written as:
machine_env_name = f"{machine}/{env_name}"
(note the f before the string quotes)

The next command returns the list of strings to replace:
grep -R --exclude-dir="build" --exclude="*.css" ".format(" asv/config.py

For this file, you will find the following issues to solve:

asv/config.py:        self.pythons = ["{0[0]}.{0[1]}".format(sys.version_info)]
asv/config.py:            raise util.UserError("Config file {0} not found.".format(path))
asv/config.py:                "No repo specified in {0} config file.".format(path))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant