Showing 127 of 287 total issues
Function _parse_usul_dict
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _parse_usul_dict():
mu2_usul_dict = {}
inv_mu2_usul_dict = {}
usul_dict = IO.load_music_data('usul')
for _, val in usul_dict.items():
- 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 correct_oct_error
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def correct_oct_error(self, pitch):
pitch_series = [pitch[i][1] for i in range(len(pitch))]
midf0 = (np.median(pitch_series) + np.mean(pitch_series)) / 2
for i in range(4, len(pitch) - 2):
- 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 convertsymbtr2xml
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convertsymbtr2xml(self, verbose=None):
if verbose is not None:
self.verbose = verbose
outkoddict = dict((e, 0) for e in kodlist)
Function filter_noise_region
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def filter_noise_region(self, pitch):
for i in range(3):
for j in range(1, len(pitch) - 2):
if not self.are_close(pitch[i - 1][1], pitch[i][1]) and \
self.are_close(pitch[i][1], pitch[i + 1][1]):
- 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 _decompose_into_chunks
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _decompose_into_chunks(pitch, bottom_limit=0.7, upper_limit=1.3):
pitch_chunks = []
temp_pitch = np.array([])
# starts at the first sample
for i in range(1, len(pitch) - 1):
- 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 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, info, verbose=None):
# base attributes
self.sira = None
self.kod = None
self.nota53 = None
Function remove_extreme_values
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def remove_extreme_values(pitch):
pitch_series = [element[1] for element in pitch]
pitch_max = max(pitch_series)
pitch_mean = np.mean(pitch_series)
pitch_std = np.std(pitch_series)
- 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_note_type
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_note_type(n_type, pay, payda):
global tuplet
# NEW PART FOR DOTTED NOTES
temp_pay_payda = float(pay) / int(payda)
- 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 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, txtpath, mu2path, symbtrname='', mbid_url='',
verbose=None):
self.txtpath = txtpath # filepath for the txt score
self.mu2path = mu2path # filepath for the mu2 score; used for
# obtaining the symbtr from its header
Function _validate_musicbrainz_attribute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _validate_musicbrainz_attribute(attrib_dict, score_attrib, score_name):
is_attribute_valid = True
if 'mb_attribute' in score_attrib.keys(): # work
skip_makam_slug = ['12212212', '22222221', '223', '232223', '262',
'3223323', '3334', '14_4']
- 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 correct_offset_gracenote
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def correct_offset_gracenote(cls, txt_file, mu2_file):
# extract symbtr data
data = cls.get_symbtr_data(txt_file, mu2_file)
# get zaman and mertebe from usul variant
- 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_attributes_from_works
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_attributes_from_works(audio_meta):
attribute_keys = ['makam', 'form', 'usul']
for w in audio_meta['works']:
work_meta = WorkMetadata.from_musicbrainz(w['mbid'])
for ak in attribute_keys:
- 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 plot_audio_features
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def plot_audio_features(cls,
Function generate_distance_matrix
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def generate_distance_matrix(cls, distrib, peak_idx, training_distribs,
distance_method='bhat'):
"""--------------------------------------------------------------------
Iteratively calculates the distance of the input distribution from each
(mode candidate, tonic candidate) pair. This is a generic function,
- 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 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, hop_size=128, frame_size=2048, bin_resolution=1.0,
Function addwordinfo
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def addwordinfo(xmllyric, templyric, word, e):
# lyrics word information
if (len(templyric) > 0 and templyric != "." and
templyric not in SECTION_LIST):
syllabic = etree.SubElement(xmllyric, 'syllabic')
- 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 _write_lilypond
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def _write_lilypond(cls, measures, makam, usul, form, time_sigs,
Function check_instrumentation_voice
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check_instrumentation_voice(cls, instrument_vocal_list):
# remove attributes, which are not about performance
for ii, iv in reversed(list(enumerate(instrument_vocal_list))):
if iv not in ['vocal', 'instrument', 'performing orchestra',
'performer', 'choir_vocals']:
- 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_tonic_tempo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_tonic_tempo(self, score_filename='', score_data=None,
audio_filename='', audio_pitch=None):
tic = timeit.default_timer()
self.vprint("- Extracting score-informed tonic and tempo of {0:s}"
.format(audio_filename))
Function convert
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def convert(cls, symtr_txt_filename, symbtr_mu2_filename, symbtr_name=None,