bopt/cli/exp.py
Function run
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
Open
def run(args) -> None:
# TODO: acquire in the same with?
with handle_cd_revertible(args.dir):
with acquire_lock():
experiment = Experiment.deserialize()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
Open
if sample.result is not None:
print(sample.result)
Avoid deeply nested control flow statements. Open
Open
if best_res is None or (sample.result and sample.result > best_res):
best_res = sample.result
best_sample = sample
except ValueError:
Avoid deeply nested control flow statements. Open
Open
for h, v in best_sample.hyperparam_values.mapping.items():
if isinstance(v, float):
v = round(v, 2)
run_str += " --{}={}".format(h.name, v)
TODO found Open
Open
# TODO: get rid of psutil?
- Exclude checks
TODO found Open
Open
# TODO: acquire in the same with?
- Exclude checks
TODO found Open
Open
# TODO fix this on osx, shared={mem.shared}"
- Exclude checks
TODO found Open
Open
# TODO: cleanup checks
- Exclude checks