Showing 161 of 211 total issues
Function plot
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def plot(self, figsize=None, ax=None):
if self.dim == 2:
tri, cb = plot(self.expression, mesh=self.domain, ax=ax)
fig = plt.gcf()
ax = fig.axes
- 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 build_geometry
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_geometry(pmesh):
pmesh_scatt = 1 * pmesh
b = a * 2 * 1.2
box_size = (b, b, b)
pml_width = (lambda0, lambda0, lambda0)
- 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 weak
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def weak(self, a):
self.mesh = a.function_space().mesh() if self._mesh is None else self._mesh
self.dim = self.mesh.ufl_domain().geometric_dimension()
self.function_space = self._function_space or df.FunctionSpace(
self.mesh, "CG", self.degree
- 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 set_size
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_size(self, idf, s, dim=None):
if hasattr(idf, "__len__") and not isinstance(idf, str):
for i, id_ in enumerate(idf):
s_ = s[i] if hasattr(s, "__len__") else s
params = {id_: s_}
- 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 jacobian_matrix
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def jacobian_matrix(self):
if self.direction == "x":
s = self.stretch, 1, 1
elif self.direction == "y":
s = 1, self.stretch, 1
- 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 compute_absorption
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compute_absorption(self, subdomain_absorption=False):
omega = self.source.pulsation
doms_no_pml = [
z for z in self.epsilon.keys() if z not in ["pml_bottom", "pml_top"]
]
- 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 plot_field
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def plot_field(
self,
nper=1,
type="real",
field="total",
- 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 _complexcheck
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _complexcheck(func):
"""Wrapper to check if arguments are complex"""
def wrapper(self, z):
if hasattr(z, "real") and hasattr(z, "imag"):
- 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 too many return
statements within this function. Open
return ((2 * n + 1) * (n - 1) / (n + 1)) ** 0.5 * x * u(x, n - 1, n - 1)
Avoid too many return
statements within this function. Open
return ((2 * n + 1) * (n - 1) / ((n + 1) * (n**2 - m**2))) ** 0.5 * (
Avoid too many return
statements within this function. Open
return (((2 * n + 1) / (n**2 - m**2)) ** 0.5) * (
Function solve_system
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def solve_system(self, again=False, vector_function=True):
"""Solve the discretized system.
Parameters
----------
- 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 _get_effective_param
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_effective_param(self, case):
self.solve_param(case)
coeff = self.formulation.epsilon if case == "epsilon" else self.formulation.mu
param = coeff.as_subdomain()
if param.real.ufl_shape == (3, 3):
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(directory):
for root, dirs, files in os.walk(directory):
for file in files:
if file.endswith(".py"):
python_file = os.path.abspath(os.path.join(root, file))
- 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 read_mesh_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_mesh_file(self, subdomains=None):
if subdomains is not None:
if isinstance(subdomains, str):
subdomains = [subdomains]
key = "volumes" if self.dim == 3 else "surfaces"
- 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 pause
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pause(interval):
backend = plt.rcParams["backend"]
if backend in matplotlib.rcsetup.interactive_bk:
figManager = matplotlib._pylab_helpers.Gcf.get_active()
if figManager is not 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 eval_cell
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def eval_cell(self, values, x, cell):
for sub, val in self.mapping.items():
if self.markers[cell.index] == self.subdomains[sub]:
values[:] = val(x) if callable(val) else val
- 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 __init__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, dict, geometry=None, pmls=None, dim=2, degree=1, element=None):
if pmls is None:
pmls = []
self.dict = dict
self.geometry = geometry
- 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 _cross_section_helper
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _cross_section_helper(self, return_type="s", boundaries="calc_bnds"):
uscatt = self.solution["diffracted"]
vscatt = self.formulation.get_dual(uscatt)
utot = self.solution["total"]
vtot = self.formulation.get_dual(utot)
- 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 _check_subdomains
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _check_subdomains(self):
groups = self.model.getPhysicalGroups()
names = [self.model.getPhysicalName(*g) for g in groups]
for subtype, subitems in self.subdomains.items():
for idf in subitems.copy().keys():
- 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"