rasa/core/policies/ted_policy.py
File ted_policy.py
has 1581 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
from __future__ import annotations
import logging
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
from pathlib import Path
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function _load_policy_with_model
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _load_policy_with_model(
Function load
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def load(
Function _load
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _load(
Function predict_action_probabilities
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def predict_action_probabilities(
Function _load_tf_model
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _load_tf_model(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function _reshape_for_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _reshape_for_entities(
Function _batch_predict_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _batch_predict_entities(
Function _real_batch_predict_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _real_batch_predict_entities(
Function _create_optional_event_for_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _create_optional_event_for_entities(
Function _real_batch_loss_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _real_batch_loss_entities(
Function train
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def train(
Function _prepare_for_training
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _prepare_for_training(
Function _featurize_tracker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _featurize_tracker(
Function _batch_loss_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _batch_loss_entities(
Function _create_model_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _create_model_data(
Function _should_extract_entities
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def _should_extract_entities(
entity_tags: List[List[Dict[Text, List[Features]]]]
) -> bool:
for turns_tags in entity_tags:
for turn_tags in turns_tags:
- 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"