Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Using the snippet: <|code_start|> """ return dot(self.L, self.L.T) def gradient(self): """ Derivative of the covariance matrix over the lower triangular, flat part of L. It is equal to ∂K/∂Lᵢⱼ = ALᵀ + LAᵀ, where Aᵢⱼ is an n×m matrix of zeros except at [...
return format_function(
Here is a snippet: <|code_start|> class Memshark(): def __init__(self, config): self.wii_u_ip = config.wii_u_ip self.tcp_gecko = None self.pokes = [] def connect(self): if self.is_connected(): self.tcp_gecko.s.close() try: <|code_end|> . Write the next line using the current file imports: from vendor....
self.tcp_gecko = tcpgecko.TCPGecko(self.wii_u_ip)
Here is a snippet: <|code_start|> config = MemsharkConfig('config.json') games = Games('games') memshark = memshark.Memshark(config) exploit_server = server.ExploitServer() background.schedule(memshark) background.schedule(exploit_server) <|code_end|> . Write the next line using the current file imports: from memsh...
app = gui.MainApp(config, games, memshark, exploit_server)
Given the code snippet: <|code_start|> config = MemsharkConfig('config.json') games = Games('games') memshark = memshark.Memshark(config) exploit_server = server.ExploitServer() <|code_end|> , generate the next line using the imports in this file: from memshark_config import MemsharkConfig from games import Games fro...
background.schedule(memshark)
Predict the next line for this snippet: <|code_start|> config = MemsharkConfig('config.json') games = Games('games') memshark = memshark.Memshark(config) <|code_end|> with the help of current file imports: from memshark_config import MemsharkConfig from games import Games from gui import gui from background import ba...
exploit_server = server.ExploitServer()
Given the code snippet: <|code_start|> self.game_selected.set("Choose a game...") self.game_selected.trace('w', self.change_game_selection) self.game_list = tk.OptionMenu(self.master, self.game_selected, *self.game_options) self.game_list.config(width=50, padx=10) # Calling this b...
self.poke_table = table_widget.TableWidget(self.game_actions_frame)
Given snippet: <|code_start|> class MainApp: def __init__(self, config, games, memshark, exploit_server): self.root = tk.Tk() self.mainWindow = MainWindow(self.root, config, games, memshark, exploit_server) def start(self): self.root.mainloop() class MainWindow: def __init__(se...
self.server_frame = exploit_server_frame.ExploitServerFrame(self.notebook, exploit_server)
Using the snippet: <|code_start|> class MainApp: def __init__(self, config, games, memshark, exploit_server): self.root = tk.Tk() self.mainWindow = MainWindow(self.root, config, games, memshark, exploit_server) def start(self): self.root.mainloop() class MainWindow: def __init_...
self.tcp_gecko_frame = tcp_gecko_frame.TcpGeckoFrame(self.notebook, memshark)
Based on the snippet: <|code_start|> class MainApp: def __init__(self, config, games, memshark, exploit_server): self.root = tk.Tk() self.mainWindow = MainWindow(self.root, config, games, memshark, exploit_server) def start(self): self.root.mainloop() class MainWindow: def __in...
self.game_actions_frame = game_actions_frame.GameActionsFrame(self.notebook, games, memshark, config)
Given snippet: <|code_start|># # Revision 1.2 2007/01/05 23:33:55 customdesigned # Make blacklist an AddrCache # # Revision 1.1 2007/01/05 21:25:40 customdesigned # Move AddrCache to Milter package. # # Author: Stuart D. Gathman <stuart@bmsi.com> # Copyright 2001,2002,2003,2004,2005 Business Management Systems, In...
lock = PLock(self.fname)
Given the code snippet: <|code_start|>## Determine if a hostname is internal or not. # True if internal, False otherwise def is_internal(hostname): components = hostname.split(".") return components.pop() in internal_tlds # Determine if internal and external hosts are mixed based on a list # of hostnames def ...
t = parse_addr(mailfrom)
Predict the next line for this snippet: <|code_start|> self.fp = None self.receiver = self.getsymval('j') self.log("connect from %s at %s" % (IPname, hostaddr) ) return Milter.CONTINUE ## def hello(self,hostname): def hello(self, heloname): # (self, 'mailout17.dallas.texas.example.com') ...
self.canon_from = '@'.join(parse_addr(mailfrom))
Given the code snippet: <|code_start|>#from Milter.greylist import Greylist class GreylistTestCase(unittest.TestCase): def setUp(self): self.fname = 'test.db' if os.path.isfile(self.fname): os.remove(self.fname) def tearDown(self): #os.remove(self.fname) pass def testGrey(self): <|code_e...
grey = Greylist(self.fname)
Here is a snippet: <|code_start|>from __future__ import print_function class Config(object): def __init__(self): self.access_file='test/access.db' self.access_file_nulls=True class PolicyTestCase(unittest.TestCase): def setUp(self): self.config = Config() if os.access('test/access',os.R_OK): ...
with MTAPolicy('good@example.com',conf=self.config) as p:
Continue the code snippet: <|code_start|> self._activity = time.time() def _abort(self): "What Milter sets for abort_callback" self._priv.abort() self._close() def _close(self): Milter.close_callback(self) def _negotiate(self): self._body = None self._bodyreplaced = False self._p...
if utils.ip4re.match(ip):
Predict the next line for this snippet: <|code_start|> def test_find_all_payables(): all_payables = payable.find_all() assert all_payables is not None def test_find_by(): <|code_end|> with the help of current file imports: from pagarme import payable from tests.resources.dictionaries import payable_dictiona...
search_params = {'id': str(payable_dictionary.PAYABLES[0]['id'])}
Next line prediction: <|code_start|> BOLETO_TRANSACTION = { 'amount': '1000000', 'payment_method': 'boleto', 'postback_url': pagarme_test.create_postback_url(), 'customer': customer_dictionary.CUSTOMER, } CALCULATE_INTALLMENTS_AMOUNT = { 'amount': '10000', 'free_installments': "1", 'interes...
DEFAULT_RECIPIENT = recipient.default_recipient()['test']
Using the snippet: <|code_start|> BOLETO_TRANSACTION = { 'amount': '1000000', 'payment_method': 'boleto', <|code_end|> , determine the next line of code. You have imports: from pagarme import recipient from tests.resources import pagarme_test from tests.resources.dictionaries import card_dictionary from tests....
'postback_url': pagarme_test.create_postback_url(),
Given snippet: <|code_start|> 'amount': 500000, 'liable': 'true', 'charge_processing_fee': 'true' } ] SPLIT_RULE_PERCENTAGE = [ { 'recipient_id': DEFAULT_RECIPIENT, 'percentage': 50, 'liable': 'true', 'charge_processing_fee': 'true' }, { 'r...
'card_number': card_dictionary.INVALID_CARD['card_number'],
Here is a snippet: <|code_start|> BOLETO_TRANSACTION = { 'amount': '1000000', 'payment_method': 'boleto', 'postback_url': pagarme_test.create_postback_url(), <|code_end|> . Write the next line using the current file imports: from pagarme import recipient from tests.resources import pagarme_test from tests....
'customer': customer_dictionary.CUSTOMER,
Given the code snippet: <|code_start|> BOLETO_TRANSACTION = { 'amount': '1000000', 'payment_method': 'boleto', 'postback_url': pagarme_test.create_postback_url(), 'customer': customer_dictionary.CUSTOMER, } CALCULATE_INTALLMENTS_AMOUNT = { 'amount': '10000', 'free_installments': "1", 'inter...
RECIPIENT = recipient.create(recipient_dictionary.RECIPIENT)
Next line prediction: <|code_start|> TEMPORARY_COMPANY = 'https://api.pagar.me/1/companies/temporary' KEYS = {} def validate_response(pagarme_response): if pagarme_response.ok: return pagarme_response.json() else: return error(pagarme_response.json()) def create_temporary_company(): <|code_e...
company = requests_retry_session().post(TEMPORARY_COMPANY)
Next line prediction: <|code_start|> filename = pushbutton['filename'] audio_segments = utils.get_segments(filename) print 'Single response to {} duration {} seconds with {} segments'.format(filename, audio_segments[-1], len(audio_segments)-1) ...
projection = _project(best_match.audio_id, sound_to_face, NAP, video_producer)
Here is a snippet: <|code_start|> start = 0 voice1 = 'playfile {} {} {} {} {} {} {} {} {}'.format(1, voiceType1, start, soundfile, speed, segstart, segend, amp, maxamp) voice2 = '' print 'Recognized as sound {}'.format(...
NAP = _extract_NAP(segstart, segend, soundfile)
Based on the snippet: <|code_start|> NAP = _extract_NAP(segstart, segend, audio_segment.wav_file) speed = 1 amp = -3 maxamp = 1 start = 0 voice1 = 'playfile {} {} {} {} {} {} {} {} {}'.format(1, 6, np....
stateQ, eventQ, brainQ = _three_amigos(context, host)
Predict the next line for this snippet: <|code_start|>class NeverUseMeAgainParser: def __init__(self, learn_state, respond_state): self.learn_state = learn_state self.respond_state = respond_state def parse(self, message): print '[self.] received:', message if message ==...
mp.Process(target=receive, args=(parser.parse,)).start()
Next line prediction: <|code_start|> plt.draw() plt.tight_layout() def learn(memorize_q, brain, learned_q): while True: input_data = memorize_q.get() scaler = pp.MinMaxScaler() scaled_data = scaler.fit_transform(input_data) reservoir = Oger.nodes.LeakyReservoirNod...
rmse = net_rmse(brain, signals)
Given the code snippet: <|code_start|>def sentinel(host): context = zmq.Context() life_signal_Q = context.socket(zmq.PULL) life_signal_Q.bind('tcp://*:{}'.format(IO.SENTINEL)) sender = context.socket(zmq.PUSH) sender.connect('tcp://{}:{}'.format(host, IO.EXTERNAL)) poller = zmq.Poller() ...
if save_name and (len(glob.glob('{}*'.format(save_name))) == NUMBER_OF_BRAINS or time.time() - save_time > IO.SYSTEM_TIME_OUT):
Next line prediction: <|code_start|>''' [self.] @author: Axel Tidemann, Øyvind Brandtsegg @contact: axel.tidemann@gmail.com, obrandts@gmail.com @license: GPL ''' ''' Finds the best parameters for the neural networks that performs audio recognition, using evolution.''' audio_memories = pickle.load(open('counts.pic...
recognizer = _train_network(new_train, targets, output_dim=chromosome[0]*10, leak_rate=float(chromosome[1])/100, bias_scaling=float(chromosome[2])/100)
Here is a snippet: <|code_start|># it under the terms of the GNU General Public License version 3 # as published by the Free Software Foundation. # # [self.] is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS F...
new_test = [chop(t[:,idxs]) for t in test ]
Given snippet: <|code_start|># -*- coding: latin-1 -*- # Copyright 2014 Oeyvind Brandtsegg and Axel Tidemann # # This file is part of [self.] # # [self.] is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 # as published by the Free S...
send('playfile_input {}'.format(f))
Predict the next line after this snippet: <|code_start|> # Copyright 2014 Oeyvind Brandtsegg and Axel Tidemann # # This file is part of [self.] # # [self.] is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 # as published by the Free ...
sleep(wav_duration(f) + wait_secs)
Given snippet: <|code_start|># [self.] is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of ...
audio_segment = AudioSegment(audio_id, crude_hash, fine_hash, wav_file, wav_audio_ids[(wav_file, audio_id)])
Based on the snippet: <|code_start|>#!/usr/bin/python # -*- coding: latin-1 -*- # Copyright 2014 Oeyvind Brandtsegg and Axel Tidemann # # This file is part of [self.] # # [self.] is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 # a...
audio_memory = AudioMemory()
Predict the next line for this snippet: <|code_start|># Copyright 2014 Oeyvind Brandtsegg and Axel Tidemann # # This file is part of [self.] # # [self.] is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 # as published by the Free Sof...
send('playfile {}'.format(sys.argv[3]))
Using the snippet: <|code_start|> print '{} chosen to respond. Audio data: {} Video data: {}'.format(me.name, audio_data.shape, video_data.shape) if audio_data.size == 0 and video_data.size == 0: print '*** Audio data and video data arrays are empty. Aborting the res...
print '{} saved as file {} ({})'.format(me.name, filename, filesize(filename))
Here is a snippet: <|code_start|> if 'rmse' in pushbutton: rmse = np.sqrt((np.array(list(error)).flatten() ** 2).mean()) sender.send_json('{} RMSE {}'.format(me.name, rmse)) if 'respond' in pushbutton and pushbutton['respond'] == me.name: ...
send_array(projector, row)
Given the following code snippet before the placeholder: <|code_start|> def recognize(host): me = mp.current_process() print me.name, 'PID', me.pid context = zmq.Context() rec_in = context.socket(zmq.SUB) rec_in.connect('tcp://{}:{}'.format(host, RECOGNIZE_IN)) rec_in.setsockopt(zmq.S...
audio_segment = recv_array(rec_in)
Using the snippet: <|code_start|> if row_diff < 0: scaled_audio_in = np.vstack([ scaled_audio_in, np.zeros((-row_diff, scaled_audio_in.shape[1])) ]) # Zeros because of level elif row_diff > 0: scaled_audio_in = scaled_audio_in[:len(scaled_audio_out)] x = scaled_audio_in[:-1] y = scaled_a...
mic.connect('tcp://{}:{}'.format(host, MIC))
Using the snippet: <|code_start|> x = scaled_audio_in[:-1] y = scaled_audio_out[1:] audio_producer = _train_network(x, y) audio_producer.length = audio_out.shape[0] # Video is sampled at a much lower frequency than audio. stride = audio_out.shape[0]/video_out.shape[0] x = scaled_audio_...
speaker.connect('tcp://{}:{}'.format(host, SPEAKER))
Using the snippet: <|code_start|> audio_producer = _train_network(x, y) audio_producer.length = audio_out.shape[0] # Video is sampled at a much lower frequency than audio. stride = audio_out.shape[0]/video_out.shape[0] x = scaled_audio_in[scaled_audio_in.shape[0] - stride*video_out.shape[0]::st...
camera.connect('tcp://{}:{}'.format(host, CAMERA))
Using the snippet: <|code_start|> stride = audio_out.shape[0]/video_out.shape[0] x = scaled_audio_in[scaled_audio_in.shape[0] - stride*video_out.shape[0]::stride] y = video_out audio2video = _train_network(x, y) audio2video.length = video_out.shape[0] print '[self.] learns in {} second...
projector.connect('tcp://{}:{}'.format(host, PROJECTOR))
Here is a snippet: <|code_start|> y = video_out audio2video = _train_network(x, y) audio2video.length = video_out.shape[0] print '[self.] learns in {} seconds'.format(time.time() - start_time) live(audio_recognizer, audio_producer, audio2video, scaler, host) def live(audio_recognizer, aud...
stateQ.connect('tcp://{}:{}'.format(host, STATE))
Based on the snippet: <|code_start|> def live(audio_recognizer, audio_producer, audio2video, scaler, host): me = mp.current_process() print me.name, 'PID', me.pid context = zmq.Context() mic = context.socket(zmq.SUB) mic.connect('tcp://{}:{}'.format(host, MIC)) mic.setsockopt(zmq.SUBSCRIBE...
snapshot.connect('tcp://{}:{}'.format(host, SNAPSHOT))
Next line prediction: <|code_start|> print '[self.] learns in {} seconds'.format(time.time() - start_time) live(audio_recognizer, audio_producer, audio2video, scaler, host) def live(audio_recognizer, audio_producer, audio2video, scaler, host): me = mp.current_process() print me.name, 'PID', me.pi...
eventQ.connect('tcp://{}:{}'.format(host, EVENT))
Based on the snippet: <|code_start|> self.bins = bins def fit(data): minlength = min([ d.shape[0] for d in data ]) maxlength = max([ d.shape[0] for d in data ]) zones = np.linspace(minlength, maxlength, self.bins) zones.astype('int') def predict(te...
sender.connect('tcp://{}:{}'.format(host, EXTERNAL))
Predict the next line for this snippet: <|code_start|> publisher.bind('tcp://*:{}'.format(CAMERA)) projector = context.socket(zmq.PULL) projector.bind('tcp://*:{}'.format(PROJECTOR)) eventQ = context.socket(zmq.SUB) eventQ.connect('tcp://localhost:{}'.format(EVENT)) eventQ.setsockopt(zmq.SU...
send_array(publisher, frame)
Using the snippet: <|code_start|> cv2.namedWindow('Output', cv2.WND_PROP_FULLSCREEN) camera = cv2.VideoCapture(0) context = zmq.Context() publisher = context.socket(zmq.PUB) publisher.bind('tcp://*:{}'.format(CAMERA)) projector = context.socket(zmq.PULL) projector.bind('tcp://*:{}'.format(...
cv2.imshow('Output', cv2.resize(recv_array(projector), FRAME_SIZE))
Given the code snippet: <|code_start|> ########################################################################## ## Validators ########################################################################## class InRange(object): """ Validator that specifies a value must be in a particular range """ def _...
model = Topic
Continue the code snippet: <|code_start|># # Copyright (C) 2015 District Data Labs # For license information, see LICENSE.txt # # ID: views.py [] benjamin@bengfort.com $ """ Views for the Topics application """ ########################################################################## ## Imports #####################...
context['num_topics'] = Topic.objects.count()
Using the snippet: <|code_start|># For license information, see LICENSE.txt # # ID: views.py [] benjamin@bengfort.com $ """ Views for the Topics application """ ########################################################################## ## Imports #######################################################################...
context['num_responses'] = Vote.objects.num_responses()
Continue the code snippet: <|code_start|> ########################################################################## ## HTML/Django Views ########################################################################## class ResultView(TemplateView): template_name = "site/results.html" def get_context_data(self, ...
form_class = MultiTopicForm
Given snippet: <|code_start|># For license information, see LICENSE.txt # # ID: models.py [] benjamin@bengfort.com $ """ Topic modeling for data survey analysis """ ########################################################################## ## Imports ###################################################################...
objects = TopicManager()
Based on the snippet: <|code_start|> """ votes = self.votes.aggregate( total=models.Sum('vote') )['total'] if self.is_canonical: for ref in self.references.all(): votes += ref.vote_total() return votes ####################################...
objects = VotingManager()
Predict the next line for this snippet: <|code_start|> ) # Ensure at least two topics are submitted. if len(topics) < 2: raise forms.ValidationError( _("Please provide at least 2 topics, techniques, or technologies!"), code="single_topic_error" ...
for topic in Topic.objects.from_string(self.cleaned_data['topics']):
Using the snippet: <|code_start|> # Ensure at least two topics are submitted. if len(topics) < 2: raise forms.ValidationError( _("Please provide at least 2 topics, techniques, or technologies!"), code="single_topic_error" ) # 50 topics is ...
Vote.objects.create(topic=topic, ipaddr=self.ipaddr)
Next line prediction: <|code_start|> ########################################################################## ## Imports ########################################################################## ########################################################################## ## Admin Views ##############################...
admin.site.register(Topic, TopicAdmin)
Predict the next line after this snippet: <|code_start|> try: except ImportError: @pytest.fixture def dut(moku): <|code_end|> using the current file's imports: import pytest from pymoku.instruments import WaveformGenerator from unittest.mock import ANY from mock import ANY and any relevant context from ot...
i = WaveformGenerator()
Given the following code snippet before the placeholder: <|code_start|> try: except ImportError: @pytest.fixture def dut(moku): with patch('pymoku._frame_instrument.FrameBasedInstrument._set_running'): <|code_end|> , predict the next line using imports from the current file: import pytest from pymoku.instrument...
i = Oscilloscope()
Based on the snippet: <|code_start|> dut.set_precision_mode(True) dut.is_precision_mode() moku._write_regs.assert_called_with(ANY) def test_set_defaults(dut, moku): ''' TODO Default test ''' dut.set_defaults() moku._write_regs.assert_called_with(ANY) def test_set_trigger(dut, moku): ...
('source_ch1', _oscilloscope._OSC_SOURCE_CH1),
Next line prediction: <|code_start|> try: except ImportError: @pytest.fixture def dut(moku): with patch('pymoku._stream_instrument.StreamBasedInstrument._set_running'): <|code_end|> . Use current file imports: (import pytest from pymoku.instruments import Datalogger from pymoku import _datalogger from unitt...
i = Datalogger()
Given the code snippet: <|code_start|> dut.get_samplerate() moku._write_regs.assert_called_with(ANY) def test_set_precision_mode(dut, moku): ''' TODO Default test ''' dut.set_precision_mode(True) dut.is_precision_mode() moku._write_regs.assert_called_with(ANY) def test_set_defaults(du...
('source_ch1', _datalogger._DL_SOURCE_ADC1),
Given the code snippet: <|code_start|> try: except ImportError: @pytest.fixture def dut(moku): <|code_end|> , generate the next line using the imports in this file: import pytest from pymoku.instruments import LockInAmp from pymoku import _lockinamp from unittest.mock import ANY from mock import ANY and co...
i = LockInAmp()
Given snippet: <|code_start|> elif 8 <= factor <= 64: d_wdfmuxsel = 1 d_outmuxsel = 2 d_cic1_dec = factor / 4 d_cic1_bitshift = 12 - math.log(d_cic1_dec ** 3, 2) i_muxsel = 3 i_ratechange_cic1 = factor / 4 i_interprate_cic1 = 0 ...
to_reg_unsigned(0, 2), d_wdfmuxsel
Continue the code snippet: <|code_start|> try: except ImportError: @pytest.fixture def dut(moku): <|code_end|> . Use current file imports: import pytest from pymoku.instruments import Phasemeter from unittest.mock import ANY from mock import ANY and context (classes, functions, or code) from other files: ...
i = Phasemeter()
Here is a snippet: <|code_start|> try: except ImportError: filt_coeff = [[1.0], [1.0, 0.64, -1.02, 0.646, -1.637, 0.898], [1.0, 0.51, -0.75, 0.518, -1.403, 0.679], [1.0, 0.31, -0.31, 0.314, -1.082, 0.410], [1.0, 0.13, 0.122, 0.130, -0.795, 0.178]] @pytest.fixt...
i = IIRFilterBox()
Given snippet: <|code_start|> ''' TODO Default test ''' dut.set_gains_offsets(1, 1.0, 1.0, 0, 0) moku._write_regs.assert_called_with(ANY) def test_set_monitor(dut, moku): ''' TODO Default test ''' dut.set_monitor('a', 'adc1') moku._write_regs.assert_called_with(ANY) def test_s...
('matrixscale_ch1_ch1', 1 / _iirfilterbox._ADC_DEFAULT_CALIBRATION),
Predict the next line for this snippet: <|code_start|> try: except ImportError: @pytest.fixture def dut(moku): with patch('pymoku._frame_instrument.FrameBasedInstrument._set_running'): <|code_end|> with the help of current file imports: import pytest from pymoku.instruments import PIDController from unitt...
i = PIDController()
Next line prediction: <|code_start|> try: except ImportError: @pytest.fixture def dut(moku): with patch('pymoku._frame_instrument.FrameBasedInstrument._set_running'): <|code_end|> . Use current file imports: (import pytest from pymoku.instruments import FrequencyResponseAnalyzer from unittest.mock import pa...
i = FrequencyResponseAnalyzer()
Predict the next line for this snippet: <|code_start|> def build_is_compatible(moku): # Check firmware versions moku_fw = moku.get_firmware_build() pymoku_fw = compat_fw[0] if moku_fw == 65535: return None # Development build, unable to determine return moku_fw == pymoku_fw def patch_i...
return set(moku._list_running_packs()) == set(compat_packs)
Based on the snippet: <|code_start|> # Calculates magnitude of a sample given I,Q and gain correction # factors def calculate_magnitude(I, Q, G, frontend_scale): if I is None or Q is None: return None else: return 2.0 * math.sqrt( ...
class FRAData(_frame_instrument.InstrumentData):
Given the code snippet: <|code_start|> class SweepGenerator(object): _REG_CONFIG = 0 _REG_START_LSB = 1 _REG_START_MSB = 2 _REG_STOP_LSB = 3 _REG_STOP_MSB = 4 _REG_STEP_LSB = 5 _REG_STEP_MSB = 6 _REG_DURATION_LSB = 7 _REG_DURATION_MSB = 8 WAVE_TYPE_SINGLE = 0 WAVE_TYPE_UPDOW...
r, to_reg_unsigned(0, 2,
Predict the next line after this snippet: <|code_start|> class SweepGenerator(object): _REG_CONFIG = 0 _REG_START_LSB = 1 _REG_START_MSB = 2 _REG_STOP_LSB = 3 _REG_STOP_MSB = 4 _REG_STEP_LSB = 5 _REG_STEP_MSB = 6 _REG_DURATION_LSB = 7 _REG_DURATION_MSB = 8 WAVE_TYPE_SINGLE = 0 ...
return self._instr._accessor_get(r, from_reg_unsigned(0, 2))
Continue the code snippet: <|code_start|> r1 = self.reg_base + SweepGenerator._REG_STEP_LSB r2 = self.reg_base + SweepGenerator._REG_STEP_MSB return self._instr._accessor_get((r2, r1), from_reg_unsigned(0, 64)) @step.setter def step(self, value): r1 = self.reg_base + SweepGenerat...
self._instr._accessor_set(r, to_reg_bool(2), value)
Predict the next line after this snippet: <|code_start|> r2 = self.reg_base + SweepGenerator._REG_STOP_MSB self._instr._accessor_set((r2, r1), to_reg_unsigned(0, 64), value) @property def step(self): r1 = self.reg_base + SweepGenerator._REG_STEP_LSB r2 = self.reg_base + SweepGene...
return self._instr._accessor_get(r, from_reg_bool(2))
Given snippet: <|code_start|> try: except ImportError: filt_coeff = [[1.0, 1.0, 0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 0.0, 0.0, 0.0, 0.0]] @pytest.fixture def dut(moku): with patch( 'pymoku._frame_instrument.' 'FrameBasedInstrument._set_running'): <|code_end|> , continue by predi...
i = LaserLockBox()
Based on the snippet: <|code_start|> try: except ImportError: @pytest.fixture def dut(moku): <|code_end|> , predict the immediate next line with the help of imports: import pytest from pymoku.instruments import ArbitraryWaveGen from pymoku import _arbwavegen from unittest.mock import ANY from mock import AN...
i = ArbitraryWaveGen()
Given the following code snippet before the placeholder: <|code_start|> moku._write_regs.assert_called_with(ANY) def test_reset_phase(dut, moku): ''' TODO Default test ''' dut.reset_phase(1) moku._write_regs.assert_called_with(ANY) def test_gen_off(dut, moku): ''' TODO Default test ...
('mode1', _arbwavegen._ARB_MODE_125),
Based on the snippet: <|code_start|> class EmbeddedPLL(object): _REG_BANDWIDTH = 0 _REG_AUTOACQ = 1 _REG_REACQ = 2 _REG_RESET = 3 def __init__(self, instr, reg_base): self._instr = instr self.reg_base = reg_base @property def bandwidth(self): r = self.reg_base + E...
return self._instr._accessor_get(r, from_reg_signed(0, 5))
Predict the next line for this snippet: <|code_start|> class EmbeddedPLL(object): _REG_BANDWIDTH = 0 _REG_AUTOACQ = 1 _REG_REACQ = 2 _REG_RESET = 3 def __init__(self, instr, reg_base): self._instr = instr self.reg_base = reg_base @property def bandwidth(self): r =...
return self._instr._accessor_get(r, from_reg_bool(0))
Predict the next line for this snippet: <|code_start|> class EmbeddedPLL(object): _REG_BANDWIDTH = 0 _REG_AUTOACQ = 1 _REG_REACQ = 2 _REG_RESET = 3 def __init__(self, instr, reg_base): self._instr = instr self.reg_base = reg_base @property def bandwidth(self): r =...
self._instr._accessor_set(r, to_reg_signed(0, 5), value) # allow_set?
Here is a snippet: <|code_start|> class EmbeddedPLL(object): _REG_BANDWIDTH = 0 _REG_AUTOACQ = 1 _REG_REACQ = 2 _REG_RESET = 3 def __init__(self, instr, reg_base): self._instr = instr self.reg_base = reg_base @property def bandwidth(self): r = self.reg_base + Embed...
self._instr._accessor_set(r, to_reg_bool(0), value) # allow_set?
Based on the snippet: <|code_start|> initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( core_exceptions.DeadlineExceeded, core_exceptions.ServiceUnavailable, ...
[webrisk.ComputeThreatListDiffRequest],
Based on the snippet: <|code_start|> self.search_hashes: gapic_v1.method.wrap_method( self.search_hashes, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.i...
[webrisk.ComputeThreatListDiffRequest],
Predict the next line after this snippet: <|code_start|> INSTRUCTIONS = """ To get MIDI realtime output in CAMP to work, you must select an appropriate MIDI bus. This will be the bus that will drive instruments in your DAW, VST host, or externally. Currently, only one bus can be used at a time with CAMP. In the list...
ports = get_ports()
Predict the next line after this snippet: <|code_start|>This will be the bus that will drive instruments in your DAW, VST host, or externally. Currently, only one bus can be used at a time with CAMP. In the list below, the LAST bus will be selected unless the environment variable CAMP_MIDI_BUS is set to a different nu...
print("The currently selected bus is #%s" % get_bus())
Given snippet: <|code_start|>""" Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless require...
class ScaleFollower(Member):
Predict the next line after this snippet: <|code_start|>ma""" Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/license...
class Duration(Member):
Given snippet: <|code_start|> # inversions, as such, I' means first inversion of I, and I'' means # second inversion, we'll optionally invert a bit further down inversion = 0 if sym.endswith("''''"): inversion = 3 sym = sym.replace("'''","") elif sym.endswi...
chord = Chord(root=base_note, typ=typ)
Here is a snippet: <|code_start|>http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific lan...
def __init__(self, scale=None):
Using the snippet: <|code_start|>""" Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless req...
class Ordered(Member):
Given the code snippet: <|code_start|> self._when = when # FIXME: BUGLET? Depends how you use it. # currently reset does NOT reset the draw_from on the when. # to do this, we'll need to make sure every reset() calls super() # as it should. That's minor though. self.when...
elif isinstance(item, Selector):
Using the snippet: <|code_start|>""" Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless req...
assert Note(name=nm, octave=4) > Note(name=nm, octave=3)
Predict the next line after this snippet: <|code_start|>""" Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/...
for nm in NOTES:
Given snippet: <|code_start|>""" Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless require...
class Velocity(Member):
Continue the code snippet: <|code_start|>""" Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Un...
class Endlessly(Selector):
Based on the snippet: <|code_start|>class Chord(object): def __init__(self, notes=None, root=None, typ=None): """ Constructs a chord, in different ways: notes = [ note('C4'), note('E4'), note('G4') ] chord = Chord(notes=notes) OR: chord = Chord(root=note('C4'), type='ma...
root = note(root)
Predict the next line after this snippet: <|code_start|> """ Constructs a chord, in different ways: notes = [ note('C4'), note('E4'), note('G4') ] chord = Chord(notes=notes) OR: chord = Chord(root=note('C4'), type='major') OR: chord = Chord(root='C4', type='major') ...
assert type(x) == Note
Given the code snippet: <|code_start|>""" Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unles...
class Channel(Member):
Predict the next line for this snippet: <|code_start|> def __init__(self): """ Constructs an interpreter for specific note names or chords. It doesn't need to know a scale and is pretty basic. literal = Literal() roman.do("C4,E4,G4") == chord("C4 major") roman.do("C4 ma...
return note(sym)