98ae38f57c7a7a369604b4bb78d9879c4a990a24,mir_eval/chord.py,,validate_chord_label,#Any#,320
Before Change
// Test for single special characters
for one_char in [":", "/", "(", ")"]:
if chord_label.count(one_char) > 1:
raise InvalidChordException(
"Chord label may only contain one "%s". "
"Received: "%s"" % (one_char, chord_label))
// Test for closed parens
parens = [paren in chord_label for paren in ["(", ")"]]
if any(parens) and not all(parens):
raise InvalidChordException(
"Chord label must have closed parentheses. "
"Received: "%s"" % chord_label)
def split(chord_label, reduce_extended_chords=False):
Parse a chord label into its four constituent parts:
After Change
// which is in turn derived from the context-free grammar of
// Harte et al., 2005.
pattern = re.compile(r"""^((N|X)|(([A-G](b*|//*))((:(maj|min|dim|aug|1|5|sus2|sus4|maj6|min6|7|maj7|min7|dim7|hdim7|minmaj7|aug7|9|maj9|min9|11|maj11|min11|13|maj13|min13)(\((\*?((b*|//*)([1-9]|1[0-3]?))(,\*?((b*|//*)([1-9]|1[0-3]?)))*)\))?)|(:\((\*?((b*|//*)([1-9]|1[0-3]?))(,\*?((b*|//*)([1-9]|1[0-3]?)))*)\)))?((/((b*|//*)([1-9]|1[0-3]?)))?)?))$""") // nopep8
if not pattern.match(chord_label):
raise InvalidChordException("Invalid chord label: "
"{}".format(chord_label))
pass
def split(chord_label, reduce_extended_chords=False):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: craffel/mir_eval
Commit Name: 98ae38f57c7a7a369604b4bb78d9879c4a990a24
Time: 2017-03-17
Author: bmcfee@users.noreply.github.com
File Name: mir_eval/chord.py
Class Name:
Method Name: validate_chord_label
Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 32dd1ac4e1d44382f481d0e4e22a81cbb5a66510
Time: 2015-08-13
Author: nlavine@google.com
File Name: perfkitbenchmarker/benchmarks/fio_benchmark.py
Class Name:
Method Name: GetIODepths
Project Name: bokeh/bokeh
Commit Name: 8451d9c3690f1d47adcb929771b4ce37ea2c3e0d
Time: 2017-09-01
Author: mattpap@gmail.com
File Name: bokeh/util/compiler.py
Class Name:
Method Name: _detect_nodejs