Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Mar 16, 2021
1 parent e29cf76 commit b89e16e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cotengra/hyper_optuna.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ def make_getter(name, param):
name, param['min'], param['max'])
raise ValueError("Didn't understand space {}.".format(param))


def make_retriever(methods, space):

if len(methods) == 1:
def meth_getter(trial):
def meth_getter(_):
return methods[0]
else:
def meth_getter(trial):
Expand Down
7 changes: 4 additions & 3 deletions cotengra/hyper_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, space):
def sample(self):
return {k: fn() for k, fn in self._samplers.items()}


class RandomSampler:

def __init__(self, methods, spaces):
Expand All @@ -81,15 +82,15 @@ def random_init_optimizers(
space : dict[str, dict[str, dict]]
The search space.
"""
self._random_sampler = RandomSampler(methods, space)
self.sampler = RandomSampler(methods, space)


def random_get_setting(self):
method, params = self._random_sampler.ask()
method, params = self.sampler.ask()
return {'method': method, 'params': params}


def random_report_result(self, setting, trial, score):
def random_report_result(*_, **__):
pass


Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ testpaths = tests
addopts = --cov=cotengra --cov-report term-missing --verbose --durations=10
filterwarnings =
once

[pylama]
ignore = C901

0 comments on commit b89e16e

Please sign in to comment.