File generator.py
has 664 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import defaultdict, namedtuple, deque
import copy
import logging
import random
Function _generate
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
def _generate(
self, story_steps: List[StoryStep], is_rule_data: bool = False
) -> List[TrackerWithCachedStates]:
if not story_steps:
logger.debug(f"No {'rules' if is_rule_data else 'story blocks'} found.")
- 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 _process_step
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def _process_step(
self, step: StoryStep, incoming_trackers: List[TrackerWithCachedStates]
) -> TrackersTuple:
"""Processes a steps events with all trackers.
- 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 _issue_unused_checkpoint_notification
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _issue_unused_checkpoint_notification(
self, unused_checkpoints: Set[Text]
) -> None:
"""Warns about unused story blocks.
- 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 _mark_first_action_in_story_steps_as_unpredictable
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _mark_first_action_in_story_steps_as_unpredictable(self) -> None:
"""Mark actions which shouldn't be used during ML training.
If a story starts with an action, we can not use
that first action as a training example, as there is no
- 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 _remove_duplicate_trackers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _remove_duplicate_trackers(
self, trackers: List[TrackerWithCachedStates]
) -> TrackersTuple:
"""Removes trackers that create equal featurizations
for current story step.
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update(
self,
event: Event,
domain: Optional[Domain] = None,
) -> 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 from_events
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_events(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(