From 7544e0a5d67adf6b1d8d405eff3b28fa8db7bec5 Mon Sep 17 00:00:00 2001 From: LucyJimenez Date: Thu, 3 Mar 2022 07:57:36 -0500 Subject: [PATCH 1/4] fix issues pep8 related --- asv/plugins/__init__.py | 1 - asv/plugins/conda.py | 6 ++++-- asv/plugins/git.py | 9 ++++----- asv/plugins/mercurial.py | 4 ++-- asv/plugins/regressions.py | 27 ++++++++++++++++----------- asv/plugins/summarylist.py | 2 +- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/asv/plugins/__init__.py b/asv/plugins/__init__.py index 975bdd1c8..9dce85d06 100644 --- a/asv/plugins/__init__.py +++ b/asv/plugins/__init__.py @@ -1,2 +1 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst - diff --git a/asv/plugins/conda.py b/asv/plugins/conda.py index 7a6ba7b99..1fd8e5e38 100644 --- a/asv/plugins/conda.py +++ b/asv/plugins/conda.py @@ -177,11 +177,13 @@ def _setup(self): env=env) except Exception: if env_file_name != env_file.name: - log.info("conda env create/update failed: in {} with file {}".format(self._path, env_file_name)) + log.info("conda env create/update failed: " + "in {} with file {}".format(self._path, env_file_name)) elif os.path.isfile(env_file_name): with open(env_file_name, 'r') as f: text = f.read() - log.info("conda env create/update failed: in {} with:\n{}".format(self._path, text)) + log.info("conda env create/update failed: " + "in {} with:\n{}".format(self._path, text)) raise finally: os.unlink(env_file.name) diff --git a/asv/plugins/git.py b/asv/plugins/git.py index a00e20c5e..3fbe59631 100644 --- a/asv/plugins/git.py +++ b/asv/plugins/git.py @@ -32,8 +32,7 @@ def __init__(self, url, mirror_path): # Clone is missing log.info("Cloning project") - self._run_git(['clone', '--mirror', url, self._path], - cwd=None) + self._run_git(['clone', '--mirror', url, self._path], cwd=None) @classmethod def is_local_repo(cls, path): @@ -65,8 +64,8 @@ def _run_git(self, args, cwd=True, **kwargs): if cwd is not None: prev = env.get('GIT_CEILING_DIRECTORIES') env['GIT_CEILING_DIRECTORIES'] = os.pathsep.join( - [os.path.join(os.path.abspath(cwd), os.pardir)] - + ([prev] if prev is not None else [])) + [os.path.join(os.path.abspath(cwd), os.pardir)] + + ([prev] if prev is not None else [])) return util.check_output([self._git] + args, env=env, **kwargs) def get_new_range_spec(self, latest_result, branch=None): @@ -149,7 +148,7 @@ def get_name_from_hash(self, commit): display_error=False).strip() if not name: return None - except util.ProcessError as err: + except util.ProcessError: # Failed to obtain. return None diff --git a/asv/plugins/mercurial.py b/asv/plugins/mercurial.py index e17dd184a..19a184d2f 100644 --- a/asv/plugins/mercurial.py +++ b/asv/plugins/mercurial.py @@ -9,7 +9,7 @@ import re try: import hglib -except ImportError as exc: +except ImportError: hglib = None from ..console import log @@ -91,7 +91,7 @@ def url_match(cls, url): return False def get_range_spec(self, commit_a, commit_b): - return '{0}::{1} and not {0}'.format(commit_a, commit_b, commit_a) + return '{0}::{1} and not {0}'.format(commit_a, commit_b) def get_new_range_spec(self, latest_result, branch=None): return '{0}::{1}'.format(latest_result, self.get_branch_name(branch)) diff --git a/asv/plugins/regressions.py b/asv/plugins/regressions.py index 1d43c7d45..d47e690be 100644 --- a/asv/plugins/regressions.py +++ b/asv/plugins/regressions.py @@ -50,8 +50,8 @@ def publish(cls, conf, repo, benchmarks, graphs, revisions): cls._save_feed(conf, benchmarks, regressions, revisions, revision_to_hash) @classmethod - def _process_regression(cls, regressions, revision_to_hash, repo, all_params, - graph_data, graph): + def _process_regression(cls, regressions, revision_to_hash, repo, + all_params, graph_data, graph): j, entry_name, steps, threshold = graph_data last_v, best_v, jumps = detect_regressions(steps, threshold) @@ -138,10 +138,11 @@ def _save_feed(cls, conf, benchmarks, data, revisions, revision_to_hash): graph_params['p-' + k] = v for rev1, rev2, value1, value2 in jumps: - timestamps = (run_timestamps[benchmark_name, t] for t in (rev1, rev2) if t is not None) + timestamps = (run_timestamps[benchmark_name, t] + for t in (rev1, rev2) if t is not None) last_timestamp = max(timestamps) - updated = datetime.datetime.fromtimestamp(last_timestamp/1000) + updated = datetime.datetime.fromtimestamp(last_timestamp / 1000) params = dict(graph_params) @@ -154,7 +155,8 @@ def _save_feed(cls, conf, benchmarks, data, revisions, revision_to_hash): link = 'index.html#{0}?{1}'.format(benchmark_name, urllib.parse.urlencode(params)) try: - best_percentage = "{0:.2f}%".format(100 * (last_value - best_value) / best_value) + best_percentage = "{0:.2f}%".format(100 * + (last_value - best_value) / best_value) except ZeroDivisionError: best_percentage = "{0:.2g} units".format(last_value - best_value) @@ -163,14 +165,15 @@ def _save_feed(cls, conf, benchmarks, data, revisions, revision_to_hash): except ZeroDivisionError: percentage = "{0:.2g} units".format(value2 - value1) - jump_date = datetime.datetime.fromtimestamp(revision_timestamps[rev2]/1000) + jump_date = datetime.datetime.fromtimestamp(revision_timestamps[rev2] / 1000) jump_date_str = jump_date.strftime('%Y-%m-%d %H:%M:%S') if rev1 is not None: commit_a = revision_to_hash[rev1] commit_b = revision_to_hash[rev2] if 'github.com' in conf.show_commit_url: - commit_url = conf.show_commit_url + '../compare/' + commit_a + "..." + commit_b + commit_url = (conf.show_commit_url + '../compare/' + + commit_a + "..." + commit_b) else: commit_url = conf.show_commit_url + commit_a commit_ref = 'in commits {1}...{2}'.format(commit_url, @@ -191,7 +194,8 @@ def _save_feed(cls, conf, benchmarks, data, revisions, revision_to_hash): summary = """ {percentage} regression on {jump_date_str} {commit_ref}.
New value: {value2_str}, old value: {value1_str}.
- Latest value: {last_value_str} ({best_percentage} worse than best value {best_value_str}). + Latest value: {last_value_str} ({best_percentage} worse + than best value {best_value_str}). """.format(**locals()).strip() # Information that uniquely identifies a regression @@ -243,7 +247,7 @@ def get_graph_data(self, graph, benchmark): """ if benchmark.get('params'): param_iter = enumerate(zip(itertools.product(*benchmark['params']), - graph.get_steps())) + graph.get_steps())) else: param_iter = [(None, (None, graph.get_steps()))] @@ -302,7 +306,7 @@ def _get_start_revision(self, graph, benchmark, entry_name): else: # Commit not found in the branch --- warn and ignore. log.warning(("Commit {0} specified in `regressions_first_commits` " - "not found in branch").format(start_commit)) + "not found in branch").format(start_commit)) self._start_revisions[key] = -1 start_revision = max(start_revision, self._start_revisions[key] + 1) @@ -325,7 +329,8 @@ def _get_threshold(self, graph, benchmark, entry_name): try: threshold = float(threshold) except ValueError: - raise util.UserError("Non-float threshold in asv.conf.json: {!r}".format(threshold)) + raise util.UserError("Non-float threshold in asv.conf.json: {!r}" + .format(threshold)) if max_threshold is None: max_threshold = threshold diff --git a/asv/plugins/summarylist.py b/asv/plugins/summarylist.py index 5b6e79dcb..936bef27b 100644 --- a/asv/plugins/summarylist.py +++ b/asv/plugins/summarylist.py @@ -88,7 +88,7 @@ def publish(cls, conf, repo, benchmarks, graphs, revisions): change_rev = [None, last_piece[0]] else: # Revision range (left-exclusive) - change_rev = [prev_piece[1]-1, last_piece[0]] + change_rev = [prev_piece[1] - 1, last_piece[0]] row = dict(name=benchmark_name, idx=idx, From 083dcb7e09525b090a1ceffbfb9d75593dbf49fc Mon Sep 17 00:00:00 2001 From: LucyJimenez Date: Thu, 3 Mar 2022 08:17:47 -0500 Subject: [PATCH 2/4] fix issues pep8 related --- asv/plugins/virtualenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asv/plugins/virtualenv.py b/asv/plugins/virtualenv.py index 72421119c..2c9863919 100644 --- a/asv/plugins/virtualenv.py +++ b/asv/plugins/virtualenv.py @@ -48,7 +48,7 @@ def __init__(self, conf, python, requirements, tagged_env_vars): tagged_env_vars) try: - import virtualenv + import virtualenv # noqa F401 unused, but required in case the step before don't work except ImportError: raise environment.EnvironmentUnavailable( "virtualenv package not installed") From 21de86d09320dca8bb2d2537b2d2dd461c053656 Mon Sep 17 00:00:00 2001 From: LucyJimenez Date: Thu, 3 Mar 2022 08:19:13 -0500 Subject: [PATCH 3/4] fix issues pep8 related --- asv/plugins/virtualenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asv/plugins/virtualenv.py b/asv/plugins/virtualenv.py index 2c9863919..b4367cd07 100644 --- a/asv/plugins/virtualenv.py +++ b/asv/plugins/virtualenv.py @@ -48,7 +48,7 @@ def __init__(self, conf, python, requirements, tagged_env_vars): tagged_env_vars) try: - import virtualenv # noqa F401 unused, but required in case the step before don't work + import virtualenv # noqa F401 unused, but required in case the step before does not work except ImportError: raise environment.EnvironmentUnavailable( "virtualenv package not installed") From 156a93bea07500a996ee5e42700b9450f0b80097 Mon Sep 17 00:00:00 2001 From: LucyJimenez Date: Thu, 3 Mar 2022 08:19:56 -0500 Subject: [PATCH 4/4] fix issues pep8 related --- asv/plugins/virtualenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asv/plugins/virtualenv.py b/asv/plugins/virtualenv.py index b4367cd07..3e0e1cfad 100644 --- a/asv/plugins/virtualenv.py +++ b/asv/plugins/virtualenv.py @@ -48,7 +48,7 @@ def __init__(self, conf, python, requirements, tagged_env_vars): tagged_env_vars) try: - import virtualenv # noqa F401 unused, but required in case the step before does not work + import virtualenv # noqa F401 unused, but required in case the previous step does not work except ImportError: raise environment.EnvironmentUnavailable( "virtualenv package not installed")