Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Continue the code snippet: <|code_start|> PM_ID = "private_message" # Define models PMParticipants = db.Table('{}_participants'.format(PM_ID), db.Column('user_id', db.Integer(), db.ForeignKey(User.id), ...
lazy='dynamic'))
Predict the next line for this snippet: <|code_start|> class ModelConverter(BaseConverter): __OBJECTS__ = { 'user': User, 'object': Object, 'activity': Activity } def __init__(self, url_map, obj="object"): super(ModelConverter, self).__init__(url_map) # match ID or ...
).first_or_404()
Given the following code snippet before the placeholder: <|code_start|> class ModelConverter(BaseConverter): __OBJECTS__ = { 'user': User, 'object': Object, 'activity': Activity } def __init__(self, url_map, obj="object"): <|code_end|> , predict the next line using imports from the...
super(ModelConverter, self).__init__(url_map)
Given the following code snippet before the placeholder: <|code_start|> print("You need to configure the APP to be used!") exit(1) exit(behave_main(sys.argv[2:] + ['--no-capture', "beavy_apps/{}/tests/features".format(frontend)])) if has_behave: manager.add_command("beh...
if verbose:
Here is a snippet: <|code_start|> if not re.match("^[a-z][a-z0-9]{2,24}$", name): print("""Sorry, the app name has to be a lower-cased 3-25 character long string only containing letters, numbers and underscore and starting with a letter!""") print("RegEx: ^[a-z][a-z0-9]{2,24}$ ") exit(1) ...
// This is your app entry point
Predict the next line after this snippet: <|code_start|> """ Setup beavy template and infrastructure for a new app given the @name. """ ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) if not re.match("^[a-z][a-z0-9]{2,24}$", name): print("""Sorry, the app name has to be a lower-cas...
import { MainMenu } from "components/MainMenu";
Predict the next line after this snippet: <|code_start|> # from unittest import mock class TestObject(): def __init__(self): self.payload = {} title = PayloadProperty("title") header_o = PayloadProperty("other", "content.header") header_p = PayloadProperty("p", "content.header") def test_...
def test_deeper(mocker):
Predict the next line for this snippet: <|code_start|> class BaseObject(Schema): class Meta: type_ = "object" id = fields.Integer() created_at = fields.DateTime() owner = fields.Nested(BaseUser) belongs_to_id = fields.Integer() # don't leak type = fields.String(attribute="discriminat...
pass
Given the following code snippet before the placeholder: <|code_start|> class BaseObject(Schema): class Meta: type_ = "object" <|code_end|> , predict the next line using imports from the current file: from beavy.common.paging_schema import makePaginationSchema from beavy.common.morphing_schema import Mo...
id = fields.Integer()
Given the following code snippet before the placeholder: <|code_start|> class Like(Activity): __mapper_args__ = { 'polymorphic_identity': 'like' } Object.likes_count = db.Column(db.Integer()) @event.listens_for(Like, 'after_insert') def update_object_likes_count(mapper, connection, target): # u...
likes_count = Like.query.filter(Like.object_id == target.object_id).count()
Given the following code snippet before the placeholder: <|code_start|> class Like(Activity): __mapper_args__ = { 'polymorphic_identity': 'like' } Object.likes_count = db.Column(db.Integer()) @event.listens_for(Like, 'after_insert') def update_object_likes_count(mapper, connection, target): # u...
).update({'likes_count': likes_count})
Predict the next line for this snippet: <|code_start|> provider = db.Column(db.String(255), nullable=False) profile_id = db.Column(db.String(255), nullable=False) username = db.Column(db.String(255)) email = db.Column(db.String(255)) access_token = db.Column(db.String(255)) secret = db.Column(db....
msg = "Please provide an email address."
Predict the next line for this snippet: <|code_start|> if not user or user.is_anonymous: if not app.config.get("SECURITY_REGISTERABLE"): msg = "User not found. Registration disabled." logging.warning(msg) raise Exception(_(msg)) email = prof...
connection = cls(user_id=user.id, **profile.data)
Next line prediction: <|code_start|> class SocialConnection(db.Model): id = db.Column(db.Integer, primary_key=True) created_at = db.Column('created_at', db.DateTime(), nullable=False, server_default=func.now()) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=F...
@classmethod
Next line prediction: <|code_start|> raise UnSupportedExceptions('sort', sort) return self.do('GET', 'projects', query_params={'name': name, 'sort': sort} ) def create_project(self, name, datastore='light', location='false'): if validate_dat...
def update_project(self, project_id, name, location):
Based on the snippet: <|code_start|> class ProjectMixins(object): def show_projects(self, name=None, sort=None): # validate sort option if not validate_sort_project(sort): raise UnSupportedExceptions('sort', sort) return self.do('GET', 'projects', query_p...
'location': location
Predict the next line for this snippet: <|code_start|> class ProjectMixins(object): def show_projects(self, name=None, sort=None): # validate sort option if not validate_sort_project(sort): raise UnSupportedExceptions('sort', sort) return self.do('GET', 'projects', ...
)
Given the code snippet: <|code_start|> class ProjectMixins(object): def show_projects(self, name=None, sort=None): # validate sort option if not validate_sort_project(sort): raise UnSupportedExceptions('sort', sort) return self.do('GET', 'projects', query...
}
Predict the next line for this snippet: <|code_start|> class ModuleMixins(object): def show_modules(self, project_id=None, serial_number=None, model=None, sort=None): sort_options = [ None, '', 'project', '-project', 'name', '-name', 'id', '-id', ...
if sort not in sort_options:
Given the following code snippet before the placeholder: <|code_start|> return self.do('POST', 'services/?type=outgoing-webhook', request_params={ 'name': name, 'type': 'outgoing-webhook', 'project': project_i...
def create_mqtt_service(self, name, project_id, hostname, port, publish_prefix, subscribe_topic,
Given the code snippet: <|code_start|> # Transmit CMD_TX_ENQUEUE = 0x20 CMD_TX_SENDIMMED = 0x21 CMD_TX_LENGTH = 0x22 CMD_TX_CLEAR = 0x23 CMD_TX_SEND = 0x24 CMD_TX_STAT = 0x25 <|code_end|> , generate the next line using the imports in this file: import struct import datetime from .utils import pack, value_to_bytes ...
class TransmitMixins(object):
Based on the snippet: <|code_start|> sakuraio = self._initial(0x01, [0x01, ord("b"), 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 31, 239, 255, 255, 255, 255, 255, 255]) self.assertEqual(sakuraio.dequeue_rx_raw(), {'channel': 1, 'data': [1, 2, 3, 4, 5, 6, 7, 8], 'offset': -4321, 'type': 'b'}) ...
sakuraio = self._initial(0x01, [0, 0x01, 0x02, 0x03, 0x04])
Predict the next line for this snippet: <|code_start|> sakuraio = self._initial(0x01, [0x01, 0x02, 0x03, 0x04, 0x05]) result = sakuraio.get_file_data([128]) self.assertEqual(sakuraio.values, [CMD_GET_FILE_DATA, 1, 128, 197]) self.assertEqual(result, {"data":[0x01, 0x02, 0x03, 0x04, 0x05]}...
sakuraio = self._initial(0x01, [])
Given the following code snippet before the placeholder: <|code_start|> class SakuraIOBaseTest(unittest.TestCase): def test_parity(self): self.assertEqual(calc_parity([0x00]), 0x00) self.assertEqual(calc_parity([0x24]), 0x24) self.assertEqual(calc_parity([0x00, 0x24]), 0x24) self....
request = [0x01, 0x02, 0x03, 0x04]
Here is a snippet: <|code_start|> cmd = 0x10 request = [0x01, 0x02, 0x03, 0x04] request.append(calc_parity(request)) response = [0x01, 0x04, 0x11, 0x12, 0x13, 0x14] response.append(calc_parity(response)) expected = response[2:-1] self.assertEqual(self._execute_...
request = [0x01, 0x02, 0x03, 0x04]
Predict the next line after this snippet: <|code_start|> request.append(calc_parity(request)) response = [0x01, 0x04, 0x11, 0x12, 0x13, 0x14] response.append(calc_parity(response)) expected = response[2:-1] self.assertEqual(self._execute_command(cmd, request, response), expecte...
status = 0x01
Given the code snippet: <|code_start|> return base.execute_command(cmd, request, as_bytes=as_bytes) def test_execute_command(self): base = DummySakuraIO() cmd = 0x10 request = [0x01, 0x02, 0x03, 0x04] request.append(calc_parity(request)) response = [0x01, 0x04, 0x11...
def test_execute_command_parity_error(self):
Here is a snippet: <|code_start|> class DummySakuraIO(SakuraIOBase): def start(self, write=True): pass def end(self): pass def initial(self, response): self.return_values = response <|code_end|> . Write the next line using the current file imports: from sakuraio.hardware.base im...
self.values = []
Predict the next line for this snippet: <|code_start|> d[item] = value # _put modified data self._put_nosync(d) def __delitem__(self, item): self._write_op(self._delitem_nosync, item) def _delitem_nosync(self, key): # load existing data d = self._get_nosync() ...
def update(self, *args, **kwargs):
Given snippet: <|code_start|> if dtype.kind == 'V' and dtype.hasobject: if object_codec is None: raise ValueError('missing object_codec for object array') v = object_codec.encode(v) v = str(base64.standard_b64encode(v), 'ascii') return v if ...
return int(v.view("i8"))
Using the snippet: <|code_start|> # check metadata format version zarr_format = meta.get("zarr_format", None) if zarr_format != cls.ZARR_FORMAT: raise MetadataError("unsupported zarr format: %s" % zarr_format) meta = dict(zarr_format=zarr_format) return meta # N...
return np.nan
Based on the snippet: <|code_start|> object_codec = None meta = dict( zarr_format=cls.ZARR_FORMAT, shape=meta["shape"] + sdshape, chunks=meta["chunks"], dtype=cls.encode_dtype(dtype), compressor=meta["compressor"], fill_value=cl...
if isinstance(d, list):
Given the code snippet: <|code_start|> if compressor: chunk = compressor.decode(cdata) else: chunk = cdata actual = np.frombuffer(chunk, dtype=encode_dtype) expect = data.astype(encode_dtype)[i*chunk_size:(i+1)*chunk_size] assert...
else:
Based on the snippet: <|code_start|> # 2D assert is_total_slice(Ellipsis, (100, 100)) assert is_total_slice(slice(None), (100, 100)) assert is_total_slice((slice(None), slice(None)), (100, 100)) assert is_total_slice((slice(0, 100), slice(0, 100)), (100, 100)) assert not is_total_slice((slice(0, ...
def test_human_readable_size():
Predict the next line for this snippet: <|code_start|> normalize_order('foo') def test_normalize_fill_value(): assert b'' == normalize_fill_value(0, dtype=np.dtype('S1')) structured_dtype = np.dtype([('foo', 'S3'), ('bar', 'i4'), ('baz', 'f8')]) expect = np.array((b'', 0, 0.), dtype=structured_dtyp...
(1, 2, 0, 4, 5),
Given the following code snippet before the placeholder: <|code_start|> assert '100' == human_readable_size(100) assert '1.0K' == human_readable_size(2**10) assert '1.0M' == human_readable_size(2**20) assert '1.0G' == human_readable_size(2**30) assert '1.0T' == human_readable_size(2**40) assert '...
(1000000000,),
Based on the snippet: <|code_start|> def test_normalize_order(): assert 'F' == normalize_order('F') assert 'C' == normalize_order('C') assert 'F' == normalize_order('f') assert 'C' == normalize_order('c') with pytest.raises(ValueError): normalize_order('foo') def test_normalize_fill_value...
(1000, 10000000, 2),
Based on the snippet: <|code_start|> ) for shape in shapes: chunks = guess_chunks(shape, 1) assert isinstance(chunks, tuple) assert len(chunks) == len(shape) # doesn't make any sense to allow chunks to have zero length dimension assert all(0 < c <= max(s, 1) for c, s in zi...
with pytest.raises(ValueError):
Continue the code snippet: <|code_start|> def test_normalize_order(): assert 'F' == normalize_order('F') assert 'C' == normalize_order('C') assert 'F' == normalize_order('f') assert 'C' == normalize_order('c') with pytest.raises(ValueError): normalize_order('foo') def test_normalize_fill_...
(1000, 10000000, 2),
Given the code snippet: <|code_start|> assert '1.0P' == human_readable_size(2**50) def test_normalize_order(): assert 'F' == normalize_order('F') assert 'C' == normalize_order('C') assert 'F' == normalize_order('f') assert 'C' == normalize_order('c') with pytest.raises(ValueError): norm...
(10000000, 1000, 2),
Given the following code snippet before the placeholder: <|code_start|> @mock.patch.dict("sys.modules", {"ipytree": None}) def test_tree_widget_missing_ipytree(): pattern = ( "Run `pip install zarr[jupyter]` or `conda install ipytree`" "to get the required ipytree dependency for displaying the tree ...
assert fixture.c == x
Using the snippet: <|code_start|> (1000000000, 1000000000, 1000000000), (0,), (0, 0), (10, 0), (0, 10), (1, 2, 0, 4, 5), ) for shape in shapes: chunks = guess_chunks(shape, 1) assert isinstance(chunks, tuple) assert len(chunks) == len(shape)...
assert '</table>' == actual[-8:]
Given the following code snippet before the placeholder: <|code_start|> with pytest.raises(ValueError): normalize_order('foo') def test_normalize_fill_value(): assert b'' == normalize_fill_value(0, dtype=np.dtype('S1')) structured_dtype = np.dtype([('foo', 'S3'), ('bar', 'i4'), ('baz', 'f8')]) ...
(0, 10),
Predict the next line after this snippet: <|code_start|> assert '1.0G' == human_readable_size(2**30) assert '1.0T' == human_readable_size(2**40) assert '1.0P' == human_readable_size(2**50) def test_normalize_order(): assert 'F' == normalize_order('F') assert 'C' == normalize_order('C') assert '...
(10000000, 1000),
Given the code snippet: <|code_start|> def test_normalize_dimension_separator(): assert None is normalize_dimension_separator(None) assert '/' == normalize_dimension_separator('/') assert '.' == normalize_dimension_separator('.') <|code_end|> , generate the next line using the imports in this file: impo...
with pytest.raises(ValueError):
Here is a snippet: <|code_start|> with pytest.raises(TypeError): is_total_slice('foo', (100,)) def test_normalize_resize_args(): # 1D assert (200,) == normalize_resize_args((100,), 200) assert (200,) == normalize_resize_args((100,), (200,)) # 2D assert (200, 100) == normalize_resize_...
def test_normalize_order():
Using the snippet: <|code_start|> expect = "foo : bar\nbaz : qux\n" assert expect == info_text_report(items) def test_info_html_report(): items = [('foo', 'bar'), ('baz', 'qux')] actual = info_html_report(items) assert '<table' == actual[:6] assert '</table>' == actual[-8:] def test_tree_get_...
def test_retry_call():
Continue the code snippet: <|code_start|> assert all(0 < c <= max(s, 1) for c, s in zip(chunks, shape)) # ludicrous itemsize chunks = guess_chunks((1000000,), 40000000000) assert isinstance(chunks, tuple) assert (1,) == chunks def test_info_text_report(): items = [('foo', 'bar'), ('baz', '...
pattern = (
Given the following code snippet before the placeholder: <|code_start|> (1000, 10000000, 2), (10000, 10000, 10000), (100000, 100000, 100000), (1000000000, 1000000000, 1000000000), (0,), (0, 0), (10, 0), (0, 10), (1, 2, 0, 4, 5), ) for shape ...
items = [('foo', 'bar'), ('baz', 'qux')]
Given snippet: <|code_start|> assert (200,) == normalize_resize_args((100,), (200,)) # 2D assert (200, 100) == normalize_resize_args((100, 100), (200, 100)) assert (200, 100) == normalize_resize_args((100, 100), (200, None)) assert (200, 100) == normalize_resize_args((100, 100), 200, 100) assert...
def test_normalize_fill_value():
Next line prediction: <|code_start|> assert '1.0K' == human_readable_size(2**10) assert '1.0M' == human_readable_size(2**20) assert '1.0G' == human_readable_size(2**30) assert '1.0T' == human_readable_size(2**40) assert '1.0P' == human_readable_size(2**50) def test_normalize_order(): assert 'F'...
(10000000000000000000000,),
Predict the next line for this snippet: <|code_start|> else: dim_out_sel = self.dim_out_sel[start:stop] # find region in chunk dim_offset = dim_chunk_ix * self.dim_chunk_len dim_chunk_sel = self.dim_sel[start:stop] - dim_offset yield ChunkDimP...
return selection
Given the following code snippet before the placeholder: <|code_start|> # find region in output if dim_chunk_ix == 0: start = 0 else: start = self.chunk_nitems_cumsum[dim_chunk_ix - 1] stop = self.chunk_nitems_cumsum[dim_chunk_ix] ...
selection = [slice_to_range(dim_sel, dim_len) if isinstance(dim_sel, slice)
Given the following code snippet before the placeholder: <|code_start|> start = 0 else: start = self.chunk_nitems_cumsum[dim_chunk_ix - 1] stop = self.chunk_nitems_cumsum[dim_chunk_ix] if self.order == Order.INCREASING: dim_out_sel = sli...
else dim_sel
Given the following code snippet before the placeholder: <|code_start|> if self.order == Order.INCREASING: dim_out_sel = slice(start, stop) else: dim_out_sel = self.dim_out_sel[start:stop] # find region in chunk dim_offset = dim_chunk_ix * ...
selection = np.ix_(*selection)
Predict the next line after this snippet: <|code_start|> urlpatterns = patterns('replayswithfriends.sc2match.views', url(r'^player/$', PlayerList.as_view(), name='player_list'), url(r'^player/(?P<pk>[\d]+)$', PlayerDetail.as_view(), name='player_detail'), url(r'^match/$', MatchList.as_view(), name='match_li...
)
Next line prediction: <|code_start|> urlpatterns = patterns('replayswithfriends.sc2match.views', url(r'^player/$', PlayerList.as_view(), name='player_list'), url(r'^player/(?P<pk>[\d]+)$', PlayerDetail.as_view(), name='player_detail'), url(r'^match/$', MatchList.as_view(), name='match_list'), url(r'^mat...
)
Using the snippet: <|code_start|> urlpatterns = patterns('replayswithfriends.sc2match.views', url(r'^player/$', PlayerList.as_view(), name='player_list'), url(r'^player/(?P<pk>[\d]+)$', PlayerDetail.as_view(), name='player_detail'), url(r'^match/$', MatchList.as_view(), name='match_list'), url(r'^match/...
)
Next line prediction: <|code_start|>class PlayerDetail(DetailView): queryset = Player.objects.all() slug_field = 'username' slug_url_kwarg = 'username' def get_queryset(self): if self.request.user.is_authenticated(): return Player.objects.filter(match__in=Match.share.available(self.r...
if self.request.user.is_authenticated():
Here is a snippet: <|code_start|> def get_queryset(self): if self.request.user.is_authenticated(): return Player.objects.filter(match__in=Match.share.available(self.request.user)) else: return Player.objects.filter(match__in=Match.share.public()) class MatchView(DetailView): ...
def get_form_kwargs(self):
Given snippet: <|code_start|> class PlayerDetail(DetailView): queryset = Player.objects.all() slug_field = 'username' slug_url_kwarg = 'username' def get_queryset(self): if self.request.user.is_authenticated(): return Player.objects.filter(match__in=Match.share.available(self.request...
def get_queryset(self):
Using the snippet: <|code_start|> class MatchUploadForm(ModelForm): def __init__(self, *args, **kwargs): self.user = kwargs.pop('user', None) super(MatchUploadForm, self).__init__(*args, **kwargs) def save(self, *args, **kwargs): commit = kwargs.get('commit', True) match = sup...
if commit:
Based on the snippet: <|code_start|> # assign the cartrographer's CCD to this one self.camera.cartographer.ccd = self.ccd # create coordinate object for the stars stars = self.camera.cartographer.point(ras, decs, 'celestial') x, y = stars.ccdxy.tuple # start with target...
self.finishFromStars()
Using the snippet: <|code_start|> if extreme: p = [0.1, 30.0] d = [0.1, 1] else: p = [0.1, 30.0] d = [0.0001, 0.01] P = 10 ** prng.uniform(*np.log10(p)) E = prng.uniform(0, P) mass = prng.uniform(0.1, 1.5) radius = mass ...
def demo(self, tmin=0, tmax=27.4, cadence=30.0 / 60.0 / 24.0, offset=0, raw=False, ax=None):
Based on the snippet: <|code_start|> pmdec[np.isfinite(pmdec) == False] = 0.0 ok = np.isfinite(imag) if faintlimit is not None: ok *= imag <= faintlimit logger.info("found {0} stars with {1} < V < {2}".format(np.sum(ok), np.min(rmag[ok]), np.max(rmag[ok]))) self.ra =...
self.epoch = inputcatalog.epoch
Here is a snippet: <|code_start|> # define a filename for this magnitude range self.note = 'starsbrighterthan{0:02d}'.format(magnitudethreshold) starsfilename = os.path.join(self.directory, self.note + '.fits') # load the existing stellar image, if possib...
self.currentfocus = self.camera.focus.model(self.camera.counter)
Using the snippet: <|code_start|>"""Calculate the expected photometric precision for TESS. (translated from Josh Winn's IDL TESS signal-to-noise calculator on the TESS wiki and updated to include calculations published with Peter Sullivan's simulation paper).""" logger = logging.getLogger(__name__) logger.addHandl...
optimalpixelsdata = astropy.io.ascii.read(pkgutil.get_data(__name__, 'relations/optimalnumberofpixels.txt'))
Predict the next line for this snippet: <|code_start|> ax.plot(time, what, **kw) ax.set_ylabel(['dRA (arcsec)', 'dDec (arcsec)'][i]) if i == 0: ax.set_title('Jitter Timeseries from\n{}'.format(self.basename)) plt.xlabel('Time from Observation Start (days)') ...
n = len(self.x)
Predict the next line for this snippet: <|code_start|> logger = logging.getLogger(__name__) logger.addHandler(log_file_handler) class Cartographer(object): """An object to handle all conversions between coordinate systems.""" def __init__(self, camera=None, ccd=None): """Initialize Cartographer, tell...
possibilities.extend(['celestial', 'ecliptic', 'galactic'])
Continue the code snippet: <|code_start|># Copyright (c) 2011-2014, Alexander Todorov <atodorov@nospam.dif.io> # # 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.apa...
try:
Continue the code snippet: <|code_start|> # used in Django Admin and in # application dashboard VENDOR_TYPES = ( (VENDOR_OPENSHIFT_EXPRESS, 'OpenShift'), (VENDOR_DOTCLOUD, 'dotCloud'), (VENDOR_HEROKU, 'Heroku'), (VENDOR_CLOUDCONTROL, 'cloudControl'), (VENDOR_APPFOG, 'AppFog'), (VENDOR_VIRTUALENV...
(APP_STATUS_UPTODATE, 'Up to date'),
Here is a snippet: <|code_start|># # Copyright (c) 2011-2014, Alexander Todorov <atodorov@nospam.dif.io> # # 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.or...
Below you can see a truncated part of it. If you still need everything
Using the snippet: <|code_start|># Copyright (c) 2011-2012, Alexander Todorov <atodorov@nospam.dif.io> # # 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/...
'Twisted-Words' : 'Twisted Words',
Continue the code snippet: <|code_start|># # Copyright (c) 2011-2012, Alexander Todorov <atodorov@nospam.dif.io> # # 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.a...
'Twisted-Web' : 'Twisted Web',
Predict the next line for this snippet: <|code_start|> if request.user.has_perm('difio.packageversion_modify_all'): return super(PackageVersionAdmin, self).get_fieldsets(request, obj) else: return [ (None, { 'fields': ( ('package_status'), ...
obj.package.get_status_display(), obj.size,
Using the snippet: <|code_start|> if request.user.has_perm('difio.packageversion_modify_all'): return super(PackageVersionAdmin, self).get_fieldsets(request, obj) else: return [ (None, { 'fields': ( ('package_status'), ...
obj.package.get_status_display(), obj.size,
Given the code 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 th...
url(r'^ajax/delete/InstalledPackage/$', 'difio.views.ajax_delete_inst_pkg', name='ajax_delete_inst_pkg'),
Based on the snippet: <|code_start|> self.app.settings.save() self.app.scene.save() def populate_networking_clients_table(self): clients = self.app.settings['networking']['clients'] self.tbl_networking_clients.setRowCount(len(clients)) for i, client in enumerate(clients): ...
self.tbl_networking_clients.setItem(i, 0, item_host)
Next line prediction: <|code_start|> except yaml.YAMLError as yea: ExceptionCollector.appendException(ValueError(yea)) else: if tpl is None: tpl = {} return tpl def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict): class OrderedLoader(Loader): ...
return tpl
Given the code snippet: <|code_start|># 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 required by applicable law or...
f.close()
Given snippet: <|code_start|>if hasattr(yaml, 'CSafeLoader'): yaml_loader = yaml.CSafeLoader else: yaml_loader = yaml.SafeLoader def load_yaml(path, a_file=True): f = None try: if a_file: f = codecs.open(path, encoding='utf-8', errors='strict') else: f = urllib....
raise
Here is a snippet: <|code_start|># 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 required by applicable law or agre...
expected_output = '18.0'
Here is a snippet: <|code_start|> class TOSCAVersionPropertyTest(TestCase): def test_tosca_version_property(self): version = '18.0.3.beta-1' expected_output = '18.0.3.beta-1' output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) vers...
expected_output = None
Given the following code snippet before the placeholder: <|code_start|># 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 required by applicable law or agreed to in writing, software # distrib...
def test_format_error(self):
Given snippet: <|code_start|># 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 required by applicable law or agreed t...
self.assertFalse(
Given the following code snippet before the placeholder: <|code_start|># 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 required by applicable law or agreed to in writing, software # distrib...
def test_format_error(self):
Continue the code snippet: <|code_start|># 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 required by applicable law...
'dsl_definitions', 'node_types', 'repositories',
Here is a snippet: <|code_start|> 'interface_types', 'policy_types', 'topology_template', 'metadata') VALID_TEMPLATE_VERSIONS = ['tosca_simple_yaml_1_0', 'tosca_simple_yaml_1_2'] exttools = ExtTools() VALID_TEMPLATE_VERSIONS.extend(exttools.get_versions()) ...
valid_versions='", "'. join(self.VALID_TEMPLATE_VERSIONS)))
Predict the next line after this snippet: <|code_start|># WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. class TypeValidation(object): ALLOWED_TYPE_SECTIONS = (DEFINITION_VERSION, DE...
version = custom_type[self.DEFINITION_VERSION] \
Given the code snippet: <|code_start|># 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 required by applicable law or agreed to in writing, software # distributed under the License is distrib...
self.assertEqual(
Based on the snippet: <|code_start|># 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 required by applicable law or a...
def test_invalid_arg(self):
Predict the next line for this snippet: <|code_start|># 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 required by a...
def test_invalid_arg(self):
Given snippet: <|code_start|># # 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 required by applicable law or agreed to in writing, soft...
def __init__(self):
Here is a snippet: <|code_start|># 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 required by applicable law or agre...
self.keyname = val
Continue the code snippet: <|code_start|># 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 required by applicable law...
self.name = repositories
Given the code snippet: <|code_start|># 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 language governing per...
% self.keyname, field=key))
Given the code snippet: <|code_start|># License for the specific language governing permissions and limitations # under the License. SECTIONS = (DESCRIPTION, URL, CREDENTIAL) = \ ('description', 'url', 'credential') class Repository(object): def __init__(self, repositories, values): sel...
reposit_url = reposit_def.get(URL)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import absolute_import PICKLE_FILENAME = "trontagger-0.1.0.pickle" class MissingCorpusException(Exception): <|code_end|> , generate the next line using the imports in this file: import os import random import pickle import logging from co...
pass
Given the following code snippet before the placeholder: <|code_start|> class QuestionForm(Form): name = StringField('Name', [Required()], description="The name you want to give this question.", ) prompt = TextAreaField('Prompt', [Optional()], description="The prompt for this question (optional).") def sav...
self.populate_obj(e)
Using the snippet: <|code_start|> actual_score = FloatField('Score (optional)', [Optional()], description="The score the essay got, if it has a score.") info = TextAreaField("Additional Info (optional)", [Optional()], description="Any additional info you want to store with this essay.") def save(self, ques...
score = None