rasa/core/policies/ted_policy.py

Summary

Maintainability
F
5 days
Test Coverage
B
83%

File ted_policy.py has 1581 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations
import logging

from rasa.engine.recipes.default_recipe import DefaultV1Recipe
from pathlib import Path
Severity: Major
Found in rasa/core/policies/ted_policy.py - About 4 days to fix

    Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in rasa/core/policies/ted_policy.py - About 1 hr to fix

      Function _load_policy_with_model has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _load_policy_with_model(
      Severity: Major
      Found in rasa/core/policies/ted_policy.py - About 1 hr to fix

        Function load has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def load(
        Severity: Minor
        Found in rasa/core/policies/ted_policy.py - About 45 mins to fix

          Function _load has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _load(
          Severity: Minor
          Found in rasa/core/policies/ted_policy.py - About 45 mins to fix

            Function predict_action_probabilities has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def predict_action_probabilities(
            Severity: Minor
            Found in rasa/core/policies/ted_policy.py - About 45 mins to fix

              Function _load_tf_model has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def _load_tf_model(
              Severity: Minor
              Found in rasa/core/policies/ted_policy.py - About 45 mins to fix

                Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(
                Severity: Minor
                Found in rasa/core/policies/ted_policy.py - About 45 mins to fix

                  Function _reshape_for_entities has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def _reshape_for_entities(
                  Severity: Minor
                  Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                    Function _batch_predict_entities has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def _batch_predict_entities(
                    Severity: Minor
                    Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                      Function _real_batch_predict_entities has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def _real_batch_predict_entities(
                      Severity: Minor
                      Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                        Function _create_optional_event_for_entities has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def _create_optional_event_for_entities(
                        Severity: Minor
                        Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                          Function _real_batch_loss_entities has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def _real_batch_loss_entities(
                          Severity: Minor
                          Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                            Function train has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def train(
                            Severity: Minor
                            Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                              Function _prepare_for_training has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def _prepare_for_training(
                              Severity: Minor
                              Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                                Function _featurize_tracker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def _featurize_tracker(
                                Severity: Minor
                                Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                                  Function _batch_loss_entities has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def _batch_loss_entities(
                                  Severity: Minor
                                  Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                                    Function _create_model_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        def _create_model_data(
                                    Severity: Minor
                                    Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                                      Function _should_extract_entities has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      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:
                                      Severity: Minor
                                      Found in rasa/core/policies/ted_policy.py - About 35 mins to fix

                                      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

                                      There are no issues that match your filters.

                                      Category
                                      Status