rasa/core/trackers.py
DialogueStateTracker
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class DialogueStateTracker(object):
"""Maintains the state of a conversation.
The field max_event_history will only give you these last events,
it can be set in the tracker_store"""
File trackers.py
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import typing
from collections import deque
import copy
import io
Function generate_all_prior_trackers
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
Open
def generate_all_prior_trackers(self):
# type: () -> Generator[DialogueStateTracker, None, None]
"""Returns a generator of the previous trackers of this tracker.
The resulting array is representing
- 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 applied_events
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def applied_events(self) -> List[Event]:
"""Returns all actions that should be applied - w/o reverted events."""
def undo_till_previous(event_type, done_events):
"""Removes events from `done_events` until `event_type` is
- 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"