# HG changeset patch # User Raphaël Gomès <rgomes@octobus.net> # Date 1678372517 -3600 # Thu Mar 09 15:35:17 2023 +0100 # Node ID 15f9310accf7deabbfe03b041a760724b7c44ff2 # Parent 4d1779626665c2f4a011663b8a64e469644954ab formatting: run black on the codebase # skip-blame because this is just formatting diff --git a/bin/bin-env-util b/bin/bin-env-util --- a/bin/bin-env-util +++ b/bin/bin-env-util @@ -98,17 +98,14 @@ def _parsers(): top_parser = argparse.ArgumentParser(prog='poulpe-bin-env-util') subparsers = top_parser.add_subparsers( - help='available sub-command', - dest='command', - required=True + help='available sub-command', dest='command', required=True ) # XXX having PATH everywhere is not great ### bin-env-util create-empty PATH cmd_parser = subparsers.add_parser( - 'create-empty', - help='create a new empty bin-env' + 'create-empty', help='create a new empty bin-env' ) cmd_parser.add_argument( 'PATH', @@ -117,8 +114,7 @@ ### bin-env-util setup-one-sh PATH SCRIPT cmd_parser = subparsers.add_parser( - 'setup-one', - help='create a new bin-env with a setup script' + 'setup-one', help='create a new bin-env with a setup script' ) cmd_parser.add_argument( 'PATH', @@ -131,8 +127,7 @@ ### bin-env-util mark-ready PATH cmd_parser = subparsers.add_parser( - 'mark-ready', - help='mark a bin-env as ready' + 'mark-ready', help='mark a bin-env as ready' ) cmd_parser.add_argument( 'PATH', @@ -141,8 +136,7 @@ ### bin-env-util show PATH cmd_parser = subparsers.add_parser( - 'show', - help='Show all data we have about this environment' + 'show', help='Show all data we have about this environment' ) cmd_parser.add_argument( 'PATH', @@ -151,8 +145,7 @@ ### bin-env-util get PATH KEY cmd_parser = subparsers.add_parser( - 'get', - help='Show a specific bin-env variable' + 'get', help='Show a specific bin-env variable' ) cmd_parser.add_argument( 'PATH', @@ -165,8 +158,7 @@ ### bin-env-util set PATH KEY VALUE cmd_parser = subparsers.add_parser( - 'set', - help='Set the value of a specific bin-env variable' + 'set', help='Set the value of a specific bin-env variable' ) cmd_parser.add_argument( 'PATH', @@ -183,8 +175,7 @@ ### bin-env-util del PATH KEY cmd_parser = subparsers.add_parser( - 'del', - help='Delete a specific bin-env variable' + 'del', help='Delete a specific bin-env variable' ) cmd_parser.add_argument( 'PATH', diff --git a/bin/result-compare b/bin/result-compare --- a/bin/result-compare +++ b/bin/result-compare @@ -63,7 +63,6 @@ print(f'{prefix} {k} = {v}') prefix = " #" - base = None # display the result now for r in some_results: @@ -77,7 +76,7 @@ if change <= 0.99: perc = (1 - change) * -100 display = f"({perc:+.2f}%)".rjust(10) - elif 1.01 <= change: + elif 1.01 <= change: perc = (change - 1) * 100 display = f"({perc:+.2f}%)".rjust(10) else: diff --git a/python-libs/poulpe/benchmarks.py b/python-libs/poulpe/benchmarks.py --- a/python-libs/poulpe/benchmarks.py +++ b/python-libs/poulpe/benchmarks.py @@ -16,9 +16,11 @@ return value.split(':', 1)[1] return None + class UnknownBenchmarkMethod(KeyError): pass + def _merge_constraint(core, new): # XXX implement something proper sometime t = core.get('graph', {}) @@ -46,6 +48,7 @@ rev_range = f"({core_range}) and ({new_range})" core['compatible-revision-range'] = rev_range + def get_benchmark(path_def): """get a benchmark from path applying possible variant selection on the way @@ -70,7 +73,6 @@ class Benchmark: - def __init__(self, data, variants=None): self._raw_data = data @@ -162,7 +164,6 @@ class SimpleCommandBenchmark(Benchmark): - def __init__(self, data, variants=None): super().__init__(data, variants) @@ -186,7 +187,6 @@ all_dimensions = l_2.get('dimensions', {}) return all_dimensions.copy() - @property def needed_vars(self): variables = super().needed_vars @@ -263,7 +263,6 @@ stderr=r.stderr, ) - with open(tmp_result.name) as f: return json.load(f) @@ -289,7 +288,9 @@ self.cwd = get_var('cwd', '.') def apply_data_env(self, data_env): - variables_data = self._benchmark_data.get_var('simple-command').get('variables') + variables_data = self._benchmark_data.get_var('simple-command').get( + 'variables' + ) get_var = data_env.get_benchmark_input_vars @@ -308,10 +309,11 @@ if key is not None: self.cwd = get_var(key) + class PerfBenchmark(Benchmark): """A benchmark that use the Mercurial performance extension - It assumes an up to date mercurial repository live in + It assumes an up to date mercurial repository live in The path to the perf extension should be contained in the HGPERFPATH environment variable. @@ -320,6 +322,7 @@ (This might live in a pluging in the future.) """ + def __init__(self, data, variants=None): super().__init__(data, variants) @@ -418,7 +421,7 @@ 'perf.all-timing=yes', perf_command, '--template', - 'json' + 'json', ] def filter_arg(value): diff --git a/python-libs/poulpe/dataenvs.py b/python-libs/poulpe/dataenvs.py --- a/python-libs/poulpe/dataenvs.py +++ b/python-libs/poulpe/dataenvs.py @@ -11,7 +11,6 @@ class DataEnvironment: - def __init__(self, path, data): self._path = path self._data = data diff --git a/python-libs/poulpe/errors.py b/python-libs/poulpe/errors.py --- a/python-libs/poulpe/errors.py +++ b/python-libs/poulpe/errors.py @@ -3,7 +3,6 @@ class BenchmarkRunFailure(BenchmarkFailure): - def __init__( self, command=None, diff --git a/suites/hg/setup-data/setup-55-delta-chain.py b/suites/hg/setup-data/setup-55-delta-chain.py --- a/suites/hg/setup-data/setup-55-delta-chain.py +++ b/suites/hg/setup-data/setup-55-delta-chain.py @@ -19,7 +19,7 @@ data_env = poulpe.dataenvs.get_data_env(data_env_directory) -main_repo= data_env.get_benchmark_input_vars("mercurial.main-repo-path") +main_repo = data_env.get_benchmark_input_vars("mercurial.main-repo-path") repo_path = data_env_directory / main_repo @@ -55,7 +55,7 @@ repo_path, 'debug-delta-find', '--manifest', - '%d' % rev_info['rev'] + '%d' % rev_info['rev'], ] proc = subprocess.run(cmd, stdout=subprocess.PIPE, encoding='utf8') proc.check_returncode()