File domain.py
has 502 lines of code (exceeds 250 allowed). Consider refactoring. Open
import collections
import json
import logging
import os
import typing
Domain
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
class Domain(object):
"""The domain specifies the universe in which the bot's policy acts.
A Domain subclass provides the actions the bot can take, the intents
and entities it can recognise"""
Function check_domain_sanity
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def check_domain_sanity(domain):
"""Make sure the domain is properly configured.
Checks the settings and checks if there are duplicate actions,
intents, slots and entities."""
- 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 get_parsing_states
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def get_parsing_states(self,
tracker: 'DialogueStateTracker'
) -> Dict[Text, float]:
state_dict = {}
- 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 slots_for_entities
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def slots_for_entities(self, entities):
if self.store_entities_as_slots:
slot_events = []
for s in self.slots:
if s.auto_fill:
- 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 persist_clean
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def persist_clean(self, filename: Text) -> None:
"""Write domain to a file.
Strips redundant keys with default values."""
- 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 collect_intent_properties
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def collect_intent_properties(intent_list):
intent_properties = {}
for intent in intent_list:
if isinstance(intent, dict):
for properties in intent.values():
- 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 merge
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def merge(self, domain: 'Domain', override: bool = False) -> 'Domain':
"""Merge this domain with another one, combining their attributes.
List attributes like ``intents`` and ``actions`` will be deduped
and merged. Single attributes will be taken from ``self`` unless
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Avoid deeply nested control flow statements. Open
if s.type_name == 'list':
slot_events.append(SlotSet(s.name,
matching_entities))
else:
slot_events.append(SlotSet(s.name,
Function collect_templates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def collect_templates(
yml_templates: Dict[Text, List[Any]]
) -> Dict[Text, List[Dict[Text, Any]]]:
"""Go through the templates and make sure they are all in dict format
"""
- 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"