Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given the code snippet: <|code_start|> self_stepsize = self_periodreg_value * self_scale i = 0 if self_progress < self_stepsize: val = self_shape_buf[self_index] j = min(self_stepsize - self_progress, self_block_framecount) while i < j: self...
val = self_shape_buf[self_index]
Predict the next line after this snippet: <|code_start|># # You should have received a copy of the GNU General Public License # along with pym2149. If not, see <http://www.gnu.org/licenses/>. oscnodepyrbotype = dict( blockbuf = dict(buf = [signaldtype]), block = dict(framecount = u4), index = i4, sha...
@turbo(
Next line prediction: <|code_start|> self.shape = effect.getshape(self.fixedreg) prescalerornone = self.timer.prescalerornone.value if prescalerornone is None: self.blockbuf.fill_same(self.shape.buf[self.index]) self.precounterxmfp = None else: if self....
def rtoneimpl(self, prescaler, etdr):
Predict the next line after this snippet: <|code_start|> eager = u1, ), i = u4, j = u4, n = u4, val = signaldtype, ) def shapeimpl(self): self_blockbuf_buf = self_block_framecount = self_index = self_progress = self_scale = self_periodreg_value = self_s...
while i < j:
Given snippet: <|code_start|> n = u4, val = signaldtype, ) def shapeimpl(self): self_blockbuf_buf = self_block_framecount = self_index = self_progress = self_scale = self_periodreg_value = self_shape_buf = self_shape_size = self_shape_introlen = self_eager = LOCAL if self_eager: ...
if i == self_block_framecount:
Based on the snippet: <|code_start|> self_blockbuf_buf = self_block_framecount = self_mfpclock = self_chipimplclock = self_repeat = self_index = self_maincounter = self_precounterxmfp = self_shape_buf = self_shape_size = self_shape_introlen = LOCAL chunksizexmfp = self_chipimplclock * prescaler s...
eager = True
Continue the code snippet: <|code_start|># (at your option) any later version. # # pym2149 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. # ...
self.progress = np.iinfo(self.progressdtype).max
Predict the next line for this snippet: <|code_start|> self.periodreg = periodreg def reset(self, shape): self.index = -1 self.progress = np.iinfo(self.progressdtype).max self.shape = shape def callimpl(self): self.index, self.progress, self.stepsize = self.shapeimpl() ...
val = self_shape_buf[self_index]
Continue the code snippet: <|code_start|> val = self_shape_buf[self_index] j = i + self_stepsize while i < j: self_blockbuf_buf[i] = val i += 1 n -= 1 if i == self_block_framecount: self_pr...
def callimpl(self):
Given the following code snippet before the placeholder: <|code_start|> oscnodepyrbotype, mfpclock = i8, # Signed so j doesn't blow up. chipimplclock = u8, maincounter = i4, precounterxmfp = u4, repeat = u4, ), prescaler = u4, ...
i += 1
Based on the snippet: <|code_start|># along with pym2149. If not, see <http://www.gnu.org/licenses/>. log = logging.getLogger(__name__) class PortAudioClient(pac.PortAudioClient, Platform): @types(Config, StereoInfo) def __init__(self, config, stereoinfo): config = config.PortAudio super()....
def flush(self):
Given the code snippet: <|code_start|># pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pym2149 is distributed in the hope ...
self.chancount = stereoinfo.getoutchans.size
Given the code snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Li...
log2maxpeaktopeak = 1
Here is a snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License...
def __init__(self, config, stereoinfo):
Based on the snippet: <|code_start|># # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pym2149 is distributed in the hope ...
super().__init__()
Given snippet: <|code_start|># GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with pym2149. If not, see <http://www.gnu.org/licenses/>. log = logging.getLogger(__name__) class PortAudioClient(pac.PortAudioClient, Platform): @types(Conf...
def callimpl(self):
Predict the next line for this snippet: <|code_start|># You should have received a copy of the GNU General Public License # along with pym2149. If not, see <http://www.gnu.org/licenses/>. class TestSimpleTimer(TestCase): def periodframecount(self, rate): block, = self.t.blocksforperiod(rate) ret...
self.assertEqual(66, self.periodframecount(1.5))
Next line prediction: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
return block.framecount
Here is a snippet: <|code_start|>class LogicalBundle(Bundle): @types(Prerecorded, [Chip]) def __init__(self, prerecorded, chips): super().__init__(prerecorded, {chip.param: chip.channels for chip in chips}) class PhysicalBundle(Bundle): @types(Prerecorded, PhysicalRegisters) def __init__(self...
self.stream.flush()
Using the snippet: <|code_start|> self.prerecorded = prerecorded self.registers = registers def __iter__(self): yield from self.prerecorded.frames(self.registers) class LogicalBundle(Bundle): @types(Prerecorded, [Chip]) def __init__(self, prerecorded, chips): super().__init...
for _ in self.bundle:
Given snippet: <|code_start|> self.registers = registers def __iter__(self): yield from self.prerecorded.frames(self.registers) class LogicalBundle(Bundle): @types(Prerecorded, [Chip]) def __init__(self, prerecorded, chips): super().__init__(prerecorded, {chip.param: chip.channels ...
if self.quit:
Given the code snippet: <|code_start|>class Bundle: def __init__(self, prerecorded, registers): self.prerecorded = prerecorded self.registers = registers def __iter__(self): yield from self.prerecorded.frames(self.registers) class LogicalBundle(Bundle): @types(Prerecorded, [Chip]...
self.stream = stream
Given the following code snippet before the placeholder: <|code_start|> # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at you...
super().__init__(prerecorded, {chip.param: chip.channels for chip in chips})
Based on the snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
r.anim(2, 5)
Next line prediction: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
self.assertEqual([1, 27, 27, 31], list(s.buf))
Predict the next line for this snippet: <|code_start|> def test_diamond(self): self.spectator = Reg(value = -1) self.lhs = Reg() self.rhs = Reg() self.pair = Reg() self.leaf = Reg().link(lambda l, r, s: (l, r, s), self.lhs, self.rhs, self.spectator) self.lhs.link(lambd...
r.value = 2
Given the code snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Li...
self.assertEqual(0x87, high.value)
Based on the snippet: <|code_start|> chanindex = syschanindex % stream.chancount self.client.connect(f"{clientname}:{stream.streamname}_{1 + chanindex}", f"system:playback_{1 + syschanindex}") self.filler = BufferFiller(sum(s.chancount for s in self.streams), self.client.buffersiz...
if self.cursor == self.buffersize:
Given snippet: <|code_start|> super().__init__(clientname, portcount, config.jackringsize, config.jackcoupling) def start(self): super().start() log.debug( "JACK block size: %s or %.3f seconds", self.buffersize, self.buffersize / self.outputrate) class Ja...
self.filler = BufferFiller(sum(s.chancount for s in self.streams), self.client.buffersize, self.client.current_output_buffer, self.client.send_and_get_output_buffer)
Given the following code snippet before the placeholder: <|code_start|> for stream in self.streams: # Connect all system channels, cycling over our streams if necessary: for syschanindex in range(self.systemchannelcount): chanindex = syschanindex % stream.chancount ...
self.outbuf[portindex, self.cursor:self.cursor + m] = outbufs[portindex].buf[i:i + m]
Continue the code snippet: <|code_start|> super().start() log.debug( "JACK block size: %s or %.3f seconds", self.buffersize, self.buffersize / self.outputrate) class JackStream(Stream, Node, metaclass = AmpScale): log2maxpeaktopeak = 1 @types(Config, [FloatS...
self.filler([self.chain(wav) for stream in self.streams for wav in stream])
Given the code snippet: <|code_start|># This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # p...
self.buffersize / self.outputrate)
Based on the snippet: <|code_start|> self.client = client def start(self): self.client.activate() for stream in self.streams: # Connect all system channels, cycling over our streams if necessary: for syschanindex in range(self.systemchannelcount): chan...
i = 0
Next line prediction: <|code_start|># GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with pym2149. If not, see <http://www.gnu.org/licenses/>. log = logging.getLogger(__name__) class JackClient(jc.JackClient, Platform): @types(Config, ...
for stream in streams:
Predict the next line after this snippet: <|code_start|> self.client = client def start(self): self.client.activate() for stream in self.streams: # Connect all system channels, cycling over our streams if necessary: for syschanindex in range(self.systemchannelcount): ...
i = 0
Here is a snippet: <|code_start|> return Pitch(self.refmidi + 12 * math.log(freq / self.reffreq, 2)) class Unequal: def __init__(self, refpitch, freqs): self.factors = [math.log(g / f, 2) for f, g in zip(freqs, freqs[1:] + [freqs[0] * 2])] self.refpitch = refpitch self.freqs = freqs...
flats = config.meantoneflats
Given the code snippet: <|code_start|> self.freqs = freqs def freq(self, pitch): pitch -= self.refpitch pitchindex = math.floor(pitch) % 12 return self.freqs[pitchindex] * 2 ** (self.factors[pitchindex] * (pitch % 1) + pitch // 12) def pitch(self, freq): octave = math.fl...
wolfpitch = Pitch(refpitch + 11 - flats)
Predict the next line after this snippet: <|code_start|># 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 the GNU General Public License # along with pym21...
def update(self, tcr, tdr, effect):
Based on the snippet: <|code_start|>class MFPTimer: def __init__(self): self.control = Reg() self.data = Reg() # TODO LATER: Verify that TDR 0 indeed behaves like 0x100. self.effectivedata = Reg().link(lambda tdr: tdr if tdr else 0x100, self.data) self.control.value = 0 ...
if 1 <= etdr and etdr <= 0x100:
Based on the snippet: <|code_start|># pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pym2149 is distributed in the hope th...
naiven = min(naiveN, self.minbleps.getminnaiven(self.naivex, self.buffersize - self.bufferx))
Based on the snippet: <|code_start|> @types(Platform, MinBleps, ClockInfo) def __init__(self, platform, minbleps, clockinfo): self.naiverate = clockinfo.implclock super().__init__(self.naiverate) self.buffersize = platform.buffersize self.naivex = 0 self.bufferx = 0 ...
def __init__(self, clockinfo):
Here is a snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License...
self.minbleps = minbleps
Given the following code snippet before the placeholder: <|code_start|># You should have received a copy of the GNU General Public License # along with pym2149. If not, see <http://www.gnu.org/licenses/>. class SyncTimer(SimpleTimer): 'Fill platform buffer most efficiently.' @types(Platform, MinBleps, Clock...
super().__init__(clockinfo.implclock, 100)
Based on the snippet: <|code_start|># pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pym2149 is distributed in the hope th...
naiven = min(naiveN, self.minbleps.getminnaiven(self.naivex, self.buffersize - self.bufferx))
Given the following code snippet before the placeholder: <|code_start|> self.writen(rate) bytesperframe = self.bytespersample * channels self.writen(rate * bytesperframe) # Bytes per second. self.writen(bytesperframe, 2) self.writen(self.bytespersample * 8, 2) # Bits per sample. ...
raise
Predict the next line for this snippet: <|code_start|> @_turbo(startframe = u4, endframe = u4, thatnp = [T], j = u4) def partcopyintonp(self, startframe, endframe, thatnp): self_buf = LOCAL for j in range(endframe - startframe): thatnp[j] = self_buf[startframe] startframe ...
if not alreadynegated:
Predict the next line for this snippet: <|code_start|> def subbuf(self, that): self.buf -= that.buf def andbuf(self, that): self.buf &= that.buf def copybuf(self, that): self.buf[:] = that.buf def tofile(self, fileobj): # TODO LATER: Reinstate tofile when fixed upstrea...
self.buf = np.empty(size, self.dtype)
Given the code snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Li...
class BufType:
Next line prediction: <|code_start|> self.assertEqual(1.5, m.freq(22.25) / m.freq(15.25)) self.assertEqual(1.5, m.freq(23.25) / m.freq(16.25)) self.assertEqual(1.5, m.freq(24.25) / m.freq(17.25)) self.assertEqual(2 ** 18 / 3 ** 11, m.freq(25.25) / m.freq(18.25)) # Comma. self.asse...
self.assertAlmostEqual(440 * 6 / 5, t.freq(72))
Using the snippet: <|code_start|> def freqpitch(a): # Pitches: a(2048, 25.25) a(3072, 32.25) a(4608, 39.25) a(6912, 46.25) a(10368, 53.25) a(15552, 60.25) a(23328, 67.25) a(34992, 74.25) a(5248...
self.assertEqual(1.5, m.freq(21.25) / m.freq(14.25))
Given the code snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Li...
a(15552, 60.25)
Continue the code snippet: <|code_start|> log = logging.getLogger(__name__) stclock = 2000000 spectrum128crystal = 17734470 # Correct according to service manual. spectrumclock = spectrum128crystal // 10 defaultscale = 8 class ClockInfo: trishapes = frozenset([0xa, 0xe]) tonescale = 16 @classmethod ...
self.scale = defaultscale // config.underclock
Continue the code snippet: <|code_start|># it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pym2149 is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without eve...
def __init__(self, config, platform, ymfile = None):
Using the snippet: <|code_start|># along with pym2149. If not, see <http://www.gnu.org/licenses/>. log = logging.getLogger(__name__) stclock = 2000000 spectrum128crystal = 17734470 # Correct according to service manual. spectrumclock = spectrum128crystal // 10 defaultscale = 8 class ClockInfo: trishapes = froz...
raise Exception(f"underclock must be a factor of {defaultscale}.")
Based on the snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
class TestNode(TestCase):
Here is a snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License...
self.x += 1
Given snippet: <|code_start|> assert repr(group) == "ContextGroup(bar, foo)" assert len(group) == 2 assert set(group) == {'foo', 'bar'} assert group['bar'] is thing assert 'foo' in group del group.foo assert len(group) == 1 assert set(group) == {'bar'} del group['bar'] assert len(group) == 0 def test_con...
assert 'foo' not in inner, list(inner)
Predict the next line for this snippet: <|code_start|> class Thing(object): def __init__(self): self.__name__ = None def test_basic_context_operations(): sample = Context(foo=1, bar=2, _baz=3) assert sorted(sample) == ['bar', 'foo'] assert len(sample) == 2 assert sample['foo'] == 1 del sample['bar'] wi...
assert len(group) == 1
Using the snippet: <|code_start|>class Sample(object): ep = static(HERE) epm = static(HERE, dict(html='mako')) dev = static('/dev') far = static(HERE, far=('txt')) sample = Sample() def test_base_path_policy(): with pytest.raises(HTTPForbidden): sample.ep(None, '..', 'foo') with pytest.raises(HTTPForbidden...
assert data == dict()
Given the code snippet: <|code_start|> from __future__ import unicode_literals HERE = os.path.dirname(__file__) class Sample(object): ep = static(HERE) epm = static(HERE, dict(html='mako')) dev = static('/dev') far = static(HERE, far=('txt')) sample = Sample() def test_base_path_policy(): with pytest.raise...
def test_non_file():
Given snippet: <|code_start|> ext.mutate(ctx, endpoint, args, kwargs) assert args == [27, 42] assert kwargs == {} def test_annotation_transformation(): ext = AnnotationExtension() ctx = Context() result = ext.transform(ctx, endpoint, 1134) assert result == ('int', 1134) def test_annotation_failure(): ...
assert 'xyzzy' in s
Given the code snippet: <|code_start|> def test_annotation_method(): ext = AnnotationExtension() ctx = Context() args = [] kwargs = {'a': '27', 'b': '42'} ext.mutate(ctx, Endpoint().endpoint, args, kwargs) assert kwargs == {'a': 27, 'b': 42} def test_annotation_positional(): ext = AnnotationExtension() ct...
assert result == ('int', 1134)
Here is a snippet: <|code_start|># encoding: utf-8 def mock_lazy_value(context): context.ran = True context.count += 1 return 42 <|code_end|> . Write the next line using the current file imports: from web.core.context import Context from web.core.util import lazy and context from other files: # Path: web/core...
def test_lazy_context_value():
Based on the snippet: <|code_start|># encoding: utf-8 def mock_lazy_value(context): context.ran = True context.count += 1 return 42 def test_lazy_context_value(): Ctx = Context(sample=lazy(mock_lazy_value, 'sample'))._promote('MockContext', False) ctx = Ctx(count=0, ran=False) assert isinstance(Ctx.sample, ...
assert 'sample' not in ctx.__dict__
Continue the code snippet: <|code_start|> # ----------------------------------------------------------------------------- class WorkfileEntity(SetBasedWorkfileEntity): category = "workfile" # ------------------------------------------------------------------------- @staticmethod def _name_from_conte...
os.path.split(file_path)[-1])
Given the code snippet: <|code_start|> # ----------------------------------------------------------------------------- class WorkfileEntity(SetBasedWorkfileEntity): category = "workfile" # ------------------------------------------------------------------------- @staticmethod def _name_from_context(...
else:
Predict the next line after this snippet: <|code_start|> cls._fbx_import(session, representation, *args, **kwargs) # ------------------------------------------------------------------------- def export(self, product_desc=None, version_note=None, fbx_export=False, fbx_options=None, ma_export...
product_repr_dir = product_repr.directory
Based on the snippet: <|code_start|> category = "camera" # ------------------------------------------------------------------------- @classmethod def import_product_representation(cls, session, representation, *args, **kwargs): if representation.type == 'ma': super(CameraEnt...
product_reprs.extend(
Given the following code snippet before the placeholder: <|code_start|> raise SessionError( "Can not open '{f}'. File does not exist.".format(f=file_path)) self.nuke.scriptOpen(file_path) # ------------------------------------------------------------------------- def...
@property
Predict the next line after this snippet: <|code_start|> # ----------------------------------------------------------------------------- try: except ImportError: NUKE_IMPORTED = False NUKE_HAS_UI = False else: <|code_end|> using the current file's imports: import os import nuke from PySide import QtCo...
NUKE_IMPORTED = True
Based on the snippet: <|code_start|> # ----------------------------------------------------------------------------- try: except ImportError: NUKE_IMPORTED = False NUKE_HAS_UI = False else: NUKE_IMPORTED = True NUKE_HAS_UI = nuke.GUI # ---------------------------------------------------------------...
app_name = 'nuke'
Based on the snippet: <|code_start|> # ----------------------------------------------------------------------------- class MariShelf(object): # ------------------------------------------------------------------------- def __init__(self, name, layout=None, widget=None, palette=None): self._name = name...
def add_button(self, **kwargs):
Continue the code snippet: <|code_start|> # ----------------------------------------------------------------------------- class GeomcacheEntity(SetBasedEntity): category = "geomcache" # ------------------------------------------------------------------------- @classmethod def import_product_represen...
cls._fbx_import(session, representation, *args, **kwargs)
Given the following code snippet before the placeholder: <|code_start|> # ----------------------------------------------------------------------------- class GeomcacheEntity(SetBasedEntity): category = "geomcache" # ------------------------------------------------------------------------- @classmethod ...
else:
Using the snippet: <|code_start|> raise SessionError("Unable to determine current app session.") if not parent: parent = self._session.main_window super(SessionDialog, self).__init__(parent=parent) # ------------------------------------------------------------------...
font = title.font()
Next line prediction: <|code_start|> def delete(self): cmds.deleteUI("|".join([self.layout, self.name])) self._shelf_error_fix() # ------------------------------------------------------------------------- @property def exists(self): cmds.setParent(self.layout) return cmds...
def _shelf_error_fix(self):
Next line prediction: <|code_start|> # ----------------------------------------------------------------------------- class MapsEntity(MayaEntity): category = 'maps' # ------------------------------------------------------------------------- @classmethod def import_product_representation(cls, session,...
shader_name = kwargs.get('shader', False)[0]
Predict the next line after this snippet: <|code_start|> # ----------------------------------------------------------------------------- class MapsEntity(MayaEntity): category = 'maps' # ------------------------------------------------------------------------- @classmethod <|code_end|> using the current...
def import_product_representation(cls, session, representation, *args,
Continue the code snippet: <|code_start|> # ----------------------------------------------------------------------------- class MapsEntity(MayaEntity): category = 'maps' # ------------------------------------------------------------------------- @classmethod def import_product_representation(cls, ses...
MapsEntity.ptexImport(session, representation, kwargs)
Next line prediction: <|code_start|> # options: # export types: obj # ----------------------------------------------------------------------------- class GeomEntity(SetBasedEntity): category = "geom" # ------------------------------------------------------------------------- def export(self, product_d...
obj_options=None):
Given snippet: <|code_start|> print 'Encrypting...' enc = c.encrypt(msg, 'user1') #print enc print len(enc) assert enc != msg assert len(enc) > len(msg) print 'Decrypting...' txt = c.decrypt(enc, 'user1') #print txt assert txt == msg print 'OK' def bench(): msg = """{ "...
if count > 1 and now > start:
Next line prediction: <|code_start|> __all__ = ['LogMessage', 'InfofileMessage', 'JobRequestMessage', 'JobConfigReplyMessage', 'TaskRegisterMessage', 'TaskSendMessage'] class BaseMessage(Struct): # needs default as json.py seems to get inheritance wrong req = Field(str, '?') time = Field(float, default =...
class EchoResponseMessage (BaseMessage):
Predict the next line after this snippet: <|code_start|> log_function = Field(str) class DatabaseMessage (BaseMessage): req = Field (str, "db") function = Field (str) params = Field (str) class InfofileMessage(BaseMessage): req = Field(str, "pub.infofile") mtime = Field(float) # ...
class JobConfigReplyMessage(BaseMessage):
Using the snippet: <|code_start|># coding: utf8 # in all modules that use pubsub class WxStripWindow(wx.Frame): def __init__(self, parent, title,weh): super(WxStripWindow, self).__init__(parent, title=title, size=(500, 500)) self.weh = weh self.panel = wx.Panel(...
self.SetBackgroundColour('#000000')
Continue the code snippet: <|code_start|> if file_path.match(no_flags_pattern): log.debug(f"removing flags from {file_path} because it matches pattern {no_flags_pattern}") break else: retVal = False return retVal def remove_extraneous_files(sel...
else:
Using the snippet: <|code_start|> def find_file_log_handler(log_file_path): retVal = None top_logger = logging.getLogger() for handler in top_logger.handlers: if hasattr(handler, 'stream'): if handler.stream.name == os.fspath(log_file_path): retVal = handler ...
debug_logging_started = False
Next line prediction: <|code_start|> blueprint = Blueprint("statistics", __name__, url_prefix="/statistics", static_folder="../static") @blueprint.route("/") @cache.cached(timeout=3600, key_prefix="statistics") <|code_end|> . Use current file imports: (from flask import Blueprint, render_template from solarpi.exten...
def statistics():
Predict the next line for this snippet: <|code_start|> blueprint = Blueprint("statistics", __name__, url_prefix="/statistics", static_folder="../static") @blueprint.route("/") @cache.cached(timeout=3600, key_prefix="statistics") def statistics(): """Renders a page with statistics for the last 12 months :retu...
)
Here is a snippet: <|code_start|> class Weather(SurrogatePK, Model): __tablename__ = "weather_data" id = Column(db.Integer(), nullable=False, primary_key=True) created_at = Column(db.Text(), nullable=False, default=dt.datetime.utcnow) temp = Column(db.Float(), nullable=True) pressure = Column(db....
def __init__(self):
Based on the snippet: <|code_start|> class Weather(SurrogatePK, Model): __tablename__ = "weather_data" id = Column(db.Integer(), nullable=False, primary_key=True) created_at = Column(db.Text(), nullable=False, default=dt.datetime.utcnow) temp = Column(db.Float(), nullable=True) pressure = Column(...
def __init__(self):
Predict the next line for this snippet: <|code_start|> class Weather(SurrogatePK, Model): __tablename__ = "weather_data" id = Column(db.Integer(), nullable=False, primary_key=True) created_at = Column(db.Text(), nullable=False, default=dt.datetime.utcnow) temp = Column(db.Float(), nullable=True) ...
def __init__(self):
Using the snippet: <|code_start|># -*- coding: utf-8 -*- WEATHER_ICONS = { 211: "wi-storm-showers", 300: "wi-showers", 301: "wi-showers", 310: "wi-showers", 500: "wi-showers", 501: "wi-showers", 502: "wi-rain", 520: "wi-rain", <|code_end|> , determine the next line of code. You have im...
521: "wi-rain",
Predict the next line for this snippet: <|code_start|> blueprint = Blueprint("tables", __name__, url_prefix="/tables", static_folder="../static") @blueprint.route("/") @cache.cached(timeout=3600, key_prefix="tables") <|code_end|> with the help of current file imports: from datetime import timedelta, datetime from...
def tables():
Predict the next line for this snippet: <|code_start|> blueprint = Blueprint("tables", __name__, url_prefix="/tables", static_folder="../static") @blueprint.route("/") @cache.cached(timeout=3600, key_prefix="tables") <|code_end|> with the help of current file imports: from datetime import timedelta, datetime from...
def tables():
Given the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- if os.environ.get("SOLARPI_ENV") == "prod": app = create_app(ProdConfig) else: app = create_app(DevConfig) <|code_end|> , generate the next line using the imports in this file: import os import sys import subprocess from fla...
manager = Manager(app)
Using the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- if os.environ.get("SOLARPI_ENV") == "prod": app = create_app(ProdConfig) else: app = create_app(DevConfig) <|code_end|> , determine the next line of code. You have imports: import os import sys import subprocess from flask_script...
manager = Manager(app)
Given snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- if os.environ.get("SOLARPI_ENV") == "prod": app = create_app(ProdConfig) else: app = create_app(DevConfig) manager = Manager(app) TEST_CMD = "py.test tests" <|code_end|> , continue by predicting the next line. Consider current file ...
def _make_context():
Given snippet: <|code_start|># -*- coding: utf-8 -*- def test_production_config(): app = create_app(ProdConfig) assert app.config["ENV"] == "prod" assert app.config["DEBUG"] is False assert app.config["DEBUG_TB_ENABLED"] is False assert app.config["ASSETS_DEBUG"] is False def test_dev_config(): ...
assert app.config["DEBUG"] is True
Next line prediction: <|code_start|># -*- coding: utf-8 -*- def test_production_config(): app = create_app(ProdConfig) assert app.config["ENV"] == "prod" assert app.config["DEBUG"] is False assert app.config["DEBUG_TB_ENABLED"] is False assert app.config["ASSETS_DEBUG"] is False def test_dev_con...
assert app.config["ENV"] == "dev"
Next line prediction: <|code_start|># -*- coding: utf-8 -*- class PVData(SurrogatePK, Model): __tablename__ = "pvdata" id = Column(db.Integer(), nullable=False, primary_key=True) created_at = Column(db.Text(), nullable=False, default=dt.datetime.utcnow) dc_1_u = Column(db.Integer(), nullable=True) ...
def __init__(self):