Showing 35 of 205 total issues
Function populate
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def populate(self, data, resize_x=True, normalize=True):
"""Adds/Replace data in the table.
data: an iterable of iterables in the form [[col1, col2, col3], [col1, col2, col3]]
resize_x: if True, changes the x-size of the table according to the given data.
If False and data have dimensions different from the existing table structure a WidgetDataError is raised.
- Read upRead up
- Create a ticketCreate a ticket
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 _insert
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _insert(self, dom_group, idx=None, prepend=False, name=None):
"""Inserts a DOMGroup inside this element.
If provided at the given index, if prepend at the start of the childs list, by default at the end.
If the child is a DOMElement, correctly links the child.
If the DOMGroup have a name, an attribute containing the child is created in this instance.
- Read upRead up
- Create a ticketCreate a ticket
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 wrap_many
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def wrap_many(self, *args, strict=False):
"""Wraps different copies of this element inside all empty tags
listed in params or param's (non-empty) iterators.
Returns list of copies of this element wrapped inside args
or None if not succeeded, in the same order and same structure,
- Read upRead up
- Create a ticketCreate a ticket
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 pop
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def pop(self, arg=None):
"""Removes the child at given position or by name (or name iterator).
if no argument is given removes the last."""
if arg is None:
arg = len(self.childs) - 1
- Read upRead up
- Create a ticketCreate a ticket
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
TempyMarkdownRenderer
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class TempyMarkdownRenderer(Renderer):
_tempy_tags = importlib.import_module(".tags", package="tempy")
def placeholder(self):
return []
- Create a ticketCreate a ticket
Function apply_function
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def apply_function(self, format_function):
for index, content in enumerate(filter(lambda c: c is not None, self.content)):
if isinstance(content, DOMElement):
content.apply_function(format_function)
elif self._t_repr:
- Read upRead up
- Create a ticketCreate a ticket
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
DOMNavigator
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class DOMNavigator(TempyClass):
@property
def root(self):
return self.parent.root if self.parent else self
- Create a ticketCreate a ticket
TempyTable
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class TempyTable(tags.Table):
"""Table widget.
Creates a simple table structure using the give data, or an empty table of the given size.self
params:
data: an iterable of iterables in this form [[col1, col2, col3], [col1, col2, col3]]
- Create a ticketCreate a ticket
Tag
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Tag(DOMElement):
"""
Provides an api for tag inner manipulation and for rendering.
"""
_template = "%s<%s%s>%s%s</%s>"
- Create a ticketCreate a ticket
DOMElement
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class DOMElement(TempyRenderer, DOMNavigator, DOMModifier):
"""Takes care of the tree structure using the "childs" and "parent" attributes.
Manages the DOM manipulation with proper valorization of those two.
"""
- Create a ticketCreate a ticket
Function content
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def content(self):
content = self._fixed_content
if not content and self.parent:
content = self.parent.find_content(self._name)
if isinstance(content, DOMElement) or content:
- Read upRead up
- Create a ticketCreate a ticket
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 content_receiver
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def content_receiver(reverse=False):
"""Decorator for content adding methods.
Takes args and kwargs and calls the decorated method one time for each argument provided.
The reverse parameter should be used for prepending (relative to self) methods.
"""
- Read upRead up
- Create a ticketCreate a ticket
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 _iter_child_renders
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _iter_child_renders(self, pretty=False):
for child in self.childs:
if isinstance(child, str):
yield escape(child)
elif isinstance(child, Number):
- Read upRead up
- Create a ticketCreate a ticket
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 render_attrs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def render_attrs(self):
"""Renders the tag's attributes using the formats and performing special attributes name substitution."""
ret = []
for k, v in self.attrs.items():
if v:
- Read upRead up
- Create a ticketCreate a ticket
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 _render_node
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _render_node(node, parents, result, nodes_to_parse, pretty=False):
for key, value in node.items():
if isinstance(value, str):
result.append("%s: %s; %s" % (key, value, "\n" if pretty else ""))
elif hasattr(value, "__call__"):
- Read upRead up
- Create a ticketCreate a ticket
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 __process_dl_struct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __process_dl_struct(self, struct):
for k, submenu in struct.items():
item = tags.Dt()(k)
self(item)
if submenu:
- Read upRead up
- Create a ticketCreate a ticket
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 render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def render(self, *args, **kwargs):
"""Renders the element and all his childrens."""
# args kwargs API provided for last minute content injection
# self._reverse_mro_func('pre_render')
pretty = kwargs.pop("pretty", False)
- Read upRead up
- Create a ticketCreate a ticket
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 find_attr
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find_attr(self, selector_list, ignore_error=True):
try:
if not isinstance(selector_list, list) or len(selector_list) < 1:
raise WrongArgsError(
self, selector_list, "The provided argument should be a non-empty list."
- Read upRead up
- Create a ticketCreate a ticket
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 attr
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def attr(self, *args, **kwargs):
"""Add an attribute to the element"""
for key, value in kwargs.items():
if key == "klass":
self.attrs["klass"].update(value.split())
- Read upRead up
- Create a ticketCreate a ticket
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 replace_element
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def replace_element(self, selector_list, new_style, ignore_error=True):
if new_style is None or not isinstance(new_style, (str, dict)) or not new_style:
if ignore_error:
return
else:
- Read upRead up
- Create a ticketCreate a ticket
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"