diff --git a/asv/feed.py b/asv/feed.py index 1d69dab79..b3406216b 100644 --- a/asv/feed.py +++ b/asv/feed.py @@ -220,4 +220,4 @@ def _get_id(owner, date, content): if date is None: date = datetime.datetime(1970, 1, 1) - return "tag:{0},{1}:/{2}".format(owner, date.strftime('%Y-%m-%d'), h.hexdigest()) + return f"tag:{owner},{date.strftime('%Y-%m-%d')}:/{h.hexdigest()}" diff --git a/asv/plugins/git.py b/asv/plugins/git.py index a00e20c5e..5b5ba6298 100644 --- a/asv/plugins/git.py +++ b/asv/plugins/git.py @@ -70,10 +70,10 @@ def _run_git(self, args, cwd=True, **kwargs): return util.check_output([self._git] + args, env=env, **kwargs) def get_new_range_spec(self, latest_result, branch=None): - return '{0}..{1}'.format(latest_result, self.get_branch_name(branch)) + return f'{latest_result}..{self.get_branch_name(branch)}' def get_range_spec(self, commit_a, commit_b): - return '{0}..{1}'.format(commit_a, commit_b) + return f'{commit_a}..{commit_b}' def pull(self): # We assume the remote isn't updated during the run of asv diff --git a/asv/plugins/summarylist.py b/asv/plugins/summarylist.py index 5b6e79dcb..1832ac0a6 100644 --- a/asv/plugins/summarylist.py +++ b/asv/plugins/summarylist.py @@ -52,8 +52,8 @@ def publish(cls, conf, repo, benchmarks, graphs, revisions): pretty_name = benchmark['pretty_name'] if idx is not None: - pretty_name = '{0}({1})'.format(pretty_name, - ", ".join(benchmark_param)) + bench_param = ", ".join(benchmark_param) + pretty_name = f'{pretty_name}({bench_param})' # Each environment parameter combination is reported # separately on the summarylist page diff --git a/asv/plugins/virtualenv.py b/asv/plugins/virtualenv.py index 72421119c..a5e370abc 100644 --- a/asv/plugins/virtualenv.py +++ b/asv/plugins/virtualenv.py @@ -37,7 +37,7 @@ def __init__(self, conf, python, requirements, tagged_env_vars): executable = Virtualenv._find_python(python) if executable is None: raise environment.EnvironmentUnavailable( - "No executable found for python {0}".format(python)) + f"No executable found for python {python}") self._executable = executable self._python = python @@ -67,7 +67,7 @@ def _find_python(python): python_version = python[4:] else: python_version = python - executable = "python{0}".format(python_version) + executable = f"python{python_version}" # Find Python executable on path try: @@ -77,8 +77,8 @@ def _find_python(python): # Maybe the current one is correct? current_is_pypy = hasattr(sys, 'pypy_version_info') - current_versions = ['{0[0]}'.format(sys.version_info), - '{0[0]}.{0[1]}'.format(sys.version_info)] + current_versions = [f'{sys.version_info[0]}', + f'{sys.version_info[0]}.{sys.version_info[1]}'] if is_pypy == current_is_pypy and python_version in current_versions: return sys.executable @@ -130,7 +130,7 @@ def _setup(self): env = dict(os.environ) env.update(self.build_env_vars) - log.info("Creating virtualenv for {0}".format(self.name)) + log.info(f"Creating virtualenv for {self.name}") util.check_call([ sys.executable, "-mvirtualenv", @@ -138,7 +138,7 @@ def _setup(self): self._executable, self._path], env=env) - log.info("Installing requirements for {0}".format(self.name)) + log.info(f"Installing requirements for {self.name}") self._install_requirements() def _install_requirements(self): @@ -160,7 +160,7 @@ def _install_requirements(self): pkg = key[4:] if val: - args.append("{0}=={1}".format(pkg, val)) + args.append(f"{pkg}=={val}") else: args.append(pkg) self._run_pip(args, timeout=self._install_timeout, env=env) @@ -171,5 +171,6 @@ def _run_pip(self, args, **kwargs): return self.run_executable('python', ['-mpip'] + list(args), **kwargs) def run(self, args, **kwargs): - log.debug("Running '{0}' in {1}".format(' '.join(args), self.name)) + joined_args = ' '.join(args) + log.debug(f"Running '{joined_args}' in {self.name}") return self.run_executable('python', args, **kwargs)