Showing 61 of 61 total issues
Function _createBatch
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _createBatch(self, samples):
"""Create a single batch from the list of sample. The batch size is automatically defined by the number of
samples given.
The inputs should already be inverted. The target should already have <go> and <eos>
Warning: This function should not make direct calls to args.batchSize !!!
- 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 loadCorpus
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def loadCorpus(self):
"""Load/create the conversations data
"""
datasetExist = os.path.isfile(self.filteredSamplesPath)
if not datasetExist: # First time we load the database: creating all files
- 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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, dirName):
"""
Args:
dirName (string): directory where to load the corpus
"""
- 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 execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def execute(self, cmd="", msg="", speak=False, duration=0):
"""Method to execute the given bash command and display a desktop environment independent notification.
Keyword Args:
cmd (str): Bash command.
- 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 buildNetwork
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def buildNetwork(self):
""" Create the computational graph
"""
# TODO: Create name_scopes (for better graph visualisation)
- 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 async_performer
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def async_performer(self, thread_number, samples, results, s_print):
s_print('\nThead {0} is started.\n'.format(thread_number + 1))
from termcolor import colored
correct_counter = 0
- 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 extract
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def extract(self, sentence):
"""Extract the main topics from the sentence.
Returns:
(list) of (str)s: List of strings.
- 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 predictTestset
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def predictTestset(self, sess):
""" Try predicting the sentences from the samples.txt file.
The sentences are saved on the modelDir under the same name
Args:
sess: The current running session
- 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
Consider simplifying this complex logical expression. Open
if not (token.lemma_ == "search" or token.lemma_ == "find" or token.lemma_ == "Google" or token.lemma_ == "web" or token.lemma_ == "internet" or token.lemma_ == "image" or token.is_stop):
search_query += ' ' + token.text
search_query = search_query.strip()
Function greet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def greet(userin):
"""The top-level method to greet the user with message like "*Good morning, sir.*".
Args:
userin: :class:`dragonfire.utilities.TextToAction` instance.
- 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 loadConversations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def loadConversations(self, dirName):
"""
Args:
dirName (str): folder to load
Return:
- 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
Avoid deeply nested control flow statements. Open
if not (token.lemma_ == "search" or token.lemma_ == "find" or token.lemma_ == "Google" or token.lemma_ == "web" or token.lemma_ == "internet" or token.is_stop):
search_query += ' ' + token.text
search_query = search_query.strip()
Function get_config
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_config(self, key):
config = {}
config['model'] = "/usr/share/dragonfire/deepspeech/models/output_graph.pb"
config['alphabet'] = "/usr/share/dragonfire/deepspeech/models/alphabet.txt"
config['lm'] = "/usr/share/dragonfire/deepspeech/models/lm.binary"
- 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
Avoid deeply nested control flow statements. Open
if not args["server"] and not self.testing:
time.sleep(5)
k.tap_key(k.tab_key)
k.tap_key(k.tab_key)
k.tap_key(k.tab_key)
Avoid deeply nested control flow statements. Open
if reduction < 1:
reduction = None
text = text[:reduction] + " " + cmd[1]
Avoid deeply nested control flow statements. Open
if not first_clause: # if the first verbtense assignment does not made yet
answer += ' ' + clause # concatenate with a whitespace
first_clause = True
else:
answer += ' and ' + clause # otherwise concatenate with ' AND '
Avoid deeply nested control flow statements. Open
for character in com[n:]:
k.tap_key(character)
k.tap_key(" ")
Avoid deeply nested control flow statements. Open
if img_url:
response = urllib.request.urlopen(img_url)
img_data = response.read()
img_extension = mimetypes.guess_extension(response.headers['content-type'])
filename = "/tmp/tmp" + uuid.uuid4().hex + img_extension
Avoid deeply nested control flow statements. Open
if not (token.lemma_ == "search" or token.lemma_ == "find" or token.lemma_ == "Google" or token.lemma_ == "web" or token.lemma_ == "internet" or token.lemma_ == "image" or token.is_stop):
search_query += ' ' + token.text
search_query = search_query.strip()
Avoid deeply nested control flow statements. Open
if not self.testing:
m.scroll(0, 5)
return "swipe right"