File geometry.py
has 570 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Benjamin Vial
# This file is part of gyptis
# Version: 1.0.2
Geometry
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class Geometry:
"""Base class for geometry models."""
def __init__(
self,
Function read_mesh_info
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def read_mesh_info(self):
if self.dim == 1:
marker_dim = "line"
sub_dim = "curves"
marker_dim_minus_1 = "point"
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
model_name="geometry",
mesh_name="mesh.msh",
data_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 __init__
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
model_name="geometry",
mesh_name="mesh.msh",
data_dir=None,
Function set_mesh_size
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_mesh_size(self, params, dim=None):
dim = self._check_dim(dim)
if dim == 3:
type_entity = "volumes"
elif dim == 2:
- 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 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _build_serial
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _build_serial(
Function fragment
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def fragment(self, id1, id2, dim1=None, dim2=None, sync=True, map=False, **kwargs):
Function intersect
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def intersect(self, id1, id2, dim1=None, dim2=None, sync=True, map=False, **kwargs):
Function add_ellipse
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_ellipse(self, x, y, z, ax, ay, surface=True, **kwargs):
Function build
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def build(
Function get_boundaries
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_boundaries(self, idf, dim=None, physical=True):
dim = self._check_dim(dim)
if isinstance(idf, str):
if dim == 2:
type_entity = "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 cut
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def cut(self, id1, id2, dim1=None, dim2=None, sync=True, **kwargs):
Function add_circle
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_circle(self, x, y, z, r, surface=True, **kwargs):
Function is_on_plane
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def is_on_plane(P, A, B, C, eps=dolfin.DOLFIN_EPS):
Function fuse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fuse(self, id1, id2, dim1=None, dim2=None, sync=True):
Function rotate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def rotate(self, tag, point, axis, angle, dim=None):
Function add_square
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_square(self, x, y, z, dx, **kwargs):
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 _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"
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"