File create_acc.py
has 772 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""create JSON/ACC files for Arbor from a set of BluePyOpt.ephys parameters"""
# pylint: disable=R0914
import io
Function _translate_mech
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def _translate_mech(cls, mech_name, mech_params, arb_cats):
"""Translate NMODL mechanism to Arbor ACC format
Args:
mech_name (): NMODL mechanism name (suffix)
- 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
Function create_acc
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create_acc(
mechs,
parameters,
morphology=None,
morphology_dir=None,
- 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
Function create_acc
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_acc(
Function _separate_global_properties
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _separate_global_properties(cls, loc, mechs):
"""Separates global properties from a label-specific dict of mechanisms
Args:
loc (): An Arbor label describing the location
- 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
Function create_acc
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_acc(
mechs,
parameters,
morphology=None,
morphology_dir=None,
Function _read_templates
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _read_templates(template_dir, template_filename):
"""Expand Jinja2 template filepath with glob and
return dict of target filename -> parsed template"""
if template_dir is None:
template_dir = (
- 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
Function _load_catalogue_meta
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _load_catalogue_meta(cat_dir):
"""Load mechanism catalogue metadata from NMODL files
Args:
cat_dir (): Path to directory with NMODL files of catalogue
- 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
Function write_acc
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def write_acc(
Function format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def format(cls, param, mechs):
"""Find a parameter's mechanism and convert name to Arbor format
Args:
param (): A parameter in Neuron format
- 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
if isinstance(mech_param, RangeIExpr):
remaining_mech_params.append(
RangeIExpr(
name=mech_param.name,
value=None,
Function _load_mech_catalogue_meta
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _load_mech_catalogue_meta(cls, ext_catalogues):
"""Load metadata of external and Arbor's built-in mechanism catalogues
Args:
ext_catalogues (): Mapping of catalogue name to directory
- 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
Function write_acc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_acc(
output_dir,
cell,
parameters,
template_filename="acc/*_template.jinja2",
- 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"