Function say
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def say(self, msg, dynamic=False, end=False, cmd=None):
"""Method to give text-to-speech output(using **The Festival Speech Synthesis System**), print the response into console and **send a tweet**.
Args:
msg (str): Message to be read by Dragonfire or turned into a tweet.
- 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
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 reduction < 1:
reduction = None
text = text[:reduction] + " " + cmd[1]
Function pretty_print_nlp_parsing_results
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pretty_print_nlp_parsing_results(self, doc):
"""Method to print the nlp parsing results in a pretty way.
Args:
doc: A :class:`Doc` instance from :mod:`spacy` library.
- 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"