piotrmaslanka/satella

View on GitHub
satella/coding/decorators/arguments.py

Summary

Maintainability
A
0 mins
Test Coverage
A
94%

Cyclomatic complexity is too high in function for_argument. (8)
Open

def for_argument(*t_ops: ForArgumentArg, **t_kwops: ForArgumentArg):
    """
    Calls a callable for each of the arguments. Pass None if you do not wish to process given
    argument.

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Either all return statements in a function should return an expression, or none of them should.
Open

        def inner(self, *args, **kwargs):

According to PEP8, if any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None, and an explicit return statement should be present at the end of the function (if reachable)

Unnecessary else after return
Open

            if altered:

Used in order to highlight an unnecessary block of code following an if containing a return statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a return statement.

Either all return statements in a function should return an expression, or none of them should.
Open

        def inner(self, *args, **kwargs):

According to PEP8, if any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None, and an explicit return statement should be present at the end of the function (if reachable)

Unnecessary else after return
Open

        if len(args) == 1 and not kwargs and callable(args[0]):

Used in order to highlight an unnecessary block of code following an if containing a return statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a return statement.

Unnecessary else after return
Open

            if attr_v == assume_not_loaded:

Used in order to highlight an unnecessary block of code following an if containing a return statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a return statement.

Use of eval
Open

            return eval(expr, globals(), local)

Used when you use the eval function, to discourage its usage. Consider using ast.literal_eval for safely evaluating strings containing Python expressions from untrusted sources.

Use of eval
Open

                new_args[arg] = eval(arg_value, globals(), old_args)

Used when you use the eval function, to discourage its usage. Consider using ast.literal_eval for safely evaluating strings containing Python expressions from untrusted sources.

Line too long (87 > 79 characters)
Open

    If argument arg_name is found to be an instance of instance_of, it will be replaced
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (94 > 79 characters)
Open

    This way you can pass dictionaries to the function that would normally have modified them.
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (99 > 79 characters)
Open

                        instance_of: tp.Optional[tp.Union[tp.Type, tp.Tuple[tp.Type, ...]]] = None,
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (81 > 79 characters)
Open

    A decorator transforming the arguments of a function prior to it's execution.
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (91 > 79 characters)
Open

    The result is feeded as the local variable "x", while arguments are fed as if they were
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (102 > 79 characters)
Open

from satella.coding.misc import source_to_function, get_arguments, call_with_arguments, _get_arguments
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (80 > 79 characters)
Open

        predicate is called on the value of the argument and replacement is done
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (93 > 79 characters)
Open

    Calls a callable for each of the arguments. Pass None if you do not wish to process given
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (80 > 79 characters)
Open

    If it detects that the function that you passed does not use default values,
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (83 > 79 characters)
Open

    A decorator transforming the result value of a function by a Python expression.
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (83 > 79 characters)
Open

    :param structure: a callable that takes original argument and returns new, or a
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (82 > 79 characters)
Open

                        **{k: t_kwops.get(k, _NOP)(v) for k, v in kwargs.items()})
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Line too long (87 > 79 characters)
Open

    Arguments given in attach_arguments will take precedence in case of key collisions.
Severity: Minor
Found in satella/coding/decorators/arguments.py by pep8

Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side.  The default wrapping on such
devices looks ugly.  Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.

Reports error E501.

Variable name a doesn't conform to snake_case naming style
Open

                a = fun(*((_NOP if op2 is None else op2)(arg) for arg, op2 in

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Line too long (102/100)
Open

from satella.coding.misc import source_to_function, get_arguments, call_with_arguments, _get_arguments

Used when a line is longer than a given number of characters.

Function name _NOP doesn't conform to snake_case naming style
Open

def _NOP(x):

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Variable name v doesn't conform to snake_case naming style
Open

                v = args_dict[arg_name]

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Variable name f doesn't conform to snake_case naming style
Open

                        f = dict_operations[arg_name]

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Argument name x doesn't conform to snake_case naming style
Open

def _NOP(x):

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Variable name v doesn't conform to snake_case naming style
Open

                    v = dict_values[arg_name]

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Variable name a doesn't conform to snake_case naming style
Open

            a = fun(*args, **kwargs)

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Variable name op doesn't conform to snake_case naming style
Open

    for op in t_ops:

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Class name U doesn't conform to PascalCase naming style
Open

U = tp.TypeVar('U')

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Variable name v doesn't conform to snake_case naming style
Open

                            v = f(v)

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

There are no issues that match your filters.

Category
Status