Showing 216 of 245 total issues
File embedding_policy.py
has 1090 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import namedtuple
import copy
import json
import logging
import os
File interactive.py
has 1050 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import logging
import os
import tempfile
import textwrap
File __init__.py
has 747 lines of code (exceeds 250 allowed). Consider refactoring. Open
import time
import typing
import json
import jsonpickle
File tf_utils.py
has 679 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import namedtuple
import tensorflow as tf
class TimedNTM(object):
Function as_story_string
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def as_story_string(self, flat=False, e2e=False):
# if the result should be flattened, we
# will exclude the caption and any checkpoints.
for s in self.start_checkpoints:
- 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
File server.py
has 605 lines of code (exceeds 250 allowed). Consider refactoring. Open
import glob
import logging
import os
import tempfile
import zipfile
File agent.py
has 574 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import logging
import os
import shutil
import tempfile
File test_policies.py
has 549 lines of code (exceeds 250 allowed). Consider refactoring. Open
from unittest.mock import patch
import numpy as np
import pytest
File test.py
has 543 lines of code (exceeds 250 allowed). Consider refactoring. Open
import argparse
import asyncio
import json
import logging
import os
Function generate
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def generate(self, silent: bool = False) -> List[TrackerWithCachedStates]:
if (self.config.remove_duplicates and
self.config.unique_last_num_states):
logger.debug("Generated trackers will be deduplicated "
"based on their unique last {} states."
- 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
File structures.py
has 524 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import deque, defaultdict
import io
import sys
import json
File test_channels.py
has 511 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
import mock
import pytest
import sanic
File domain.py
has 502 lines of code (exceeds 250 allowed). Consider refactoring. Open
import collections
import json
import logging
import os
import typing
Function create_app
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def create_app(agent=None,
cors_origins: Union[Text, List[Text]] = "*",
auth_token: Optional[Text] = None,
jwt_secret: Optional[Text] = None,
jwt_method: Text = "HS256",
- 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
File featurizers.py
has 469 lines of code (exceeds 250 allowed). Consider refactoring. Open
import io
import jsonpickle
import logging
import numpy as np
import os
File generator.py
has 459 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from collections import defaultdict, namedtuple, deque
import copy
import logging
Function with_cycles_removed
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def with_cycles_removed(self) -> 'StoryGraph':
"""Create a graph with the cyclic edges removed from this graph."""
story_end_checkpoints = self.story_end_checkpoints.copy()
cyclic_edge_ids = self.cyclic_edge_ids
- 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
EmbeddingPolicy
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
class EmbeddingPolicy(Policy):
"""Recurrent Embedding Dialogue Policy (REDP)
The policy that is used in our paper https://arxiv.org/abs/1811.11707
"""
File visualization.py
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import defaultdict, deque
import random
import re
from typing import Any, Text, List, Dict, Optional, TYPE_CHECKING
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"""