Showing 10 of 12 total issues
Function record_speech
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def record_speech(self, record_conf):
squeak_min_count = 4
last_audio_data = bytes() #上一个数据包
block_inverse_count = 0 #当前录音块离结束的距离
for bin_audio_data in self.record_realtime(record_conf.speech_filter):
- 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 post_recognition
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def post_recognition(self,sonic):
if not sonic.wave_bin_data or sonic.channels is not 1:
raise Exception("wave_channels only support 1!")
if isinstance(sonic.wave_bin_data, list):
audio_data = bytearray()
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, channels=1, sample_width=2, sample_frequency=16000, sample_length=0, wave_bin_data=None):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, gate_value=700, series_min_count=30, block_min_count=8, record_max_second=10, speech_filter=None):
Function cheby1_bandpass
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def cheby1_bandpass(low_cut, high_cut, sample_frequency, order=6, rp=0.1):
Function realtime_plot
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def realtime_plot(lines_conf, data_generator=None):
fig = plt.figure()
lines = []
if not isinstance(lines_conf, list):
lines_conf = [lines_conf]
- 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 save_wave_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_wave_file(self, filename, wave_buffer=None):
if not wave_buffer:
wave_buffer = self.wave_buffer
wf = wave.open(filename, 'wb')
wf.setnchannels(self.channels)
- 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 wav_file_play
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def wav_file_play(filename):
audio_player = None
chunk = 1024
for sound in wav_file_block_read(filename, chunk):
if not audio_player:
- 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 recognize_callback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recognize_callback(self, sonic, callback=None, traceback=None):
err_no, result = self.post_recognition(sonic)
if err_no:
if traceback:
traceback(result)
- 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 wave_plotting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def wave_plotting(sonic, block=False):
if isinstance(sonic.wave_bin_data, list):
bin_buffer = bytearray()
for data in sonic.wave_bin_data:
bin_buffer.extend(data)
- 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"