hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
add_event
null
def add_event(self, event, index): """ Adds an event at the given index. We use the accumulated time from the events before us to determine the start time. :param event: Event to add :type event: BaseEvent :param index: Index to add the event to :type index: in...
Adds an event at the given index. We use the accumulated time from the events before us to determine the start time. :param event: Event to add :type event: BaseEvent :param index: Index to add the event to :type index: int
Adds an event at the given index. We use the accumulated time from the events before us to determine the start time.
[ "Adds", "an", "event", "at", "the", "given", "index", ".", "We", "use", "the", "accumulated", "time", "from", "the", "events", "before", "us", "to", "determine", "the", "start", "time", "." ]
def add_event(self, event, index): event._bind(self, self.seq) if index == -1: self.events.append(event) index = len(self.events) - 1 else: self.events.insert(index, event) event._set_start(self._get_acctime(index))
[ "def", "add_event", "(", "self", ",", "event", ",", "index", ")", ":", "event", ".", "_bind", "(", "self", ",", "self", ".", "seq", ")", "if", "index", "==", "-", "1", ":", "self", ".", "events", ".", "append", "(", "event", ")", "index", "=", ...
Adds an event at the given index.
[ "Adds", "an", "event", "at", "the", "given", "index", "." ]
[ "\"\"\"\n Adds an event at the given index.\n\n We use the accumulated time from the events before us to determine the start time.\n\n :param event: Event to add\n :type event: BaseEvent\n :param index: Index to add the event to\n :type index: int\n \"\"\"", "# Bin...
[ { "param": "self", "type": null }, { "param": "event", "type": null }, { "param": "index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "event", "type": null, "docstring": "Event to add", "docstring...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
_get_acctime
<not_specific>
def _get_acctime(self, index): """ Gets the accumulated time at the given index. The accumulated time is the total time elapsed in the events before us. We simply get the stop time for the event directly behind us in the event list. :param index: Index to get the accum...
Gets the accumulated time at the given index. The accumulated time is the total time elapsed in the events before us. We simply get the stop time for the event directly behind us in the event list. :param index: Index to get the accumulated time for :type index: int
Gets the accumulated time at the given index. The accumulated time is the total time elapsed in the events before us. We simply get the stop time for the event directly behind us in the event list.
[ "Gets", "the", "accumulated", "time", "at", "the", "given", "index", ".", "The", "accumulated", "time", "is", "the", "total", "time", "elapsed", "in", "the", "events", "before", "us", ".", "We", "simply", "get", "the", "stop", "time", "for", "the", "even...
def _get_acctime(self, index): if index == 0: return 0 return self.events[index-1].time_stop
[ "def", "_get_acctime", "(", "self", ",", "index", ")", ":", "if", "index", "==", "0", ":", "return", "0", "return", "self", ".", "events", "[", "index", "-", "1", "]", ".", "time_stop" ]
Gets the accumulated time at the given index.
[ "Gets", "the", "accumulated", "time", "at", "the", "given", "index", "." ]
[ "\"\"\"\n Gets the accumulated time at the given index.\n\n The accumulated time is the total time elapsed in the events before us.\n We simply get the stop time for the event directly behind us in the event list.\n\n :param index: Index to get the accumulated time for\n :type ind...
[ { "param": "self", "type": null }, { "param": "index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": null, "docstring": "Index to get the accumulated ti...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
run
<not_specific>
def run(self, time): """ Runs the given commands, and starts manipulating the sequencer. We run ALL events that are less than the given time value, and that are more than our current index. We also add the offset to the start time, as it will be used to support features...
Runs the given commands, and starts manipulating the sequencer. We run ALL events that are less than the given time value, and that are more than our current index. We also add the offset to the start time, as it will be used to support features like repeating. Normall...
Runs the given commands, and starts manipulating the sequencer. We run ALL events that are less than the given time value, and that are more than our current index. We also add the offset to the start time, as it will be used to support features like repeating. Normally, we return True when we have done our work. When...
[ "Runs", "the", "given", "commands", "and", "starts", "manipulating", "the", "sequencer", ".", "We", "run", "ALL", "events", "that", "are", "less", "than", "the", "given", "time", "value", "and", "that", "are", "more", "than", "our", "current", "index", "."...
def run(self, time): events = 0 for event in self.events[self.index:]: if event.time_start + self.offset < time: event.run() events += 1 continue self.index += events print("New index: {}".format(self.index)) ...
[ "def", "run", "(", "self", ",", "time", ")", ":", "events", "=", "0", "for", "event", "in", "self", ".", "events", "[", "self", ".", "index", ":", "]", ":", "if", "event", ".", "time_start", "+", "self", ".", "offset", "<", "time", ":", "event", ...
Runs the given commands, and starts manipulating the sequencer.
[ "Runs", "the", "given", "commands", "and", "starts", "manipulating", "the", "sequencer", "." ]
[ "\"\"\"\n Runs the given commands, and starts manipulating the sequencer.\n\n We run ALL events that are less than the given time value,\n and that are more than our current index.\n We also add the offset to the start time,\n as it will be used to support features like repeating....
[ { "param": "self", "type": null }, { "param": "time", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "time", "type": null, "docstring": "Time value, all events less than...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
note
null
def note(self, num, length, index=-1, name=None): """ We schedule a note event with the given note number, length, and index of the event to add. The 'num' parameter can be a integer, or a 'Note' object. If it is an integer, then it will be converted into a note. The '...
We schedule a note event with the given note number, length, and index of the event to add. The 'num' parameter can be a integer, or a 'Note' object. If it is an integer, then it will be converted into a note. The 'length' is the length of the note. We will block and r...
We schedule a note event with the given note number, length, and index of the event to add. The 'num' parameter can be a integer, or a 'Note' object. If it is an integer, then it will be converted into a note. The 'length' is the length of the note. We will block and remove the note at the end of this time. Index is...
[ "We", "schedule", "a", "note", "event", "with", "the", "given", "note", "number", "length", "and", "index", "of", "the", "event", "to", "add", ".", "The", "'", "num", "'", "parameter", "can", "be", "a", "integer", "or", "a", "'", "Note", "'", "object...
def note(self, num, length, index=-1, name=None): if type(num) != Note: num = Note.from_num(num) self.add_event(NoteOn(num, length, name=name), index)
[ "def", "note", "(", "self", ",", "num", ",", "length", ",", "index", "=", "-", "1", ",", "name", "=", "None", ")", ":", "if", "type", "(", "num", ")", "!=", "Note", ":", "num", "=", "Note", ".", "from_num", "(", "num", ")", "self", ".", "add_...
We schedule a note event with the given note number, length, and index of the event to add.
[ "We", "schedule", "a", "note", "event", "with", "the", "given", "note", "number", "length", "and", "index", "of", "the", "event", "to", "add", "." ]
[ "\"\"\"\n We schedule a note event with the given note number,\n length, and index of the event to add.\n\n The 'num' parameter can be a integer, or a 'Note' object.\n If it is an integer, then it will be converted into a note.\n\n The 'length' is the length of the note.\n ...
[ { "param": "self", "type": null }, { "param": "num", "type": null }, { "param": "length", "type": null }, { "param": "index", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num", "type": null, "docstring": "Number of the note to play", ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
add_event
<not_specific>
def add_event(self, event, index): """ Adds an event at the given index. We also append this object, s well as the sequencer instance. :param event: Event to add :type event: BaseCommand :param index: Index to add the event to :type index: int "...
Adds an event at the given index. We also append this object, s well as the sequencer instance. :param event: Event to add :type event: BaseCommand :param index: Index to add the event to :type index: int
Adds an event at the given index. We also append this object, s well as the sequencer instance.
[ "Adds", "an", "event", "at", "the", "given", "index", ".", "We", "also", "append", "this", "object", "s", "well", "as", "the", "sequencer", "instance", "." ]
def add_event(self, event, index): event._bind(self, self.seq) if index == -1: self.events.append(event) return self.events.insert(index, event)
[ "def", "add_event", "(", "self", ",", "event", ",", "index", ")", ":", "event", ".", "_bind", "(", "self", ",", "self", ".", "seq", ")", "if", "index", "==", "-", "1", ":", "self", ".", "events", ".", "append", "(", "event", ")", "return", "self"...
Adds an event at the given index.
[ "Adds", "an", "event", "at", "the", "given", "index", "." ]
[ "\"\"\"\n Adds an event at the given index.\n\n We also append this object,\n s well as the sequencer instance.\n\n :param event: Event to add\n :type event: BaseCommand\n :param index: Index to add the event to\n :type index: int\n \"\"\"", "# Bind info to ...
[ { "param": "self", "type": null }, { "param": "event", "type": null }, { "param": "index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "event", "type": null, "docstring": "Event to add", "docstring...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
run
null
def run(self, cond=True): """ Runs the sequencer commands, and start manipulating the sequencer. This is a blocking function, and we will block until we reach then end. This should be called when the events are setup and configured. You can also pass a conditi...
Runs the sequencer commands, and start manipulating the sequencer. This is a blocking function, and we will block until we reach then end. This should be called when the events are setup and configured. You can also pass a conditional to determine when we stop. ...
Runs the sequencer commands, and start manipulating the sequencer. This is a blocking function, and we will block until we reach then end. This should be called when the events are setup and configured. You can also pass a conditional to determine when we stop. Once this value becomes False, then we will stop our co...
[ "Runs", "the", "sequencer", "commands", "and", "start", "manipulating", "the", "sequencer", ".", "This", "is", "a", "blocking", "function", "and", "we", "will", "block", "until", "we", "reach", "then", "end", ".", "This", "should", "be", "called", "when", ...
def run(self, cond=True): while self.index < len(self.events) and cond: self.events[self.index].run() self.index += 1
[ "def", "run", "(", "self", ",", "cond", "=", "True", ")", ":", "while", "self", ".", "index", "<", "len", "(", "self", ".", "events", ")", "and", "cond", ":", "self", ".", "events", "[", "self", ".", "index", "]", ".", "run", "(", ")", "self", ...
Runs the sequencer commands, and start manipulating the sequencer.
[ "Runs", "the", "sequencer", "commands", "and", "start", "manipulating", "the", "sequencer", "." ]
[ "\"\"\"\n Runs the sequencer commands,\n and start manipulating the sequencer.\n\n This is a blocking function,\n and we will block until we reach then end.\n\n This should be called when the events are setup and configured.\n\n You can also pass a conditional to determine ...
[ { "param": "self", "type": null }, { "param": "cond", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cond", "type": null, "docstring": "Conditional to check after each ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
lookahead_ms
null
def lookahead_ms(self, look): """ Sets the lookahead using the given value in microseconds. We automatically convert the microseconds into nanoseconds, as this sequencer works with nanoseconds. """ self.lookahead = look * 1000000
Sets the lookahead using the given value in microseconds. We automatically convert the microseconds into nanoseconds, as this sequencer works with nanoseconds.
Sets the lookahead using the given value in microseconds. We automatically convert the microseconds into nanoseconds, as this sequencer works with nanoseconds.
[ "Sets", "the", "lookahead", "using", "the", "given", "value", "in", "microseconds", ".", "We", "automatically", "convert", "the", "microseconds", "into", "nanoseconds", "as", "this", "sequencer", "works", "with", "nanoseconds", "." ]
def lookahead_ms(self, look): self.lookahead = look * 1000000
[ "def", "lookahead_ms", "(", "self", ",", "look", ")", ":", "self", ".", "lookahead", "=", "look", "*", "1000000" ]
Sets the lookahead using the given value in microseconds.
[ "Sets", "the", "lookahead", "using", "the", "given", "value", "in", "microseconds", "." ]
[ "\"\"\"\n Sets the lookahead using the given value in microseconds.\n\n We automatically convert the microseconds into nanoseconds,\n as this sequencer works with nanoseconds.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "look", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "look", "type": null, "docstring": null, "docstring_tokens": [...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
interval_ms
null
def interval_ms(self, wait): """ Sets the waiting interval using the given value in microseconds. We automatically convert the microseconds into seconds, as this is what time.sleep() understands. """ self.interval = wait / 1000
Sets the waiting interval using the given value in microseconds. We automatically convert the microseconds into seconds, as this is what time.sleep() understands.
Sets the waiting interval using the given value in microseconds. We automatically convert the microseconds into seconds, as this is what time.sleep() understands.
[ "Sets", "the", "waiting", "interval", "using", "the", "given", "value", "in", "microseconds", ".", "We", "automatically", "convert", "the", "microseconds", "into", "seconds", "as", "this", "is", "what", "time", ".", "sleep", "()", "understands", "." ]
def interval_ms(self, wait): self.interval = wait / 1000
[ "def", "interval_ms", "(", "self", ",", "wait", ")", ":", "self", ".", "interval", "=", "wait", "/", "1000" ]
Sets the waiting interval using the given value in microseconds.
[ "Sets", "the", "waiting", "interval", "using", "the", "given", "value", "in", "microseconds", "." ]
[ "\"\"\"\n Sets the waiting interval using the given value in microseconds.\n\n We automatically convert the microseconds into seconds,\n as this is what time.sleep() understands.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "wait", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "wait", "type": null, "docstring": null, "docstring_tokens": [...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
start
null
def start(self): """ Starts the sequencer, control thread, and bound modules. """ # Start each component: self._input.running = True self._input.start() self._decoder.running = True self._decoder.start() # Start the control thread; se...
Starts the sequencer, control thread, and bound modules.
Starts the sequencer, control thread, and bound modules.
[ "Starts", "the", "sequencer", "control", "thread", "and", "bound", "modules", "." ]
def start(self): self._input.running = True self._input.start() self._decoder.running = True self._decoder.start() self.thread = threading.Thread(target=self._input.run) self.thread.daemon = True self.thread.start()
[ "def", "start", "(", "self", ")", ":", "self", ".", "_input", ".", "running", "=", "True", "self", ".", "_input", ".", "start", "(", ")", "self", ".", "_decoder", ".", "running", "=", "True", "self", ".", "_decoder", ".", "start", "(", ")", "self",...
Starts the sequencer, control thread, and bound modules.
[ "Starts", "the", "sequencer", "control", "thread", "and", "bound", "modules", "." ]
[ "\"\"\"\n Starts the sequencer, control thread, and bound modules.\n \"\"\"", "# Start each component:", "# Start the control thread;" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
stop
null
def stop(self): """ Stops the sequencer, control thread, and bound modules. """ self.running = False # Stop the modules: self._input.running = False self._decoder.running = False self._input.stop() self._decoder.stop() # Stop the runn...
Stops the sequencer, control thread, and bound modules.
Stops the sequencer, control thread, and bound modules.
[ "Stops", "the", "sequencer", "control", "thread", "and", "bound", "modules", "." ]
def stop(self): self.running = False self._input.running = False self._decoder.running = False self._input.stop() self._decoder.stop() self.stop_all()
[ "def", "stop", "(", "self", ")", ":", "self", ".", "running", "=", "False", "self", ".", "_input", ".", "running", "=", "False", "self", ".", "_decoder", ".", "running", "=", "False", "self", ".", "_input", ".", "stop", "(", ")", "self", ".", "_dec...
Stops the sequencer, control thread, and bound modules.
[ "Stops", "the", "sequencer", "control", "thread", "and", "bound", "modules", "." ]
[ "\"\"\"\n Stops the sequencer, control thread, and bound modules.\n \"\"\"", "# Stop the modules:", "# Stop the running synths:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
join
null
def join(self): """ Joins all the track threads, and blocks until each of them are done. """ self.thread.join()
Joins all the track threads, and blocks until each of them are done.
Joins all the track threads, and blocks until each of them are done.
[ "Joins", "all", "the", "track", "threads", "and", "blocks", "until", "each", "of", "them", "are", "done", "." ]
def join(self): self.thread.join()
[ "def", "join", "(", "self", ")", ":", "self", ".", "thread", ".", "join", "(", ")" ]
Joins all the track threads, and blocks until each of them are done.
[ "Joins", "all", "the", "track", "threads", "and", "blocks", "until", "each", "of", "them", "are", "done", "." ]
[ "\"\"\"\n Joins all the track threads,\n and blocks until each of them are done.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
bind_input
null
def bind_input(self, inp): """ Binds a given input module to this sequencer. We do a brief check to make sure that they inherit BaseInput. :param inp: Input module to add :type inp: BaseInput """ # Check if given input module is valid: assert isinstan...
Binds a given input module to this sequencer. We do a brief check to make sure that they inherit BaseInput. :param inp: Input module to add :type inp: BaseInput
Binds a given input module to this sequencer. We do a brief check to make sure that they inherit BaseInput.
[ "Binds", "a", "given", "input", "module", "to", "this", "sequencer", ".", "We", "do", "a", "brief", "check", "to", "make", "sure", "that", "they", "inherit", "BaseInput", "." ]
def bind_input(self, inp): assert isinstance(inp, BaseInput), "Given input module MUST inherit BaseInput!" self._input = inp self._bind_comps()
[ "def", "bind_input", "(", "self", ",", "inp", ")", ":", "assert", "isinstance", "(", "inp", ",", "BaseInput", ")", ",", "\"Given input module MUST inherit BaseInput!\"", "self", ".", "_input", "=", "inp", "self", ".", "_bind_comps", "(", ")" ]
Binds a given input module to this sequencer.
[ "Binds", "a", "given", "input", "module", "to", "this", "sequencer", "." ]
[ "\"\"\"\n Binds a given input module to this sequencer.\n\n We do a brief check to make sure that they inherit BaseInput.\n\n :param inp: Input module to add\n :type inp: BaseInput\n \"\"\"", "# Check if given input module is valid:", "# Valid class! Lets bind this module to u...
[ { "param": "self", "type": null }, { "param": "inp", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "inp", "type": null, "docstring": "Input module to add", "docs...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
add_seqcom
null
def add_seqcom(self, com): """ Adds the given SeqCommand instance to this sequencer. If we are ever invoked, then we will run each SeqCommand in our collection. We do a quick check to make sure the thing we are adding is a SeqCommand. :param com: SeqCommand instance ...
Adds the given SeqCommand instance to this sequencer. If we are ever invoked, then we will run each SeqCommand in our collection. We do a quick check to make sure the thing we are adding is a SeqCommand. :param com: SeqCommand instance to add :type com: SeqCommand ...
Adds the given SeqCommand instance to this sequencer. If we are ever invoked, then we will run each SeqCommand in our collection. We do a quick check to make sure the thing we are adding is a SeqCommand.
[ "Adds", "the", "given", "SeqCommand", "instance", "to", "this", "sequencer", ".", "If", "we", "are", "ever", "invoked", "then", "we", "will", "run", "each", "SeqCommand", "in", "our", "collection", ".", "We", "do", "a", "quick", "check", "to", "make", "s...
def add_seqcom(self, com): assert isinstance(com, SeqCommand), "Given command chain MUST inherit SeqCommand!" self._coms.append(com)
[ "def", "add_seqcom", "(", "self", ",", "com", ")", ":", "assert", "isinstance", "(", "com", ",", "SeqCommand", ")", ",", "\"Given command chain MUST inherit SeqCommand!\"", "self", ".", "_coms", ".", "append", "(", "com", ")" ]
Adds the given SeqCommand instance to this sequencer.
[ "Adds", "the", "given", "SeqCommand", "instance", "to", "this", "sequencer", "." ]
[ "\"\"\"\n Adds the given SeqCommand instance to this sequencer.\n\n If we are ever invoked, \n then we will run each SeqCommand in our collection.\n\n We do a quick check to make sure the thing we are adding is a SeqCommand.\n\n :param com: SeqCommand instance to add\n :typ...
[ { "param": "self", "type": null }, { "param": "com", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "com", "type": null, "docstring": "SeqCommand instance to add", ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
bind_decoder
null
def bind_decoder(self, dec): """ Binds a given decoder to this sequencer. We do a brief check to make sure that they inherit BaseDecoder :param dec: Decoder module to add :type dec: BaseDecoder """ # Check if given input module is valid: assert isins...
Binds a given decoder to this sequencer. We do a brief check to make sure that they inherit BaseDecoder :param dec: Decoder module to add :type dec: BaseDecoder
Binds a given decoder to this sequencer. We do a brief check to make sure that they inherit BaseDecoder
[ "Binds", "a", "given", "decoder", "to", "this", "sequencer", ".", "We", "do", "a", "brief", "check", "to", "make", "sure", "that", "they", "inherit", "BaseDecoder" ]
def bind_decoder(self, dec): assert isinstance(dec, BaseDecoder), "Given decoder module MUST inherit BaseDecoder!" self._decoder = dec self._bind_comps()
[ "def", "bind_decoder", "(", "self", ",", "dec", ")", ":", "assert", "isinstance", "(", "dec", ",", "BaseDecoder", ")", ",", "\"Given decoder module MUST inherit BaseDecoder!\"", "self", ".", "_decoder", "=", "dec", "self", ".", "_bind_comps", "(", ")" ]
Binds a given decoder to this sequencer.
[ "Binds", "a", "given", "decoder", "to", "this", "sequencer", "." ]
[ "\"\"\"\n Binds a given decoder to this sequencer.\n\n We do a brief check to make sure that they inherit BaseDecoder\n\n :param dec: Decoder module to add\n :type dec: BaseDecoder\n \"\"\"", "# Check if given input module is valid:", "# Valid class! Lets bind this module to ...
[ { "param": "self", "type": null }, { "param": "dec", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dec", "type": null, "docstring": "Decoder module to add", "do...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
add_synth
null
def add_synth(self, synth, name=None, notes=None): """ Adds the given synth(Or synth collection) to the sequencer. You can specify the notes to add, which should be in a list in 'notes'. If no notes are specified, then this synth will be made the default synth for this name. If...
Adds the given synth(Or synth collection) to the sequencer. You can specify the notes to add, which should be in a list in 'notes'. If no notes are specified, then this synth will be made the default synth for this name. If the sequencer attempts to start a note that is not configured,...
Adds the given synth(Or synth collection) to the sequencer. You can specify the notes to add, which should be in a list in 'notes'. If no notes are specified, then this synth will be made the default synth for this name. If the sequencer attempts to start a note that is not configured, then a copy of the default synth ...
[ "Adds", "the", "given", "synth", "(", "Or", "synth", "collection", ")", "to", "the", "sequencer", ".", "You", "can", "specify", "the", "notes", "to", "add", "which", "should", "be", "in", "a", "list", "in", "'", "notes", "'", ".", "If", "no", "notes"...
def add_synth(self, synth, name=None, notes=None): if name is None: name = self.default_name if name not in self._synths: self._synths[name] = {} self._on[name] = [] if notes is not None: for note in notes: temp_synth = deepcopy(syn...
[ "def", "add_synth", "(", "self", ",", "synth", ",", "name", "=", "None", ",", "notes", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", "default_name", "if", "name", "not", "in", "self", ".", "_synths", ":", "self",...
Adds the given synth(Or synth collection) to the sequencer.
[ "Adds", "the", "given", "synth", "(", "Or", "synth", "collection", ")", "to", "the", "sequencer", "." ]
[ "\"\"\"\n Adds the given synth(Or synth collection) to the sequencer.\n\n You can specify the notes to add, which should be in a list in 'notes'.\n If no notes are specified, then this synth will be made the default synth for this name.\n If the sequencer attempts to start a note that is...
[ { "param": "self", "type": null }, { "param": "synth", "type": null }, { "param": "name", "type": null }, { "param": "notes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "synth", "type": null, "docstring": null, "docstring_tokens": ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
start_note
null
def start_note(self, note, name=None, time_stop=0, time_start=0, velocity=1): """ Starts a synth at the specified note and name. This will start and invoke the synth at the specified note. If necessary, we will also configure the synth to operate at the specified frequency. ...
Starts a synth at the specified note and name. This will start and invoke the synth at the specified note. If necessary, we will also configure the synth to operate at the specified frequency. If a name is not provided, then we will simply search for relevant synths in...
Starts a synth at the specified note and name. This will start and invoke the synth at the specified note. If necessary, we will also configure the synth to operate at the specified frequency. If a name is not provided, then we will simply search for relevant synths in the first name that we have registered. We also ...
[ "Starts", "a", "synth", "at", "the", "specified", "note", "and", "name", ".", "This", "will", "start", "and", "invoke", "the", "synth", "at", "the", "specified", "note", ".", "If", "necessary", "we", "will", "also", "configure", "the", "synth", "to", "op...
def start_note(self, note, name=None, time_stop=0, time_start=0, velocity=1): synth = self._find_synth(note, name=name) self._on[self._resolve_name(name)].append(note.revert()) if time_stop > 0 and time_start > 0: synth.time_event(time_start, time_stop) synth.info.velocity = ...
[ "def", "start_note", "(", "self", ",", "note", ",", "name", "=", "None", ",", "time_stop", "=", "0", ",", "time_start", "=", "0", ",", "velocity", "=", "1", ")", ":", "synth", "=", "self", ".", "_find_synth", "(", "note", ",", "name", "=", "name", ...
Starts a synth at the specified note and name.
[ "Starts", "a", "synth", "at", "the", "specified", "note", "and", "name", "." ]
[ "\"\"\"\n Starts a synth at the specified note and name.\n\n This will start and invoke the synth at the specified note.\n If necessary, we will also configure the synth to operate at\n the specified frequency.\n\n If a name is not provided, then we will simply search for relevant...
[ { "param": "self", "type": null }, { "param": "note", "type": null }, { "param": "name", "type": null }, { "param": "time_stop", "type": null }, { "param": "time_start", "type": null }, { "param": "velocity", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "note", "type": null, "docstring": "Note to turn on", "docstri...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
stop_note
null
def stop_note(self, note, name=None): """ Stops a synth at the specified note and name. This will stop the synth at the specified note. If a name is not provided, then we will simply use the first registered name. :param note: Note to stop :type note: Note ...
Stops a synth at the specified note and name. This will stop the synth at the specified note. If a name is not provided, then we will simply use the first registered name. :param note: Note to stop :type note: Note :param name: Name of the synth to stop ...
Stops a synth at the specified note and name. This will stop the synth at the specified note. If a name is not provided, then we will simply use the first registered name.
[ "Stops", "a", "synth", "at", "the", "specified", "note", "and", "name", ".", "This", "will", "stop", "the", "synth", "at", "the", "specified", "note", ".", "If", "a", "name", "is", "not", "provided", "then", "we", "will", "simply", "use", "the", "first...
def stop_note(self, note, name=None): name = self._resolve_name(name) synth = self._find_synth(note, name) note_value = note.revert() if note_value not in self._on[name]: raise Exception("Note is not currently on!") synth.stop() self._on[name].remove(note_valu...
[ "def", "stop_note", "(", "self", ",", "note", ",", "name", "=", "None", ")", ":", "name", "=", "self", ".", "_resolve_name", "(", "name", ")", "synth", "=", "self", ".", "_find_synth", "(", "note", ",", "name", ")", "note_value", "=", "note", ".", ...
Stops a synth at the specified note and name.
[ "Stops", "a", "synth", "at", "the", "specified", "note", "and", "name", "." ]
[ "\"\"\"\n Stops a synth at the specified note and name.\n\n This will stop the synth at the specified note.\n\n If a name is not provided, then we will simply\n use the first registered name.\n\n :param note: Note to stop\n :type note: Note\n :param name: Name of the...
[ { "param": "self", "type": null }, { "param": "note", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "note", "type": null, "docstring": "Note to stop", "docstring_...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
stop_all
null
def stop_all(self): """ Stops all synths that are currently started. """ # Iterate over the outputting synths: for name in self._on: for synth_num in self._on[name]: # Stop the synth: try: self.stop_note(Note....
Stops all synths that are currently started.
Stops all synths that are currently started.
[ "Stops", "all", "synths", "that", "are", "currently", "started", "." ]
def stop_all(self): for name in self._on: for synth_num in self._on[name]: try: self.stop_note(Note.from_num(synth_num)) except: continue
[ "def", "stop_all", "(", "self", ")", ":", "for", "name", "in", "self", ".", "_on", ":", "for", "synth_num", "in", "self", ".", "_on", "[", "name", "]", ":", "try", ":", "self", ".", "stop_note", "(", "Note", ".", "from_num", "(", "synth_num", ")", ...
Stops all synths that are currently started.
[ "Stops", "all", "synths", "that", "are", "currently", "started", "." ]
[ "\"\"\"\n Stops all synths that are currently started.\n \"\"\"", "# Iterate over the outputting synths:", "# Stop the synth:", "# Don't care about errors, continue" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
run_commands
null
def run_commands(self): """ Runs the given SeqCommand instances. This is where the magic happens with SeqCommands. We handle and invoke each track at the same time, to ensure that they remain synchronized. We use a lookahead method for scheduling synth components. ...
Runs the given SeqCommand instances. This is where the magic happens with SeqCommands. We handle and invoke each track at the same time, to ensure that they remain synchronized. We use a lookahead method for scheduling synth components. We lookahead a given amount of ...
Runs the given SeqCommand instances. This is where the magic happens with SeqCommands. We handle and invoke each track at the same time, to ensure that they remain synchronized. We use a lookahead method for scheduling synth components. We lookahead a given amount of time, schedule the events that occur within that ti...
[ "Runs", "the", "given", "SeqCommand", "instances", ".", "This", "is", "where", "the", "magic", "happens", "with", "SeqCommands", ".", "We", "handle", "and", "invoke", "each", "track", "at", "the", "same", "time", "to", "ensure", "that", "they", "remain", "...
def run_commands(self): start = get_time() for com in self._coms: com.offset = start while self.running and self._coms: time_now = get_time() + self.lookahead for com in self._coms: if com.run(time_now): continue ...
[ "def", "run_commands", "(", "self", ")", ":", "start", "=", "get_time", "(", ")", "for", "com", "in", "self", ".", "_coms", ":", "com", ".", "offset", "=", "start", "while", "self", ".", "running", "and", "self", ".", "_coms", ":", "time_now", "=", ...
Runs the given SeqCommand instances.
[ "Runs", "the", "given", "SeqCommand", "instances", "." ]
[ "\"\"\"\n Runs the given SeqCommand instances.\n\n This is where the magic happens with SeqCommands.\n We handle and invoke each track at the same time, \n to ensure that they remain synchronized.\n\n We use a lookahead method for scheduling synth components.\n We lookahead...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
_resolve_name
<not_specific>
def _resolve_name(self, name): """ Takes the given name and resolves it. If the name exists and is valid, then we simply return it. If the name is None, then we return the first name registered. If the name is invalid and does not exist, then we raise ...
Takes the given name and resolves it. If the name exists and is valid, then we simply return it. If the name is None, then we return the first name registered. If the name is invalid and does not exist, then we raise an exception. :param name: Name to...
Takes the given name and resolves it. If the name exists and is valid, then we simply return it. If the name is None, then we return the first name registered. If the name is invalid and does not exist, then we raise an exception.
[ "Takes", "the", "given", "name", "and", "resolves", "it", ".", "If", "the", "name", "exists", "and", "is", "valid", "then", "we", "simply", "return", "it", ".", "If", "the", "name", "is", "None", "then", "we", "return", "the", "first", "name", "registe...
def _resolve_name(self, name): if name is None: return list(self._synths.keys())[0] if name not in self._synths.keys(): raise Exception("Name not valid!") return name
[ "def", "_resolve_name", "(", "self", ",", "name", ")", ":", "if", "name", "is", "None", ":", "return", "list", "(", "self", ".", "_synths", ".", "keys", "(", ")", ")", "[", "0", "]", "if", "name", "not", "in", "self", ".", "_synths", ".", "keys",...
Takes the given name and resolves it.
[ "Takes", "the", "given", "name", "and", "resolves", "it", "." ]
[ "\"\"\"\n Takes the given name and resolves it.\n\n If the name exists and is valid,\n then we simply return it.\n\n If the name is None,\n then we return the first name registered.\n\n If the name is invalid and does not exist,\n then we raise an exception.\n\n ...
[ { "param": "self", "type": null }, { "param": "name", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
_find_synth
<not_specific>
def _find_synth(self, note, name=None): """ Finds a synth by the given note and name. If a name is not specified, then we simply use the first registered name. If no note is found in the name, then a new one is created from the default synth via 'deepcopy'. :param not...
Finds a synth by the given note and name. If a name is not specified, then we simply use the first registered name. If no note is found in the name, then a new one is created from the default synth via 'deepcopy'. :param note: Noe of the synth to start :type note: Not...
Finds a synth by the given note and name. If a name is not specified, then we simply use the first registered name. If no note is found in the name, then a new one is created from the default synth via 'deepcopy'.
[ "Finds", "a", "synth", "by", "the", "given", "note", "and", "name", ".", "If", "a", "name", "is", "not", "specified", "then", "we", "simply", "use", "the", "first", "registered", "name", ".", "If", "no", "note", "is", "found", "in", "the", "name", "t...
def _find_synth(self, note, name=None): name = self._resolve_name(name) note_val = note.revert() synth = None if note_val in self._synths[name].keys(): synth = self._synths[name][note_val] else: if 'd' not in self._synths[name].keys(): rais...
[ "def", "_find_synth", "(", "self", ",", "note", ",", "name", "=", "None", ")", ":", "name", "=", "self", ".", "_resolve_name", "(", "name", ")", "note_val", "=", "note", ".", "revert", "(", ")", "synth", "=", "None", "if", "note_val", "in", "self", ...
Finds a synth by the given note and name.
[ "Finds", "a", "synth", "by", "the", "given", "note", "and", "name", "." ]
[ "\"\"\"\n Finds a synth by the given note and name.\n\n If a name is not specified, then we simply use the first registered name.\n\n If no note is found in the name,\n then a new one is created from the default synth via 'deepcopy'.\n\n :param note: Noe of the synth to start\n ...
[ { "param": "self", "type": null }, { "param": "note", "type": null }, { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "Synth at that position", "docstring_tokens": [ "Synth", "at", "that", "position" ], "type": "BaseModule" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
_bind_comps
null
def _bind_comps(self): """ Binds all components together. This is called multiple times to ensure that all components are aware of eachother. """ # Binds the modules to each other: self._input.decoder = self._decoder self._decoder.input = self._input ...
Binds all components together. This is called multiple times to ensure that all components are aware of eachother.
Binds all components together. This is called multiple times to ensure that all components are aware of eachother.
[ "Binds", "all", "components", "together", ".", "This", "is", "called", "multiple", "times", "to", "ensure", "that", "all", "components", "are", "aware", "of", "eachother", "." ]
def _bind_comps(self): self._input.decoder = self._decoder self._decoder.input = self._input self._input.seq = self self._decoder.seq = self
[ "def", "_bind_comps", "(", "self", ")", ":", "self", ".", "_input", ".", "decoder", "=", "self", ".", "_decoder", "self", ".", "_decoder", ".", "input", "=", "self", ".", "_input", "self", ".", "_input", ".", "seq", "=", "self", "self", ".", "_decode...
Binds all components together.
[ "Binds", "all", "components", "together", "." ]
[ "\"\"\"\n Binds all components together.\n\n This is called multiple times to ensure that all components are aware of eachother.\n \"\"\"", "# Binds the modules to each other:", "# Bind ourself to the components:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
peek
<not_specific>
def peek(self): """ Peaks ahead at the next character, without incrementing our index. :return: Character at next position :rtype: str """ # Check if we have another character: if not self.has_next(): # Return nothing: return ...
Peaks ahead at the next character, without incrementing our index. :return: Character at next position :rtype: str
Peaks ahead at the next character, without incrementing our index.
[ "Peaks", "ahead", "at", "the", "next", "character", "without", "incrementing", "our", "index", "." ]
def peek(self): if not self.has_next(): return ' ' return self.source[self.index + 1]
[ "def", "peek", "(", "self", ")", ":", "if", "not", "self", ".", "has_next", "(", ")", ":", "return", "' '", "return", "self", ".", "source", "[", "self", ".", "index", "+", "1", "]" ]
Peaks ahead at the next character, without incrementing our index.
[ "Peaks", "ahead", "at", "the", "next", "character", "without", "incrementing", "our", "index", "." ]
[ "\"\"\"\n Peaks ahead at the next character,\n without incrementing our index.\n\n :return: Character at next position\n :rtype: str\n \"\"\"", "# Check if we have another character:", "# Return nothing:", "# Return character at the next position:" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Character at next position", "docstring_tokens": [ "Character", "at", "next", "position" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
forward
<not_specific>
def forward(self): """ Increments the index by one. We also make sure that our current value is valid, not a space. """ # Iterate until we find something: while self.has_next(): # Move forward: self.index += 1 # Check the...
Increments the index by one. We also make sure that our current value is valid, not a space.
Increments the index by one. We also make sure that our current value is valid, not a space.
[ "Increments", "the", "index", "by", "one", ".", "We", "also", "make", "sure", "that", "our", "current", "value", "is", "valid", "not", "a", "space", "." ]
def forward(self): while self.has_next(): self.index += 1 if self.get() != ' ': return raise Exception("Unable to move forward, index out of bounds!")
[ "def", "forward", "(", "self", ")", ":", "while", "self", ".", "has_next", "(", ")", ":", "self", ".", "index", "+=", "1", "if", "self", ".", "get", "(", ")", "!=", "' '", ":", "return", "raise", "Exception", "(", "\"Unable to move forward, index out of ...
Increments the index by one.
[ "Increments", "the", "index", "by", "one", "." ]
[ "\"\"\"\n Increments the index by one.\n\n We also make sure that our current value is valid,\n not a space.\n \"\"\"", "# Iterate until we find something:", "# Move forward:", "# Check the value residing here:", "# We have a value! return" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
read_until
<not_specific>
def read_until(self, match): """ Read until we match with a certain character. We act as a generator, continuously yielding until we reach our target. :param match: String to match with :type match: str :return: Character at our position :rtype: str ...
Read until we match with a certain character. We act as a generator, continuously yielding until we reach our target. :param match: String to match with :type match: str :return: Character at our position :rtype: str
Read until we match with a certain character. We act as a generator, continuously yielding until we reach our target.
[ "Read", "until", "we", "match", "with", "a", "certain", "character", ".", "We", "act", "as", "a", "generator", "continuously", "yielding", "until", "we", "reach", "our", "target", "." ]
def read_until(self, match): while self.has_next(): self.forward() temp = self.get() if temp == match: return yield temp
[ "def", "read_until", "(", "self", ",", "match", ")", ":", "while", "self", ".", "has_next", "(", ")", ":", "self", ".", "forward", "(", ")", "temp", "=", "self", ".", "get", "(", ")", "if", "temp", "==", "match", ":", "return", "yield", "temp" ]
Read until we match with a certain character.
[ "Read", "until", "we", "match", "with", "a", "certain", "character", "." ]
[ "\"\"\"\n Read until we match with a certain character.\n\n We act as a generator, continuously yielding until\n we reach our target.\n\n :param match: String to match with\n :type match: str\n :return: Character at our position\n :rtype: str\n \"\"\"", "# I...
[ { "param": "self", "type": null }, { "param": "match", "type": null } ]
{ "returns": [ { "docstring": "Character at our position", "docstring_tokens": [ "Character", "at", "our", "position" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
has_next
<not_specific>
def has_next(self): """ Checks to see if another character is available. We do this by comparing our index to the length of the source string. :return: True for success, False for failure :rtype: bool """ # Compare our index: if self.index < len(self....
Checks to see if another character is available. We do this by comparing our index to the length of the source string. :return: True for success, False for failure :rtype: bool
Checks to see if another character is available. We do this by comparing our index to the length of the source string.
[ "Checks", "to", "see", "if", "another", "character", "is", "available", ".", "We", "do", "this", "by", "comparing", "our", "index", "to", "the", "length", "of", "the", "source", "string", "." ]
def has_next(self): if self.index < len(self.source) - 1: return True return False
[ "def", "has_next", "(", "self", ")", ":", "if", "self", ".", "index", "<", "len", "(", "self", ".", "source", ")", "-", "1", ":", "return", "True", "return", "False" ]
Checks to see if another character is available.
[ "Checks", "to", "see", "if", "another", "character", "is", "available", "." ]
[ "\"\"\"\n Checks to see if another character is available.\n\n We do this by comparing our index to the length of the source string.\n\n :return: True for success, False for failure\n :rtype: bool\n \"\"\"", "# Compare our index:", "# Less than, let's return True", "# No goo...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "True for success, False for failure", "docstring_tokens": [ "True", "for", "success", "False", "for", "failure" ], "type": "bool" } ], "raises": [], "params": [ { "identifier": "self", ...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
load_string
null
def load_string(self, data): """ Loads string data into the MMLSeeker. :param data: String data to seek :type data: str """ # Create a new seeker and load string data self.source = MMLSeeker(data) # Add the seeker to the decoder: self.decoder...
Loads string data into the MMLSeeker. :param data: String data to seek :type data: str
Loads string data into the MMLSeeker.
[ "Loads", "string", "data", "into", "the", "MMLSeeker", "." ]
def load_string(self, data): self.source = MMLSeeker(data) self.decoder.source = self.source
[ "def", "load_string", "(", "self", ",", "data", ")", ":", "self", ".", "source", "=", "MMLSeeker", "(", "data", ")", "self", ".", "decoder", ".", "source", "=", "self", ".", "source" ]
Loads string data into the MMLSeeker.
[ "Loads", "string", "data", "into", "the", "MMLSeeker", "." ]
[ "\"\"\"\n Loads string data into the MMLSeeker.\n\n :param data: String data to seek\n :type data: str\n \"\"\"", "# Create a new seeker and load string data", "# Add the seeker to the decoder:" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": "String data to seek", "doc...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
run
null
def run(self): """ Continuously move the seeker forward and call the decoder. """ for event in self.decoder.command.events: print(event) # Run the SeqCommand instance: self.seq.run_commands() print("Done running")
Continuously move the seeker forward and call the decoder.
Continuously move the seeker forward and call the decoder.
[ "Continuously", "move", "the", "seeker", "forward", "and", "call", "the", "decoder", "." ]
def run(self): for event in self.decoder.command.events: print(event) self.seq.run_commands() print("Done running")
[ "def", "run", "(", "self", ")", ":", "for", "event", "in", "self", ".", "decoder", ".", "command", ".", "events", ":", "print", "(", "event", ")", "self", ".", "seq", ".", "run_commands", "(", ")", "print", "(", "\"Done running\"", ")" ]
Continuously move the seeker forward and call the decoder.
[ "Continuously", "move", "the", "seeker", "forward", "and", "call", "the", "decoder", "." ]
[ "\"\"\"\n Continuously move the seeker forward and call the decoder.\n \"\"\"", "# Run the SeqCommand instance:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
_reset_values
null
def _reset_values(self): """ Resets(Or sets) this decodes values back to normal. This is called upon each new track, as each track will have their own configurations. """ self.octave = 0 # Current octave we are set at self.tempo = 120 # Tempo in beats per min...
Resets(Or sets) this decodes values back to normal. This is called upon each new track, as each track will have their own configurations.
Resets(Or sets) this decodes values back to normal. This is called upon each new track, as each track will have their own configurations.
[ "Resets", "(", "Or", "sets", ")", "this", "decodes", "values", "back", "to", "normal", ".", "This", "is", "called", "upon", "each", "new", "track", "as", "each", "track", "will", "have", "their", "own", "configurations", "." ]
def _reset_values(self): self.octave = 0 self.tempo = 120 self.velocity = 1 self.default_length = 4 self.beats_per_measure = 4 self.name = None self.loop_index = 0 self.num_processed = 0 self.loop = False
[ "def", "_reset_values", "(", "self", ")", ":", "self", ".", "octave", "=", "0", "self", ".", "tempo", "=", "120", "self", ".", "velocity", "=", "1", "self", ".", "default_length", "=", "4", "self", ".", "beats_per_measure", "=", "4", "self", ".", "na...
Resets(Or sets) this decodes values back to normal.
[ "Resets", "(", "Or", "sets", ")", "this", "decodes", "values", "back", "to", "normal", "." ]
[ "\"\"\"\n Resets(Or sets) this decodes values back to normal.\n\n This is called upon each new track,\n as each track will have their own configurations.\n \"\"\"", "# Current octave we are set at", "# Tempo in beats per minute", "# Default length to apply when not specified", "#...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
start
null
def start(self): """ We setup and configure the Sequencer Command instance. We also parse the source string for input. """ # Create the SeqCommand instance self.command = SeqCommand(self.seq) # Parse over the input text: while True: # De...
We setup and configure the Sequencer Command instance. We also parse the source string for input.
We setup and configure the Sequencer Command instance. We also parse the source string for input.
[ "We", "setup", "and", "configure", "the", "Sequencer", "Command", "instance", ".", "We", "also", "parse", "the", "source", "string", "for", "input", "." ]
def start(self): self.command = SeqCommand(self.seq) while True: self.decode() try: self.source.forward() except: break if self.loop: print("Adding repeat:") self.command.repeat(0, -1) self.seq.ad...
[ "def", "start", "(", "self", ")", ":", "self", ".", "command", "=", "SeqCommand", "(", "self", ".", "seq", ")", "while", "True", ":", "self", ".", "decode", "(", ")", "try", ":", "self", ".", "source", ".", "forward", "(", ")", "except", ":", "br...
We setup and configure the Sequencer Command instance.
[ "We", "setup", "and", "configure", "the", "Sequencer", "Command", "instance", "." ]
[ "\"\"\"\n We setup and configure the Sequencer Command instance.\n\n We also parse the source string for input.\n \"\"\"", "# Create the SeqCommand instance", "# Parse over the input text:", "# Decode the next character", "# Move the source forward:", "# We are done decoding, lets exi...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
decode
<not_specific>
def decode(self, chord=False): """ Decodes the given MML input. We may change our state, or toggle a note to be on in the sequencer. We also have the option to operate in chord mode, meaning that we do not attempt to stop notes. :param chord: Determines if we ...
Decodes the given MML input. We may change our state, or toggle a note to be on in the sequencer. We also have the option to operate in chord mode, meaning that we do not attempt to stop notes. :param chord: Determines if we are working with a chord :type chor...
Decodes the given MML input. We may change our state, or toggle a note to be on in the sequencer. We also have the option to operate in chord mode, meaning that we do not attempt to stop notes.
[ "Decodes", "the", "given", "MML", "input", ".", "We", "may", "change", "our", "state", "or", "toggle", "a", "note", "to", "be", "on", "in", "the", "sequencer", ".", "We", "also", "have", "the", "option", "to", "operate", "in", "chord", "mode", "meaning...
def decode(self, chord=False): inp = self.source.get() print(inp) if inp in self.note_map: self.read_note(no_time=chord) if not chord: self.num_processed += 1 return if inp == 'r': time_amount = self.read_length() ...
[ "def", "decode", "(", "self", ",", "chord", "=", "False", ")", ":", "inp", "=", "self", ".", "source", ".", "get", "(", ")", "print", "(", "inp", ")", "if", "inp", "in", "self", ".", "note_map", ":", "self", ".", "read_note", "(", "no_time", "=",...
Decodes the given MML input.
[ "Decodes", "the", "given", "MML", "input", "." ]
[ "\"\"\"\n Decodes the given MML input.\n\n We may change our state,\n or toggle a note to be on in the sequencer.\n\n We also have the option to operate in chord mode,\n meaning that we do not attempt to stop notes.\n\n :param chord: Determines if we are working with a chor...
[ { "param": "self", "type": null }, { "param": "chord", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "chord", "type": null, "docstring": "Determines if we are working wi...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
read_note
<not_specific>
def read_note(self, no_time=False): """ Reads a note at the current position. We also handle the processing of accidentals, and the reading of note lengths. Once the note is invoked, we calculate the time the note will take, and then disable it. If we are worki...
Reads a note at the current position. We also handle the processing of accidentals, and the reading of note lengths. Once the note is invoked, we calculate the time the note will take, and then disable it. If we are working with chords and don't want each note to be wa...
Reads a note at the current position. We also handle the processing of accidentals, and the reading of note lengths. Once the note is invoked, we calculate the time the note will take, and then disable it. If we are working with chords and don't want each note to be waited on, then you can pass True to the 'no_time' p...
[ "Reads", "a", "note", "at", "the", "current", "position", ".", "We", "also", "handle", "the", "processing", "of", "accidentals", "and", "the", "reading", "of", "note", "lengths", ".", "Once", "the", "note", "is", "invoked", "we", "calculate", "the", "time"...
def read_note(self, no_time=False): note = self.source.get() note_num = self.note_map[note] note_val = Note(self.octave, note_num + self.read_accidental()) if no_time: self.notes.append(note_val) return length = self.read_length() time_amount = sel...
[ "def", "read_note", "(", "self", ",", "no_time", "=", "False", ")", ":", "note", "=", "self", ".", "source", ".", "get", "(", ")", "note_num", "=", "self", ".", "note_map", "[", "note", "]", "note_val", "=", "Note", "(", "self", ".", "octave", ",",...
Reads a note at the current position.
[ "Reads", "a", "note", "at", "the", "current", "position", "." ]
[ "\"\"\"\n Reads a note at the current position.\n\n We also handle the processing of accidentals, and\n the reading of note lengths.\n\n Once the note is invoked, we calculate the time the note will take,\n and then disable it.\n If we are working with chords and don't want...
[ { "param": "self", "type": null }, { "param": "no_time", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "no_time", "type": null, "docstring": "Value determining if we shoul...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
read_accidental
<not_specific>
def read_accidental(self): """ Reads an accidental for the current note. The accidental must ALWAYS pre-pend the note. We return the offset of the note, weather that be -1 or 1 step. If we encounter an integer, then this is the note length, and we will simply r...
Reads an accidental for the current note. The accidental must ALWAYS pre-pend the note. We return the offset of the note, weather that be -1 or 1 step. If we encounter an integer, then this is the note length, and we will simply return 0 for no change. :return:...
Reads an accidental for the current note. The accidental must ALWAYS pre-pend the note. We return the offset of the note, weather that be -1 or 1 step. If we encounter an integer, then this is the note length, and we will simply return 0 for no change.
[ "Reads", "an", "accidental", "for", "the", "current", "note", ".", "The", "accidental", "must", "ALWAYS", "pre", "-", "pend", "the", "note", ".", "We", "return", "the", "offset", "of", "the", "note", "weather", "that", "be", "-", "1", "or", "1", "step"...
def read_accidental(self): val = self.source.peek() if val in ['+', '#']: self.source.forward() return 1 if val in ['-']: self.source.forward() return -1 return 0
[ "def", "read_accidental", "(", "self", ")", ":", "val", "=", "self", ".", "source", ".", "peek", "(", ")", "if", "val", "in", "[", "'+'", ",", "'#'", "]", ":", "self", ".", "source", ".", "forward", "(", ")", "return", "1", "if", "val", "in", "...
Reads an accidental for the current note.
[ "Reads", "an", "accidental", "for", "the", "current", "note", "." ]
[ "\"\"\"\n Reads an accidental for the current note.\n\n The accidental must ALWAYS pre-pend the note.\n We return the offset of the note,\n weather that be -1 or 1 step.\n\n If we encounter an integer, then this is the note length,\n and we will simply return 0 for no chang...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Offset of the note, -1 for flat, 1 for sharp", "docstring_tokens": [ "Offset", "of", "the", "note", "-", "1", "for", "flat", "1", "for", "sharp" ], "type": "int" } ]...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
read_length
<not_specific>
def read_length(self): """ Reads the length of an arbitrary item, be it a note, rest, chord, ect. We assume our current index is the item(or end of the item) we wish to figure out the length of. We will continue to read values and push the seeker forward until ...
Reads the length of an arbitrary item, be it a note, rest, chord, ect. We assume our current index is the item(or end of the item) we wish to figure out the length of. We will continue to read values and push the seeker forward until we find no more integers. W...
Reads the length of an arbitrary item, be it a note, rest, chord, ect. We assume our current index is the item(or end of the item) we wish to figure out the length of. We will continue to read values and push the seeker forward until we find no more integers. We also handle doted notes! We return the length of the n...
[ "Reads", "the", "length", "of", "an", "arbitrary", "item", "be", "it", "a", "note", "rest", "chord", "ect", ".", "We", "assume", "our", "current", "index", "is", "the", "item", "(", "or", "end", "of", "the", "item", ")", "we", "wish", "to", "figure",...
def read_length(self): length = self._read_ints() last = 1 final = 0 while True: if self.source.peek() == '.': self.source.forward() last = last * 0.5 final += last continue break length = len...
[ "def", "read_length", "(", "self", ")", ":", "length", "=", "self", ".", "_read_ints", "(", ")", "last", "=", "1", "final", "=", "0", "while", "True", ":", "if", "self", ".", "source", ".", "peek", "(", ")", "==", "'.'", ":", "self", ".", "source...
Reads the length of an arbitrary item, be it a note, rest, chord, ect.
[ "Reads", "the", "length", "of", "an", "arbitrary", "item", "be", "it", "a", "note", "rest", "chord", "ect", "." ]
[ "\"\"\"\n Reads the length of an arbitrary item,\n be it a note, rest, chord, ect.\n\n We assume our current index is the item(or end of the item)\n we wish to figure out the length of.\n\n We will continue to read values and push the seeker forward\n until we find no more ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "length of the value we are currently on", "docstring_tokens": [ "length", "of", "the", "value", "we", "are", "currently", "on" ], "type": "int" } ], "raises": [], "params": [ { ...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
read_number
<not_specific>
def read_number(self): """ Reads the number after an arbitrary item, taking dots into account and converting them into floats. We assume our current index is the item we want the length of. Like 'read_length()', we will continue to push the seeker forward until we stop ...
Reads the number after an arbitrary item, taking dots into account and converting them into floats. We assume our current index is the item we want the length of. Like 'read_length()', we will continue to push the seeker forward until we stop reading ints. :return: Ret...
Reads the number after an arbitrary item, taking dots into account and converting them into floats. We assume our current index is the item we want the length of. Like 'read_length()', we will continue to push the seeker forward until we stop reading ints.
[ "Reads", "the", "number", "after", "an", "arbitrary", "item", "taking", "dots", "into", "account", "and", "converting", "them", "into", "floats", ".", "We", "assume", "our", "current", "index", "is", "the", "item", "we", "want", "the", "length", "of", ".",...
def read_number(self): final = 0 ints = self._read_ints() if ints: final += ints if self.source.peek() == '.': self.source.forward() final = float(str(final) + '.' + str(self.read_length())) return float(final)
[ "def", "read_number", "(", "self", ")", ":", "final", "=", "0", "ints", "=", "self", ".", "_read_ints", "(", ")", "if", "ints", ":", "final", "+=", "ints", "if", "self", ".", "source", ".", "peek", "(", ")", "==", "'.'", ":", "self", ".", "source...
Reads the number after an arbitrary item, taking dots into account and converting them into floats.
[ "Reads", "the", "number", "after", "an", "arbitrary", "item", "taking", "dots", "into", "account", "and", "converting", "them", "into", "floats", "." ]
[ "\"\"\"\n Reads the number after an arbitrary item,\n taking dots into account and converting them into floats.\n\n We assume our current index is the item we want the length of.\n Like 'read_length()', we will continue to push the seeker forward\n until we stop reading ints.\n\n ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Returns the number after the current position", "docstring_tokens": [ "Returns", "the", "number", "after", "the", "current", "position" ], "type": "float" } ], "raises": [], "params": [ { ...
e75a676d5a851d5cc9b84ae5ef549e199db1bd0e
monarrk/python-audio-synth
pysynth/wrappers/mml.py
[ "MIT" ]
Python
load_string
null
def load_string(self, data): """ Creates a StringMMLInput module and binds it to this sequencer. :param data: String to add to the input module :type data: str """ # Bind the StringMMLInput self.bind_input(StringMMLInput()) # Load the input into the S...
Creates a StringMMLInput module and binds it to this sequencer. :param data: String to add to the input module :type data: str
Creates a StringMMLInput module and binds it to this sequencer.
[ "Creates", "a", "StringMMLInput", "module", "and", "binds", "it", "to", "this", "sequencer", "." ]
def load_string(self, data): self.bind_input(StringMMLInput()) self._input.load_string(data)
[ "def", "load_string", "(", "self", ",", "data", ")", ":", "self", ".", "bind_input", "(", "StringMMLInput", "(", ")", ")", "self", ".", "_input", ".", "load_string", "(", "data", ")" ]
Creates a StringMMLInput module and binds it to this sequencer.
[ "Creates", "a", "StringMMLInput", "module", "and", "binds", "it", "to", "this", "sequencer", "." ]
[ "\"\"\"\n Creates a StringMMLInput module and binds it to this sequencer.\n\n :param data: String to add to the input module\n :type data: str\n \"\"\"", "# Bind the StringMMLInput", "# Load the input into the StringMMLInput:" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": "String to add to the input modul...
cc944783d12012cda3bde3a1e09ff62728241820
monarrk/python-audio-synth
pysynth/synth.py
[ "MIT" ]
Python
calc_next
null
def calc_next(self): """ This function will return the next value computed value. Most of the math should reside here. :return: Float representing the next number in the waveform :rtype: float """ raise NotImplemented("Sub-synths should implement this...
This function will return the next value computed value. Most of the math should reside here. :return: Float representing the next number in the waveform :rtype: float
This function will return the next value computed value. Most of the math should reside here.
[ "This", "function", "will", "return", "the", "next", "value", "computed", "value", ".", "Most", "of", "the", "math", "should", "reside", "here", "." ]
def calc_next(self): raise NotImplemented("Sub-synths should implement this method!")
[ "def", "calc_next", "(", "self", ")", ":", "raise", "NotImplemented", "(", "\"Sub-synths should implement this method!\"", ")" ]
This function will return the next value computed value.
[ "This", "function", "will", "return", "the", "next", "value", "computed", "value", "." ]
[ "\"\"\"\r\n This function will return the next value computed value.\r\n Most of the math should reside here.\r\n\r\n :return: Float representing the next number in the waveform\r\n :rtype: float\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Float representing the next number in the waveform", "docstring_tokens": [ "Float", "representing", "the", "next", "number", "in", "the", "waveform" ], "type": "float" } ], "raises": [], ...
cc944783d12012cda3bde3a1e09ff62728241820
monarrk/python-audio-synth
pysynth/synth.py
[ "MIT" ]
Python
calc_next
<not_specific>
def calc_next(self): """ Modulate the carrier wave and return the value. :return: Float :rtype: float """ val = math.cos(self.carry.calc_next() + self.const * self.mod.calc_next()) return val
Modulate the carrier wave and return the value. :return: Float :rtype: float
Modulate the carrier wave and return the value.
[ "Modulate", "the", "carrier", "wave", "and", "return", "the", "value", "." ]
def calc_next(self): val = math.cos(self.carry.calc_next() + self.const * self.mod.calc_next()) return val
[ "def", "calc_next", "(", "self", ")", ":", "val", "=", "math", ".", "cos", "(", "self", ".", "carry", ".", "calc_next", "(", ")", "+", "self", ".", "const", "*", "self", ".", "mod", ".", "calc_next", "(", ")", ")", "return", "val" ]
Modulate the carrier wave and return the value.
[ "Modulate", "the", "carrier", "wave", "and", "return", "the", "value", "." ]
[ "\"\"\"\r\n Modulate the carrier wave and return the value.\r\n\r\n :return: Float\r\n :rtype: float\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null...
22df9880adc86113afae52920448b56671a2db7d
monarrk/python-audio-synth
pysynth/wrappers/midi/midi.py
[ "MIT" ]
Python
decode
<not_specific>
def decode(self, event): """ Decodes a given MIDI event. We only support note on and off events as of now. """ if isinstance(event, NoteOn): # Turn the given synth on: note = Note.from_num(event.note - 69) # Toggle the note: ...
Decodes a given MIDI event. We only support note on and off events as of now.
Decodes a given MIDI event. We only support note on and off events as of now.
[ "Decodes", "a", "given", "MIDI", "event", ".", "We", "only", "support", "note", "on", "and", "off", "events", "as", "of", "now", "." ]
def decode(self, event): if isinstance(event, NoteOn): note = Note.from_num(event.note - 69) self.seq.start_note(note) return if isinstance(event, NoteOff): note = Note.from_num(event.note - 69) self.seq.stop_note(note)
[ "def", "decode", "(", "self", ",", "event", ")", ":", "if", "isinstance", "(", "event", ",", "NoteOn", ")", ":", "note", "=", "Note", ".", "from_num", "(", "event", ".", "note", "-", "69", ")", "self", ".", "seq", ".", "start_note", "(", "note", ...
Decodes a given MIDI event.
[ "Decodes", "a", "given", "MIDI", "event", "." ]
[ "\"\"\"\n Decodes a given MIDI event.\n\n We only support note on and off events as of now.\n \"\"\"", "# Turn the given synth on:", "# Toggle the note:", "# Turn the given synth off:", "# Toggle the note:" ]
[ { "param": "self", "type": null }, { "param": "event", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "event", "type": null, "docstring": null, "docstring_tokens": ...
22df9880adc86113afae52920448b56671a2db7d
monarrk/python-audio-synth
pysynth/wrappers/midi/midi.py
[ "MIT" ]
Python
alsa_live
null
def alsa_live(self): """ Load the ALSA input module and the live decoder module. """ self.bind_decoder(MIDILiveDecoder()) self.bind_input(ALSAInput())
Load the ALSA input module and the live decoder module.
Load the ALSA input module and the live decoder module.
[ "Load", "the", "ALSA", "input", "module", "and", "the", "live", "decoder", "module", "." ]
def alsa_live(self): self.bind_decoder(MIDILiveDecoder()) self.bind_input(ALSAInput())
[ "def", "alsa_live", "(", "self", ")", ":", "self", ".", "bind_decoder", "(", "MIDILiveDecoder", "(", ")", ")", "self", ".", "bind_input", "(", "ALSAInput", "(", ")", ")" ]
Load the ALSA input module and the live decoder module.
[ "Load", "the", "ALSA", "input", "module", "and", "the", "live", "decoder", "module", "." ]
[ "\"\"\"\n Load the ALSA input module and the live decoder module.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
finish
null
def finish(self): """ Function called when this module is told to finish up whatever they are doing. This is called when the chain we are attached to is told to stop. This feature allows us to continue to add audio information when we are stopped, i.e we implemented a fa...
Function called when this module is told to finish up whatever they are doing. This is called when the chain we are attached to is told to stop. This feature allows us to continue to add audio information when we are stopped, i.e we implemented a fade out when the note is stopped....
Function called when this module is told to finish up whatever they are doing. This is called when the chain we are attached to is told to stop. This feature allows us to continue to add audio information when we are stopped, i.e we implemented a fade out when the note is stopped. THIS WILL PROBABLY ONLY BE CALLED BY ...
[ "Function", "called", "when", "this", "module", "is", "told", "to", "finish", "up", "whatever", "they", "are", "doing", ".", "This", "is", "called", "when", "the", "chain", "we", "are", "attached", "to", "is", "told", "to", "stop", ".", "This", "feature"...
def finish(self): self.done()
[ "def", "finish", "(", "self", ")", ":", "self", ".", "done", "(", ")" ]
Function called when this module is told to finish up whatever they are doing.
[ "Function", "called", "when", "this", "module", "is", "told", "to", "finish", "up", "whatever", "they", "are", "doing", "." ]
[ "\"\"\"\r\n Function called when this module is told to finish up whatever they are doing.\r\n\r\n This is called when the chain we are attached to is told to stop.\r\n This feature allows us to continue to add audio information when we are stopped,\r\n i.e we implemented a fade out when...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
done
null
def done(self): """ Method called when this module is ready to stop. The finishing process is described in more detail in the 'finish()' method. When this module is ready to stop, then it should call the 'done()' method, which will tell the chain that this mod...
Method called when this module is ready to stop. The finishing process is described in more detail in the 'finish()' method. When this module is ready to stop, then it should call the 'done()' method, which will tell the chain that this module is ready to stop. ...
Method called when this module is ready to stop. The finishing process is described in more detail in the 'finish()' method. When this module is ready to stop, then it should call the 'done()' method, which will tell the chain that this module is ready to stop.
[ "Method", "called", "when", "this", "module", "is", "ready", "to", "stop", ".", "The", "finishing", "process", "is", "described", "in", "more", "detail", "in", "the", "'", "finish", "()", "'", "method", ".", "When", "this", "module", "is", "ready", "to",...
def done(self): self.info.done += 1
[ "def", "done", "(", "self", ")", ":", "self", ".", "info", ".", "done", "+=", "1" ]
Method called when this module is ready to stop.
[ "Method", "called", "when", "this", "module", "is", "ready", "to", "stop", "." ]
[ "\"\"\"\r\n Method called when this module is ready to stop.\r\n\r\n The finishing process is described in more detail in the 'finish()' method.\r\n\r\n When this module is ready to stop,\r\n then it should call the 'done()' method,\r\n which will tell the chain that this module i...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
bind
null
def bind(self, module): """ Binds an iterable to this class. We register the iterable to the AudioCollection, and then let it take it from here. We also bind their information to us. :param module: Iterable to add. This should ideally inherit BaseModule ...
Binds an iterable to this class. We register the iterable to the AudioCollection, and then let it take it from here. We also bind their information to us. :param module: Iterable to add. This should ideally inherit BaseModule :type module: iter
Binds an iterable to this class. We register the iterable to the AudioCollection, and then let it take it from here. We also bind their information to us.
[ "Binds", "an", "iterable", "to", "this", "class", ".", "We", "register", "the", "iterable", "to", "the", "AudioCollection", "and", "then", "let", "it", "take", "it", "from", "here", ".", "We", "also", "bind", "their", "information", "to", "us", "." ]
def bind(self, module): if self.input._objs: module._info = self._info else: self._info = module._info module.output = self self.input.add_module(module) self.info.connected += 1
[ "def", "bind", "(", "self", ",", "module", ")", ":", "if", "self", ".", "input", ".", "_objs", ":", "module", ".", "_info", "=", "self", ".", "_info", "else", ":", "self", ".", "_info", "=", "module", ".", "_info", "module", ".", "output", "=", "...
Binds an iterable to this class.
[ "Binds", "an", "iterable", "to", "this", "class", "." ]
[ "\"\"\"\r\n Binds an iterable to this class.\r\n\r\n We register the iterable to the AudioCollection,\r\n and then let it take it from here.\r\n\r\n We also bind their information to us.\r\n\r\n :param module: Iterable to add. This should ideally inherit BaseModule\r\n :typ...
[ { "param": "self", "type": null }, { "param": "module", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "module", "type": null, "docstring": "Iterable to add. This should i...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
unbind
null
def unbind(self, module): """ Unbinds an iterable from this class. We tell AudioCollection to remove the module. :param module: Module to remove :type module: iter """ # Unregister info: module.info = ModuleInfo() # Remove ours...
Unbinds an iterable from this class. We tell AudioCollection to remove the module. :param module: Module to remove :type module: iter
Unbinds an iterable from this class. We tell AudioCollection to remove the module.
[ "Unbinds", "an", "iterable", "from", "this", "class", ".", "We", "tell", "AudioCollection", "to", "remove", "the", "module", "." ]
def unbind(self, module): module.info = ModuleInfo() module.output = None self.input.add_module(module) self.info.connected -= 1
[ "def", "unbind", "(", "self", ",", "module", ")", ":", "module", ".", "info", "=", "ModuleInfo", "(", ")", "module", ".", "output", "=", "None", "self", ".", "input", ".", "add_module", "(", "module", ")", "self", ".", "info", ".", "connected", "-=",...
Unbinds an iterable from this class.
[ "Unbinds", "an", "iterable", "from", "this", "class", "." ]
[ "\"\"\"\r\n Unbinds an iterable from this class.\r\n\r\n We tell AudioCollection to remove the module.\r\n\r\n :param module: Module to remove\r\n :type module: iter\r\n \"\"\"", "# Unregister info:\r", "# Remove ourselves from the output:\r", "# Remove the module from the A...
[ { "param": "self", "type": null }, { "param": "module", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "module", "type": null, "docstring": "Module to remove", "docs...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
freq
<not_specific>
def freq(self): """ Getter for the frequency of this module. :return: Frequency for this module :rtype: AudioValue """ # Get the frequency and return it: return self._info.freq
Getter for the frequency of this module. :return: Frequency for this module :rtype: AudioValue
Getter for the frequency of this module.
[ "Getter", "for", "the", "frequency", "of", "this", "module", "." ]
def freq(self): return self._info.freq
[ "def", "freq", "(", "self", ")", ":", "return", "self", ".", "_info", ".", "freq" ]
Getter for the frequency of this module.
[ "Getter", "for", "the", "frequency", "of", "this", "module", "." ]
[ "\"\"\"\r\n Getter for the frequency of this module.\r\n\r\n :return: Frequency for this module\r\n :rtype: AudioValue\r\n \"\"\"", "# Get the frequency and return it:\r" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Frequency for this module", "docstring_tokens": [ "Frequency", "for", "this", "module" ], "type": "AudioValue" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": nu...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
freq
null
def freq(self, freq): """ Setter for the frequency. Under the hood, AudioCollection schedules an event at this instant to set the value to. If you want more fined control for chaining this value, then you should instead get the AudioValue, and schedul...
Setter for the frequency. Under the hood, AudioCollection schedules an event at this instant to set the value to. If you want more fined control for chaining this value, then you should instead get the AudioValue, and schedule an event. :param freq: ...
Setter for the frequency. Under the hood, AudioCollection schedules an event at this instant to set the value to. If you want more fined control for chaining this value, then you should instead get the AudioValue, and schedule an event.
[ "Setter", "for", "the", "frequency", ".", "Under", "the", "hood", "AudioCollection", "schedules", "an", "event", "at", "this", "instant", "to", "set", "the", "value", "to", ".", "If", "you", "want", "more", "fined", "control", "for", "chaining", "this", "v...
def freq(self, freq): self._info.freq.value = freq
[ "def", "freq", "(", "self", ",", "freq", ")", ":", "self", ".", "_info", ".", "freq", ".", "value", "=", "freq" ]
Setter for the frequency.
[ "Setter", "for", "the", "frequency", "." ]
[ "\"\"\"\r\n Setter for the frequency.\r\n\r\n Under the hood, AudioCollection schedules an event at this instant\r\n to set the value to.\r\n\r\n If you want more fined control for chaining this value,\r\n then you should instead get the AudioValue,\r\n and schedule an even...
[ { "param": "self", "type": null }, { "param": "freq", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "freq", "type": null, "docstring": "Frequency to set", "docstr...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
sample_rate
<not_specific>
def sample_rate(self): """ getter for the sampling rate of this module. :return: Sampling rate of this module :rtype: float """ return self._info.rate
getter for the sampling rate of this module. :return: Sampling rate of this module :rtype: float
getter for the sampling rate of this module.
[ "getter", "for", "the", "sampling", "rate", "of", "this", "module", "." ]
def sample_rate(self): return self._info.rate
[ "def", "sample_rate", "(", "self", ")", ":", "return", "self", ".", "_info", ".", "rate" ]
getter for the sampling rate of this module.
[ "getter", "for", "the", "sampling", "rate", "of", "this", "module", "." ]
[ "\"\"\"\r\n getter for the sampling rate of this module.\r\n\r\n :return: Sampling rate of this module\r\n :rtype: float\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Sampling rate of this module", "docstring_tokens": [ "Sampling", "rate", "of", "this", "module" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "do...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
sample_rate
null
def sample_rate(self, samp): """ Setter for the sampling rate. :param samp: Sampling rate to set :type samp: float """ self._info.rate = samp
Setter for the sampling rate. :param samp: Sampling rate to set :type samp: float
Setter for the sampling rate.
[ "Setter", "for", "the", "sampling", "rate", "." ]
def sample_rate(self, samp): self._info.rate = samp
[ "def", "sample_rate", "(", "self", ",", "samp", ")", ":", "self", ".", "_info", ".", "rate", "=", "samp" ]
Setter for the sampling rate.
[ "Setter", "for", "the", "sampling", "rate", "." ]
[ "\"\"\"\r\n Setter for the sampling rate.\r\n\r\n :param samp: Sampling rate to set\r\n :type samp: float\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "samp", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "samp", "type": null, "docstring": "Sampling rate to set", "do...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
finish_module
null
def finish_module(self): """ Meta finish method - Called by other modules when this chain is finishing. We do a few things here: - Call our 'finish()' method - Tell AudioCollection to finish all input modules This is called when the module is asked t...
Meta finish method - Called by other modules when this chain is finishing. We do a few things here: - Call our 'finish()' method - Tell AudioCollection to finish all input modules This is called when the module is asked to finish up it's work.
Meta finish method - Called by other modules when this chain is finishing. We do a few things here. Call our 'finish()' method Tell AudioCollection to finish all input modules This is called when the module is asked to finish up it's work.
[ "Meta", "finish", "method", "-", "Called", "by", "other", "modules", "when", "this", "chain", "is", "finishing", ".", "We", "do", "a", "few", "things", "here", ".", "Call", "our", "'", "finish", "()", "'", "method", "Tell", "AudioCollection", "to", "fini...
def finish_module(self): self.finish() self.input.finish_modules()
[ "def", "finish_module", "(", "self", ")", ":", "self", ".", "finish", "(", ")", "self", ".", "input", ".", "finish_modules", "(", ")" ]
Meta finish method - Called by other modules when this chain is finishing.
[ "Meta", "finish", "method", "-", "Called", "by", "other", "modules", "when", "this", "chain", "is", "finishing", "." ]
[ "\"\"\"\r\n Meta finish method - Called by other modules when this chain is finishing.\r\n\r\n We do a few things here:\r\n\r\n - Call our 'finish()' method\r\n - Tell AudioCollection to finish all input modules\r\n\r\n This is called when the module is asked to finish up ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
add_module
null
def add_module(self, node, start=False): """ Adds a PySynth node to the collection. We can optionally start the module before adding it. Great for if we are adding something on the fly! :param node: PySynth node to add :type node: BaseModule :param st...
Adds a PySynth node to the collection. We can optionally start the module before adding it. Great for if we are adding something on the fly! :param node: PySynth node to add :type node: BaseModule :param start: Value determining if we are starting :typ...
Adds a PySynth node to the collection. We can optionally start the module before adding it. Great for if we are adding something on the fly!
[ "Adds", "a", "PySynth", "node", "to", "the", "collection", ".", "We", "can", "optionally", "start", "the", "module", "before", "adding", "it", ".", "Great", "for", "if", "we", "are", "adding", "something", "on", "the", "fly!" ]
def add_module(self, node, start=False): if start: node = iter(node) self._objs.append(node) self.change = not self.change
[ "def", "add_module", "(", "self", ",", "node", ",", "start", "=", "False", ")", ":", "if", "start", ":", "node", "=", "iter", "(", "node", ")", "self", ".", "_objs", ".", "append", "(", "node", ")", "self", ".", "change", "=", "not", "self", ".",...
Adds a PySynth node to the collection.
[ "Adds", "a", "PySynth", "node", "to", "the", "collection", "." ]
[ "\"\"\"\r\n Adds a PySynth node to the collection.\r\n\r\n We can optionally start the module before adding it.\r\n Great for if we are adding something on the fly!\r\n\r\n :param node: PySynth node to add\r\n :type node: BaseModule\r\n :param start: Value determining if we...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "start", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": "PySynth node to add", "doc...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
fill_buffer
<not_specific>
def fill_buffer(self, ignore_global=False): """ Fills the buffer to a specified size using data from the source. :param ignore_global: Determines if we should ignore the global fill value and fill :type ignore_global: bool """ if ignore_global or self.no_fill:...
Fills the buffer to a specified size using data from the source. :param ignore_global: Determines if we should ignore the global fill value and fill :type ignore_global: bool
Fills the buffer to a specified size using data from the source.
[ "Fills", "the", "buffer", "to", "a", "specified", "size", "using", "data", "from", "the", "source", "." ]
def fill_buffer(self, ignore_global=False): if ignore_global or self.no_fill: return for index in range(len(self), self.size): self.append(next(self.source))
[ "def", "fill_buffer", "(", "self", ",", "ignore_global", "=", "False", ")", ":", "if", "ignore_global", "or", "self", ".", "no_fill", ":", "return", "for", "index", "in", "range", "(", "len", "(", "self", ")", ",", "self", ".", "size", ")", ":", "sel...
Fills the buffer to a specified size using data from the source.
[ "Fills", "the", "buffer", "to", "a", "specified", "size", "using", "data", "from", "the", "source", "." ]
[ "\"\"\"\r\n Fills the buffer to a specified size using data from the source.\r\n\r\n :param ignore_global: Determines if we should ignore the global fill value and fill\r\n :type ignore_global: bool\r\n \"\"\"", "# Do not fill this buffer!\r", "# Iterate over the remaining values tha...
[ { "param": "self", "type": null }, { "param": "ignore_global", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ignore_global", "type": null, "docstring": "Determines if we should...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
pop
<not_specific>
def pop(self): """ Removes an item from the right side of the queue, and returns it. Great for removing the newest values added. We call the parent function here, 'deque.pop()', but we also include a 'fill_buffer()' call to ensure the buffer is always full. :r...
Removes an item from the right side of the queue, and returns it. Great for removing the newest values added. We call the parent function here, 'deque.pop()', but we also include a 'fill_buffer()' call to ensure the buffer is always full. :return: Value removed from rig...
Removes an item from the right side of the queue, and returns it. Great for removing the newest values added. We call the parent function here, 'deque.pop()', but we also include a 'fill_buffer()' call to ensure the buffer is always full.
[ "Removes", "an", "item", "from", "the", "right", "side", "of", "the", "queue", "and", "returns", "it", ".", "Great", "for", "removing", "the", "newest", "values", "added", ".", "We", "call", "the", "parent", "function", "here", "'", "deque", ".", "pop", ...
def pop(self): val = super(AudioBuffer, self).pop() self.fill_buffer() return val
[ "def", "pop", "(", "self", ")", ":", "val", "=", "super", "(", "AudioBuffer", ",", "self", ")", ".", "pop", "(", ")", "self", ".", "fill_buffer", "(", ")", "return", "val" ]
Removes an item from the right side of the queue, and returns it.
[ "Removes", "an", "item", "from", "the", "right", "side", "of", "the", "queue", "and", "returns", "it", "." ]
[ "\"\"\"\r\n Removes an item from the right side of the queue, and returns it.\r\n Great for removing the newest values added.\r\n\r\n We call the parent function here, 'deque.pop()', but we also include a 'fill_buffer()'\r\n call to ensure the buffer is always full.\r\n\r\n :retur...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Value removed from right side of buffer", "docstring_tokens": [ "Value", "removed", "from", "right", "side", "of", "buffer" ], "type": "float, int" } ], "raises": [], "params": [ { "i...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
popleft
<not_specific>
def popleft(self): """ Removes an item from the left side of the queue, and returns it. Great for removing the oldest values added. Like 'pop()', we call the parent function and re-fill our buffer. :return: Value removed from left side of the buffer :rtype: fl...
Removes an item from the left side of the queue, and returns it. Great for removing the oldest values added. Like 'pop()', we call the parent function and re-fill our buffer. :return: Value removed from left side of the buffer :rtype: float, int
Removes an item from the left side of the queue, and returns it. Great for removing the oldest values added. Like 'pop()', we call the parent function and re-fill our buffer.
[ "Removes", "an", "item", "from", "the", "left", "side", "of", "the", "queue", "and", "returns", "it", ".", "Great", "for", "removing", "the", "oldest", "values", "added", ".", "Like", "'", "pop", "()", "'", "we", "call", "the", "parent", "function", "a...
def popleft(self): val = super(AudioBuffer, self).popleft() self.fill_buffer() return val
[ "def", "popleft", "(", "self", ")", ":", "val", "=", "super", "(", "AudioBuffer", ",", "self", ")", ".", "popleft", "(", ")", "self", ".", "fill_buffer", "(", ")", "return", "val" ]
Removes an item from the left side of the queue, and returns it.
[ "Removes", "an", "item", "from", "the", "left", "side", "of", "the", "queue", "and", "returns", "it", "." ]
[ "\"\"\"\r\n Removes an item from the left side of the queue, and returns it.\r\n Great for removing the oldest values added.\r\n\r\n Like 'pop()', we call the parent function and re-fill our buffer.\r\n\r\n :return: Value removed from left side of the buffer\r\n :rtype: float, int...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Value removed from left side of the buffer", "docstring_tokens": [ "Value", "removed", "from", "left", "side", "of", "the", "buffer" ], "type": "float, int" } ], "raises": [], "params":...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
value
<not_specific>
def value(self): """ Handles any relevant events and return the internal value. We only handle one event at a time. If the target time for the handled event is less than or equal to the current time, then we set the internal value to the target value. If the end time i...
Handles any relevant events and return the internal value. We only handle one event at a time. If the target time for the handled event is less than or equal to the current time, then we set the internal value to the target value. If the end time is negative, then we do not remo...
Handles any relevant events and return the internal value. We only handle one event at a time. If the target time for the handled event is less than or equal to the current time, then we set the internal value to the target value. If the end time is negative, then we do not remove it.
[ "Handles", "any", "relevant", "events", "and", "return", "the", "internal", "value", ".", "We", "only", "handle", "one", "event", "at", "a", "time", ".", "If", "the", "target", "time", "for", "the", "handled", "event", "is", "less", "than", "or", "equal"...
def value(self): if self._events: if type(self._events[0]) == tuple: self._events[0] = self.start_event(self._events[0]) if get_time() >= self._events[0].time_end > 0.0: self._value = self._events.pop(0).value_target else: self....
[ "def", "value", "(", "self", ")", ":", "if", "self", ".", "_events", ":", "if", "type", "(", "self", ".", "_events", "[", "0", "]", ")", "==", "tuple", ":", "self", ".", "_events", "[", "0", "]", "=", "self", ".", "start_event", "(", "self", "....
Handles any relevant events and return the internal value.
[ "Handles", "any", "relevant", "events", "and", "return", "the", "internal", "value", "." ]
[ "\"\"\"\r\n Handles any relevant events and return the internal value.\r\n\r\n We only handle one event at a time. If the target time for the handled event\r\n is less than or equal to the current time, then we set the internal value to the target value.\r\n\r\n If the end time is negati...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
value
null
def value(self, value): """ Sets the internal value to the given value. Under the hood, we simply add a SetValue event at the current time, so we don't interfere with the current event. :param value: Value to set """ self.add_event(SetValue, value, ...
Sets the internal value to the given value. Under the hood, we simply add a SetValue event at the current time, so we don't interfere with the current event. :param value: Value to set
Sets the internal value to the given value. Under the hood, we simply add a SetValue event at the current time, so we don't interfere with the current event.
[ "Sets", "the", "internal", "value", "to", "the", "given", "value", ".", "Under", "the", "hood", "we", "simply", "add", "a", "SetValue", "event", "at", "the", "current", "time", "so", "we", "don", "'", "t", "interfere", "with", "the", "current", "event", ...
def value(self, value): self.add_event(SetValue, value, get_time())
[ "def", "value", "(", "self", ",", "value", ")", ":", "self", ".", "add_event", "(", "SetValue", ",", "value", ",", "get_time", "(", ")", ")" ]
Sets the internal value to the given value.
[ "Sets", "the", "internal", "value", "to", "the", "given", "value", "." ]
[ "\"\"\"\r\n Sets the internal value to the given value.\r\n\r\n Under the hood, we simply add a SetValue event at the current time,\r\n so we don't interfere with the current event.\r\n\r\n :param value: Value to set\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "Value to set", "docstring...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
start_event
<not_specific>
def start_event(self, params): """ Starts an event instance by instantiating it, and giving it the necessary values. :param params: Event and parameters to instantiate it with :type params: tuple :return: Instantiated and started event :rtype: BaseEvent...
Starts an event instance by instantiating it, and giving it the necessary values. :param params: Event and parameters to instantiate it with :type params: tuple :return: Instantiated and started event :rtype: BaseEvent :raise: ValueError - If the target ...
Starts an event instance by instantiating it, and giving it the necessary values.
[ "Starts", "an", "event", "instance", "by", "instantiating", "it", "and", "giving", "it", "the", "necessary", "values", "." ]
def start_event(self, params): return params[0](get_time(), params[2], self._value, params[1])
[ "def", "start_event", "(", "self", ",", "params", ")", ":", "return", "params", "[", "0", "]", "(", "get_time", "(", ")", ",", "params", "[", "2", "]", ",", "self", ".", "_value", ",", "params", "[", "1", "]", ")" ]
Starts an event instance by instantiating it, and giving it the necessary values.
[ "Starts", "an", "event", "instance", "by", "instantiating", "it", "and", "giving", "it", "the", "necessary", "values", "." ]
[ "\"\"\"\r\n Starts an event instance by instantiating it,\r\n and giving it the necessary values.\r\n\r\n :param params: Event and parameters to instantiate it with\r\n :type params: tuple\r\n :return: Instantiated and started event\r\n :rtype: BaseEvent\r\n :raise: ...
[ { "param": "self", "type": null }, { "param": "params", "type": null } ]
{ "returns": [ { "docstring": "Instantiated and started event", "docstring_tokens": [ "Instantiated", "and", "started", "event" ], "type": "BaseEvent" } ], "raises": [ { "docstring": "If the target value is outside of the range.", "do...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
add_event
null
def add_event(self, event, target, time_e): """ Adds an event to the queue. This event is not started or instantiated, it is instead added as a tuple with it's intended parameters. It is started once the AudioValue object reaches it. :param event: Event to instantiate an...
Adds an event to the queue. This event is not started or instantiated, it is instead added as a tuple with it's intended parameters. It is started once the AudioValue object reaches it. :param event: Event to instantiate and start :type event: BaseEvent :param ta...
Adds an event to the queue. This event is not started or instantiated, it is instead added as a tuple with it's intended parameters. It is started once the AudioValue object reaches it.
[ "Adds", "an", "event", "to", "the", "queue", ".", "This", "event", "is", "not", "started", "or", "instantiated", "it", "is", "instead", "added", "as", "a", "tuple", "with", "it", "'", "s", "intended", "parameters", ".", "It", "is", "started", "once", "...
def add_event(self, event, target, time_e): self._events.append((event, target, time_e))
[ "def", "add_event", "(", "self", ",", "event", ",", "target", ",", "time_e", ")", ":", "self", ".", "_events", ".", "append", "(", "(", "event", ",", "target", ",", "time_e", ")", ")" ]
Adds an event to the queue.
[ "Adds", "an", "event", "to", "the", "queue", "." ]
[ "\"\"\"\r\n Adds an event to the queue. This event is not started or instantiated,\r\n it is instead added as a tuple with it's intended parameters.\r\n It is started once the AudioValue object reaches it.\r\n\r\n :param event: Event to instantiate and start\r\n :type event: BaseE...
[ { "param": "self", "type": null }, { "param": "event", "type": null }, { "param": "target", "type": null }, { "param": "time_e", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "event", "type": null, "docstring": "Event to instantiate and start"...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
cancel_all_events
null
def cancel_all_events(self): """ Cancles all events current occuring. This will not correct the value fo the event, it will remain as it left off! """ # Cancel all events: self._events.clear()
Cancles all events current occuring. This will not correct the value fo the event, it will remain as it left off!
Cancles all events current occuring. This will not correct the value fo the event, it will remain as it left off!
[ "Cancles", "all", "events", "current", "occuring", ".", "This", "will", "not", "correct", "the", "value", "fo", "the", "event", "it", "will", "remain", "as", "it", "left", "off!" ]
def cancel_all_events(self): self._events.clear()
[ "def", "cancel_all_events", "(", "self", ")", ":", "self", ".", "_events", ".", "clear", "(", ")" ]
Cancles all events current occuring.
[ "Cancles", "all", "events", "current", "occuring", "." ]
[ "\"\"\"\r\n Cancles all events current occuring.\r\n\r\n This will not correct the value fo the event,\r\n it will remain as it left off!\r\n \"\"\"", "# Cancel all events:\r" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
linear_ramp
null
def linear_ramp(self, target, endtime): """ Creates and adds a LinearRamp event to the event queue. :param target: Target value :type target: float :param endtime: End time :type endtime: float """ self.add_event(LinearRamp, target, endtime)
Creates and adds a LinearRamp event to the event queue. :param target: Target value :type target: float :param endtime: End time :type endtime: float
Creates and adds a LinearRamp event to the event queue.
[ "Creates", "and", "adds", "a", "LinearRamp", "event", "to", "the", "event", "queue", "." ]
def linear_ramp(self, target, endtime): self.add_event(LinearRamp, target, endtime)
[ "def", "linear_ramp", "(", "self", ",", "target", ",", "endtime", ")", ":", "self", ".", "add_event", "(", "LinearRamp", ",", "target", ",", "endtime", ")" ]
Creates and adds a LinearRamp event to the event queue.
[ "Creates", "and", "adds", "a", "LinearRamp", "event", "to", "the", "event", "queue", "." ]
[ "\"\"\"\r\n Creates and adds a LinearRamp event to the event queue.\r\n\r\n :param target: Target value\r\n :type target: float\r\n :param endtime: End time\r\n :type endtime: float\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "target", "type": null }, { "param": "endtime", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": null, "docstring": null, "docstring_tokens":...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
exponential_ramp
null
def exponential_ramp(self, target, endtime): """ Creates and adds a ExponentialRamp event to the event queue. :param target: Target value :type target: float :param endtime: End time :type endtime: float """ self.add_event(ExponentialRamp, ta...
Creates and adds a ExponentialRamp event to the event queue. :param target: Target value :type target: float :param endtime: End time :type endtime: float
Creates and adds a ExponentialRamp event to the event queue.
[ "Creates", "and", "adds", "a", "ExponentialRamp", "event", "to", "the", "event", "queue", "." ]
def exponential_ramp(self, target, endtime): self.add_event(ExponentialRamp, target, endtime)
[ "def", "exponential_ramp", "(", "self", ",", "target", ",", "endtime", ")", ":", "self", ".", "add_event", "(", "ExponentialRamp", ",", "target", ",", "endtime", ")" ]
Creates and adds a ExponentialRamp event to the event queue.
[ "Creates", "and", "adds", "a", "ExponentialRamp", "event", "to", "the", "event", "queue", "." ]
[ "\"\"\"\r\n Creates and adds a ExponentialRamp event to the event queue.\r\n\r\n :param target: Target value\r\n :type target: float\r\n :param endtime: End time\r\n :type endtime: float\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "target", "type": null }, { "param": "endtime", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": null, "docstring": null, "docstring_tokens":...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
bind_oscillator
null
def bind_oscillator(self, osc, endtime=-1.0): """ Binds an oscillator to this object. The default time is negative, as the user probably wants to use this oscillator indefinitely. The values pulled from the oscillator will be added to the starting value when the...
Binds an oscillator to this object. The default time is negative, as the user probably wants to use this oscillator indefinitely. The values pulled from the oscillator will be added to the starting value when the OscillatorEvent was instantiated. If you just want...
Binds an oscillator to this object. The default time is negative, as the user probably wants to use this oscillator indefinitely. The values pulled from the oscillator will be added to the starting value when the OscillatorEvent was instantiated. If you just want to get oscillator information without adding the output...
[ "Binds", "an", "oscillator", "to", "this", "object", ".", "The", "default", "time", "is", "negative", "as", "the", "user", "probably", "wants", "to", "use", "this", "oscillator", "indefinitely", ".", "The", "values", "pulled", "from", "the", "oscillator", "w...
def bind_oscillator(self, osc, endtime=-1.0): self.add_event(OscillatorEvent, osc, endtime)
[ "def", "bind_oscillator", "(", "self", ",", "osc", ",", "endtime", "=", "-", "1.0", ")", ":", "self", ".", "add_event", "(", "OscillatorEvent", ",", "osc", ",", "endtime", ")" ]
Binds an oscillator to this object.
[ "Binds", "an", "oscillator", "to", "this", "object", "." ]
[ "\"\"\"\r\n Binds an oscillator to this object.\r\n The default time is negative,\r\n as the user probably wants to use this oscillator indefinitely.\r\n\r\n The values pulled from the oscillator will be added to the starting value\r\n when the OscillatorEvent was instantiated.\r\...
[ { "param": "self", "type": null }, { "param": "osc", "type": null }, { "param": "endtime", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "osc", "type": null, "docstring": "Oscillator to bind", "docst...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
comp
<not_specific>
def comp(self): """ Runs the necessary computations on the value and returns it. This should be overridden in the child class! :return: New value """ return self.value_start
Runs the necessary computations on the value and returns it. This should be overridden in the child class! :return: New value
Runs the necessary computations on the value and returns it. This should be overridden in the child class!
[ "Runs", "the", "necessary", "computations", "on", "the", "value", "and", "returns", "it", ".", "This", "should", "be", "overridden", "in", "the", "child", "class!" ]
def comp(self): return self.value_start
[ "def", "comp", "(", "self", ")", ":", "return", "self", ".", "value_start" ]
Runs the necessary computations on the value and returns it.
[ "Runs", "the", "necessary", "computations", "on", "the", "value", "and", "returns", "it", "." ]
[ "\"\"\"\r\n Runs the necessary computations on the value and returns it.\r\n\r\n This should be overridden in the child class!\r\n\r\n :return: New value\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
comp
<not_specific>
def comp(self): """ Exponentially ramps the value to a target over a time period. We use this formula for our calculations: v(t) = V0 * (V1 / V0) ^ ((t - T0) - (T1 - T0)) t = current time V0 = Initial value V1 = Target value T0 = Initial ti...
Exponentially ramps the value to a target over a time period. We use this formula for our calculations: v(t) = V0 * (V1 / V0) ^ ((t - T0) - (T1 - T0)) t = current time V0 = Initial value V1 = Target value T0 = Initial time T1 = End time ...
Exponentially ramps the value to a target over a time period. We use this formula for our calculations.
[ "Exponentially", "ramps", "the", "value", "to", "a", "target", "over", "a", "time", "period", ".", "We", "use", "this", "formula", "for", "our", "calculations", "." ]
def comp(self): return self.value_start * (self.val_div) ** \ ((get_time() - self.time_start) / (self.time_dif))
[ "def", "comp", "(", "self", ")", ":", "return", "self", ".", "value_start", "*", "(", "self", ".", "val_div", ")", "**", "(", "(", "get_time", "(", ")", "-", "self", ".", "time_start", ")", "/", "(", "self", ".", "time_dif", ")", ")" ]
Exponentially ramps the value to a target over a time period.
[ "Exponentially", "ramps", "the", "value", "to", "a", "target", "over", "a", "time", "period", "." ]
[ "\"\"\"\r\n Exponentially ramps the value to a target over a time period.\r\n\r\n We use this formula for our calculations:\r\n\r\n v(t) = V0 * (V1 / V0) ^ ((t - T0) - (T1 - T0))\r\n\r\n t = current time\r\n V0 = Initial value\r\n V1 = Target value\r\n T0 = Initial t...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null...
aa91f7fa543066675204f1080f9391bee8881acd
monarrk/python-audio-synth
pysynth/utils.py
[ "MIT" ]
Python
comp
<not_specific>
def comp(self): """ Computes the next value in the oscillator and returns it. :return: New value :rtype: float """ return self.value_start + self.value_target.calc_next()
Computes the next value in the oscillator and returns it. :return: New value :rtype: float
Computes the next value in the oscillator and returns it.
[ "Computes", "the", "next", "value", "in", "the", "oscillator", "and", "returns", "it", "." ]
def comp(self): return self.value_start + self.value_target.calc_next()
[ "def", "comp", "(", "self", ")", ":", "return", "self", ".", "value_start", "+", "self", ".", "value_target", ".", "calc_next", "(", ")" ]
Computes the next value in the oscillator and returns it.
[ "Computes", "the", "next", "value", "in", "the", "oscillator", "and", "returns", "it", "." ]
[ "\"\"\"\r\n Computes the next value in the oscillator and returns it.\r\n\r\n :return: New value\r\n :rtype: float\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null...
fce885da452bd9223616ca634f08a4ec6578074e
monarrk/python-audio-synth
pysynth/osc.py
[ "MIT" ]
Python
val_calc
<not_specific>
def val_calc(self): """ Calculates and returns the inner value of the function. This is based off of frequency and sampling rate. :return: Number inside function :rtype: float """ return math.pi * self.freq.value * (float(self.index) / float(self.samp...
Calculates and returns the inner value of the function. This is based off of frequency and sampling rate. :return: Number inside function :rtype: float
Calculates and returns the inner value of the function. This is based off of frequency and sampling rate.
[ "Calculates", "and", "returns", "the", "inner", "value", "of", "the", "function", ".", "This", "is", "based", "off", "of", "frequency", "and", "sampling", "rate", "." ]
def val_calc(self): return math.pi * self.freq.value * (float(self.index) / float(self.sample_rate))
[ "def", "val_calc", "(", "self", ")", ":", "return", "math", ".", "pi", "*", "self", ".", "freq", ".", "value", "*", "(", "float", "(", "self", ".", "index", ")", "/", "float", "(", "self", ".", "sample_rate", ")", ")" ]
Calculates and returns the inner value of the function.
[ "Calculates", "and", "returns", "the", "inner", "value", "of", "the", "function", "." ]
[ "\"\"\"\r\n Calculates and returns the inner value of the function.\r\n This is based off of frequency and sampling rate.\r\n\r\n :return: Number inside function\r\n :rtype: float\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Number inside function", "docstring_tokens": [ "Number", "inside", "function" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_t...
fce885da452bd9223616ca634f08a4ec6578074e
monarrk/python-audio-synth
pysynth/osc.py
[ "MIT" ]
Python
start
null
def start(self): """ Prepares the SquareOscillator for iteration. We create a SineOscillator to pull values from. """ # Create a SineOscillator: self._sine = SineOscillator() # Set the oscillator AudioParameter to ours: self._sine._info.f...
Prepares the SquareOscillator for iteration. We create a SineOscillator to pull values from.
Prepares the SquareOscillator for iteration. We create a SineOscillator to pull values from.
[ "Prepares", "the", "SquareOscillator", "for", "iteration", ".", "We", "create", "a", "SineOscillator", "to", "pull", "values", "from", "." ]
def start(self): self._sine = SineOscillator() self._sine._info.freq = self._info.freq
[ "def", "start", "(", "self", ")", ":", "self", ".", "_sine", "=", "SineOscillator", "(", ")", "self", ".", "_sine", ".", "_info", ".", "freq", "=", "self", ".", "_info", ".", "freq" ]
Prepares the SquareOscillator for iteration.
[ "Prepares", "the", "SquareOscillator", "for", "iteration", "." ]
[ "\"\"\"\r\n Prepares the SquareOscillator for iteration.\r\n We create a SineOscillator to pull values from.\r\n \"\"\"", "# Create a SineOscillator:\r", "# Set the oscillator AudioParameter to ours:\r" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c6454e43c31048482de674a7caf9145f04dff7d7
majamassarini/knx-stack
knx_stack/definition/layer/network/address_table.py
[ "MIT" ]
Python
add
"knx_stack.AddressTable"
def add(self, address: "knx_stack.Address") -> "knx_stack.AddressTable": """ Returns a new *Address Table* containing the given *group address* :param address: a new *group address* to be inserted :return: a new AddressTable instance """ if address not in self._group_add...
Returns a new *Address Table* containing the given *group address* :param address: a new *group address* to be inserted :return: a new AddressTable instance
Returns a new *Address Table* containing the given *group address
[ "Returns", "a", "new", "*", "Address", "Table", "*", "containing", "the", "given", "*", "group", "address" ]
def add(self, address: "knx_stack.Address") -> "knx_stack.AddressTable": if address not in self._group_addresses or address != self._individual_address: if len(self._group_addresses) >= self.max_size: raise AddressTableException( "Max entries %d, already written i...
[ "def", "add", "(", "self", ",", "address", ":", "\"knx_stack.Address\"", ")", "->", "\"knx_stack.AddressTable\"", ":", "if", "address", "not", "in", "self", ".", "_group_addresses", "or", "address", "!=", "self", ".", "_individual_address", ":", "if", "len", "...
Returns a new *Address Table* containing the given *group address
[ "Returns", "a", "new", "*", "Address", "Table", "*", "containing", "the", "given", "*", "group", "address" ]
[ "\"\"\"\n Returns a new *Address Table* containing the given *group address*\n\n :param address: a new *group address* to be inserted\n :return: a new AddressTable instance\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "address", "type": "\"knx_stack.Address\"" } ]
{ "returns": [ { "docstring": "a new AddressTable instance", "docstring_tokens": [ "a", "new", "AddressTable", "instance" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
c6454e43c31048482de674a7caf9145f04dff7d7
majamassarini/knx-stack
knx_stack/definition/layer/network/address_table.py
[ "MIT" ]
Python
remove
"knx_stack.AddressTable"
def remove(self, address: "knx_stack.GroupAddress") -> "knx_stack.AddressTable": """ Returns a new *Address Table* without the given *group address* :param address: a *group address* to be removed :return: a new AddressTable instance """ self._group_addresses.remove(addr...
Returns a new *Address Table* without the given *group address* :param address: a *group address* to be removed :return: a new AddressTable instance
Returns a new *Address Table* without the given *group address
[ "Returns", "a", "new", "*", "Address", "Table", "*", "without", "the", "given", "*", "group", "address" ]
def remove(self, address: "knx_stack.GroupAddress") -> "knx_stack.AddressTable": self._group_addresses.remove(address) self._group_addresses.sort(key=lambda group_address: group_address.free_style)
[ "def", "remove", "(", "self", ",", "address", ":", "\"knx_stack.GroupAddress\"", ")", "->", "\"knx_stack.AddressTable\"", ":", "self", ".", "_group_addresses", ".", "remove", "(", "address", ")", "self", ".", "_group_addresses", ".", "sort", "(", "key", "=", "...
Returns a new *Address Table* without the given *group address
[ "Returns", "a", "new", "*", "Address", "Table", "*", "without", "the", "given", "*", "group", "address" ]
[ "\"\"\"\n Returns a new *Address Table* without the given *group address*\n\n :param address: a *group address* to be removed\n :return: a new AddressTable instance\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "address", "type": "\"knx_stack.GroupAddress\"" } ]
{ "returns": [ { "docstring": "a new AddressTable instance", "docstring_tokens": [ "a", "new", "AddressTable", "instance" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
431c7c181340cb64a28cf8ef8a7c42ca4dc0b569
majamassarini/knx-stack
knx_stack/datapointtypes.py
[ "MIT" ]
Python
make
"knx_stack.datapointtypes.DPT"
def make(dpt: str, fields_values: dict) -> "knx_stack.datapointtypes.DPT": """ Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values. :param dpt: a DPT name :param fields_values: a dictionary of values for the DPT's fields :return: a knx_stack.datapoint...
Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values. :param dpt: a DPT name :param fields_values: a dictionary of values for the DPT's fields :return: a knx_stack.datapointtypes.DPT instance >>> import knx_stack >>> factory = knx_stack.datap...
Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.
[ "Build", "a", "knx_stack", ".", "datapointtypes", ".", "DPT", "from", "a", "dpt", "name", "and", "a", "dictionary", "of", "values", "." ]
def make(dpt: str, fields_values: dict) -> "knx_stack.datapointtypes.DPT": from knx_stack import datapointtypes dpt = getattr(datapointtypes, dpt)() for key, value in fields_values.items(): if key == "decoded_value": dpt.encode(value) else: ...
[ "def", "make", "(", "dpt", ":", "str", ",", "fields_values", ":", "dict", ")", "->", "\"knx_stack.datapointtypes.DPT\"", ":", "from", "knx_stack", "import", "datapointtypes", "dpt", "=", "getattr", "(", "datapointtypes", ",", "dpt", ")", "(", ")", "for", "ke...
Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.
[ "Build", "a", "knx_stack", ".", "datapointtypes", ".", "DPT", "from", "a", "dpt", "name", "and", "a", "dictionary", "of", "values", "." ]
[ "\"\"\"\n Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.\n\n :param dpt: a DPT name\n :param fields_values: a dictionary of values for the DPT's fields\n :return: a knx_stack.datapointtypes.DPT instance\n\n >>> import knx_stack\n >>> factor...
[ { "param": "dpt", "type": "str" }, { "param": "fields_values", "type": "dict" } ]
{ "returns": [ { "docstring": "a knx_stack.datapointtypes.DPT instance\n>>> import knx_stack\n>>> factory = knx_stack.datapointtypes.DPT_Factory()\n\n>>> dpt = factory.make(\"DPT_Control_Dimming\", {\"step\": 7, \"direction\": \"up\"})\n>>> dpt.step\n7\n>>> dpt.direction == knx_stack.datapointtypes.DPT_Cont...
431c7c181340cb64a28cf8ef8a7c42ca4dc0b569
majamassarini/knx-stack
knx_stack/datapointtypes.py
[ "MIT" ]
Python
twos_comp
<not_specific>
def twos_comp(self, val, bits): """compute the 2's complement of int value val""" max_mantissa_value = (1 << bits) - 1 comp_two = abs(max_mantissa_value - val) + 1 return comp_two
compute the 2's complement of int value val
compute the 2's complement of int value val
[ "compute", "the", "2", "'", "s", "complement", "of", "int", "value", "val" ]
def twos_comp(self, val, bits): max_mantissa_value = (1 << bits) - 1 comp_two = abs(max_mantissa_value - val) + 1 return comp_two
[ "def", "twos_comp", "(", "self", ",", "val", ",", "bits", ")", ":", "max_mantissa_value", "=", "(", "1", "<<", "bits", ")", "-", "1", "comp_two", "=", "abs", "(", "max_mantissa_value", "-", "val", ")", "+", "1", "return", "comp_two" ]
compute the 2's complement of int value val
[ "compute", "the", "2", "'", "s", "complement", "of", "int", "value", "val" ]
[ "\"\"\"compute the 2's complement of int value val\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "val", "type": null }, { "param": "bits", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "val", "type": null, "docstring": null, "docstring_tokens": []...
ad09fce1a5317aeb12908a05e6b6e6a443ec1668
majamassarini/knx-stack
knx_stack/msg.py
[ "MIT" ]
Python
octect
Tuple["knx_stack.msg.Octect", "knx_stack.Msg"]
def octect(self) -> Tuple["knx_stack.msg.Octect", "knx_stack.Msg"]: """ Consumes an Octect from the message's byte list :return: Tuple(Octect, the other bytes as a new Msg) """ return self[0], self.__class__(self[1:])
Consumes an Octect from the message's byte list :return: Tuple(Octect, the other bytes as a new Msg)
Consumes an Octect from the message's byte list
[ "Consumes", "an", "Octect", "from", "the", "message", "'", "s", "byte", "list" ]
def octect(self) -> Tuple["knx_stack.msg.Octect", "knx_stack.Msg"]: return self[0], self.__class__(self[1:])
[ "def", "octect", "(", "self", ")", "->", "Tuple", "[", "\"knx_stack.msg.Octect\"", ",", "\"knx_stack.Msg\"", "]", ":", "return", "self", "[", "0", "]", ",", "self", ".", "__class__", "(", "self", "[", "1", ":", "]", ")" ]
Consumes an Octect from the message's byte list
[ "Consumes", "an", "Octect", "from", "the", "message", "'", "s", "byte", "list" ]
[ "\"\"\"\n Consumes an Octect from the message's byte list\n\n :return: Tuple(Octect, the other bytes as a new Msg)\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Tuple(Octect, the other bytes as a new Msg)", "docstring_tokens": [ "Tuple", "(", "Octect", "the", "other", "bytes", "as", "a", "new", "Msg", ")" ], "type": null } ]...
ad09fce1a5317aeb12908a05e6b6e6a443ec1668
majamassarini/knx-stack
knx_stack/msg.py
[ "MIT" ]
Python
short
Tuple["knx_stack.msg.Short", "knx_stack.Msg"]
def short(self) -> Tuple["knx_stack.msg.Short", "knx_stack.Msg"]: """ Consumes a Short from the message's byte list :return: Tuple(Short, the other bytes as a new Msg) """ short = Short() short.byte.MSB = self[0].value short.byte.LSB = self[1].value retur...
Consumes a Short from the message's byte list :return: Tuple(Short, the other bytes as a new Msg)
Consumes a Short from the message's byte list
[ "Consumes", "a", "Short", "from", "the", "message", "'", "s", "byte", "list" ]
def short(self) -> Tuple["knx_stack.msg.Short", "knx_stack.Msg"]: short = Short() short.byte.MSB = self[0].value short.byte.LSB = self[1].value return short, self.__class__(self[2:])
[ "def", "short", "(", "self", ")", "->", "Tuple", "[", "\"knx_stack.msg.Short\"", ",", "\"knx_stack.Msg\"", "]", ":", "short", "=", "Short", "(", ")", "short", ".", "byte", ".", "MSB", "=", "self", "[", "0", "]", ".", "value", "short", ".", "byte", "....
Consumes a Short from the message's byte list
[ "Consumes", "a", "Short", "from", "the", "message", "'", "s", "byte", "list" ]
[ "\"\"\"\n Consumes a Short from the message's byte list\n\n :return: Tuple(Short, the other bytes as a new Msg)\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Tuple(Short, the other bytes as a new Msg)", "docstring_tokens": [ "Tuple", "(", "Short", "the", "other", "bytes", "as", "a", "new", "Msg", ")" ], "type": null } ], ...
ad09fce1a5317aeb12908a05e6b6e6a443ec1668
majamassarini/knx-stack
knx_stack/msg.py
[ "MIT" ]
Python
long
Tuple["knx_stack.msg.Long", "knx_stack.Msg"]
def long(self) -> Tuple["knx_stack.msg.Long", "knx_stack.Msg"]: """ Consumes a Long from the message's byte list :return: Tuple(Long, the other bytes as a new Msg) """ long = Long() long.byte.B4 = self[0].value long.byte.B3 = self[1].value long.byte.B2 = ...
Consumes a Long from the message's byte list :return: Tuple(Long, the other bytes as a new Msg)
Consumes a Long from the message's byte list
[ "Consumes", "a", "Long", "from", "the", "message", "'", "s", "byte", "list" ]
def long(self) -> Tuple["knx_stack.msg.Long", "knx_stack.Msg"]: long = Long() long.byte.B4 = self[0].value long.byte.B3 = self[1].value long.byte.B2 = self[2].value long.byte.B1 = self[3].value return long, self.__class__(self[4:])
[ "def", "long", "(", "self", ")", "->", "Tuple", "[", "\"knx_stack.msg.Long\"", ",", "\"knx_stack.Msg\"", "]", ":", "long", "=", "Long", "(", ")", "long", ".", "byte", ".", "B4", "=", "self", "[", "0", "]", ".", "value", "long", ".", "byte", ".", "B...
Consumes a Long from the message's byte list
[ "Consumes", "a", "Long", "from", "the", "message", "'", "s", "byte", "list" ]
[ "\"\"\"\n Consumes a Long from the message's byte list\n\n :return: Tuple(Long, the other bytes as a new Msg)\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Tuple(Long, the other bytes as a new Msg)", "docstring_tokens": [ "Tuple", "(", "Long", "the", "other", "bytes", "as", "a", "new", "Msg", ")" ], "type": null } ], ...
ca6a1abd6701e5128dd3c4919a0e3a23f1c9f346
mdesmet/dbt-trino
dbt/adapters/trino/connections.py
[ "Apache-2.0" ]
Python
_escape_value
<not_specific>
def _escape_value(cls, value): """A not very comprehensive system for escaping bindings. I think "'" (a single quote) is the only character that matters. """ numbers = (decimal.Decimal, int, float) if value is None: return "NULL" elif isinstance(value, str): ...
A not very comprehensive system for escaping bindings. I think "'" (a single quote) is the only character that matters.
A not very comprehensive system for escaping bindings. I think "'" (a single quote) is the only character that matters.
[ "A", "not", "very", "comprehensive", "system", "for", "escaping", "bindings", ".", "I", "think", "\"", "'", "\"", "(", "a", "single", "quote", ")", "is", "the", "only", "character", "that", "matters", "." ]
def _escape_value(cls, value): numbers = (decimal.Decimal, int, float) if value is None: return "NULL" elif isinstance(value, str): return "'{}'".format(value.replace("'", "''")) elif isinstance(value, numbers): return value elif isinstance(val...
[ "def", "_escape_value", "(", "cls", ",", "value", ")", ":", "numbers", "=", "(", "decimal", ".", "Decimal", ",", "int", ",", "float", ")", "if", "value", "is", "None", ":", "return", "\"NULL\"", "elif", "isinstance", "(", "value", ",", "str", ")", ":...
A not very comprehensive system for escaping bindings.
[ "A", "not", "very", "comprehensive", "system", "for", "escaping", "bindings", "." ]
[ "\"\"\"A not very comprehensive system for escaping bindings.\n\n I think \"'\" (a single quote) is the only character that matters.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": [...
8e3f96fc579c409213baeea752153e3b03cec239
alanrkessler/fangraphs_db
fangraphs_db.py
[ "MIT" ]
Python
specify_driver
<not_specific>
def specify_driver(): """Set Chrome webdriver options and return a diver object.""" # Set default download directory options = webdriver.ChromeOptions() prefs = {"download.default_directory": str(Path.cwd() / 'data')} options.add_experimental_option("prefs", prefs) # Define the executabl...
Set Chrome webdriver options and return a diver object.
Set Chrome webdriver options and return a diver object.
[ "Set", "Chrome", "webdriver", "options", "and", "return", "a", "diver", "object", "." ]
def specify_driver(): options = webdriver.ChromeOptions() prefs = {"download.default_directory": str(Path.cwd() / 'data')} options.add_experimental_option("prefs", prefs) chrome_driver = Path.cwd() / 'chromedriver' cap = DesiredCapabilities.CHROME cap["pageLoadStrategy"] = "none" if type(chr...
[ "def", "specify_driver", "(", ")", ":", "options", "=", "webdriver", ".", "ChromeOptions", "(", ")", "prefs", "=", "{", "\"download.default_directory\"", ":", "str", "(", "Path", ".", "cwd", "(", ")", "/", "'data'", ")", "}", "options", ".", "add_experimen...
Set Chrome webdriver options and return a diver object.
[ "Set", "Chrome", "webdriver", "options", "and", "return", "a", "diver", "object", "." ]
[ "\"\"\"Set Chrome webdriver options and return a diver object.\"\"\"", "# Set default download directory\r", "# Define the executable path fro the Chrome call\r", "# Set the load strategy so that it does not wait for adds to load\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
8e3f96fc579c409213baeea752153e3b03cec239
alanrkessler/fangraphs_db
fangraphs_db.py
[ "MIT" ]
Python
download_leaderboard
<not_specific>
def download_leaderboard(link): """Download the leaderboard and return a bool if successful.""" # Clear any existing file clear_temp() # Specify the driver driver = specify_driver() # Wait a reasonable time that a person would take wait = WebDriverWait(driver, 20) # Instruc...
Download the leaderboard and return a bool if successful.
Download the leaderboard and return a bool if successful.
[ "Download", "the", "leaderboard", "and", "return", "a", "bool", "if", "successful", "." ]
def download_leaderboard(link): clear_temp() driver = specify_driver() wait = WebDriverWait(driver, 20) driver.get(link) wait.until(EC.presence_of_element_located((By.ID, "LeaderBoard1_cmdCSV"))) driver.execute_script("window.stop();") driver.execute_script("window.scrollTo(0, 200)") dri...
[ "def", "download_leaderboard", "(", "link", ")", ":", "clear_temp", "(", ")", "driver", "=", "specify_driver", "(", ")", "wait", "=", "WebDriverWait", "(", "driver", ",", "20", ")", "driver", ".", "get", "(", "link", ")", "wait", ".", "until", "(", "EC...
Download the leaderboard and return a bool if successful.
[ "Download", "the", "leaderboard", "and", "return", "a", "bool", "if", "successful", "." ]
[ "\"\"\"Download the leaderboard and return a bool if successful.\"\"\"", "# Clear any existing file\r", "# Specify the driver\r", "# Wait a reasonable time that a person would take\r", "# Instruct the browser to go to the correct page\r", "# Wait until the element to download is available and then stop lo...
[ { "param": "link", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "link", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b9773aab572b9576c93e940e5ff23908b1010a01
JonasKs/code-jam-4
project/__main__.py
[ "MIT" ]
Python
search_function
null
def search_function(self): """ Called with someone presses the `enter`-button. Basically does everything: - Fetches the search field - Decides whether it should use the real word or swap it out - Fetches backend for weather information - Display information ...
Called with someone presses the `enter`-button. Basically does everything: - Fetches the search field - Decides whether it should use the real word or swap it out - Fetches backend for weather information - Display information - Calls on the change_background() f...
Called with someone presses the `enter`-button. Basically does everything: Fetches the search field Decides whether it should use the real word or swap it out Fetches backend for weather information Display information Calls on the change_background() function Display the location it actually searched for in the search...
[ "Called", "with", "someone", "presses", "the", "`", "enter", "`", "-", "button", ".", "Basically", "does", "everything", ":", "Fetches", "the", "search", "field", "Decides", "whether", "it", "should", "use", "the", "real", "word", "or", "swap", "it", "out"...
def search_function(self): search_string = self.search_bar.get() if random.choice([True, False]): location = get_similar_location(search_string) else: location = search_string self.show_location_name(location) weather = ForecastFetcher("OWM_API_KEY") ...
[ "def", "search_function", "(", "self", ")", ":", "search_string", "=", "self", ".", "search_bar", ".", "get", "(", ")", "if", "random", ".", "choice", "(", "[", "True", ",", "False", "]", ")", ":", "location", "=", "get_similar_location", "(", "search_st...
Called with someone presses the `enter`-button.
[ "Called", "with", "someone", "presses", "the", "`", "enter", "`", "-", "button", "." ]
[ "\"\"\"\n Called with someone presses the\n `enter`-button. Basically does everything:\n - Fetches the search field\n - Decides whether it should use the real word or swap it out\n - Fetches backend for weather information\n - Display information\n - Calls on the cha...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b9773aab572b9576c93e940e5ff23908b1010a01
JonasKs/code-jam-4
project/__main__.py
[ "MIT" ]
Python
change_background
null
def change_background(self, status: str): """ Changes background according to the weather :param status: Weather status. E.g. `Clear` """ self.background_image = ImageTk.PhotoImage( Image.open(f"data/{status}.jpg")) self.main_canvas.itemconfig(self.canvas_imag...
Changes background according to the weather :param status: Weather status. E.g. `Clear`
Changes background according to the weather
[ "Changes", "background", "according", "to", "the", "weather" ]
def change_background(self, status: str): self.background_image = ImageTk.PhotoImage( Image.open(f"data/{status}.jpg")) self.main_canvas.itemconfig(self.canvas_image, image=self.background_image)
[ "def", "change_background", "(", "self", ",", "status", ":", "str", ")", ":", "self", ".", "background_image", "=", "ImageTk", ".", "PhotoImage", "(", "Image", ".", "open", "(", "f\"data/{status}.jpg\"", ")", ")", "self", ".", "main_canvas", ".", "itemconfig...
Changes background according to the weather
[ "Changes", "background", "according", "to", "the", "weather" ]
[ "\"\"\"\n Changes background according to the weather\n :param status: Weather status. E.g. `Clear`\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "status", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "status", "type": "str", "docstring": "Weather status. E.g. `Clear`"...
b9773aab572b9576c93e940e5ff23908b1010a01
JonasKs/code-jam-4
project/__main__.py
[ "MIT" ]
Python
show_location_name
null
def show_location_name(self, location_name: str): """ Show the end user where the weather is from :param location_name: For instance Oslo, Norway """ self.search_bar.delete(0, tk.END) self.search_bar.insert(0, location_name)
Show the end user where the weather is from :param location_name: For instance Oslo, Norway
Show the end user where the weather is from
[ "Show", "the", "end", "user", "where", "the", "weather", "is", "from" ]
def show_location_name(self, location_name: str): self.search_bar.delete(0, tk.END) self.search_bar.insert(0, location_name)
[ "def", "show_location_name", "(", "self", ",", "location_name", ":", "str", ")", ":", "self", ".", "search_bar", ".", "delete", "(", "0", ",", "tk", ".", "END", ")", "self", ".", "search_bar", ".", "insert", "(", "0", ",", "location_name", ")" ]
Show the end user where the weather is from
[ "Show", "the", "end", "user", "where", "the", "weather", "is", "from" ]
[ "\"\"\"\n Show the end user where the weather is from\n :param location_name: For instance Oslo, Norway\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "location_name", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "location_name", "type": "str", "docstring": "For instance Oslo, Nor...
5727d121a17e77dfe167a984712940bb2e83a2b2
JonasKs/code-jam-4
project/services/weather.py
[ "MIT" ]
Python
fetch_forecast_7_days
[Dict[str, str]]
def fetch_forecast_7_days(self, location: str, unit: str) -> [Dict[str, str]]: """Fetches the forecast for the next seven days from openweathermap.org :param location: The name of the location this :param unit: Defines the units for the temperature. Only accepts ...
Fetches the forecast for the next seven days from openweathermap.org :param location: The name of the location this :param unit: Defines the units for the temperature. Only accepts 'celsius', 'fahrenheit', 'kelvin' and 'random'.
Fetches the forecast for the next seven days from openweathermap.org
[ "Fetches", "the", "forecast", "for", "the", "next", "seven", "days", "from", "openweathermap", ".", "org" ]
def fetch_forecast_7_days(self, location: str, unit: str) -> [Dict[str, str]]: forecasts = self.owm.daily_forecast(location).get_forecast() if forecasts is None: msg = f"There is no weather data for this location={location}" raise AttributeError(msg)...
[ "def", "fetch_forecast_7_days", "(", "self", ",", "location", ":", "str", ",", "unit", ":", "str", ")", "->", "[", "Dict", "[", "str", ",", "str", "]", "]", ":", "forecasts", "=", "self", ".", "owm", ".", "daily_forecast", "(", "location", ")", ".", ...
Fetches the forecast for the next seven days from openweathermap.org
[ "Fetches", "the", "forecast", "for", "the", "next", "seven", "days", "from", "openweathermap", ".", "org" ]
[ "\"\"\"Fetches the forecast for the next seven days from openweathermap.org\n\n :param location: The name of the location this\n :param unit: Defines the units for the temperature. Only accepts\n 'celsius', 'fahrenheit', 'kelvin' and 'random'.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "location", "type": "str" }, { "param": "unit", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "location", "type": "str", "docstring": "The name of the location th...
5727d121a17e77dfe167a984712940bb2e83a2b2
JonasKs/code-jam-4
project/services/weather.py
[ "MIT" ]
Python
format_forecast
Dict[str, str]
def format_forecast(weather: Weather, unit: str) -> Dict[str, str]: """Formats an pyowm.weatherapi25.weather.Weather to an easy to use dictionary for the frontend. :param weather: A pyowm.weatherapi25.weather.Weather object :param unit: Defines the units for the temperature in the output ...
Formats an pyowm.weatherapi25.weather.Weather to an easy to use dictionary for the frontend. :param weather: A pyowm.weatherapi25.weather.Weather object :param unit: Defines the units for the temperature in the output dictionary. Only accepts 'celsius', 'fahrenheit', 'kelvin' and ...
Formats an pyowm.weatherapi25.weather.Weather to an easy to use dictionary for the frontend.
[ "Formats", "an", "pyowm", ".", "weatherapi25", ".", "weather", ".", "Weather", "to", "an", "easy", "to", "use", "dictionary", "for", "the", "frontend", "." ]
def format_forecast(weather: Weather, unit: str) -> Dict[str, str]: units = {'celsius', 'fahrenheit', 'kelvin'} unit_symbols = {'celsius': '°C', 'fahrenheit': '°F', 'kelvin': 'K'} if unit not in units and not unit == 'random': msg = "This is not a valid input unit, please enter one of the " \ ...
[ "def", "format_forecast", "(", "weather", ":", "Weather", ",", "unit", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "units", "=", "{", "'celsius'", ",", "'fahrenheit'", ",", "'kelvin'", "}", "unit_symbols", "=", "{", "'celsius'", ":...
Formats an pyowm.weatherapi25.weather.Weather to an easy to use dictionary for the frontend.
[ "Formats", "an", "pyowm", ".", "weatherapi25", ".", "weather", ".", "Weather", "to", "an", "easy", "to", "use", "dictionary", "for", "the", "frontend", "." ]
[ "\"\"\"Formats an pyowm.weatherapi25.weather.Weather to an easy to use\n dictionary for the frontend.\n\n :param weather: A pyowm.weatherapi25.weather.Weather object\n :param unit: Defines the units for the temperature in the output\n dictionary. Only accepts 'celsius', 'fahrenheit', 'kelvi...
[ { "param": "weather", "type": "Weather" }, { "param": "unit", "type": "str" } ]
{ "returns": [], "raises": [ { "docstring": "If an invalid unit has been supplied", "docstring_tokens": [ "If", "an", "invalid", "unit", "has", "been", "supplied" ], "type": "AttributeError" } ], "params": [ { "ide...
5727d121a17e77dfe167a984712940bb2e83a2b2
JonasKs/code-jam-4
project/services/weather.py
[ "MIT" ]
Python
load_owm_api_key
str
def load_owm_api_key() -> str: """Loads the Open-Weather-Map API key. :return The api key as a string """ with open("OWM_API_KEY") as infile: return infile.read().strip()
Loads the Open-Weather-Map API key. :return The api key as a string
Loads the Open-Weather-Map API key. :return The api key as a string
[ "Loads", "the", "Open", "-", "Weather", "-", "Map", "API", "key", ".", ":", "return", "The", "api", "key", "as", "a", "string" ]
def load_owm_api_key() -> str: with open("OWM_API_KEY") as infile: return infile.read().strip()
[ "def", "load_owm_api_key", "(", ")", "->", "str", ":", "with", "open", "(", "\"OWM_API_KEY\"", ")", "as", "infile", ":", "return", "infile", ".", "read", "(", ")", ".", "strip", "(", ")" ]
Loads the Open-Weather-Map API key.
[ "Loads", "the", "Open", "-", "Weather", "-", "Map", "API", "key", "." ]
[ "\"\"\"Loads the Open-Weather-Map API key.\n\n :return The api key as a string\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
795cf52b1bbf66312e6467b9710d88206934d50d
cloew/proxy-attrs
proxy_attrs.py
[ "MIT" ]
Python
proxy_for
<not_specific>
def proxy_for(parent, attrs, **kwargs): """ Add properties for the attrs on the provided field to hide interaction from a class to an internal component """ def addProxyData(cls): def add_property(cls, attr): setattr(cls, attr, ProxyAttr(parent, attr, **kwargs)) ...
Add properties for the attrs on the provided field to hide interaction from a class to an internal component
Add properties for the attrs on the provided field to hide interaction from a class to an internal component
[ "Add", "properties", "for", "the", "attrs", "on", "the", "provided", "field", "to", "hide", "interaction", "from", "a", "class", "to", "an", "internal", "component" ]
def proxy_for(parent, attrs, **kwargs): def addProxyData(cls): def add_property(cls, attr): setattr(cls, attr, ProxyAttr(parent, attr, **kwargs)) for attr in attrs: add_property(cls, attr) return cls return addProxyData
[ "def", "proxy_for", "(", "parent", ",", "attrs", ",", "**", "kwargs", ")", ":", "def", "addProxyData", "(", "cls", ")", ":", "def", "add_property", "(", "cls", ",", "attr", ")", ":", "setattr", "(", "cls", ",", "attr", ",", "ProxyAttr", "(", "parent"...
Add properties for the attrs on the provided field to hide interaction from a class to an internal component
[ "Add", "properties", "for", "the", "attrs", "on", "the", "provided", "field", "to", "hide", "interaction", "from", "a", "class", "to", "an", "internal", "component" ]
[ "\"\"\" Add properties for the attrs on the provided field to \r\n hide interaction from a class to an internal component \"\"\"" ]
[ { "param": "parent", "type": null }, { "param": "attrs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parent", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "attrs", "type": null, "docstring": null, "docstring_tokens"...
795cf52b1bbf66312e6467b9710d88206934d50d
cloew/proxy-attrs
proxy_attrs.py
[ "MIT" ]
Python
build_property
<not_specific>
def build_property(parent, attr): """ Return the property to access the field """ def getter(self): return getattr(getattr(self, parent), attr) def setter(self, v): setattr(getattr(self, parent), attr, v) def deleter(self): delattr(getattr(self, parent), attr) return ...
Return the property to access the field
Return the property to access the field
[ "Return", "the", "property", "to", "access", "the", "field" ]
def build_property(parent, attr): def getter(self): return getattr(getattr(self, parent), attr) def setter(self, v): setattr(getattr(self, parent), attr, v) def deleter(self): delattr(getattr(self, parent), attr) return property(getter, setter, deleter)
[ "def", "build_property", "(", "parent", ",", "attr", ")", ":", "def", "getter", "(", "self", ")", ":", "return", "getattr", "(", "getattr", "(", "self", ",", "parent", ")", ",", "attr", ")", "def", "setter", "(", "self", ",", "v", ")", ":", "setatt...
Return the property to access the field
[ "Return", "the", "property", "to", "access", "the", "field" ]
[ "\"\"\" Return the property to access the field \"\"\"" ]
[ { "param": "parent", "type": null }, { "param": "attr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parent", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "attr", "type": null, "docstring": null, "docstring_tokens":...
795cf52b1bbf66312e6467b9710d88206934d50d
cloew/proxy-attrs
proxy_attrs.py
[ "MIT" ]
Python
build_default_property
<not_specific>
def build_default_property(parentAttr, attr, default): """ Return the property to access the field or return a default value """ def getter(self): parent = getattr(self, parentAttr) return getattr(parent, attr) if parent is not None else default def setter(self, v): setattr(get...
Return the property to access the field or return a default value
Return the property to access the field or return a default value
[ "Return", "the", "property", "to", "access", "the", "field", "or", "return", "a", "default", "value" ]
def build_default_property(parentAttr, attr, default): def getter(self): parent = getattr(self, parentAttr) return getattr(parent, attr) if parent is not None else default def setter(self, v): setattr(getattr(self, parent), attr, v) def deleter(self): delattr(getattr(self, pa...
[ "def", "build_default_property", "(", "parentAttr", ",", "attr", ",", "default", ")", ":", "def", "getter", "(", "self", ")", ":", "parent", "=", "getattr", "(", "self", ",", "parentAttr", ")", "return", "getattr", "(", "parent", ",", "attr", ")", "if", ...
Return the property to access the field or return a default value
[ "Return", "the", "property", "to", "access", "the", "field", "or", "return", "a", "default", "value" ]
[ "\"\"\" Return the property to access the field or return a default value \"\"\"" ]
[ { "param": "parentAttr", "type": null }, { "param": "attr", "type": null }, { "param": "default", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parentAttr", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "attr", "type": null, "docstring": null, "docstring_toke...
efba9cd659db5e401940226e50efded8e2cea8eb
kathryn-rowe/Kathryn-Rowe-portfolio
model.py
[ "Unlicense" ]
Python
connect_to_db
null
def connect_to_db(app, db_uri=None): """Connect the database to our Flask app.""" # Configure to use our PstgreSQL database app.config['SQLALCHEMY_DATABASE_URI'] = db_uri or 'postgres://ujehytjehkednm:929e2ff298106000ad082a5ff0fc8bb988035b1ef141903229a08295d5e60b29@ec2-23-21-246-11.compute-1.amazonaws.com:...
Connect the database to our Flask app.
Connect the database to our Flask app.
[ "Connect", "the", "database", "to", "our", "Flask", "app", "." ]
def connect_to_db(app, db_uri=None): app.config['SQLALCHEMY_DATABASE_URI'] = db_uri or 'postgres://ujehytjehkednm:929e2ff298106000ad082a5ff0fc8bb988035b1ef141903229a08295d5e60b29@ec2-23-21-246-11.compute-1.amazonaws.com:5432/dfda3sr0flj3t0' app.config['SQLALCHEMY_ECHO'] = True app.config['SQLALCHEMY_TRACK_M...
[ "def", "connect_to_db", "(", "app", ",", "db_uri", "=", "None", ")", ":", "app", ".", "config", "[", "'SQLALCHEMY_DATABASE_URI'", "]", "=", "db_uri", "or", "'postgres://ujehytjehkednm:929e2ff298106000ad082a5ff0fc8bb988035b1ef141903229a08295d5e60b29@ec2-23-21-246-11.compute-1.am...
Connect the database to our Flask app.
[ "Connect", "the", "database", "to", "our", "Flask", "app", "." ]
[ "\"\"\"Connect the database to our Flask app.\"\"\"", "# Configure to use our PstgreSQL database" ]
[ { "param": "app", "type": null }, { "param": "db_uri", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "app", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "db_uri", "type": null, "docstring": null, "docstring_tokens": ...
cbb8f0b9cc02aade5206db2884ee89e06d05ebff
kathryn-rowe/Kathryn-Rowe-portfolio
server_with_password.py
[ "Unlicense" ]
Python
spawning_crwa
<not_specific>
def spawning_crwa(): """Available spawning area in Charles River page""" if "logged_in" in session: return render_template("spawning_crwa.html") else: flash("Incorrect password.") return redirect("/login")
Available spawning area in Charles River page
Available spawning area in Charles River page
[ "Available", "spawning", "area", "in", "Charles", "River", "page" ]
def spawning_crwa(): if "logged_in" in session: return render_template("spawning_crwa.html") else: flash("Incorrect password.") return redirect("/login")
[ "def", "spawning_crwa", "(", ")", ":", "if", "\"logged_in\"", "in", "session", ":", "return", "render_template", "(", "\"spawning_crwa.html\"", ")", "else", ":", "flash", "(", "\"Incorrect password.\"", ")", "return", "redirect", "(", "\"/login\"", ")" ]
Available spawning area in Charles River page
[ "Available", "spawning", "area", "in", "Charles", "River", "page" ]
[ "\"\"\"Available spawning area in Charles River page\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
cbb8f0b9cc02aade5206db2884ee89e06d05ebff
kathryn-rowe/Kathryn-Rowe-portfolio
server_with_password.py
[ "Unlicense" ]
Python
ne_watershed
<not_specific>
def ne_watershed(): """Patagonia project of New England Watersheds page""" if "logged_in" in session: return render_template("ne_watershed.html") else: flash("Incorrect password.") return redirect("/login")
Patagonia project of New England Watersheds page
Patagonia project of New England Watersheds page
[ "Patagonia", "project", "of", "New", "England", "Watersheds", "page" ]
def ne_watershed(): if "logged_in" in session: return render_template("ne_watershed.html") else: flash("Incorrect password.") return redirect("/login")
[ "def", "ne_watershed", "(", ")", ":", "if", "\"logged_in\"", "in", "session", ":", "return", "render_template", "(", "\"ne_watershed.html\"", ")", "else", ":", "flash", "(", "\"Incorrect password.\"", ")", "return", "redirect", "(", "\"/login\"", ")" ]
Patagonia project of New England Watersheds page
[ "Patagonia", "project", "of", "New", "England", "Watersheds", "page" ]
[ "\"\"\"Patagonia project of New England Watersheds page\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
cbb8f0b9cc02aade5206db2884ee89e06d05ebff
kathryn-rowe/Kathryn-Rowe-portfolio
server_with_password.py
[ "Unlicense" ]
Python
birds
<not_specific>
def birds(): """Tell me about the birds project page""" if "logged_in" in session: return render_template("birds.html") else: flash("Incorrect password.") return redirect("/login")
Tell me about the birds project page
Tell me about the birds project page
[ "Tell", "me", "about", "the", "birds", "project", "page" ]
def birds(): if "logged_in" in session: return render_template("birds.html") else: flash("Incorrect password.") return redirect("/login")
[ "def", "birds", "(", ")", ":", "if", "\"logged_in\"", "in", "session", ":", "return", "render_template", "(", "\"birds.html\"", ")", "else", ":", "flash", "(", "\"Incorrect password.\"", ")", "return", "redirect", "(", "\"/login\"", ")" ]
Tell me about the birds project page
[ "Tell", "me", "about", "the", "birds", "project", "page" ]
[ "\"\"\"Tell me about the birds project page\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
cbb8f0b9cc02aade5206db2884ee89e06d05ebff
kathryn-rowe/Kathryn-Rowe-portfolio
server_with_password.py
[ "Unlicense" ]
Python
srf
<not_specific>
def srf(): """Salmonid Restoration Federation (SRF) page""" if "logged_in" in session: return render_template("srf.html") else: flash("Incorrect password.") return redirect("/login")
Salmonid Restoration Federation (SRF) page
Salmonid Restoration Federation (SRF) page
[ "Salmonid", "Restoration", "Federation", "(", "SRF", ")", "page" ]
def srf(): if "logged_in" in session: return render_template("srf.html") else: flash("Incorrect password.") return redirect("/login")
[ "def", "srf", "(", ")", ":", "if", "\"logged_in\"", "in", "session", ":", "return", "render_template", "(", "\"srf.html\"", ")", "else", ":", "flash", "(", "\"Incorrect password.\"", ")", "return", "redirect", "(", "\"/login\"", ")" ]
Salmonid Restoration Federation (SRF) page
[ "Salmonid", "Restoration", "Federation", "(", "SRF", ")", "page" ]
[ "\"\"\"Salmonid Restoration Federation (SRF) page\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
c89e9d605edf56f79ca68733151ebba01e45c42a
tidoust/bikeshed
bikeshed/update/manifest.py
[ "CC0-1.0" ]
Python
createManifest
null
def createManifest(path, dryRun=False): '''Generates a manifest file for all the data files.''' manifests = [] try: for absPath, relPath in getDatafilePaths(path): if relPath in knownFiles: pass elif relPath.partition("/")[0] in knownFolders: p...
Generates a manifest file for all the data files.
Generates a manifest file for all the data files.
[ "Generates", "a", "manifest", "file", "for", "all", "the", "data", "files", "." ]
def createManifest(path, dryRun=False): manifests = [] try: for absPath, relPath in getDatafilePaths(path): if relPath in knownFiles: pass elif relPath.partition("/")[0] in knownFolders: pass else: continue w...
[ "def", "createManifest", "(", "path", ",", "dryRun", "=", "False", ")", ":", "manifests", "=", "[", "]", "try", ":", "for", "absPath", ",", "relPath", "in", "getDatafilePaths", "(", "path", ")", ":", "if", "relPath", "in", "knownFiles", ":", "pass", "e...
Generates a manifest file for all the data files.
[ "Generates", "a", "manifest", "file", "for", "all", "the", "data", "files", "." ]
[ "'''Generates a manifest file for all the data files.'''" ]
[ { "param": "path", "type": null }, { "param": "dryRun", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dryRun", "type": null, "docstring": null, "docstring_tokens":...
c89e9d605edf56f79ca68733151ebba01e45c42a
tidoust/bikeshed
bikeshed/update/manifest.py
[ "CC0-1.0" ]
Python
updateByManifest
<not_specific>
def updateByManifest(path, dryRun=False): ''' Attempts to update only the recently updated datafiles by using a manifest file. Returns False if updating failed and a full update should be performed; returns True if updating was a success. ''' ghPrefix = "https://raw.githubusercontent.com/tabatki...
Attempts to update only the recently updated datafiles by using a manifest file. Returns False if updating failed and a full update should be performed; returns True if updating was a success.
Attempts to update only the recently updated datafiles by using a manifest file. Returns False if updating failed and a full update should be performed; returns True if updating was a success.
[ "Attempts", "to", "update", "only", "the", "recently", "updated", "datafiles", "by", "using", "a", "manifest", "file", ".", "Returns", "False", "if", "updating", "failed", "and", "a", "full", "update", "should", "be", "performed", ";", "returns", "True", "if...
def updateByManifest(path, dryRun=False): ghPrefix = "https://raw.githubusercontent.com/tabatkins/bikeshed-data/master/data/" say("Updating via manifest...") try: with io.open(os.path.join(path, "manifest.txt"), 'r', encoding="utf-8") as fh: localManifest = fh.readlines() except Exce...
[ "def", "updateByManifest", "(", "path", ",", "dryRun", "=", "False", ")", ":", "ghPrefix", "=", "\"https://raw.githubusercontent.com/tabatkins/bikeshed-data/master/data/\"", "say", "(", "\"Updating via manifest...\"", ")", "try", ":", "with", "io", ".", "open", "(", "...
Attempts to update only the recently updated datafiles by using a manifest file.
[ "Attempts", "to", "update", "only", "the", "recently", "updated", "datafiles", "by", "using", "a", "manifest", "file", "." ]
[ "'''\n Attempts to update only the recently updated datafiles by using a manifest file.\n Returns False if updating failed and a full update should be performed;\n returns True if updating was a success.\n '''", "# No need to update, local data is more recent.", "# seconds of *processor* time, not w...
[ { "param": "path", "type": null }, { "param": "dryRun", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dryRun", "type": null, "docstring": null, "docstring_tokens":...
bbfd337e194c6e8fc16a93bbcb40e176cfe15fda
cloudmesh/cloudmesh-nlp
s.py
[ "Apache-2.0" ]
Python
translate
<not_specific>
def translate( content: str = Query(default=None, description="This is the content"), provider: Optional[str] = Query(default='google', description="The cloud provider that conducts the translation"), fromlang: Optional[str] = Query(default='en', description="The language the content is in"), ...
Translate the content with a cloud NLP translation service. The default service used is google. * **content**: Content to be translated by user * **provider**: The cloud/service provider * **fromlang**: The language code representing in which the content is written * **tolang**: The language code ...
Translate the content with a cloud NLP translation service. The default service used is google.
[ "Translate", "the", "content", "with", "a", "cloud", "NLP", "translation", "service", ".", "The", "default", "service", "used", "is", "google", "." ]
def translate( content: str = Query(default=None, description="This is the content"), provider: Optional[str] = Query(default='google', description="The cloud provider that conducts the translation"), fromlang: Optional[str] = Query(default='en', description="The language the content is in"), ...
[ "def", "translate", "(", "content", ":", "str", "=", "Query", "(", "default", "=", "None", ",", "description", "=", "\"This is the content\"", ")", ",", "provider", ":", "Optional", "[", "str", "]", "=", "Query", "(", "default", "=", "'google'", ",", "de...
Translate the content with a cloud NLP translation service.
[ "Translate", "the", "content", "with", "a", "cloud", "NLP", "translation", "service", "." ]
[ "\"\"\"\n Translate the content with a cloud NLP translation service. The default service used is google.\n\n * **content**: Content to be translated by user\n * **provider**: The cloud/service provider\n * **fromlang**: The language code representing in which the content is written\n * **tolang**: T...
[ { "param": "content", "type": "str" }, { "param": "provider", "type": "Optional[str]" }, { "param": "fromlang", "type": "Optional[str]" }, { "param": "tolang", "type": "Optional[str]" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "content", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": nul...
00d111004a24eaca63fc0227f6d99ab92cc383db
rcasero/cytometer
scripts/klf14_b6ntac_exp_0111_paper_figures_v8.py
[ "Apache-2.0" ]
Python
table_of_hand_traced_regions
<not_specific>
def table_of_hand_traced_regions(file_svg_list): """ Open SVG files in a list, and count the number of different types of regions (Cells, Other, Background, Windows, Windows with cells) and create a table with them for the paper :param file_svg_list: list of filenames :return: pd.Dataframe """ ...
Open SVG files in a list, and count the number of different types of regions (Cells, Other, Background, Windows, Windows with cells) and create a table with them for the paper :param file_svg_list: list of filenames :return: pd.Dataframe
Open SVG files in a list, and count the number of different types of regions (Cells, Other, Background, Windows, Windows with cells) and create a table with them for the paper
[ "Open", "SVG", "files", "in", "a", "list", "and", "count", "the", "number", "of", "different", "types", "of", "regions", "(", "Cells", "Other", "Background", "Windows", "Windows", "with", "cells", ")", "and", "create", "a", "table", "with", "them", "for", ...
def table_of_hand_traced_regions(file_svg_list): table = pd.DataFrame(columns=['Cells', 'Other', 'Background', 'Windows', 'Windows with cells']) for i, file_svg in enumerate(file_svg_list): print('file ' + str(i) + '/' + str(len(file_svg_list) - 1) + ': ' + os.path.basename(file_svg)) cell_conto...
[ "def", "table_of_hand_traced_regions", "(", "file_svg_list", ")", ":", "table", "=", "pd", ".", "DataFrame", "(", "columns", "=", "[", "'Cells'", ",", "'Other'", ",", "'Background'", ",", "'Windows'", ",", "'Windows with cells'", "]", ")", "for", "i", ",", "...
Open SVG files in a list, and count the number of different types of regions (Cells, Other, Background, Windows, Windows with cells) and create a table with them for the paper
[ "Open", "SVG", "files", "in", "a", "list", "and", "count", "the", "number", "of", "different", "types", "of", "regions", "(", "Cells", "Other", "Background", "Windows", "Windows", "with", "cells", ")", "and", "create", "a", "table", "with", "them", "for", ...
[ "\"\"\"\n Open SVG files in a list, and count the number of different types of regions (Cells, Other, Background, Windows,\n Windows with cells) and create a table with them for the paper\n :param file_svg_list: list of filenames\n :return: pd.Dataframe\n \"\"\"", "# init dataframe to aggregate tra...
[ { "param": "file_svg_list", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "file_svg_list", "type": null, "docstring": "list of filenames", "docstring_tokens": [ "list", "of",...
bcca42e3a0477496eda5255ae79d37aaaa8f2280
rcasero/cytometer
scripts/klf14_b6ntac_exp_0022_cnn_qualitynet_sigmoid.py
[ "Apache-2.0" ]
Python
one_image_and_dice_per_cell
<not_specific>
def one_image_and_dice_per_cell(dataset_im, dataset_lab, dataset_dice, training_window_len=401, smallest_cell_area=804): """ Extract a small image centered on each cell (label) of a dataset, and the corresponding Dice coefficient that gives a measure of how well the label segments the cell (the Dice coeffic...
Extract a small image centered on each cell (label) of a dataset, and the corresponding Dice coefficient that gives a measure of how well the label segments the cell (the Dice coefficient must have been computed previously, typically by comparing the label with some other ground truth label). :param d...
Extract a small image centered on each cell (label) of a dataset, and the corresponding Dice coefficient that gives a measure of how well the label segments the cell (the Dice coefficient must have been computed previously, typically by comparing the label with some other ground truth label).
[ "Extract", "a", "small", "image", "centered", "on", "each", "cell", "(", "label", ")", "of", "a", "dataset", "and", "the", "corresponding", "Dice", "coefficient", "that", "gives", "a", "measure", "of", "how", "well", "the", "label", "segments", "the", "cel...
def one_image_and_dice_per_cell(dataset_im, dataset_lab, dataset_dice, training_window_len=401, smallest_cell_area=804): n_row = dataset_im.shape[1] n_col = dataset_im.shape[2] training_windows_list = [] label_windows_list = [] dice_list = [] for i in range(dataset_im.shape[0]): dice_aux...
[ "def", "one_image_and_dice_per_cell", "(", "dataset_im", ",", "dataset_lab", ",", "dataset_dice", ",", "training_window_len", "=", "401", ",", "smallest_cell_area", "=", "804", ")", ":", "n_row", "=", "dataset_im", ".", "shape", "[", "1", "]", "n_col", "=", "d...
Extract a small image centered on each cell (label) of a dataset, and the corresponding Dice coefficient that gives a measure of how well the label segments the cell (the Dice coefficient must have been computed previously, typically by comparing the label with some other ground truth label).
[ "Extract", "a", "small", "image", "centered", "on", "each", "cell", "(", "label", ")", "of", "a", "dataset", "and", "the", "corresponding", "Dice", "coefficient", "that", "gives", "a", "measure", "of", "how", "well", "the", "label", "segments", "the", "cel...
[ "\"\"\"\n Extract a small image centered on each cell (label) of a dataset, and the corresponding Dice coefficient that gives\n a measure of how well the label segments the cell (the Dice coefficient must have been computed previously,\n typically by comparing the label with some other ground truth label)....
[ { "param": "dataset_im", "type": null }, { "param": "dataset_lab", "type": null }, { "param": "dataset_dice", "type": null }, { "param": "training_window_len", "type": null }, { "param": "smallest_cell_area", "type": null } ]
{ "returns": [ { "docstring": "training_windows, dice\ntraining_windows: numpy.ndarray (N, training_window_len, training_window_len, channel). Small windows extracted from\nthe histology. Each window is centered around one of N labelled cells.\nlabel_windows: numpy.ndarray (N, training_window_len, training_...
bffcd526ad60c791e2f78156c586adc7f8e59d3e
rcasero/cytometer
cytometer/data.py
[ "Apache-2.0" ]
Python
split_images
<not_specific>
def split_images(x, nblocks): """ Splits the rows and columns of a data array with shape (n, rows, cols, channels) into blocks. If necessary, the array is trimmed off so that all blocks have the same size. :param x: numpy.ndarray (images, rows, cols, channels). :param nblocks: scalar with the numb...
Splits the rows and columns of a data array with shape (n, rows, cols, channels) into blocks. If necessary, the array is trimmed off so that all blocks have the same size. :param x: numpy.ndarray (images, rows, cols, channels). :param nblocks: scalar with the number of blocks to split the rows and co...
Splits the rows and columns of a data array with shape (n, rows, cols, channels) into blocks. If necessary, the array is trimmed off so that all blocks have the same size.
[ "Splits", "the", "rows", "and", "columns", "of", "a", "data", "array", "with", "shape", "(", "n", "rows", "cols", "channels", ")", "into", "blocks", ".", "If", "necessary", "the", "array", "is", "trimmed", "off", "so", "that", "all", "blocks", "have", ...
def split_images(x, nblocks): _, nrows, ncols, _ = x.shape nrows = int(np.floor(nrows / nblocks) * nblocks) ncols = int(np.floor(ncols / nblocks) * nblocks) x = x[:, 0:nrows, 0:ncols, :] _, x, _ = pystoim.block_split(x, nblocks=(1, nblocks, nblocks, 1), by_reference=True) x = np.concatenate(x, a...
[ "def", "split_images", "(", "x", ",", "nblocks", ")", ":", "_", ",", "nrows", ",", "ncols", ",", "_", "=", "x", ".", "shape", "nrows", "=", "int", "(", "np", ".", "floor", "(", "nrows", "/", "nblocks", ")", "*", "nblocks", ")", "ncols", "=", "i...
Splits the rows and columns of a data array with shape (n, rows, cols, channels) into blocks.
[ "Splits", "the", "rows", "and", "columns", "of", "a", "data", "array", "with", "shape", "(", "n", "rows", "cols", "channels", ")", "into", "blocks", "." ]
[ "\"\"\"\n Splits the rows and columns of a data array with shape (n, rows, cols, channels) into blocks.\n\n If necessary, the array is trimmed off so that all blocks have the same size.\n\n :param x: numpy.ndarray (images, rows, cols, channels).\n :param nblocks: scalar with the number of blocks to spli...
[ { "param": "x", "type": null }, { "param": "nblocks", "type": null } ]
{ "returns": [ { "docstring": "numpy.ndarray with x split into blocks.", "docstring_tokens": [ "numpy", ".", "ndarray", "with", "x", "split", "into", "blocks", "." ], "type": null } ], "raises": [], "params":...
bffcd526ad60c791e2f78156c586adc7f8e59d3e
rcasero/cytometer
cytometer/data.py
[ "Apache-2.0" ]
Python
split_list
<not_specific>
def split_list(x, idx): """ Split a list into two sublists. :param x: list to be split. :param idx: list of indices. Repeated indices are ignored. :return: x[idx], x[~idx]. Here ~idx stands for the indices not in idx. """ # ignore repeated indices idx = set(idx) # indices for the s...
Split a list into two sublists. :param x: list to be split. :param idx: list of indices. Repeated indices are ignored. :return: x[idx], x[~idx]. Here ~idx stands for the indices not in idx.
Split a list into two sublists.
[ "Split", "a", "list", "into", "two", "sublists", "." ]
def split_list(x, idx): idx = set(idx) idx_2 = list(set(range(len(x))) - idx) idx = list(idx) return list(np.array(x)[idx]), list(np.array(x)[idx_2])
[ "def", "split_list", "(", "x", ",", "idx", ")", ":", "idx", "=", "set", "(", "idx", ")", "idx_2", "=", "list", "(", "set", "(", "range", "(", "len", "(", "x", ")", ")", ")", "-", "idx", ")", "idx", "=", "list", "(", "idx", ")", "return", "l...
Split a list into two sublists.
[ "Split", "a", "list", "into", "two", "sublists", "." ]
[ "\"\"\"\n Split a list into two sublists.\n :param x: list to be split.\n :param idx: list of indices. Repeated indices are ignored.\n :return: x[idx], x[~idx]. Here ~idx stands for the indices not in idx.\n \"\"\"", "# ignore repeated indices", "# indices for the second sublist" ]
[ { "param": "x", "type": null }, { "param": "idx", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": "list to be split.", "docstring_tokens": [ "list", "to", "be...
bffcd526ad60c791e2f78156c586adc7f8e59d3e
rcasero/cytometer
cytometer/data.py
[ "Apache-2.0" ]
Python
split_file_list_kfolds
<not_specific>
def split_file_list_kfolds(file_list, n_folds, ignore_str='', fold_seed=0, save_filename=None): """ Split file list into k-folds for training and testing a neural network. If there are N files, each fold gets N/k files for testing, and N*(k-1)/k files for training. If N is not divisible by k, the split...
Split file list into k-folds for training and testing a neural network. If there are N files, each fold gets N/k files for testing, and N*(k-1)/k files for training. If N is not divisible by k, the split follows the rules of numpy.array_split(). :param file_list: List of filenames. :param n_folds...
Split file list into k-folds for training and testing a neural network. If there are N files, each fold gets N/k files for testing, and N*(k-1)/k files for training. If N is not divisible by k, the split follows the rules of numpy.array_split().
[ "Split", "file", "list", "into", "k", "-", "folds", "for", "training", "and", "testing", "a", "neural", "network", ".", "If", "there", "are", "N", "files", "each", "fold", "gets", "N", "/", "k", "files", "for", "testing", "and", "N", "*", "(", "k", ...
def split_file_list_kfolds(file_list, n_folds, ignore_str='', fold_seed=0, save_filename=None): im_1_row_4.ndpi im_2_row_8.ndpi im_1_row_2.ndpi im_2_row_3.ndpi im_1_row_1.ndpi create second file list removing the ignore_from* substring im_1 im_2 im_1 im_2 im_1 ...
[ "def", "split_file_list_kfolds", "(", "file_list", ",", "n_folds", ",", "ignore_str", "=", "''", ",", "fold_seed", "=", "0", ",", "save_filename", "=", "None", ")", ":", "file_list_reduced", "=", "[", "re", ".", "sub", "(", "ignore_str", ",", "''", ",", ...
Split file list into k-folds for training and testing a neural network.
[ "Split", "file", "list", "into", "k", "-", "folds", "for", "training", "and", "testing", "a", "neural", "network", "." ]
[ "\"\"\"\n Split file list into k-folds for training and testing a neural network.\n\n If there are N files, each fold gets N/k files for testing, and N*(k-1)/k files for training. If N\n is not divisible by k, the split follows the rules of numpy.array_split().\n\n :param file_list: List of filenames.\n...
[ { "param": "file_list", "type": null }, { "param": "n_folds", "type": null }, { "param": "ignore_str", "type": null }, { "param": "fold_seed", "type": null }, { "param": "save_filename", "type": null } ]
{ "returns": [ { "docstring": "list of 1D arrays. idx_train[i] are the train indices for training files in the ith-fold.\nidx_test: list of 1D arrays. idx_train[i] are the train indices for test files in the ith-fold.", "docstring_tokens": [ "list", "of", "1D", "arrays"...
bffcd526ad60c791e2f78156c586adc7f8e59d3e
rcasero/cytometer
cytometer/data.py
[ "Apache-2.0" ]
Python
load_datasets
<not_specific>
def load_datasets(file_list, prefix_from='im', prefix_to=[], nblocks=1, shuffle_seed=None): """ Loads image files and prepare them for training or testing, returning numpy.ndarrays. Image files can be of any type loadable by the PIL module, but they must have the same size. Multiple sets of correspondi...
Loads image files and prepare them for training or testing, returning numpy.ndarrays. Image files can be of any type loadable by the PIL module, but they must have the same size. Multiple sets of corresponding images can be loaded using prefix_to. For instance, im_file_1.tif seg_file_1.tif ...
Loads image files and prepare them for training or testing, returning numpy.ndarrays. Image files can be of any type loadable by the PIL module, but they must have the same size. Multiple sets of corresponding images can be loaded using prefix_to. For instance. will return This function also provides the followi...
[ "Loads", "image", "files", "and", "prepare", "them", "for", "training", "or", "testing", "returning", "numpy", ".", "ndarrays", ".", "Image", "files", "can", "be", "of", "any", "type", "loadable", "by", "the", "PIL", "module", "but", "they", "must", "have"...
def load_datasets(file_list, prefix_from='im', prefix_to=[], nblocks=1, shuffle_seed=None): if not isinstance(prefix_to, list): raise TypeError('data_prefixes must be a list of strings') out_file_list = {} for prefix in prefix_to: out_file_list[prefix] = [] for x in file_list: ...
[ "def", "load_datasets", "(", "file_list", ",", "prefix_from", "=", "'im'", ",", "prefix_to", "=", "[", "]", ",", "nblocks", "=", "1", ",", "shuffle_seed", "=", "None", ")", ":", "if", "not", "isinstance", "(", "prefix_to", ",", "list", ")", ":", "raise...
Loads image files and prepare them for training or testing, returning numpy.ndarrays.
[ "Loads", "image", "files", "and", "prepare", "them", "for", "training", "or", "testing", "returning", "numpy", ".", "ndarrays", "." ]
[ "\"\"\"\n Loads image files and prepare them for training or testing, returning numpy.ndarrays.\n Image files can be of any type loadable by the PIL module, but they must have the same size.\n\n Multiple sets of corresponding images can be loaded using prefix_to. For instance,\n\n im_file_1.tif ...
[ { "param": "file_list", "type": null }, { "param": "prefix_from", "type": null }, { "param": "prefix_to", "type": null }, { "param": "nblocks", "type": null }, { "param": "shuffle_seed", "type": null } ]
{ "returns": [ { "docstring": "out, out_file_list, shuffle_idx:\nout: dictionary where out[prefix] contains a numpy.ndarray with the data corresponding to the \"prefix\" dataset.\nout_file_list: list of the filenames for the out[prefix] dataset.\nshuffle_idx: list of indices used to shuffle the images after...
bffcd526ad60c791e2f78156c586adc7f8e59d3e
rcasero/cytometer
cytometer/data.py
[ "Apache-2.0" ]
Python
remove_poor_data
<not_specific>
def remove_poor_data(datasets, prefix='mask', threshold=1000): """ Find images where the mask has very few pixels, and remove them from the datasets. Training with them can decrease the performance of the model. :param datasets: dictionary with numpy.ndarray datasets loaded with load_datasets(). :pa...
Find images where the mask has very few pixels, and remove them from the datasets. Training with them can decrease the performance of the model. :param datasets: dictionary with numpy.ndarray datasets loaded with load_datasets(). :param prefix: (def 'mask') string. The number of pixels will be assessed...
Find images where the mask has very few pixels, and remove them from the datasets. Training with them can decrease the performance of the model.
[ "Find", "images", "where", "the", "mask", "has", "very", "few", "pixels", "and", "remove", "them", "from", "the", "datasets", ".", "Training", "with", "them", "can", "decrease", "the", "performance", "of", "the", "model", "." ]
def remove_poor_data(datasets, prefix='mask', threshold=1000): idx = np.count_nonzero(datasets[prefix], axis=(1, 2, 3)) > threshold for prefix in datasets.keys(): datasets[prefix] = datasets[prefix][idx, ...] return datasets
[ "def", "remove_poor_data", "(", "datasets", ",", "prefix", "=", "'mask'", ",", "threshold", "=", "1000", ")", ":", "idx", "=", "np", ".", "count_nonzero", "(", "datasets", "[", "prefix", "]", ",", "axis", "=", "(", "1", ",", "2", ",", "3", ")", ")"...
Find images where the mask has very few pixels, and remove them from the datasets.
[ "Find", "images", "where", "the", "mask", "has", "very", "few", "pixels", "and", "remove", "them", "from", "the", "datasets", "." ]
[ "\"\"\"\n Find images where the mask has very few pixels, and remove them from the datasets. Training\n with them can decrease the performance of the model.\n :param datasets: dictionary with numpy.ndarray datasets loaded with load_datasets().\n :param prefix: (def 'mask') string. The number of pixels w...
[ { "param": "datasets", "type": null }, { "param": "prefix", "type": null }, { "param": "threshold", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "datasets", "type": null, "docstring": "dictionary with numpy.ndarray datasets loaded with load_datasets().", "docst...