File datastructures.py
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
from collections.abc import Mapping
class OrderedSet:
MultiValueDict
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class MultiValueDict(dict):
"""
A subclass of dictionary customized to handle multiple values for the
same key.
Function update
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update(self, *args, **kwargs):
"""Extend rather than replace existing key lists."""
if len(args) > 1:
raise TypeError("update expected at most 1 argument, got %d" % len(args))
if args:
- 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 _getlist
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _getlist(self, key, default=None, force_list=False):
"""
Return a list of values for the key.
Used internally to manipulate values list. If force_list is True,
- 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 _unpack_items
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _unpack_items(data):
# Explicitly test for dict first as the common case for performance,
# avoiding abc's __instancecheck__ and _abc_instancecheck for the
# general Mapping case.
if isinstance(data, (dict, Mapping)):
- 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"