id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
3,400
bspaans/python-mingus
mingus/midi/midi_file_out.py
MidiFile.header
def header(self): """Return a header for type 1 MIDI file.""" tracks = a2b_hex('%04x' % len([t for t in self.tracks if t.track_data != ''])) return 'MThd\x00\x00\x00\x06\x00\x01' + tracks + self.time_division
python
def header(self): """Return a header for type 1 MIDI file.""" tracks = a2b_hex('%04x' % len([t for t in self.tracks if t.track_data != ''])) return 'MThd\x00\x00\x00\x06\x00\x01' + tracks + self.time_division
[ "def", "header", "(", "self", ")", ":", "tracks", "=", "a2b_hex", "(", "'%04x'", "%", "len", "(", "[", "t", "for", "t", "in", "self", ".", "tracks", "if", "t", ".", "track_data", "!=", "''", "]", ")", ")", "return", "'MThd\\x00\\x00\\x00\\x06\\x00\\x01...
Return a header for type 1 MIDI file.
[ "Return", "a", "header", "for", "type", "1", "MIDI", "file", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_file_out.py#L42-L46
3,401
bspaans/python-mingus
mingus/midi/midi_file_out.py
MidiFile.write_file
def write_file(self, file, verbose=False): """Collect the data from get_midi_data and write to file.""" dat = self.get_midi_data() try: f = open(file, 'wb') except: print "Couldn't open '%s' for writing." % file return False try: f....
python
def write_file(self, file, verbose=False): """Collect the data from get_midi_data and write to file.""" dat = self.get_midi_data() try: f = open(file, 'wb') except: print "Couldn't open '%s' for writing." % file return False try: f....
[ "def", "write_file", "(", "self", ",", "file", ",", "verbose", "=", "False", ")", ":", "dat", "=", "self", ".", "get_midi_data", "(", ")", "try", ":", "f", "=", "open", "(", "file", ",", "'wb'", ")", "except", ":", "print", "\"Couldn't open '%s' for wr...
Collect the data from get_midi_data and write to file.
[ "Collect", "the", "data", "from", "get_midi_data", "and", "write", "to", "file", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_file_out.py#L52-L68
3,402
bspaans/python-mingus
mingus/extra/tunings.py
fingers_needed
def fingers_needed(fingering): """Return the number of fingers needed to play the given fingering.""" split = False # True if an open string must be played, thereby making any # subsequent strings impossible to bar with the index finger indexfinger = False # True if the index finger was al...
python
def fingers_needed(fingering): """Return the number of fingers needed to play the given fingering.""" split = False # True if an open string must be played, thereby making any # subsequent strings impossible to bar with the index finger indexfinger = False # True if the index finger was al...
[ "def", "fingers_needed", "(", "fingering", ")", ":", "split", "=", "False", "# True if an open string must be played, thereby making any", "# subsequent strings impossible to bar with the index finger", "indexfinger", "=", "False", "# True if the index finger was already accounted for", ...
Return the number of fingers needed to play the given fingering.
[ "Return", "the", "number", "of", "fingers", "needed", "to", "play", "the", "given", "fingering", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L337-L361
3,403
bspaans/python-mingus
mingus/extra/tunings.py
add_tuning
def add_tuning(instrument, description, tuning): """Add a new tuning to the index. The instrument and description parameters should be strings; tuning should be a list of strings or a list of lists to denote courses. Example: >>> std_strings = ['E-2', 'A-2', 'D-3', 'G-3', 'B-3', 'E-4'] >>> tun...
python
def add_tuning(instrument, description, tuning): """Add a new tuning to the index. The instrument and description parameters should be strings; tuning should be a list of strings or a list of lists to denote courses. Example: >>> std_strings = ['E-2', 'A-2', 'D-3', 'G-3', 'B-3', 'E-4'] >>> tun...
[ "def", "add_tuning", "(", "instrument", ",", "description", ",", "tuning", ")", ":", "t", "=", "StringTuning", "(", "instrument", ",", "description", ",", "tuning", ")", "if", "_known", ".", "has_key", "(", "str", ".", "upper", "(", "instrument", ")", ")...
Add a new tuning to the index. The instrument and description parameters should be strings; tuning should be a list of strings or a list of lists to denote courses. Example: >>> std_strings = ['E-2', 'A-2', 'D-3', 'G-3', 'B-3', 'E-4'] >>> tuning.add_tuning('Guitar', 'standard', std_strings) >>...
[ "Add", "a", "new", "tuning", "to", "the", "index", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L366-L383
3,404
bspaans/python-mingus
mingus/extra/tunings.py
get_tuning
def get_tuning(instrument, description, nr_of_strings=None, nr_of_courses=None): """Get the first tuning that satisfies the constraints. The instrument and description arguments are treated like case-insensitive prefixes. So search for 'bass' is the same is 'Bass Guitar'. Example: >>> tunings....
python
def get_tuning(instrument, description, nr_of_strings=None, nr_of_courses=None): """Get the first tuning that satisfies the constraints. The instrument and description arguments are treated like case-insensitive prefixes. So search for 'bass' is the same is 'Bass Guitar'. Example: >>> tunings....
[ "def", "get_tuning", "(", "instrument", ",", "description", ",", "nr_of_strings", "=", "None", ",", "nr_of_courses", "=", "None", ")", ":", "searchi", "=", "str", ".", "upper", "(", "instrument", ")", "searchd", "=", "str", ".", "upper", "(", "description"...
Get the first tuning that satisfies the constraints. The instrument and description arguments are treated like case-insensitive prefixes. So search for 'bass' is the same is 'Bass Guitar'. Example: >>> tunings.get_tuning('guitar', 'standard') <tunings.StringTuning instance at 0x139ac20>
[ "Get", "the", "first", "tuning", "that", "satisfies", "the", "constraints", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L385-L415
3,405
bspaans/python-mingus
mingus/extra/tunings.py
get_tunings
def get_tunings(instrument=None, nr_of_strings=None, nr_of_courses=None): """Search tunings on instrument, strings, courses or a combination. The instrument is actually treated like a case-insensitive prefix. So asking for 'bass' yields the same tunings as 'Bass Guitar'; the string 'ba' yields all the ...
python
def get_tunings(instrument=None, nr_of_strings=None, nr_of_courses=None): """Search tunings on instrument, strings, courses or a combination. The instrument is actually treated like a case-insensitive prefix. So asking for 'bass' yields the same tunings as 'Bass Guitar'; the string 'ba' yields all the ...
[ "def", "get_tunings", "(", "instrument", "=", "None", ",", "nr_of_strings", "=", "None", ",", "nr_of_courses", "=", "None", ")", ":", "search", "=", "''", "if", "instrument", "is", "not", "None", ":", "search", "=", "str", ".", "upper", "(", "instrument"...
Search tunings on instrument, strings, courses or a combination. The instrument is actually treated like a case-insensitive prefix. So asking for 'bass' yields the same tunings as 'Bass Guitar'; the string 'ba' yields all the instruments starting with 'ba'. Example: >>> tunings.get_tunings(nr_of_s...
[ "Search", "tunings", "on", "instrument", "strings", "courses", "or", "a", "combination", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L417-L449
3,406
bspaans/python-mingus
mingus/extra/tunings.py
StringTuning.count_courses
def count_courses(self): """Return the average number of courses per string.""" c = 0 for x in self.tuning: if type(x) == list: c += len(x) else: c += 1 return float(c) / len(self.tuning)
python
def count_courses(self): """Return the average number of courses per string.""" c = 0 for x in self.tuning: if type(x) == list: c += len(x) else: c += 1 return float(c) / len(self.tuning)
[ "def", "count_courses", "(", "self", ")", ":", "c", "=", "0", "for", "x", "in", "self", ".", "tuning", ":", "if", "type", "(", "x", ")", "==", "list", ":", "c", "+=", "len", "(", "x", ")", "else", ":", "c", "+=", "1", "return", "float", "(", ...
Return the average number of courses per string.
[ "Return", "the", "average", "number", "of", "courses", "per", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L56-L64
3,407
bspaans/python-mingus
mingus/extra/tunings.py
StringTuning.find_frets
def find_frets(self, note, maxfret=24): """Return a list with for each string the fret on which the note is played or None if it can't be played on that particular string. The maxfret parameter is the highest fret that can be played; note should either be a string or a Note object. ...
python
def find_frets(self, note, maxfret=24): """Return a list with for each string the fret on which the note is played or None if it can't be played on that particular string. The maxfret parameter is the highest fret that can be played; note should either be a string or a Note object. ...
[ "def", "find_frets", "(", "self", ",", "note", ",", "maxfret", "=", "24", ")", ":", "result", "=", "[", "]", "if", "type", "(", "note", ")", "==", "str", ":", "note", "=", "Note", "(", "note", ")", "for", "x", "in", "self", ".", "tuning", ":", ...
Return a list with for each string the fret on which the note is played or None if it can't be played on that particular string. The maxfret parameter is the highest fret that can be played; note should either be a string or a Note object. Example: >>> t = tunings.StringTuning(...
[ "Return", "a", "list", "with", "for", "each", "string", "the", "fret", "on", "which", "the", "note", "is", "played", "or", "None", "if", "it", "can", "t", "be", "played", "on", "that", "particular", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L66-L93
3,408
bspaans/python-mingus
mingus/extra/tunings.py
StringTuning.frets_to_NoteContainer
def frets_to_NoteContainer(self, fingering): """Convert a list such as returned by find_fret to a NoteContainer.""" res = [] for (string, fret) in enumerate(fingering): if fret is not None: res.append(self.get_Note(string, fret)) return NoteContainer(res)
python
def frets_to_NoteContainer(self, fingering): """Convert a list such as returned by find_fret to a NoteContainer.""" res = [] for (string, fret) in enumerate(fingering): if fret is not None: res.append(self.get_Note(string, fret)) return NoteContainer(res)
[ "def", "frets_to_NoteContainer", "(", "self", ",", "fingering", ")", ":", "res", "=", "[", "]", "for", "(", "string", ",", "fret", ")", "in", "enumerate", "(", "fingering", ")", ":", "if", "fret", "is", "not", "None", ":", "res", ".", "append", "(", ...
Convert a list such as returned by find_fret to a NoteContainer.
[ "Convert", "a", "list", "such", "as", "returned", "by", "find_fret", "to", "a", "NoteContainer", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L274-L281
3,409
bspaans/python-mingus
mingus/extra/tunings.py
StringTuning.get_Note
def get_Note(self, string=0, fret=0, maxfret=24): """Return the Note on 'string', 'fret'. Throw a RangeError if either the fret or string is unplayable. Examples: >>> t = tunings.StringTuning('test', 'test', ['A-3', 'A-4']) >>> t,get_Note(0, 0) 'A-3' >>> t.get_N...
python
def get_Note(self, string=0, fret=0, maxfret=24): """Return the Note on 'string', 'fret'. Throw a RangeError if either the fret or string is unplayable. Examples: >>> t = tunings.StringTuning('test', 'test', ['A-3', 'A-4']) >>> t,get_Note(0, 0) 'A-3' >>> t.get_N...
[ "def", "get_Note", "(", "self", ",", "string", "=", "0", ",", "fret", "=", "0", ",", "maxfret", "=", "24", ")", ":", "if", "0", "<=", "string", "<", "self", ".", "count_strings", "(", ")", ":", "if", "0", "<=", "fret", "<=", "maxfret", ":", "s"...
Return the Note on 'string', 'fret'. Throw a RangeError if either the fret or string is unplayable. Examples: >>> t = tunings.StringTuning('test', 'test', ['A-3', 'A-4']) >>> t,get_Note(0, 0) 'A-3' >>> t.get_Note(0, 1) 'A#-3' >>> t.get_Note(1, 0) ...
[ "Return", "the", "Note", "on", "string", "fret", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L307-L334
3,410
bspaans/python-mingus
mingus_examples/pygame-drum/pygame-drum.py
load_img
def load_img(name): """Load image and return an image object""" fullname = name try: image = pygame.image.load(fullname) if image.get_alpha() is None: image = image.convert() else: image = image.convert_alpha() except pygame.error, message: print ...
python
def load_img(name): """Load image and return an image object""" fullname = name try: image = pygame.image.load(fullname) if image.get_alpha() is None: image = image.convert() else: image = image.convert_alpha() except pygame.error, message: print ...
[ "def", "load_img", "(", "name", ")", ":", "fullname", "=", "name", "try", ":", "image", "=", "pygame", ".", "image", ".", "load", "(", "fullname", ")", "if", "image", ".", "get_alpha", "(", ")", "is", "None", ":", "image", "=", "image", ".", "conve...
Load image and return an image object
[ "Load", "image", "and", "return", "an", "image", "object" ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus_examples/pygame-drum/pygame-drum.py#L55-L68
3,411
bspaans/python-mingus
mingus_examples/pygame-drum/pygame-drum.py
play_note
def play_note(note): """play_note determines which pad was 'hit' and send the play request to fluidsynth""" index = None if note == Note('B', 2): index = 0 elif note == Note('A', 2): index = 1 elif note == Note('G', 2): index = 2 elif note == Note('E', 2): in...
python
def play_note(note): """play_note determines which pad was 'hit' and send the play request to fluidsynth""" index = None if note == Note('B', 2): index = 0 elif note == Note('A', 2): index = 1 elif note == Note('G', 2): index = 2 elif note == Note('E', 2): in...
[ "def", "play_note", "(", "note", ")", ":", "index", "=", "None", "if", "note", "==", "Note", "(", "'B'", ",", "2", ")", ":", "index", "=", "0", "elif", "note", "==", "Note", "(", "'A'", ",", "2", ")", ":", "index", "=", "1", "elif", "note", "...
play_note determines which pad was 'hit' and send the play request to fluidsynth
[ "play_note", "determines", "which", "pad", "was", "hit", "and", "send", "the", "play", "request", "to", "fluidsynth" ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus_examples/pygame-drum/pygame-drum.py#L88-L115
3,412
bspaans/python-mingus
mingus_examples/pygame-piano/pygame-piano.py
play_note
def play_note(note): """play_note determines the coordinates of a note on the keyboard image and sends a request to play the note to the fluidsynth server""" global text octave_offset = (note.octave - LOWEST) * width if note.name in WHITE_KEYS: # Getting the x coordinate of a white key can...
python
def play_note(note): """play_note determines the coordinates of a note on the keyboard image and sends a request to play the note to the fluidsynth server""" global text octave_offset = (note.octave - LOWEST) * width if note.name in WHITE_KEYS: # Getting the x coordinate of a white key can...
[ "def", "play_note", "(", "note", ")", ":", "global", "text", "octave_offset", "=", "(", "note", ".", "octave", "-", "LOWEST", ")", "*", "width", "if", "note", ".", "name", "in", "WHITE_KEYS", ":", "# Getting the x coordinate of a white key can be done automaticall...
play_note determines the coordinates of a note on the keyboard image and sends a request to play the note to the fluidsynth server
[ "play_note", "determines", "the", "coordinates", "of", "a", "note", "on", "the", "keyboard", "image", "and", "sends", "a", "request", "to", "play", "the", "note", "to", "the", "fluidsynth", "server" ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus_examples/pygame-piano/pygame-piano.py#L116-L176
3,413
bspaans/python-mingus
mingus/containers/suite.py
Suite.add_composition
def add_composition(self, composition): """Add a composition to the suite. Raise an UnexpectedObjectError when the supplied argument is not a Composition object. """ if not hasattr(composition, 'tracks'): raise UnexpectedObjectError("Object '%s' not expected. Expecti...
python
def add_composition(self, composition): """Add a composition to the suite. Raise an UnexpectedObjectError when the supplied argument is not a Composition object. """ if not hasattr(composition, 'tracks'): raise UnexpectedObjectError("Object '%s' not expected. Expecti...
[ "def", "add_composition", "(", "self", ",", "composition", ")", ":", "if", "not", "hasattr", "(", "composition", ",", "'tracks'", ")", ":", "raise", "UnexpectedObjectError", "(", "\"Object '%s' not expected. Expecting \"", "\"a mingus.containers.Composition object.\"", "%...
Add a composition to the suite. Raise an UnexpectedObjectError when the supplied argument is not a Composition object.
[ "Add", "a", "composition", "to", "the", "suite", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/suite.py#L39-L49
3,414
bspaans/python-mingus
mingus/containers/suite.py
Suite.set_author
def set_author(self, author, email=''): """Set the author of the suite.""" self.author = author self.email = email
python
def set_author(self, author, email=''): """Set the author of the suite.""" self.author = author self.email = email
[ "def", "set_author", "(", "self", ",", "author", ",", "email", "=", "''", ")", ":", "self", ".", "author", "=", "author", "self", ".", "email", "=", "email" ]
Set the author of the suite.
[ "Set", "the", "author", "of", "the", "suite", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/suite.py#L51-L54
3,415
bspaans/python-mingus
mingus/containers/suite.py
Suite.set_title
def set_title(self, title, subtitle=''): """Set the title and the subtitle of the suite.""" self.title = title self.subtitle = subtitle
python
def set_title(self, title, subtitle=''): """Set the title and the subtitle of the suite.""" self.title = title self.subtitle = subtitle
[ "def", "set_title", "(", "self", ",", "title", ",", "subtitle", "=", "''", ")", ":", "self", ".", "title", "=", "title", "self", ".", "subtitle", "=", "subtitle" ]
Set the title and the subtitle of the suite.
[ "Set", "the", "title", "and", "the", "subtitle", "of", "the", "suite", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/suite.py#L56-L59
3,416
bspaans/python-mingus
mingus/containers/instrument.py
Instrument.set_range
def set_range(self, range): """Set the range of the instrument. A range is a tuple of two Notes or note strings. """ if type(range[0]) == str: range[0] = Note(range[0]) range[1] = Note(range[1]) if not hasattr(range[0], 'name'): raise Unexpect...
python
def set_range(self, range): """Set the range of the instrument. A range is a tuple of two Notes or note strings. """ if type(range[0]) == str: range[0] = Note(range[0]) range[1] = Note(range[1]) if not hasattr(range[0], 'name'): raise Unexpect...
[ "def", "set_range", "(", "self", ",", "range", ")", ":", "if", "type", "(", "range", "[", "0", "]", ")", "==", "str", ":", "range", "[", "0", "]", "=", "Note", "(", "range", "[", "0", "]", ")", "range", "[", "1", "]", "=", "Note", "(", "ran...
Set the range of the instrument. A range is a tuple of two Notes or note strings.
[ "Set", "the", "range", "of", "the", "instrument", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/instrument.py#L44-L55
3,417
bspaans/python-mingus
mingus/containers/instrument.py
Instrument.note_in_range
def note_in_range(self, note): """Test whether note is in the range of this Instrument. Return True if so, False otherwise. """ if type(note) == str: note = Note(note) if not hasattr(note, 'name'): raise UnexpectedObjectError("Unexpected object '%s'. " ...
python
def note_in_range(self, note): """Test whether note is in the range of this Instrument. Return True if so, False otherwise. """ if type(note) == str: note = Note(note) if not hasattr(note, 'name'): raise UnexpectedObjectError("Unexpected object '%s'. " ...
[ "def", "note_in_range", "(", "self", ",", "note", ")", ":", "if", "type", "(", "note", ")", "==", "str", ":", "note", "=", "Note", "(", "note", ")", "if", "not", "hasattr", "(", "note", ",", "'name'", ")", ":", "raise", "UnexpectedObjectError", "(", ...
Test whether note is in the range of this Instrument. Return True if so, False otherwise.
[ "Test", "whether", "note", "is", "in", "the", "range", "of", "this", "Instrument", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/instrument.py#L57-L69
3,418
bspaans/python-mingus
mingus/containers/instrument.py
Instrument.can_play_notes
def can_play_notes(self, notes): """Test if the notes lie within the range of the instrument. Return True if so, False otherwise. """ if hasattr(notes, 'notes'): notes = notes.notes if type(notes) != list: notes = [notes] for n in notes: ...
python
def can_play_notes(self, notes): """Test if the notes lie within the range of the instrument. Return True if so, False otherwise. """ if hasattr(notes, 'notes'): notes = notes.notes if type(notes) != list: notes = [notes] for n in notes: ...
[ "def", "can_play_notes", "(", "self", ",", "notes", ")", ":", "if", "hasattr", "(", "notes", ",", "'notes'", ")", ":", "notes", "=", "notes", ".", "notes", "if", "type", "(", "notes", ")", "!=", "list", ":", "notes", "=", "[", "notes", "]", "for", ...
Test if the notes lie within the range of the instrument. Return True if so, False otherwise.
[ "Test", "if", "the", "notes", "lie", "within", "the", "range", "of", "the", "instrument", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/instrument.py#L75-L87
3,419
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.play_Note
def play_Note(self, note): """Convert a Note object to a midi event and adds it to the track_data. To set the channel on which to play this note, set Note.channel, the same goes for Note.velocity. """ velocity = 64 channel = 1 if hasattr(note, 'dynamics')...
python
def play_Note(self, note): """Convert a Note object to a midi event and adds it to the track_data. To set the channel on which to play this note, set Note.channel, the same goes for Note.velocity. """ velocity = 64 channel = 1 if hasattr(note, 'dynamics')...
[ "def", "play_Note", "(", "self", ",", "note", ")", ":", "velocity", "=", "64", "channel", "=", "1", "if", "hasattr", "(", "note", ",", "'dynamics'", ")", ":", "if", "'velocity'", "in", "note", ".", "dynamics", ":", "velocity", "=", "note", ".", "dyna...
Convert a Note object to a midi event and adds it to the track_data. To set the channel on which to play this note, set Note.channel, the same goes for Note.velocity.
[ "Convert", "a", "Note", "object", "to", "a", "midi", "event", "and", "adds", "it", "to", "the", "track_data", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L54-L75
3,420
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.play_NoteContainer
def play_NoteContainer(self, notecontainer): """Convert a mingus.containers.NoteContainer to the equivalent MIDI events and add it to the track_data. Note.channel and Note.velocity can be set as well. """ if len(notecontainer) <= 1: [self.play_Note(x) for x in noteco...
python
def play_NoteContainer(self, notecontainer): """Convert a mingus.containers.NoteContainer to the equivalent MIDI events and add it to the track_data. Note.channel and Note.velocity can be set as well. """ if len(notecontainer) <= 1: [self.play_Note(x) for x in noteco...
[ "def", "play_NoteContainer", "(", "self", ",", "notecontainer", ")", ":", "if", "len", "(", "notecontainer", ")", "<=", "1", ":", "[", "self", ".", "play_Note", "(", "x", ")", "for", "x", "in", "notecontainer", "]", "else", ":", "self", ".", "play_Note...
Convert a mingus.containers.NoteContainer to the equivalent MIDI events and add it to the track_data. Note.channel and Note.velocity can be set as well.
[ "Convert", "a", "mingus", ".", "containers", ".", "NoteContainer", "to", "the", "equivalent", "MIDI", "events", "and", "add", "it", "to", "the", "track_data", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L77-L88
3,421
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.play_Bar
def play_Bar(self, bar): """Convert a Bar object to MIDI events and write them to the track_data.""" self.set_deltatime(self.delay) self.delay = 0 self.set_meter(bar.meter) self.set_deltatime(0) self.set_key(bar.key) for x in bar: tick = int(ro...
python
def play_Bar(self, bar): """Convert a Bar object to MIDI events and write them to the track_data.""" self.set_deltatime(self.delay) self.delay = 0 self.set_meter(bar.meter) self.set_deltatime(0) self.set_key(bar.key) for x in bar: tick = int(ro...
[ "def", "play_Bar", "(", "self", ",", "bar", ")", ":", "self", ".", "set_deltatime", "(", "self", ".", "delay", ")", "self", ".", "delay", "=", "0", "self", ".", "set_meter", "(", "bar", ".", "meter", ")", "self", ".", "set_deltatime", "(", "0", ")"...
Convert a Bar object to MIDI events and write them to the track_data.
[ "Convert", "a", "Bar", "object", "to", "MIDI", "events", "and", "write", "them", "to", "the", "track_data", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L90-L110
3,422
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.play_Track
def play_Track(self, track): """Convert a Track object to MIDI events and write them to the track_data.""" if hasattr(track, 'name'): self.set_track_name(track.name) self.delay = 0 instr = track.instrument if hasattr(instr, 'instrument_nr'): self.c...
python
def play_Track(self, track): """Convert a Track object to MIDI events and write them to the track_data.""" if hasattr(track, 'name'): self.set_track_name(track.name) self.delay = 0 instr = track.instrument if hasattr(instr, 'instrument_nr'): self.c...
[ "def", "play_Track", "(", "self", ",", "track", ")", ":", "if", "hasattr", "(", "track", ",", "'name'", ")", ":", "self", ".", "set_track_name", "(", "track", ".", "name", ")", "self", ".", "delay", "=", "0", "instr", "=", "track", ".", "instrument",...
Convert a Track object to MIDI events and write them to the track_data.
[ "Convert", "a", "Track", "object", "to", "MIDI", "events", "and", "write", "them", "to", "the", "track_data", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L112-L123
3,423
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.stop_Note
def stop_Note(self, note): """Add a note_off event for note to event_track.""" velocity = 64 channel = 1 if hasattr(note, 'dynamics'): if 'velocity' in note.dynamics: velocity = note.dynamics['velocity'] if 'channel' in note.dynamics: ...
python
def stop_Note(self, note): """Add a note_off event for note to event_track.""" velocity = 64 channel = 1 if hasattr(note, 'dynamics'): if 'velocity' in note.dynamics: velocity = note.dynamics['velocity'] if 'channel' in note.dynamics: ...
[ "def", "stop_Note", "(", "self", ",", "note", ")", ":", "velocity", "=", "64", "channel", "=", "1", "if", "hasattr", "(", "note", ",", "'dynamics'", ")", ":", "if", "'velocity'", "in", "note", ".", "dynamics", ":", "velocity", "=", "note", ".", "dyna...
Add a note_off event for note to event_track.
[ "Add", "a", "note_off", "event", "for", "note", "to", "event_track", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L125-L138
3,424
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.stop_NoteContainer
def stop_NoteContainer(self, notecontainer): """Add note_off events for each note in the NoteContainer to the track_data.""" # if there is more than one note in the container, the deltatime should # be set back to zero after the first one has been stopped if len(notecontainer) <=...
python
def stop_NoteContainer(self, notecontainer): """Add note_off events for each note in the NoteContainer to the track_data.""" # if there is more than one note in the container, the deltatime should # be set back to zero after the first one has been stopped if len(notecontainer) <=...
[ "def", "stop_NoteContainer", "(", "self", ",", "notecontainer", ")", ":", "# if there is more than one note in the container, the deltatime should", "# be set back to zero after the first one has been stopped", "if", "len", "(", "notecontainer", ")", "<=", "1", ":", "[", "self"...
Add note_off events for each note in the NoteContainer to the track_data.
[ "Add", "note_off", "events", "for", "each", "note", "in", "the", "NoteContainer", "to", "the", "track_data", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L140-L150
3,425
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.set_instrument
def set_instrument(self, channel, instr, bank=1): """Add a program change and bank select event to the track_data.""" self.track_data += self.select_bank(channel, bank) self.track_data += self.program_change_event(channel, instr)
python
def set_instrument(self, channel, instr, bank=1): """Add a program change and bank select event to the track_data.""" self.track_data += self.select_bank(channel, bank) self.track_data += self.program_change_event(channel, instr)
[ "def", "set_instrument", "(", "self", ",", "channel", ",", "instr", ",", "bank", "=", "1", ")", ":", "self", ".", "track_data", "+=", "self", ".", "select_bank", "(", "channel", ",", "bank", ")", "self", ".", "track_data", "+=", "self", ".", "program_c...
Add a program change and bank select event to the track_data.
[ "Add", "a", "program", "change", "and", "bank", "select", "event", "to", "the", "track_data", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L152-L155
3,426
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.header
def header(self): """Return the bytes for the header of track. The header contains the length of the track_data, so you'll have to call this function when you're done adding data (when you're not using get_midi_data). """ chunk_size = a2b_hex('%08x' % (len(self.track_dat...
python
def header(self): """Return the bytes for the header of track. The header contains the length of the track_data, so you'll have to call this function when you're done adding data (when you're not using get_midi_data). """ chunk_size = a2b_hex('%08x' % (len(self.track_dat...
[ "def", "header", "(", "self", ")", ":", "chunk_size", "=", "a2b_hex", "(", "'%08x'", "%", "(", "len", "(", "self", ".", "track_data", ")", "+", "len", "(", "self", ".", "end_of_track", "(", ")", ")", ")", ")", "return", "TRACK_HEADER", "+", "chunk_si...
Return the bytes for the header of track. The header contains the length of the track_data, so you'll have to call this function when you're done adding data (when you're not using get_midi_data).
[ "Return", "the", "bytes", "for", "the", "header", "of", "track", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L157-L166
3,427
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.midi_event
def midi_event(self, event_type, channel, param1, param2=None): """Convert and return the paraters as a MIDI event in bytes.""" assert event_type < 0x80 and event_type >= 0 assert channel < 16 and channel >= 0 tc = a2b_hex('%x%x' % (event_type, channel)) if param2 is None: ...
python
def midi_event(self, event_type, channel, param1, param2=None): """Convert and return the paraters as a MIDI event in bytes.""" assert event_type < 0x80 and event_type >= 0 assert channel < 16 and channel >= 0 tc = a2b_hex('%x%x' % (event_type, channel)) if param2 is None: ...
[ "def", "midi_event", "(", "self", ",", "event_type", ",", "channel", ",", "param1", ",", "param2", "=", "None", ")", ":", "assert", "event_type", "<", "0x80", "and", "event_type", ">=", "0", "assert", "channel", "<", "16", "and", "channel", ">=", "0", ...
Convert and return the paraters as a MIDI event in bytes.
[ "Convert", "and", "return", "the", "paraters", "as", "a", "MIDI", "event", "in", "bytes", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L175-L184
3,428
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.note_off
def note_off(self, channel, note, velocity): """Return bytes for a 'note off' event.""" return self.midi_event(NOTE_OFF, channel, note, velocity)
python
def note_off(self, channel, note, velocity): """Return bytes for a 'note off' event.""" return self.midi_event(NOTE_OFF, channel, note, velocity)
[ "def", "note_off", "(", "self", ",", "channel", ",", "note", ",", "velocity", ")", ":", "return", "self", ".", "midi_event", "(", "NOTE_OFF", ",", "channel", ",", "note", ",", "velocity", ")" ]
Return bytes for a 'note off' event.
[ "Return", "bytes", "for", "a", "note", "off", "event", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L186-L188
3,429
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.note_on
def note_on(self, channel, note, velocity): """Return bytes for a 'note_on' event.""" return self.midi_event(NOTE_ON, channel, note, velocity)
python
def note_on(self, channel, note, velocity): """Return bytes for a 'note_on' event.""" return self.midi_event(NOTE_ON, channel, note, velocity)
[ "def", "note_on", "(", "self", ",", "channel", ",", "note", ",", "velocity", ")", ":", "return", "self", ".", "midi_event", "(", "NOTE_ON", ",", "channel", ",", "note", ",", "velocity", ")" ]
Return bytes for a 'note_on' event.
[ "Return", "bytes", "for", "a", "note_on", "event", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L190-L192
3,430
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.controller_event
def controller_event(self, channel, contr_nr, contr_val): """Return the bytes for a MIDI controller event.""" return self.midi_event(CONTROLLER, channel, contr_nr, contr_val)
python
def controller_event(self, channel, contr_nr, contr_val): """Return the bytes for a MIDI controller event.""" return self.midi_event(CONTROLLER, channel, contr_nr, contr_val)
[ "def", "controller_event", "(", "self", ",", "channel", ",", "contr_nr", ",", "contr_val", ")", ":", "return", "self", ".", "midi_event", "(", "CONTROLLER", ",", "channel", ",", "contr_nr", ",", "contr_val", ")" ]
Return the bytes for a MIDI controller event.
[ "Return", "the", "bytes", "for", "a", "MIDI", "controller", "event", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L194-L196
3,431
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.set_deltatime
def set_deltatime(self, delta_time): """Set the delta_time. Can be an integer or a variable length byte. """ if type(delta_time) == int: delta_time = self.int_to_varbyte(delta_time) self.delta_time = delta_time
python
def set_deltatime(self, delta_time): """Set the delta_time. Can be an integer or a variable length byte. """ if type(delta_time) == int: delta_time = self.int_to_varbyte(delta_time) self.delta_time = delta_time
[ "def", "set_deltatime", "(", "self", ",", "delta_time", ")", ":", "if", "type", "(", "delta_time", ")", "==", "int", ":", "delta_time", "=", "self", ".", "int_to_varbyte", "(", "delta_time", ")", "self", ".", "delta_time", "=", "delta_time" ]
Set the delta_time. Can be an integer or a variable length byte.
[ "Set", "the", "delta_time", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L203-L210
3,432
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.set_tempo
def set_tempo(self, bpm): """Convert the bpm to a midi event and write it to the track_data.""" self.bpm = bpm self.track_data += self.set_tempo_event(self.bpm)
python
def set_tempo(self, bpm): """Convert the bpm to a midi event and write it to the track_data.""" self.bpm = bpm self.track_data += self.set_tempo_event(self.bpm)
[ "def", "set_tempo", "(", "self", ",", "bpm", ")", ":", "self", ".", "bpm", "=", "bpm", "self", ".", "track_data", "+=", "self", ".", "set_tempo_event", "(", "self", ".", "bpm", ")" ]
Convert the bpm to a midi event and write it to the track_data.
[ "Convert", "the", "bpm", "to", "a", "midi", "event", "and", "write", "it", "to", "the", "track_data", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L220-L223
3,433
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.set_tempo_event
def set_tempo_event(self, bpm): """Calculate the microseconds per quarter note.""" ms_per_min = 60000000 mpqn = a2b_hex('%06x' % (ms_per_min / bpm)) return self.delta_time + META_EVENT + SET_TEMPO + '\x03' + mpqn
python
def set_tempo_event(self, bpm): """Calculate the microseconds per quarter note.""" ms_per_min = 60000000 mpqn = a2b_hex('%06x' % (ms_per_min / bpm)) return self.delta_time + META_EVENT + SET_TEMPO + '\x03' + mpqn
[ "def", "set_tempo_event", "(", "self", ",", "bpm", ")", ":", "ms_per_min", "=", "60000000", "mpqn", "=", "a2b_hex", "(", "'%06x'", "%", "(", "ms_per_min", "/", "bpm", ")", ")", "return", "self", ".", "delta_time", "+", "META_EVENT", "+", "SET_TEMPO", "+"...
Calculate the microseconds per quarter note.
[ "Calculate", "the", "microseconds", "per", "quarter", "note", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L225-L229
3,434
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.time_signature_event
def time_signature_event(self, meter=(4, 4)): """Return a time signature event for meter.""" numer = a2b_hex('%02x' % meter[0]) denom = a2b_hex('%02x' % int(log(meter[1], 2))) return self.delta_time + META_EVENT + TIME_SIGNATURE + '\x04' + numer\ + denom + '\x18\x08'
python
def time_signature_event(self, meter=(4, 4)): """Return a time signature event for meter.""" numer = a2b_hex('%02x' % meter[0]) denom = a2b_hex('%02x' % int(log(meter[1], 2))) return self.delta_time + META_EVENT + TIME_SIGNATURE + '\x04' + numer\ + denom + '\x18\x08'
[ "def", "time_signature_event", "(", "self", ",", "meter", "=", "(", "4", ",", "4", ")", ")", ":", "numer", "=", "a2b_hex", "(", "'%02x'", "%", "meter", "[", "0", "]", ")", "denom", "=", "a2b_hex", "(", "'%02x'", "%", "int", "(", "log", "(", "mete...
Return a time signature event for meter.
[ "Return", "a", "time", "signature", "event", "for", "meter", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L235-L240
3,435
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.set_key
def set_key(self, key='C'): """Add a key signature event to the track_data.""" if isinstance(key, Key): key = key.name[0] self.track_data += self.key_signature_event(key)
python
def set_key(self, key='C'): """Add a key signature event to the track_data.""" if isinstance(key, Key): key = key.name[0] self.track_data += self.key_signature_event(key)
[ "def", "set_key", "(", "self", ",", "key", "=", "'C'", ")", ":", "if", "isinstance", "(", "key", ",", "Key", ")", ":", "key", "=", "key", ".", "name", "[", "0", "]", "self", ".", "track_data", "+=", "self", ".", "key_signature_event", "(", "key", ...
Add a key signature event to the track_data.
[ "Add", "a", "key", "signature", "event", "to", "the", "track_data", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L242-L246
3,436
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.key_signature_event
def key_signature_event(self, key='C'): """Return the bytes for a key signature event.""" if key.islower(): val = minor_keys.index(key) - 7 mode = '\x01' else: val = major_keys.index(key) - 7 mode = '\x00' if val < 0: val = 256 ...
python
def key_signature_event(self, key='C'): """Return the bytes for a key signature event.""" if key.islower(): val = minor_keys.index(key) - 7 mode = '\x01' else: val = major_keys.index(key) - 7 mode = '\x00' if val < 0: val = 256 ...
[ "def", "key_signature_event", "(", "self", ",", "key", "=", "'C'", ")", ":", "if", "key", ".", "islower", "(", ")", ":", "val", "=", "minor_keys", ".", "index", "(", "key", ")", "-", "7", "mode", "=", "'\\x01'", "else", ":", "val", "=", "major_keys...
Return the bytes for a key signature event.
[ "Return", "the", "bytes", "for", "a", "key", "signature", "event", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L248-L260
3,437
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.track_name_event
def track_name_event(self, name): """Return the bytes for a track name meta event.""" l = self.int_to_varbyte(len(name)) return '\x00' + META_EVENT + TRACK_NAME + l + name
python
def track_name_event(self, name): """Return the bytes for a track name meta event.""" l = self.int_to_varbyte(len(name)) return '\x00' + META_EVENT + TRACK_NAME + l + name
[ "def", "track_name_event", "(", "self", ",", "name", ")", ":", "l", "=", "self", ".", "int_to_varbyte", "(", "len", "(", "name", ")", ")", "return", "'\\x00'", "+", "META_EVENT", "+", "TRACK_NAME", "+", "l", "+", "name" ]
Return the bytes for a track name meta event.
[ "Return", "the", "bytes", "for", "a", "track", "name", "meta", "event", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L266-L269
3,438
bspaans/python-mingus
mingus/midi/midi_track.py
MidiTrack.int_to_varbyte
def int_to_varbyte(self, value): """Convert an integer into a variable length byte. How it works: the bytes are stored in big-endian (significant bit first), the highest bit of the byte (mask 0x80) is set when there are more bytes following. The remaining 7 bits (mask 0x7F) are used ...
python
def int_to_varbyte(self, value): """Convert an integer into a variable length byte. How it works: the bytes are stored in big-endian (significant bit first), the highest bit of the byte (mask 0x80) is set when there are more bytes following. The remaining 7 bits (mask 0x7F) are used ...
[ "def", "int_to_varbyte", "(", "self", ",", "value", ")", ":", "# Warning: bit kung-fu ahead. The length of the integer in bytes", "length", "=", "int", "(", "log", "(", "max", "(", "value", ",", "1", ")", ",", "0x80", ")", ")", "+", "1", "# Remove the highest bi...
Convert an integer into a variable length byte. How it works: the bytes are stored in big-endian (significant bit first), the highest bit of the byte (mask 0x80) is set when there are more bytes following. The remaining 7 bits (mask 0x7F) are used to store the value.
[ "Convert", "an", "integer", "into", "a", "variable", "length", "byte", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L271-L289
3,439
bspaans/python-mingus
mingus/core/progressions.py
to_chords
def to_chords(progression, key='C'): """Convert a list of chord functions or a string to a list of chords. Examples: >>> to_chords(['I', 'V7']) [['C', 'E', 'G'], ['G', 'B', 'D', 'F']] >>> to_chords('I7') [['C', 'E', 'G', 'B']] Any number of accidentals can be used as prefix to augment or d...
python
def to_chords(progression, key='C'): """Convert a list of chord functions or a string to a list of chords. Examples: >>> to_chords(['I', 'V7']) [['C', 'E', 'G'], ['G', 'B', 'D', 'F']] >>> to_chords('I7') [['C', 'E', 'G', 'B']] Any number of accidentals can be used as prefix to augment or d...
[ "def", "to_chords", "(", "progression", ",", "key", "=", "'C'", ")", ":", "if", "type", "(", "progression", ")", "==", "str", ":", "progression", "=", "[", "progression", "]", "result", "=", "[", "]", "for", "chord", "in", "progression", ":", "# strip ...
Convert a list of chord functions or a string to a list of chords. Examples: >>> to_chords(['I', 'V7']) [['C', 'E', 'G'], ['G', 'B', 'D', 'F']] >>> to_chords('I7') [['C', 'E', 'G', 'B']] Any number of accidentals can be used as prefix to augment or diminish; for example: bIV or #I. ...
[ "Convert", "a", "list", "of", "chord", "functions", "or", "a", "string", "to", "a", "list", "of", "chords", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/progressions.py#L38-L91
3,440
bspaans/python-mingus
mingus/core/progressions.py
determine
def determine(chord, key, shorthand=False): """Determine the harmonic function of chord in key. This function can also deal with lists of chords. Examples: >>> determine(['C', 'E', 'G'], 'C') ['tonic'] >>> determine(['G', 'B', 'D'], 'C') ['dominant'] >>> determine(['G', 'B', 'D', 'F'],...
python
def determine(chord, key, shorthand=False): """Determine the harmonic function of chord in key. This function can also deal with lists of chords. Examples: >>> determine(['C', 'E', 'G'], 'C') ['tonic'] >>> determine(['G', 'B', 'D'], 'C') ['dominant'] >>> determine(['G', 'B', 'D', 'F'],...
[ "def", "determine", "(", "chord", ",", "key", ",", "shorthand", "=", "False", ")", ":", "result", "=", "[", "]", "# Handle lists of chords", "if", "type", "(", "chord", "[", "0", "]", ")", "==", "list", ":", "for", "c", "in", "chord", ":", "result", ...
Determine the harmonic function of chord in key. This function can also deal with lists of chords. Examples: >>> determine(['C', 'E', 'G'], 'C') ['tonic'] >>> determine(['G', 'B', 'D'], 'C') ['dominant'] >>> determine(['G', 'B', 'D', 'F'], 'C', True) ['V7'] >>> determine([['C', 'E'...
[ "Determine", "the", "harmonic", "function", "of", "chord", "in", "key", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/progressions.py#L93-L206
3,441
bspaans/python-mingus
mingus/core/progressions.py
tuple_to_string
def tuple_to_string(prog_tuple): """Create a string from tuples returned by parse_string.""" (roman, acc, suff) = prog_tuple if acc > 6: acc = 0 - acc % 6 elif acc < -6: acc = acc % 6 while acc < 0: roman = 'b' + roman acc += 1 while acc > 0: roman = '#' +...
python
def tuple_to_string(prog_tuple): """Create a string from tuples returned by parse_string.""" (roman, acc, suff) = prog_tuple if acc > 6: acc = 0 - acc % 6 elif acc < -6: acc = acc % 6 while acc < 0: roman = 'b' + roman acc += 1 while acc > 0: roman = '#' +...
[ "def", "tuple_to_string", "(", "prog_tuple", ")", ":", "(", "roman", ",", "acc", ",", "suff", ")", "=", "prog_tuple", "if", "acc", ">", "6", ":", "acc", "=", "0", "-", "acc", "%", "6", "elif", "acc", "<", "-", "6", ":", "acc", "=", "acc", "%", ...
Create a string from tuples returned by parse_string.
[ "Create", "a", "string", "from", "tuples", "returned", "by", "parse_string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/progressions.py#L234-L247
3,442
bspaans/python-mingus
mingus/core/progressions.py
substitute_minor_for_major
def substitute_minor_for_major(progression, substitute_index, ignore_suffix=False): """Substitute minor chords for its major equivalent. 'm' and 'm7' suffixes recognized, and ['II', 'III', 'VI'] if there is no suffix. Examples: >>> substitute_minor_for_major(['VI'], 0) ['I'] >>> su...
python
def substitute_minor_for_major(progression, substitute_index, ignore_suffix=False): """Substitute minor chords for its major equivalent. 'm' and 'm7' suffixes recognized, and ['II', 'III', 'VI'] if there is no suffix. Examples: >>> substitute_minor_for_major(['VI'], 0) ['I'] >>> su...
[ "def", "substitute_minor_for_major", "(", "progression", ",", "substitute_index", ",", "ignore_suffix", "=", "False", ")", ":", "(", "roman", ",", "acc", ",", "suff", ")", "=", "parse_string", "(", "progression", "[", "substitute_index", "]", ")", "res", "=", ...
Substitute minor chords for its major equivalent. 'm' and 'm7' suffixes recognized, and ['II', 'III', 'VI'] if there is no suffix. Examples: >>> substitute_minor_for_major(['VI'], 0) ['I'] >>> substitute_minor_for_major(['Vm'], 0) ['bVIIM'] >>> substitute_minor_for_major(['VIm7'], 0) ...
[ "Substitute", "minor", "chords", "for", "its", "major", "equivalent", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/progressions.py#L278-L307
3,443
bspaans/python-mingus
mingus/core/progressions.py
substitute_diminished_for_diminished
def substitute_diminished_for_diminished(progression, substitute_index, ignore_suffix=False): """Substitute a diminished chord for another diminished chord. 'dim' and 'dim7' suffixes recognized, and 'VI' if there is no suffix. Example: >>> substitute_diminished_for_diminished(['VII'], 0) [...
python
def substitute_diminished_for_diminished(progression, substitute_index, ignore_suffix=False): """Substitute a diminished chord for another diminished chord. 'dim' and 'dim7' suffixes recognized, and 'VI' if there is no suffix. Example: >>> substitute_diminished_for_diminished(['VII'], 0) [...
[ "def", "substitute_diminished_for_diminished", "(", "progression", ",", "substitute_index", ",", "ignore_suffix", "=", "False", ")", ":", "(", "roman", ",", "acc", ",", "suff", ")", "=", "parse_string", "(", "progression", "[", "substitute_index", "]", ")", "res...
Substitute a diminished chord for another diminished chord. 'dim' and 'dim7' suffixes recognized, and 'VI' if there is no suffix. Example: >>> substitute_diminished_for_diminished(['VII'], 0) ['IIdim', 'bIVdim', 'bbVIdim']
[ "Substitute", "a", "diminished", "chord", "for", "another", "diminished", "chord", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/progressions.py#L338-L364
3,444
bspaans/python-mingus
mingus/core/progressions.py
interval_diff
def interval_diff(progression1, progression2, interval): """Return the number of half steps progression2 needs to be diminished or augmented until the interval between progression1 and progression2 is interval.""" i = numeral_intervals[numerals.index(progression1)] j = numeral_intervals[numerals.ind...
python
def interval_diff(progression1, progression2, interval): """Return the number of half steps progression2 needs to be diminished or augmented until the interval between progression1 and progression2 is interval.""" i = numeral_intervals[numerals.index(progression1)] j = numeral_intervals[numerals.ind...
[ "def", "interval_diff", "(", "progression1", ",", "progression2", ",", "interval", ")", ":", "i", "=", "numeral_intervals", "[", "numerals", ".", "index", "(", "progression1", ")", "]", "j", "=", "numeral_intervals", "[", "numerals", ".", "index", "(", "prog...
Return the number of half steps progression2 needs to be diminished or augmented until the interval between progression1 and progression2 is interval.
[ "Return", "the", "number", "of", "half", "steps", "progression2", "needs", "to", "be", "diminished", "or", "augmented", "until", "the", "interval", "between", "progression1", "and", "progression2", "is", "interval", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/progressions.py#L468-L483
3,445
bspaans/python-mingus
mingus/core/progressions.py
skip
def skip(roman_numeral, skip=1): """Skip the given places to the next roman numeral. Examples: >>> skip('I') 'II' >>> skip('VII') 'I' >>> skip('I', 2) 'III' """ i = numerals.index(roman_numeral) + skip return numerals[i % 7]
python
def skip(roman_numeral, skip=1): """Skip the given places to the next roman numeral. Examples: >>> skip('I') 'II' >>> skip('VII') 'I' >>> skip('I', 2) 'III' """ i = numerals.index(roman_numeral) + skip return numerals[i % 7]
[ "def", "skip", "(", "roman_numeral", ",", "skip", "=", "1", ")", ":", "i", "=", "numerals", ".", "index", "(", "roman_numeral", ")", "+", "skip", "return", "numerals", "[", "i", "%", "7", "]" ]
Skip the given places to the next roman numeral. Examples: >>> skip('I') 'II' >>> skip('VII') 'I' >>> skip('I', 2) 'III'
[ "Skip", "the", "given", "places", "to", "the", "next", "roman", "numeral", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/progressions.py#L485-L497
3,446
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.add_note
def add_note(self, note, octave=None, dynamics={}): """Add a note to the container and sorts the notes from low to high. The note can either be a string, in which case you could also use the octave and dynamics arguments, or a Note object. """ if type(note) == str: i...
python
def add_note(self, note, octave=None, dynamics={}): """Add a note to the container and sorts the notes from low to high. The note can either be a string, in which case you could also use the octave and dynamics arguments, or a Note object. """ if type(note) == str: i...
[ "def", "add_note", "(", "self", ",", "note", ",", "octave", "=", "None", ",", "dynamics", "=", "{", "}", ")", ":", "if", "type", "(", "note", ")", "==", "str", ":", "if", "octave", "is", "not", "None", ":", "note", "=", "Note", "(", "note", ","...
Add a note to the container and sorts the notes from low to high. The note can either be a string, in which case you could also use the octave and dynamics arguments, or a Note object.
[ "Add", "a", "note", "to", "the", "container", "and", "sorts", "the", "notes", "from", "low", "to", "high", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L45-L67
3,447
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.add_notes
def add_notes(self, notes): """Feed notes to self.add_note. The notes can either be an other NoteContainer, a list of Note objects or strings or a list of lists formatted like this: >>> notes = [['C', 5], ['E', 5], ['G', 6]] or even: >>> notes = [['C', 5, {'volume': 20}...
python
def add_notes(self, notes): """Feed notes to self.add_note. The notes can either be an other NoteContainer, a list of Note objects or strings or a list of lists formatted like this: >>> notes = [['C', 5], ['E', 5], ['G', 6]] or even: >>> notes = [['C', 5, {'volume': 20}...
[ "def", "add_notes", "(", "self", ",", "notes", ")", ":", "if", "hasattr", "(", "notes", ",", "'notes'", ")", ":", "for", "x", "in", "notes", ".", "notes", ":", "self", ".", "add_note", "(", "x", ")", "return", "self", ".", "notes", "elif", "hasattr...
Feed notes to self.add_note. The notes can either be an other NoteContainer, a list of Note objects or strings or a list of lists formatted like this: >>> notes = [['C', 5], ['E', 5], ['G', 6]] or even: >>> notes = [['C', 5, {'volume': 20}], ['E', 6, {'volume': 20}]]
[ "Feed", "notes", "to", "self", ".", "add_note", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L69-L97
3,448
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.from_chord_shorthand
def from_chord_shorthand(self, shorthand): """Empty the container and add the notes in the shorthand. See mingus.core.chords.from_shorthand for an up to date list of recognized format. Example: >>> NoteContainer().from_chord_shorthand('Am') ['A-4', 'C-5', 'E-5'] ...
python
def from_chord_shorthand(self, shorthand): """Empty the container and add the notes in the shorthand. See mingus.core.chords.from_shorthand for an up to date list of recognized format. Example: >>> NoteContainer().from_chord_shorthand('Am') ['A-4', 'C-5', 'E-5'] ...
[ "def", "from_chord_shorthand", "(", "self", ",", "shorthand", ")", ":", "self", ".", "empty", "(", ")", "self", ".", "add_notes", "(", "chords", ".", "from_shorthand", "(", "shorthand", ")", ")", "return", "self" ]
Empty the container and add the notes in the shorthand. See mingus.core.chords.from_shorthand for an up to date list of recognized format. Example: >>> NoteContainer().from_chord_shorthand('Am') ['A-4', 'C-5', 'E-5']
[ "Empty", "the", "container", "and", "add", "the", "notes", "in", "the", "shorthand", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L103-L115
3,449
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.from_interval
def from_interval(self, startnote, shorthand, up=True): """Shortcut to from_interval_shorthand.""" return self.from_interval_shorthand(startnote, shorthand, up)
python
def from_interval(self, startnote, shorthand, up=True): """Shortcut to from_interval_shorthand.""" return self.from_interval_shorthand(startnote, shorthand, up)
[ "def", "from_interval", "(", "self", ",", "startnote", ",", "shorthand", ",", "up", "=", "True", ")", ":", "return", "self", ".", "from_interval_shorthand", "(", "startnote", ",", "shorthand", ",", "up", ")" ]
Shortcut to from_interval_shorthand.
[ "Shortcut", "to", "from_interval_shorthand", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L117-L119
3,450
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.from_interval_shorthand
def from_interval_shorthand(self, startnote, shorthand, up=True): """Empty the container and add the note described in the startnote and shorthand. See core.intervals for the recognized format. Examples: >>> nc = NoteContainer() >>> nc.from_interval_shorthand('C', '5') ...
python
def from_interval_shorthand(self, startnote, shorthand, up=True): """Empty the container and add the note described in the startnote and shorthand. See core.intervals for the recognized format. Examples: >>> nc = NoteContainer() >>> nc.from_interval_shorthand('C', '5') ...
[ "def", "from_interval_shorthand", "(", "self", ",", "startnote", ",", "shorthand", ",", "up", "=", "True", ")", ":", "self", ".", "empty", "(", ")", "if", "type", "(", "startnote", ")", "==", "str", ":", "startnote", "=", "Note", "(", "startnote", ")",...
Empty the container and add the note described in the startnote and shorthand. See core.intervals for the recognized format. Examples: >>> nc = NoteContainer() >>> nc.from_interval_shorthand('C', '5') ['C-4', 'G-4'] >>> nc.from_interval_shorthand('C', '5', False...
[ "Empty", "the", "container", "and", "add", "the", "note", "described", "in", "the", "startnote", "and", "shorthand", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L121-L140
3,451
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.remove_note
def remove_note(self, note, octave=-1): """Remove note from container. The note can either be a Note object or a string representing the note's name. If no specific octave is given, the note gets removed in every octave. """ res = [] for x in self.notes: ...
python
def remove_note(self, note, octave=-1): """Remove note from container. The note can either be a Note object or a string representing the note's name. If no specific octave is given, the note gets removed in every octave. """ res = [] for x in self.notes: ...
[ "def", "remove_note", "(", "self", ",", "note", ",", "octave", "=", "-", "1", ")", ":", "res", "=", "[", "]", "for", "x", "in", "self", ".", "notes", ":", "if", "type", "(", "note", ")", "==", "str", ":", "if", "x", ".", "name", "!=", "note",...
Remove note from container. The note can either be a Note object or a string representing the note's name. If no specific octave is given, the note gets removed in every octave.
[ "Remove", "note", "from", "container", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L213-L232
3,452
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.remove_notes
def remove_notes(self, notes): """Remove notes from the containers. This function accepts a list of Note objects or notes as strings and also single strings or Note objects. """ if type(notes) == str: return self.remove_note(notes) elif hasattr(notes, 'name')...
python
def remove_notes(self, notes): """Remove notes from the containers. This function accepts a list of Note objects or notes as strings and also single strings or Note objects. """ if type(notes) == str: return self.remove_note(notes) elif hasattr(notes, 'name')...
[ "def", "remove_notes", "(", "self", ",", "notes", ")", ":", "if", "type", "(", "notes", ")", "==", "str", ":", "return", "self", ".", "remove_note", "(", "notes", ")", "elif", "hasattr", "(", "notes", ",", "'name'", ")", ":", "return", "self", ".", ...
Remove notes from the containers. This function accepts a list of Note objects or notes as strings and also single strings or Note objects.
[ "Remove", "notes", "from", "the", "containers", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L234-L246
3,453
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.remove_duplicate_notes
def remove_duplicate_notes(self): """Remove duplicate and enharmonic notes from the container.""" res = [] for x in self.notes: if x not in res: res.append(x) self.notes = res return res
python
def remove_duplicate_notes(self): """Remove duplicate and enharmonic notes from the container.""" res = [] for x in self.notes: if x not in res: res.append(x) self.notes = res return res
[ "def", "remove_duplicate_notes", "(", "self", ")", ":", "res", "=", "[", "]", "for", "x", "in", "self", ".", "notes", ":", "if", "x", "not", "in", "res", ":", "res", ".", "append", "(", "x", ")", "self", ".", "notes", "=", "res", "return", "res" ...
Remove duplicate and enharmonic notes from the container.
[ "Remove", "duplicate", "and", "enharmonic", "notes", "from", "the", "container", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L248-L255
3,454
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.transpose
def transpose(self, interval, up=True): """Transpose all the notes in the container up or down the given interval.""" for n in self.notes: n.transpose(interval, up) return self
python
def transpose(self, interval, up=True): """Transpose all the notes in the container up or down the given interval.""" for n in self.notes: n.transpose(interval, up) return self
[ "def", "transpose", "(", "self", ",", "interval", ",", "up", "=", "True", ")", ":", "for", "n", "in", "self", ".", "notes", ":", "n", ".", "transpose", "(", "interval", ",", "up", ")", "return", "self" ]
Transpose all the notes in the container up or down the given interval.
[ "Transpose", "all", "the", "notes", "in", "the", "container", "up", "or", "down", "the", "given", "interval", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L276-L281
3,455
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.get_note_names
def get_note_names(self): """Return a list with all the note names in the current container. Every name will only be mentioned once. """ res = [] for n in self.notes: if n.name not in res: res.append(n.name) return res
python
def get_note_names(self): """Return a list with all the note names in the current container. Every name will only be mentioned once. """ res = [] for n in self.notes: if n.name not in res: res.append(n.name) return res
[ "def", "get_note_names", "(", "self", ")", ":", "res", "=", "[", "]", "for", "n", "in", "self", ".", "notes", ":", "if", "n", ".", "name", "not", "in", "res", ":", "res", ".", "append", "(", "n", ".", "name", ")", "return", "res" ]
Return a list with all the note names in the current container. Every name will only be mentioned once.
[ "Return", "a", "list", "with", "all", "the", "note", "names", "in", "the", "current", "container", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L283-L292
3,456
bspaans/python-mingus
mingus/core/scales.py
determine
def determine(notes): """Determine the scales containing the notes. All major and minor scales are recognized. Example: >>> determine(['A', 'Bb', 'E', 'F#', 'G']) ['G melodic minor', 'G Bachian', 'D harmonic major'] """ notes = set(notes) res = [] for key in keys: for scal...
python
def determine(notes): """Determine the scales containing the notes. All major and minor scales are recognized. Example: >>> determine(['A', 'Bb', 'E', 'F#', 'G']) ['G melodic minor', 'G Bachian', 'D harmonic major'] """ notes = set(notes) res = [] for key in keys: for scal...
[ "def", "determine", "(", "notes", ")", ":", "notes", "=", "set", "(", "notes", ")", "res", "=", "[", "]", "for", "key", "in", "keys", ":", "for", "scale", "in", "_Scale", ".", "__subclasses__", "(", ")", ":", "if", "scale", ".", "type", "==", "'m...
Determine the scales containing the notes. All major and minor scales are recognized. Example: >>> determine(['A', 'Bb', 'E', 'F#', 'G']) ['G melodic minor', 'G Bachian', 'D harmonic major']
[ "Determine", "the", "scales", "containing", "the", "notes", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/scales.py#L60-L82
3,457
bspaans/python-mingus
mingus/core/scales.py
_Scale.degree
def degree(self, degree_number, direction='a'): """Return the asked scale degree. The direction of the scale is 'a' for ascending (default) and 'd' for descending. """ if degree_number < 1: raise RangeError("degree '%s' out of range" % degree_number) if direc...
python
def degree(self, degree_number, direction='a'): """Return the asked scale degree. The direction of the scale is 'a' for ascending (default) and 'd' for descending. """ if degree_number < 1: raise RangeError("degree '%s' out of range" % degree_number) if direc...
[ "def", "degree", "(", "self", ",", "degree_number", ",", "direction", "=", "'a'", ")", ":", "if", "degree_number", "<", "1", ":", "raise", "RangeError", "(", "\"degree '%s' out of range\"", "%", "degree_number", ")", "if", "direction", "==", "'a'", ":", "not...
Return the asked scale degree. The direction of the scale is 'a' for ascending (default) and 'd' for descending.
[ "Return", "the", "asked", "scale", "degree", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/scales.py#L126-L141
3,458
bspaans/python-mingus
mingus/extra/tablature.py
begin_track
def begin_track(tuning, padding=2): """Helper function that builds the first few characters of every bar.""" # find longest shorthand tuning base names = [x.to_shorthand() for x in tuning.tuning] basesize = len(max(names)) + 3 # Build result res = [] for x in names: r = ' %s' % x ...
python
def begin_track(tuning, padding=2): """Helper function that builds the first few characters of every bar.""" # find longest shorthand tuning base names = [x.to_shorthand() for x in tuning.tuning] basesize = len(max(names)) + 3 # Build result res = [] for x in names: r = ' %s' % x ...
[ "def", "begin_track", "(", "tuning", ",", "padding", "=", "2", ")", ":", "# find longest shorthand tuning base", "names", "=", "[", "x", ".", "to_shorthand", "(", ")", "for", "x", "in", "tuning", ".", "tuning", "]", "basesize", "=", "len", "(", "max", "(...
Helper function that builds the first few characters of every bar.
[ "Helper", "function", "that", "builds", "the", "first", "few", "characters", "of", "every", "bar", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L28-L41
3,459
bspaans/python-mingus
mingus/extra/tablature.py
add_headers
def add_headers(width=80, title='Untitled', subtitle='', author='', email='', description='', tunings=[]): """Create a nice header in the form of a list of strings using the information that has been filled in. All arguments except 'width' and 'tunings' should be strings. 'width' should be an i...
python
def add_headers(width=80, title='Untitled', subtitle='', author='', email='', description='', tunings=[]): """Create a nice header in the form of a list of strings using the information that has been filled in. All arguments except 'width' and 'tunings' should be strings. 'width' should be an i...
[ "def", "add_headers", "(", "width", "=", "80", ",", "title", "=", "'Untitled'", ",", "subtitle", "=", "''", ",", "author", "=", "''", ",", "email", "=", "''", ",", "description", "=", "''", ",", "tunings", "=", "[", "]", ")", ":", "result", "=", ...
Create a nice header in the form of a list of strings using the information that has been filled in. All arguments except 'width' and 'tunings' should be strings. 'width' should be an integer and 'tunings' a list of tunings representing the instruments.
[ "Create", "a", "nice", "header", "in", "the", "form", "of", "a", "list", "of", "strings", "using", "the", "information", "that", "has", "been", "filled", "in", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L44-L88
3,460
bspaans/python-mingus
mingus/extra/tablature.py
from_Note
def from_Note(note, width=80, tuning=None): """Return a string made out of ASCII tablature representing a Note object or note string. Throw a RangeError if a suitable fret can't be found. 'tuning' should be a StringTuning object or None for the default tuning. To force a certain fingering you can...
python
def from_Note(note, width=80, tuning=None): """Return a string made out of ASCII tablature representing a Note object or note string. Throw a RangeError if a suitable fret can't be found. 'tuning' should be a StringTuning object or None for the default tuning. To force a certain fingering you can...
[ "def", "from_Note", "(", "note", ",", "width", "=", "80", ",", "tuning", "=", "None", ")", ":", "if", "tuning", "is", "None", ":", "tuning", "=", "default_tuning", "result", "=", "begin_track", "(", "tuning", ")", "min", "=", "1000", "(", "s", ",", ...
Return a string made out of ASCII tablature representing a Note object or note string. Throw a RangeError if a suitable fret can't be found. 'tuning' should be a StringTuning object or None for the default tuning. To force a certain fingering you can use a 'string' and 'fret' attribute on the Not...
[ "Return", "a", "string", "made", "out", "of", "ASCII", "tablature", "representing", "a", "Note", "object", "or", "note", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L90-L140
3,461
bspaans/python-mingus
mingus/extra/tablature.py
from_Track
def from_Track(track, maxwidth=80, tuning=None): """Convert a mingus.containers.Track object to an ASCII tablature string. 'tuning' should be set to a StringTuning object or to None to use the Track's tuning (or alternatively the default if the Track hasn't got its own tuning). 'string' and 'fret'...
python
def from_Track(track, maxwidth=80, tuning=None): """Convert a mingus.containers.Track object to an ASCII tablature string. 'tuning' should be set to a StringTuning object or to None to use the Track's tuning (or alternatively the default if the Track hasn't got its own tuning). 'string' and 'fret'...
[ "def", "from_Track", "(", "track", ",", "maxwidth", "=", "80", ",", "tuning", "=", "None", ")", ":", "result", "=", "[", "]", "width", "=", "_get_width", "(", "maxwidth", ")", "if", "not", "tuning", ":", "tuning", "=", "track", ".", "get_tuning", "("...
Convert a mingus.containers.Track object to an ASCII tablature string. 'tuning' should be set to a StringTuning object or to None to use the Track's tuning (or alternatively the default if the Track hasn't got its own tuning). 'string' and 'fret' attributes on Notes are taken into account.
[ "Convert", "a", "mingus", ".", "containers", ".", "Track", "object", "to", "an", "ASCII", "tablature", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L302-L326
3,462
bspaans/python-mingus
mingus/extra/tablature.py
from_Composition
def from_Composition(composition, width=80): """Convert a mingus.containers.Composition to an ASCII tablature string. Automatically add an header based on the title, subtitle, author, e-mail and description attributes. An extra description of the piece can also be given. Tunings can be set by usin...
python
def from_Composition(composition, width=80): """Convert a mingus.containers.Composition to an ASCII tablature string. Automatically add an header based on the title, subtitle, author, e-mail and description attributes. An extra description of the piece can also be given. Tunings can be set by usin...
[ "def", "from_Composition", "(", "composition", ",", "width", "=", "80", ")", ":", "# Collect tunings", "instr_tunings", "=", "[", "]", "for", "track", "in", "composition", ":", "tun", "=", "track", ".", "get_tuning", "(", ")", "if", "tun", ":", "instr_tuni...
Convert a mingus.containers.Composition to an ASCII tablature string. Automatically add an header based on the title, subtitle, author, e-mail and description attributes. An extra description of the piece can also be given. Tunings can be set by using the Track.instrument.tuning or Track.tuning at...
[ "Convert", "a", "mingus", ".", "containers", ".", "Composition", "to", "an", "ASCII", "tablature", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L328-L397
3,463
bspaans/python-mingus
mingus/extra/tablature.py
from_Suite
def from_Suite(suite, maxwidth=80): """Convert a mingus.containers.Suite to an ASCII tablature string, complete with headers. This function makes use of the Suite's title, subtitle, author, email and description attributes. """ subtitle = str(len(suite.compositions)) + ' Compositions' if suite....
python
def from_Suite(suite, maxwidth=80): """Convert a mingus.containers.Suite to an ASCII tablature string, complete with headers. This function makes use of the Suite's title, subtitle, author, email and description attributes. """ subtitle = str(len(suite.compositions)) + ' Compositions' if suite....
[ "def", "from_Suite", "(", "suite", ",", "maxwidth", "=", "80", ")", ":", "subtitle", "=", "str", "(", "len", "(", "suite", ".", "compositions", ")", ")", "+", "' Compositions'", "if", "suite", ".", "subtitle", "==", "''", "else", "suite", ".", "subtitl...
Convert a mingus.containers.Suite to an ASCII tablature string, complete with headers. This function makes use of the Suite's title, subtitle, author, email and description attributes.
[ "Convert", "a", "mingus", ".", "containers", ".", "Suite", "to", "an", "ASCII", "tablature", "string", "complete", "with", "headers", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L399-L422
3,464
bspaans/python-mingus
mingus/extra/tablature.py
_get_qsize
def _get_qsize(tuning, width): """Return a reasonable quarter note size for 'tuning' and 'width'.""" names = [x.to_shorthand() for x in tuning.tuning] basesize = len(max(names)) + 3 barsize = ((width - basesize) - 2) - 1 # x * 4 + 0.5x - barsize = 0 4.5x = barsize x = barsize / 4.5 return max(0...
python
def _get_qsize(tuning, width): """Return a reasonable quarter note size for 'tuning' and 'width'.""" names = [x.to_shorthand() for x in tuning.tuning] basesize = len(max(names)) + 3 barsize = ((width - basesize) - 2) - 1 # x * 4 + 0.5x - barsize = 0 4.5x = barsize x = barsize / 4.5 return max(0...
[ "def", "_get_qsize", "(", "tuning", ",", "width", ")", ":", "names", "=", "[", "x", ".", "to_shorthand", "(", ")", "for", "x", "in", "tuning", ".", "tuning", "]", "basesize", "=", "len", "(", "max", "(", "names", ")", ")", "+", "3", "barsize", "=...
Return a reasonable quarter note size for 'tuning' and 'width'.
[ "Return", "a", "reasonable", "quarter", "note", "size", "for", "tuning", "and", "width", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L424-L431
3,465
bspaans/python-mingus
mingus/extra/tablature.py
_get_width
def _get_width(maxwidth): """Return the width of a single bar, when width of the page is given.""" width = maxwidth / 3 if maxwidth <= 60: width = maxwidth elif 60 < maxwidth <= 120: width = maxwidth / 2 return width
python
def _get_width(maxwidth): """Return the width of a single bar, when width of the page is given.""" width = maxwidth / 3 if maxwidth <= 60: width = maxwidth elif 60 < maxwidth <= 120: width = maxwidth / 2 return width
[ "def", "_get_width", "(", "maxwidth", ")", ":", "width", "=", "maxwidth", "/", "3", "if", "maxwidth", "<=", "60", ":", "width", "=", "maxwidth", "elif", "60", "<", "maxwidth", "<=", "120", ":", "width", "=", "maxwidth", "/", "2", "return", "width" ]
Return the width of a single bar, when width of the page is given.
[ "Return", "the", "width", "of", "a", "single", "bar", "when", "width", "of", "the", "page", "is", "given", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L433-L440
3,466
bspaans/python-mingus
mingus/core/chords.py
triad
def triad(note, key): """Return the triad on note in key as a list. Examples: >>> triad('E', 'C') ['E', 'G', 'B'] >>> triad('E', 'B') ['E', 'G#', 'B'] """ return [note, intervals.third(note, key), intervals.fifth(note, key)]
python
def triad(note, key): """Return the triad on note in key as a list. Examples: >>> triad('E', 'C') ['E', 'G', 'B'] >>> triad('E', 'B') ['E', 'G#', 'B'] """ return [note, intervals.third(note, key), intervals.fifth(note, key)]
[ "def", "triad", "(", "note", ",", "key", ")", ":", "return", "[", "note", ",", "intervals", ".", "third", "(", "note", ",", "key", ")", ",", "intervals", ".", "fifth", "(", "note", ",", "key", ")", "]" ]
Return the triad on note in key as a list. Examples: >>> triad('E', 'C') ['E', 'G', 'B'] >>> triad('E', 'B') ['E', 'G#', 'B']
[ "Return", "the", "triad", "on", "note", "in", "key", "as", "a", "list", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L165-L174
3,467
bspaans/python-mingus
mingus/core/chords.py
triads
def triads(key): """Return all the triads in key. Implemented using a cache. """ if _triads_cache.has_key(key): return _triads_cache[key] res = map(lambda x: triad(x, key), keys.get_notes(key)) _triads_cache[key] = res return res
python
def triads(key): """Return all the triads in key. Implemented using a cache. """ if _triads_cache.has_key(key): return _triads_cache[key] res = map(lambda x: triad(x, key), keys.get_notes(key)) _triads_cache[key] = res return res
[ "def", "triads", "(", "key", ")", ":", "if", "_triads_cache", ".", "has_key", "(", "key", ")", ":", "return", "_triads_cache", "[", "key", "]", "res", "=", "map", "(", "lambda", "x", ":", "triad", "(", "x", ",", "key", ")", ",", "keys", ".", "get...
Return all the triads in key. Implemented using a cache.
[ "Return", "all", "the", "triads", "in", "key", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L176-L185
3,468
bspaans/python-mingus
mingus/core/chords.py
augmented_triad
def augmented_triad(note): """Build an augmented triad on note. Example: >>> augmented_triad('C') ['C', 'E', 'G#'] """ return [note, intervals.major_third(note), notes.augment(intervals.major_fifth(note))]
python
def augmented_triad(note): """Build an augmented triad on note. Example: >>> augmented_triad('C') ['C', 'E', 'G#'] """ return [note, intervals.major_third(note), notes.augment(intervals.major_fifth(note))]
[ "def", "augmented_triad", "(", "note", ")", ":", "return", "[", "note", ",", "intervals", ".", "major_third", "(", "note", ")", ",", "notes", ".", "augment", "(", "intervals", ".", "major_fifth", "(", "note", ")", ")", "]" ]
Build an augmented triad on note. Example: >>> augmented_triad('C') ['C', 'E', 'G#']
[ "Build", "an", "augmented", "triad", "on", "note", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L214-L222
3,469
bspaans/python-mingus
mingus/core/chords.py
seventh
def seventh(note, key): """Return the seventh chord on note in key. Example: >>> seventh('C', 'C') ['C', 'E', 'G', 'B'] """ return triad(note, key) + [intervals.seventh(note, key)]
python
def seventh(note, key): """Return the seventh chord on note in key. Example: >>> seventh('C', 'C') ['C', 'E', 'G', 'B'] """ return triad(note, key) + [intervals.seventh(note, key)]
[ "def", "seventh", "(", "note", ",", "key", ")", ":", "return", "triad", "(", "note", ",", "key", ")", "+", "[", "intervals", ".", "seventh", "(", "note", ",", "key", ")", "]" ]
Return the seventh chord on note in key. Example: >>> seventh('C', 'C') ['C', 'E', 'G', 'B']
[ "Return", "the", "seventh", "chord", "on", "note", "in", "key", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L224-L231
3,470
bspaans/python-mingus
mingus/core/chords.py
sevenths
def sevenths(key): """Return all the sevenths chords in key in a list.""" if _sevenths_cache.has_key(key): return _sevenths_cache[key] res = map(lambda x: seventh(x, key), keys.get_notes(key)) _sevenths_cache[key] = res return res
python
def sevenths(key): """Return all the sevenths chords in key in a list.""" if _sevenths_cache.has_key(key): return _sevenths_cache[key] res = map(lambda x: seventh(x, key), keys.get_notes(key)) _sevenths_cache[key] = res return res
[ "def", "sevenths", "(", "key", ")", ":", "if", "_sevenths_cache", ".", "has_key", "(", "key", ")", ":", "return", "_sevenths_cache", "[", "key", "]", "res", "=", "map", "(", "lambda", "x", ":", "seventh", "(", "x", ",", "key", ")", ",", "keys", "."...
Return all the sevenths chords in key in a list.
[ "Return", "all", "the", "sevenths", "chords", "in", "key", "in", "a", "list", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L233-L239
3,471
bspaans/python-mingus
mingus/core/chords.py
dominant_flat_ninth
def dominant_flat_ninth(note): """Build a dominant flat ninth chord on note. Example: >>> dominant_ninth('C') ['C', 'E', 'G', 'Bb', 'Db'] """ res = dominant_ninth(note) res[4] = intervals.minor_second(note) return res
python
def dominant_flat_ninth(note): """Build a dominant flat ninth chord on note. Example: >>> dominant_ninth('C') ['C', 'E', 'G', 'Bb', 'Db'] """ res = dominant_ninth(note) res[4] = intervals.minor_second(note) return res
[ "def", "dominant_flat_ninth", "(", "note", ")", ":", "res", "=", "dominant_ninth", "(", "note", ")", "res", "[", "4", "]", "=", "intervals", ".", "minor_second", "(", "note", ")", "return", "res" ]
Build a dominant flat ninth chord on note. Example: >>> dominant_ninth('C') ['C', 'E', 'G', 'Bb', 'Db']
[ "Build", "a", "dominant", "flat", "ninth", "chord", "on", "note", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L368-L377
3,472
bspaans/python-mingus
mingus/core/chords.py
dominant_sharp_ninth
def dominant_sharp_ninth(note): """Build a dominant sharp ninth chord on note. Example: >>> dominant_ninth('C') ['C', 'E', 'G', 'Bb', 'D#'] """ res = dominant_ninth(note) res[4] = notes.augment(intervals.major_second(note)) return res
python
def dominant_sharp_ninth(note): """Build a dominant sharp ninth chord on note. Example: >>> dominant_ninth('C') ['C', 'E', 'G', 'Bb', 'D#'] """ res = dominant_ninth(note) res[4] = notes.augment(intervals.major_second(note)) return res
[ "def", "dominant_sharp_ninth", "(", "note", ")", ":", "res", "=", "dominant_ninth", "(", "note", ")", "res", "[", "4", "]", "=", "notes", ".", "augment", "(", "intervals", ".", "major_second", "(", "note", ")", ")", "return", "res" ]
Build a dominant sharp ninth chord on note. Example: >>> dominant_ninth('C') ['C', 'E', 'G', 'Bb', 'D#']
[ "Build", "a", "dominant", "sharp", "ninth", "chord", "on", "note", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L379-L388
3,473
bspaans/python-mingus
mingus/core/chords.py
eleventh
def eleventh(note): """Build an eleventh chord on note. Example: >>> eleventh('C') ['C', 'G', 'Bb', 'F'] """ return [note, intervals.perfect_fifth(note), intervals.minor_seventh(note), intervals.perfect_fourth(note)]
python
def eleventh(note): """Build an eleventh chord on note. Example: >>> eleventh('C') ['C', 'G', 'Bb', 'F'] """ return [note, intervals.perfect_fifth(note), intervals.minor_seventh(note), intervals.perfect_fourth(note)]
[ "def", "eleventh", "(", "note", ")", ":", "return", "[", "note", ",", "intervals", ".", "perfect_fifth", "(", "note", ")", ",", "intervals", ".", "minor_seventh", "(", "note", ")", ",", "intervals", ".", "perfect_fourth", "(", "note", ")", "]" ]
Build an eleventh chord on note. Example: >>> eleventh('C') ['C', 'G', 'Bb', 'F']
[ "Build", "an", "eleventh", "chord", "on", "note", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L390-L398
3,474
bspaans/python-mingus
mingus/core/chords.py
dominant_flat_five
def dominant_flat_five(note): """Build a dominant flat five chord on note. Example: >>> dominant_flat_five('C') ['C', 'E', 'Gb', 'Bb'] """ res = dominant_seventh(note) res[2] = notes.diminish(res[2]) return res
python
def dominant_flat_five(note): """Build a dominant flat five chord on note. Example: >>> dominant_flat_five('C') ['C', 'E', 'Gb', 'Bb'] """ res = dominant_seventh(note) res[2] = notes.diminish(res[2]) return res
[ "def", "dominant_flat_five", "(", "note", ")", ":", "res", "=", "dominant_seventh", "(", "note", ")", "res", "[", "2", "]", "=", "notes", ".", "diminish", "(", "res", "[", "2", "]", ")", "return", "res" ]
Build a dominant flat five chord on note. Example: >>> dominant_flat_five('C') ['C', 'E', 'Gb', 'Bb']
[ "Build", "a", "dominant", "flat", "five", "chord", "on", "note", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L494-L503
3,475
bspaans/python-mingus
mingus/core/chords.py
from_shorthand
def from_shorthand(shorthand_string, slash=None): """Take a chord written in shorthand and return the notes in the chord. The function can recognize triads, sevenths, sixths, ninths, elevenths, thirteenths, slashed chords and a number of altered chords. The second argument should not be given and is o...
python
def from_shorthand(shorthand_string, slash=None): """Take a chord written in shorthand and return the notes in the chord. The function can recognize triads, sevenths, sixths, ninths, elevenths, thirteenths, slashed chords and a number of altered chords. The second argument should not be given and is o...
[ "def", "from_shorthand", "(", "shorthand_string", ",", "slash", "=", "None", ")", ":", "# warning reduce??", "if", "type", "(", "shorthand_string", ")", "==", "list", ":", "res", "=", "[", "]", "for", "x", "in", "shorthand_string", ":", "res", ".", "append...
Take a chord written in shorthand and return the notes in the chord. The function can recognize triads, sevenths, sixths, ninths, elevenths, thirteenths, slashed chords and a number of altered chords. The second argument should not be given and is only used for a recursive call when a slashed chord or...
[ "Take", "a", "chord", "written", "in", "shorthand", "and", "return", "the", "notes", "in", "the", "chord", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L699-L823
3,476
bspaans/python-mingus
mingus/core/chords.py
determine
def determine(chord, shorthand=False, no_inversions=False, no_polychords=False): """Name a chord. This function can determine almost every chord, from a simple triad to a fourteen note polychord.""" if chord == []: return [] elif len(chord) == 1: return chord elif len(chord) == ...
python
def determine(chord, shorthand=False, no_inversions=False, no_polychords=False): """Name a chord. This function can determine almost every chord, from a simple triad to a fourteen note polychord.""" if chord == []: return [] elif len(chord) == 1: return chord elif len(chord) == ...
[ "def", "determine", "(", "chord", ",", "shorthand", "=", "False", ",", "no_inversions", "=", "False", ",", "no_polychords", "=", "False", ")", ":", "if", "chord", "==", "[", "]", ":", "return", "[", "]", "elif", "len", "(", "chord", ")", "==", "1", ...
Name a chord. This function can determine almost every chord, from a simple triad to a fourteen note polychord.
[ "Name", "a", "chord", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L825-L850
3,477
bspaans/python-mingus
mingus/core/chords.py
determine_triad
def determine_triad(triad, shorthand=False, no_inversions=False, placeholder=None): """Name the triad; return answers in a list. The third argument should not be given. If shorthand is True the answers will be in abbreviated form. This function can determine major, minor, diminished and suspen...
python
def determine_triad(triad, shorthand=False, no_inversions=False, placeholder=None): """Name the triad; return answers in a list. The third argument should not be given. If shorthand is True the answers will be in abbreviated form. This function can determine major, minor, diminished and suspen...
[ "def", "determine_triad", "(", "triad", ",", "shorthand", "=", "False", ",", "no_inversions", "=", "False", ",", "placeholder", "=", "None", ")", ":", "if", "len", "(", "triad", ")", "!=", "3", ":", "# warning: raise exception: not a triad", "return", "False",...
Name the triad; return answers in a list. The third argument should not be given. If shorthand is True the answers will be in abbreviated form. This function can determine major, minor, diminished and suspended triads. Also knows about invertions. Examples: >>> determine_triad(['A', 'C', 'E']...
[ "Name", "the", "triad", ";", "return", "answers", "in", "a", "list", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L852-L925
3,478
bspaans/python-mingus
mingus/core/chords.py
determine_seventh
def determine_seventh(seventh, shorthand=False, no_inversion=False, no_polychords=False): """Determine the type of seventh chord; return the results in a list, ordered on inversions. This function expects seventh to be a list of 4 notes. If shorthand is set to True, results will be returned in...
python
def determine_seventh(seventh, shorthand=False, no_inversion=False, no_polychords=False): """Determine the type of seventh chord; return the results in a list, ordered on inversions. This function expects seventh to be a list of 4 notes. If shorthand is set to True, results will be returned in...
[ "def", "determine_seventh", "(", "seventh", ",", "shorthand", "=", "False", ",", "no_inversion", "=", "False", ",", "no_polychords", "=", "False", ")", ":", "if", "len", "(", "seventh", ")", "!=", "4", ":", "# warning raise exception: seventh chord is not a sevent...
Determine the type of seventh chord; return the results in a list, ordered on inversions. This function expects seventh to be a list of 4 notes. If shorthand is set to True, results will be returned in chord shorthand ('Cmin7', etc.); inversions will be dropped in that case. Example: >>> dete...
[ "Determine", "the", "type", "of", "seventh", "chord", ";", "return", "the", "results", "in", "a", "list", "ordered", "on", "inversions", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L927-L1019
3,479
bspaans/python-mingus
mingus/core/chords.py
determine_extended_chord5
def determine_extended_chord5(chord, shorthand=False, no_inversions=False, no_polychords=False): """Determine the names of an extended chord.""" if len(chord) != 5: # warning raise exeption: not an extended chord return False def inversion_exhauster(chord, shorthand, tries, result, ...
python
def determine_extended_chord5(chord, shorthand=False, no_inversions=False, no_polychords=False): """Determine the names of an extended chord.""" if len(chord) != 5: # warning raise exeption: not an extended chord return False def inversion_exhauster(chord, shorthand, tries, result, ...
[ "def", "determine_extended_chord5", "(", "chord", ",", "shorthand", "=", "False", ",", "no_inversions", "=", "False", ",", "no_polychords", "=", "False", ")", ":", "if", "len", "(", "chord", ")", "!=", "5", ":", "# warning raise exeption: not an extended chord", ...
Determine the names of an extended chord.
[ "Determine", "the", "names", "of", "an", "extended", "chord", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L1021-L1082
3,480
bspaans/python-mingus
mingus/core/chords.py
determine_extended_chord6
def determine_extended_chord6(chord, shorthand=False, no_inversions=False, no_polychords=False): """Determine the names of an 6 note chord.""" if len(chord) != 6: # warning raise exeption: not an extended chord return False def inversion_exhauster( chord, shorthand, ...
python
def determine_extended_chord6(chord, shorthand=False, no_inversions=False, no_polychords=False): """Determine the names of an 6 note chord.""" if len(chord) != 6: # warning raise exeption: not an extended chord return False def inversion_exhauster( chord, shorthand, ...
[ "def", "determine_extended_chord6", "(", "chord", ",", "shorthand", "=", "False", ",", "no_inversions", "=", "False", ",", "no_polychords", "=", "False", ")", ":", "if", "len", "(", "chord", ")", "!=", "6", ":", "# warning raise exeption: not an extended chord", ...
Determine the names of an 6 note chord.
[ "Determine", "the", "names", "of", "an", "6", "note", "chord", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L1084-L1140
3,481
bspaans/python-mingus
mingus/core/chords.py
determine_polychords
def determine_polychords(chord, shorthand=False): """Determine the polychords in chord. This function can handle anything from polychords based on two triads to 6 note extended chords. """ polychords = [] function_list = [determine_triad, determine_seventh, determine_ex...
python
def determine_polychords(chord, shorthand=False): """Determine the polychords in chord. This function can handle anything from polychords based on two triads to 6 note extended chords. """ polychords = [] function_list = [determine_triad, determine_seventh, determine_ex...
[ "def", "determine_polychords", "(", "chord", ",", "shorthand", "=", "False", ")", ":", "polychords", "=", "[", "]", "function_list", "=", "[", "determine_triad", ",", "determine_seventh", ",", "determine_extended_chord5", ",", "determine_extended_chord6", ",", "dete...
Determine the polychords in chord. This function can handle anything from polychords based on two triads to 6 note extended chords.
[ "Determine", "the", "polychords", "in", "chord", ".", "This", "function", "can", "handle", "anything", "from", "polychords", "based", "on", "two", "triads", "to", "6", "note", "extended", "chords", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L1197-L1231
3,482
bspaans/python-mingus
mingus/extra/lilypond.py
from_Note
def from_Note(note, process_octaves=True, standalone=True): """Get a Note object and return the LilyPond equivalent in a string. If process_octaves is set to False, all data regarding octaves will be ignored. If standalone is True, the result can be used by functions like to_png and will produce a vali...
python
def from_Note(note, process_octaves=True, standalone=True): """Get a Note object and return the LilyPond equivalent in a string. If process_octaves is set to False, all data regarding octaves will be ignored. If standalone is True, the result can be used by functions like to_png and will produce a vali...
[ "def", "from_Note", "(", "note", ",", "process_octaves", "=", "True", ",", "standalone", "=", "True", ")", ":", "# Throw exception", "if", "not", "hasattr", "(", "note", ",", "'name'", ")", ":", "return", "False", "# Lower the case of the name", "result", "=",...
Get a Note object and return the LilyPond equivalent in a string. If process_octaves is set to False, all data regarding octaves will be ignored. If standalone is True, the result can be used by functions like to_png and will produce a valid output. The argument is mostly here to let from_NoteContainer...
[ "Get", "a", "Note", "object", "and", "return", "the", "LilyPond", "equivalent", "in", "a", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/lilypond.py#L34-L70
3,483
bspaans/python-mingus
mingus/extra/lilypond.py
from_NoteContainer
def from_NoteContainer(nc, duration=None, standalone=True): """Get a NoteContainer object and return the LilyPond equivalent in a string. The second argument determining the duration of the NoteContainer is optional. When the standalone argument is True the result of this function can be used direc...
python
def from_NoteContainer(nc, duration=None, standalone=True): """Get a NoteContainer object and return the LilyPond equivalent in a string. The second argument determining the duration of the NoteContainer is optional. When the standalone argument is True the result of this function can be used direc...
[ "def", "from_NoteContainer", "(", "nc", ",", "duration", "=", "None", ",", "standalone", "=", "True", ")", ":", "# Throw exception", "if", "nc", "is", "not", "None", "and", "not", "hasattr", "(", "nc", ",", "'notes'", ")", ":", "return", "False", "# Retu...
Get a NoteContainer object and return the LilyPond equivalent in a string. The second argument determining the duration of the NoteContainer is optional. When the standalone argument is True the result of this function can be used directly by functions like to_png. It is mostly here to be used by f...
[ "Get", "a", "NoteContainer", "object", "and", "return", "the", "LilyPond", "equivalent", "in", "a", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/lilypond.py#L72-L116
3,484
bspaans/python-mingus
mingus/extra/lilypond.py
from_Bar
def from_Bar(bar, showkey=True, showtime=True): """Get a Bar object and return the LilyPond equivalent in a string. The showkey and showtime parameters can be set to determine whether the key and the time should be shown. """ # Throw exception if not hasattr(bar, 'bar'): return False ...
python
def from_Bar(bar, showkey=True, showtime=True): """Get a Bar object and return the LilyPond equivalent in a string. The showkey and showtime parameters can be set to determine whether the key and the time should be shown. """ # Throw exception if not hasattr(bar, 'bar'): return False ...
[ "def", "from_Bar", "(", "bar", ",", "showkey", "=", "True", ",", "showtime", "=", "True", ")", ":", "# Throw exception", "if", "not", "hasattr", "(", "bar", ",", "'bar'", ")", ":", "return", "False", "# Process the key", "if", "showkey", ":", "key_note", ...
Get a Bar object and return the LilyPond equivalent in a string. The showkey and showtime parameters can be set to determine whether the key and the time should be shown.
[ "Get", "a", "Bar", "object", "and", "return", "the", "LilyPond", "equivalent", "in", "a", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/lilypond.py#L118-L160
3,485
bspaans/python-mingus
mingus/extra/lilypond.py
from_Track
def from_Track(track): """Process a Track object and return the LilyPond equivalent in a string.""" # Throw exception if not hasattr(track, 'bars'): return False lastkey = Key('C') lasttime = (4, 4) # Handle the Bars: result = '' for bar in track.bars: if lastkey != bar....
python
def from_Track(track): """Process a Track object and return the LilyPond equivalent in a string.""" # Throw exception if not hasattr(track, 'bars'): return False lastkey = Key('C') lasttime = (4, 4) # Handle the Bars: result = '' for bar in track.bars: if lastkey != bar....
[ "def", "from_Track", "(", "track", ")", ":", "# Throw exception", "if", "not", "hasattr", "(", "track", ",", "'bars'", ")", ":", "return", "False", "lastkey", "=", "Key", "(", "'C'", ")", "lasttime", "=", "(", "4", ",", "4", ")", "# Handle the Bars:", ...
Process a Track object and return the LilyPond equivalent in a string.
[ "Process", "a", "Track", "object", "and", "return", "the", "LilyPond", "equivalent", "in", "a", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/lilypond.py#L162-L184
3,486
bspaans/python-mingus
mingus/extra/lilypond.py
from_Composition
def from_Composition(composition): """Return the LilyPond equivalent of a Composition in a string.""" # warning Throw exception if not hasattr(composition, 'tracks'): return False result = '\\header { title = "%s" composer = "%s" opus = "%s" } '\ % (composition.title, composition.author...
python
def from_Composition(composition): """Return the LilyPond equivalent of a Composition in a string.""" # warning Throw exception if not hasattr(composition, 'tracks'): return False result = '\\header { title = "%s" composer = "%s" opus = "%s" } '\ % (composition.title, composition.author...
[ "def", "from_Composition", "(", "composition", ")", ":", "# warning Throw exception", "if", "not", "hasattr", "(", "composition", ",", "'tracks'", ")", ":", "return", "False", "result", "=", "'\\\\header { title = \"%s\" composer = \"%s\" opus = \"%s\" } '", "%", "(", "...
Return the LilyPond equivalent of a Composition in a string.
[ "Return", "the", "LilyPond", "equivalent", "of", "a", "Composition", "in", "a", "string", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/lilypond.py#L186-L195
3,487
bspaans/python-mingus
mingus/extra/lilypond.py
save_string_and_execute_LilyPond
def save_string_and_execute_LilyPond(ly_string, filename, command): """A helper function for to_png and to_pdf. Should not be used directly.""" ly_string = '\\version "2.10.33"\n' + ly_string if filename[-4:] in ['.pdf', '.png']: filename = filename[:-4] try: f = open(filename + '.ly', '...
python
def save_string_and_execute_LilyPond(ly_string, filename, command): """A helper function for to_png and to_pdf. Should not be used directly.""" ly_string = '\\version "2.10.33"\n' + ly_string if filename[-4:] in ['.pdf', '.png']: filename = filename[:-4] try: f = open(filename + '.ly', '...
[ "def", "save_string_and_execute_LilyPond", "(", "ly_string", ",", "filename", ",", "command", ")", ":", "ly_string", "=", "'\\\\version \"2.10.33\"\\n'", "+", "ly_string", "if", "filename", "[", "-", "4", ":", "]", "in", "[", "'.pdf'", ",", "'.png'", "]", ":",...
A helper function for to_png and to_pdf. Should not be used directly.
[ "A", "helper", "function", "for", "to_png", "and", "to_pdf", ".", "Should", "not", "be", "used", "directly", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/lilypond.py#L214-L229
3,488
bspaans/python-mingus
mingus/core/value.py
determine
def determine(value): """Analyse the value and return a tuple containing the parts it's made of. The tuple respectively consists of the base note value, the number of dots, and the ratio (see tuplet). Examples: >>> determine(8) (8, 0, 1, 1) >>> determine(12) (8, 0, 3, 2) >>> determ...
python
def determine(value): """Analyse the value and return a tuple containing the parts it's made of. The tuple respectively consists of the base note value, the number of dots, and the ratio (see tuplet). Examples: >>> determine(8) (8, 0, 1, 1) >>> determine(12) (8, 0, 3, 2) >>> determ...
[ "def", "determine", "(", "value", ")", ":", "i", "=", "-", "2", "for", "v", "in", "base_values", ":", "if", "value", "==", "v", ":", "return", "(", "value", ",", "0", ",", "1", ",", "1", ")", "if", "value", "<", "v", ":", "break", "i", "+=", ...
Analyse the value and return a tuple containing the parts it's made of. The tuple respectively consists of the base note value, the number of dots, and the ratio (see tuplet). Examples: >>> determine(8) (8, 0, 1, 1) >>> determine(12) (8, 0, 3, 2) >>> determine(14) (8, 0, 7, 4) ...
[ "Analyse", "the", "value", "and", "return", "a", "tuple", "containing", "the", "parts", "it", "s", "made", "of", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/value.py#L230-L274
3,489
bspaans/python-mingus
mingus/midi/fluidsynth.py
init
def init(sf2, driver=None, file=None): """Initialize the audio. Return True on success, False on failure. This function needs to be called before you can have any audio. The sf2 argument should be the location of a valid soundfont file. The optional driver argument can be any of 'alsa', 'oss', '...
python
def init(sf2, driver=None, file=None): """Initialize the audio. Return True on success, False on failure. This function needs to be called before you can have any audio. The sf2 argument should be the location of a valid soundfont file. The optional driver argument can be any of 'alsa', 'oss', '...
[ "def", "init", "(", "sf2", ",", "driver", "=", "None", ",", "file", "=", "None", ")", ":", "global", "midi", ",", "initialized", "if", "not", "initialized", ":", "if", "file", "is", "not", "None", ":", "midi", ".", "start_recording", "(", "file", ")"...
Initialize the audio. Return True on success, False on failure. This function needs to be called before you can have any audio. The sf2 argument should be the location of a valid soundfont file. The optional driver argument can be any of 'alsa', 'oss', 'jack', 'portaudio', 'sndmgr', 'coreaudio' ...
[ "Initialize", "the", "audio", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/fluidsynth.py#L105-L130
3,490
bspaans/python-mingus
mingus/midi/fluidsynth.py
FluidSynthSequencer.start_recording
def start_recording(self, file='mingus_dump.wav'): """Initialize a new wave file for recording.""" w = wave.open(file, 'wb') w.setnchannels(2) w.setsampwidth(2) w.setframerate(44100) self.wav = w
python
def start_recording(self, file='mingus_dump.wav'): """Initialize a new wave file for recording.""" w = wave.open(file, 'wb') w.setnchannels(2) w.setsampwidth(2) w.setframerate(44100) self.wav = w
[ "def", "start_recording", "(", "self", ",", "file", "=", "'mingus_dump.wav'", ")", ":", "w", "=", "wave", ".", "open", "(", "file", ",", "'wb'", ")", "w", ".", "setnchannels", "(", "2", ")", "w", ".", "setsampwidth", "(", "2", ")", "w", ".", "setfr...
Initialize a new wave file for recording.
[ "Initialize", "a", "new", "wave", "file", "for", "recording", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/fluidsynth.py#L61-L67
3,491
bspaans/python-mingus
mingus/midi/fluidsynth.py
FluidSynthSequencer.load_sound_font
def load_sound_font(self, sf2): """Load a sound font. Return True on success, False on failure. This function should be called before your audio can be played, since the instruments are kept in the sf2 file. """ self.sfid = self.fs.sfload(sf2) return not self.sf...
python
def load_sound_font(self, sf2): """Load a sound font. Return True on success, False on failure. This function should be called before your audio can be played, since the instruments are kept in the sf2 file. """ self.sfid = self.fs.sfload(sf2) return not self.sf...
[ "def", "load_sound_font", "(", "self", ",", "sf2", ")", ":", "self", ".", "sfid", "=", "self", ".", "fs", ".", "sfload", "(", "sf2", ")", "return", "not", "self", ".", "sfid", "==", "-", "1" ]
Load a sound font. Return True on success, False on failure. This function should be called before your audio can be played, since the instruments are kept in the sf2 file.
[ "Load", "a", "sound", "font", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/fluidsynth.py#L69-L78
3,492
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.create
def create(self, group_type, config_file, group_name=None, region=None, profile_name=None): """ Create a Greengrass group in the given region. :param group_type: the type of group to create. Must match a `key` in the `group_types` dict :param config_file: conf...
python
def create(self, group_type, config_file, group_name=None, region=None, profile_name=None): """ Create a Greengrass group in the given region. :param group_type: the type of group to create. Must match a `key` in the `group_types` dict :param config_file: conf...
[ "def", "create", "(", "self", ",", "group_type", ",", "config_file", ",", "group_name", "=", "None", ",", "region", "=", "None", ",", "profile_name", "=", "None", ")", ":", "logging", ".", "info", "(", "\"[begin] create command using group_types:{0}\"", ".", "...
Create a Greengrass group in the given region. :param group_type: the type of group to create. Must match a `key` in the `group_types` dict :param config_file: config file of the group to create :param group_name: the name of the group. If no name is given, then group_ty...
[ "Create", "a", "Greengrass", "group", "in", "the", "given", "region", "." ]
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L73-L180
3,493
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands._create_subscription_definition
def _create_subscription_definition(gg_client, group_type, config): """ Configure routing subscriptions for a Greengrass group. group_type: either default or an overridden group type config: GroupConfigFile object used for routing subscriptions """ logging.info('[begin] ...
python
def _create_subscription_definition(gg_client, group_type, config): """ Configure routing subscriptions for a Greengrass group. group_type: either default or an overridden group type config: GroupConfigFile object used for routing subscriptions """ logging.info('[begin] ...
[ "def", "_create_subscription_definition", "(", "gg_client", ",", "group_type", ",", "config", ")", ":", "logging", ".", "info", "(", "'[begin] Configuring routing subscriptions'", ")", "sub_info", "=", "gg_client", ".", "create_subscription_definition", "(", "Name", "="...
Configure routing subscriptions for a Greengrass group. group_type: either default or an overridden group type config: GroupConfigFile object used for routing subscriptions
[ "Configure", "routing", "subscriptions", "for", "a", "Greengrass", "group", "." ]
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L321-L352
3,494
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.clean_core
def clean_core(self, config_file, region=None, profile_name=None): """ Clean all Core related provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the core to clean :param region: the region in which the core s...
python
def clean_core(self, config_file, region=None, profile_name=None): """ Clean all Core related provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the core to clean :param region: the region in which the core s...
[ "def", "clean_core", "(", "self", ",", "config_file", ",", "region", "=", "None", ",", "profile_name", "=", "None", ")", ":", "config", "=", "GroupConfigFile", "(", "config_file", "=", "config_file", ")", "if", "region", "is", "None", ":", "region", "=", ...
Clean all Core related provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the core to clean :param region: the region in which the core should be cleaned. [default: us-west-2] :param profile_name: the nam...
[ "Clean", "all", "Core", "related", "provisioned", "artifacts", "from", "both", "the", "local", "file", "and", "the", "AWS", "Greengrass", "service", "." ]
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L490-L518
3,495
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.clean_devices
def clean_devices(self, config_file, region=None, profile_name=None): """ Clean all device related provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the devices to clean :param region: the region in which th...
python
def clean_devices(self, config_file, region=None, profile_name=None): """ Clean all device related provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the devices to clean :param region: the region in which th...
[ "def", "clean_devices", "(", "self", ",", "config_file", ",", "region", "=", "None", ",", "profile_name", "=", "None", ")", ":", "config", "=", "GroupConfigFile", "(", "config_file", "=", "config_file", ")", "if", "region", "is", "None", ":", "region", "="...
Clean all device related provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the devices to clean :param region: the region in which the devices should be cleaned. [default: us-west-2] :param profile_name:...
[ "Clean", "all", "device", "related", "provisioned", "artifacts", "from", "both", "the", "local", "file", "and", "the", "AWS", "Greengrass", "service", "." ]
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L520-L549
3,496
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.clean_file
def clean_file(config_file): """ Clean all provisioned artifacts from the local config file. :param config_file: config file of the group to clean """ logging.info('[begin] Cleaning config file') config = GroupConfigFile(config_file=config_file) if config.is_fre...
python
def clean_file(config_file): """ Clean all provisioned artifacts from the local config file. :param config_file: config file of the group to clean """ logging.info('[begin] Cleaning config file') config = GroupConfigFile(config_file=config_file) if config.is_fre...
[ "def", "clean_file", "(", "config_file", ")", ":", "logging", ".", "info", "(", "'[begin] Cleaning config file'", ")", "config", "=", "GroupConfigFile", "(", "config_file", "=", "config_file", ")", "if", "config", ".", "is_fresh", "(", ")", "is", "True", ":", ...
Clean all provisioned artifacts from the local config file. :param config_file: config file of the group to clean
[ "Clean", "all", "provisioned", "artifacts", "from", "the", "local", "config", "file", "." ]
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L552-L564
3,497
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.clean_all
def clean_all(self, config_file, region=None, profile_name=None): """ Clean all provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the group to clean :param region: the region in which the group should be cle...
python
def clean_all(self, config_file, region=None, profile_name=None): """ Clean all provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the group to clean :param region: the region in which the group should be cle...
[ "def", "clean_all", "(", "self", ",", "config_file", ",", "region", "=", "None", ",", "profile_name", "=", "None", ")", ":", "logging", ".", "info", "(", "'[begin] Cleaning all provisioned artifacts'", ")", "config", "=", "GroupConfigFile", "(", "config_file", "...
Clean all provisioned artifacts from both the local file and the AWS Greengrass service. :param config_file: config file containing the group to clean :param region: the region in which the group should be cleaned. [default: us-west-2] :param profile_name: the name of the `a...
[ "Clean", "all", "provisioned", "artifacts", "from", "both", "the", "local", "file", "and", "the", "AWS", "Greengrass", "service", "." ]
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L566-L591
3,498
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.deploy
def deploy(self, config_file, region=None, profile_name=None): """ Deploy the configuration and Lambda functions of a Greengrass group to the Greengrass core contained in the group. :param config_file: config file of the group to deploy :param region: the region from which to de...
python
def deploy(self, config_file, region=None, profile_name=None): """ Deploy the configuration and Lambda functions of a Greengrass group to the Greengrass core contained in the group. :param config_file: config file of the group to deploy :param region: the region from which to de...
[ "def", "deploy", "(", "self", ",", "config_file", ",", "region", "=", "None", ",", "profile_name", "=", "None", ")", ":", "config", "=", "GroupConfigFile", "(", "config_file", "=", "config_file", ")", "if", "config", ".", "is_fresh", "(", ")", ":", "rais...
Deploy the configuration and Lambda functions of a Greengrass group to the Greengrass core contained in the group. :param config_file: config file of the group to deploy :param region: the region from which to deploy the group. :param profile_name: the name of the `awscli` profile to us...
[ "Deploy", "the", "configuration", "and", "Lambda", "functions", "of", "a", "Greengrass", "group", "to", "the", "Greengrass", "core", "contained", "in", "the", "group", "." ]
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L593-L619
3,499
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.create_core
def create_core(self, thing_name, config_file, region=None, cert_dir=None, account_id=None, policy_name='ggc-default-policy', profile_name=None): """ Using the `thing_name` value, creates a Thing in AWS IoT, attaches and downloads new keys & certs to the c...
python
def create_core(self, thing_name, config_file, region=None, cert_dir=None, account_id=None, policy_name='ggc-default-policy', profile_name=None): """ Using the `thing_name` value, creates a Thing in AWS IoT, attaches and downloads new keys & certs to the c...
[ "def", "create_core", "(", "self", ",", "thing_name", ",", "config_file", ",", "region", "=", "None", ",", "cert_dir", "=", "None", ",", "account_id", "=", "None", ",", "policy_name", "=", "'ggc-default-policy'", ",", "profile_name", "=", "None", ")", ":", ...
Using the `thing_name` value, creates a Thing in AWS IoT, attaches and downloads new keys & certs to the certificate directory, then records the created information in the local config file for inclusion in the Greengrass Group as a Greengrass Core. :param thing_name: the name of the th...
[ "Using", "the", "thing_name", "value", "creates", "a", "Thing", "in", "AWS", "IoT", "attaches", "and", "downloads", "new", "keys", "&", "certs", "to", "the", "certificate", "directory", "then", "records", "the", "created", "information", "in", "the", "local", ...
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L679-L733