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/plugins/conda.py #1172

Closed
LucyJimenez opened this issue Mar 18, 2022 · 2 comments
Closed

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/plugins/conda.py

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

asv/plugins/conda.py:                        'python={0}'.format(python),
asv/plugins/conda.py:        log.info("Creating conda environment for {0}".format(self.name))
asv/plugins/conda.py:            conda_args = ['python={0}'.format(self._python), 'wheel', 'pip'] + conda_args
asv/plugins/conda.py:                           'channels:\n'.format(self.name))
asv/plugins/conda.py:                             "in {} with file {}".format(self._path, env_file_name))
asv/plugins/conda.py:                             "in {} with:\n{}".format(self._path, text))
asv/plugins/conda.py:                        pip_args.append("{0}=={1}".format(key[4:], val))
asv/plugins/conda.py:                        conda_args.append("{0}={1}".format(key, val))
asv/plugins/conda.py:        log.debug("Running '{0}' in {1}".format(' '.join(args), self.name))
@LucyJimenez
Copy link
Contributor Author

@dorothykiz1 and @datapythonista, I'll work on this one.

@datapythonista
Copy link
Member

Not useful anymore, and add noise to the issues list.

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.

2 participants