Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given the code snippet: <|code_start|> my_env = os.environ.copy() my_env["OCF_ROOT"] = config.path.ocf_root for k, v in params.items(): my_env["OCF_RESKEY_" + k] = v cmd = [os.path.join(config.path.ocf_root, "resource.d", agent.ra_provider, agent.ra_type), "validate-all"] if options.regressio...
op stop timeout=100 \
Predict the next line after this snippet: <|code_start|> if msg.startswith("ERROR: "): logger.error(msg[7:]) elif msg.startswith("WARNING: "): logger.warning(msg[9:]) elif msg.startswith("INFO: "): logger.info(msg[6:]) elif m...
primitive {id} ocf:heartbeat:LVM-activate \
Continue the code snippet: <|code_start|> print(".EXT", " ".join(cmd)) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=my_env) _out, _ = p.communicate() out = to_ascii(_out) p.wait() if log is True: for msg in out.splitlines(): if msg.start...
op start timeout=60 \
Given the code snippet: <|code_start|> 'release': release, 'version': version, 'machine': machine, 'processor': processor, 'distname': distname, 'user': get_user(), 'hostname': hostname, 'uptime': uptime[0], 'idle...
'/etc/csync2/key_hagroup',
Using the snippet: <|code_start|># Copyright (C) 2013 Dejan Muhamedagic <dmuhamedagic@suse.de> # See COPYING for license information. logger = log.setup_logger(__name__) # graphviz stuff def _attr_str(attr_d): return ','.join(['%s="%s"' % (k, v) for k, v in attr_d.items()]) <|code_end|> ...
def _quoted(name):
Given snippet: <|code_start|> #print out out = self._parse('location loc-1 thing rule role=slave -inf: #uname eq madrid') self.assertEqual(out.get('id'), 'loc-1') self.assertEqual(out.get('rsc'), 'thing') self.assertEqual(out.get('score'), None) out = self._parse('locati...
out = self._parse('colocation col-1 10: ( bar wiz')
Using the snippet: <|code_start|> #self.assertTrue(['sequential', 'false'] in out.resources[0][1]) self.assertEqual(out.get('id'), 'o1') out = self._parse('order o1 Mandatory: A B C sequential=true') self.assertEqual(1, len(out.xpath('/rsc_order/resource_set'))) #self.assertTrue(...
out = self._parse(inp)
Based on the snippet: <|code_start|> @mock.patch('logging.Logger.error') def test_acl(self, mock_error): out = self._parse('role user-1 error') self.assertFalse(out) out = self._parse('user user-1 role:user-1') self.assertNotEqual(out, False) out = self._parse("role bigd...
self.assertEqual(['a', 'b', 'c'], out.xpath('./role/@id'))
Here is a snippet: <|code_start|> "ptest": "ptest", "simulate": "crm_simulate", } meta_progs = ("crmd", "pengine", "stonithd", "cib") meta_progs_20 = ("pacemaker-controld", "pacemaker-schedulerd", "pacemaker-fenced", "pacemaker-based") # elide these properties from tab completion crmd_metadata_do_not_complete ...
Default:1
Given the code snippet: <|code_start|> followed by some {{foo}}.{{wiz}} and then some at the end""" assert """Here's a line of text followed by another line followed by some a.b and then some at the end""" == handles.parse(t, {'foo': "a", 'wiz': "b"}) def test_weird_chars(): t = "{{foo#_bar...
def test_result():
Here is a snippet: <|code_start|># Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de> # Copyright (C) 2013-2016 Kristoffer Gronlund <kgronlund@suse.com> # See COPYING for license information. logger = log.setup_logger(__name__) logger_utils = log.LoggerUtils(logger) _NVPAIR_RE = re.compile(r'([^=@$][...
_RESOURCE_RE = re.compile(r'([a-z_#$][^=]*)$', re.IGNORECASE)
Here is a snippet: <|code_start|># Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de> # Copyright (C) 2013-2016 Kristoffer Gronlund <kgronlund@suse.com> # See COPYING for license information. logger = log.setup_logger(__name__) logger_utils = log.LoggerUtils(logger) _NVPAIR_RE = re.compile(r'([^=@$][...
_ALERT_PATH_RE = re.compile(r'(.*)$')
Here is a snippet: <|code_start|># Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de> # Copyright (C) 2013-2016 Kristoffer Gronlund <kgronlund@suse.com> # See COPYING for license information. logger = log.setup_logger(__name__) logger_utils = log.LoggerUtils(logger) _NVPAIR_RE = re.compile(r'([^=@$][...
_RESOURCE_RE = re.compile(r'([a-z_#$][^=]*)$', re.IGNORECASE)
Next line prediction: <|code_start|> @mock.patch('crmsh.crash_test.utils.crmshutils.get_stdout_stderr') def test_check_node_status(self, mock_run, mock_error): output = """ 1084783297 15sp2-1 member 1084783193 15sp2-2 lost """ mock_run.return_value = (0, output, None) res = utils...
* Online: [ 15sp2-1 15sp2-2 ]
Using the snippet: <|code_start|> err_output = """ ==Dumping header on disk {} ==Header on disk {} NOT dumped sbd failed; please check the logs. """.format(dev, dev) mock_os_path_exists.return_value = True mock_sbd_check_header.return_value = (1, "==Dumping header on disk {}".format(dev), ...
Timeout (loop) : 1
Based on the snippet: <|code_start|> def login_required(view_callable): def check_login(request, *args, **kwargs): if request.user.is_authenticated: return view_callable(request, *args, **kwargs) assert hasattr(request, 'session'), "Session middleware needed." login_kwargs =...
return login(request, **login_kwargs)
Next line prediction: <|code_start|># -*- coding: utf-8 -*- USER_AGENT = ( 'FeedHQ/%s (https://github.com/feedhq/feedhq; %%s; https://github.com/' 'feedhq/feedhq/wiki/fetcher; like FeedFetcher-Google)' ) % __version__ FAVICON_FETCHER = USER_AGENT % 'favicon fetcher' LINK_CHECKER = USER_AGENT % 'ping' <|co...
def is_feed(parsed):
Here is a snippet: <|code_start|> FONT_PT_SANS = 'pt-sans' FONT_UBUNTU_CONDENSED = 'ubuntu-condensed' FONT_SOURCE_SANS_PRO = 'source-sans-pro' FONTS = ( ( _('Serif'), ( (FONT_DROID_SERIF, 'Droid Serif'), (FONT_GENTIUM_BASIC, 'Gentium Basic'), ...
is_staff = models.BooleanField(default=False)
Predict the next line for this snippet: <|code_start|> logger = get_logger(__name__) def sentry_handler(job, *exc_info): extra = { <|code_end|> with the help of current file imports: import os from raven import Client from rq import Connection, Queue, Worker from structlog import get_logger from . import Sent...
'job_id': job.id,
Given the code snippet: <|code_start|> logger = structlog.get_logger(__name__) class Command(SentryCommand): def handle_sentry(self, **options): r = get_redis_connection() prefix = 'rq:job:' keys = ( "".join(chars) for chars in product('0123456789abcdef', repeat=1) ) ...
)
Predict the next line after this snippet: <|code_start|> admin.autodiscover() urlpatterns = [ url(r'^admin/rq/', include('django_rq_dashboard.urls')), url(r'^admin/', admin.site.urls), url(r'^subscriber/', include('django_push.subscriber.urls')), url(r'^health/$', views.health, name='health'), url...
level_overrides=settings.LOG_LEVEL_OVERRIDES,
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- monkey.patch_html5lib() monkey.patch_feedparser() admin.autodiscover() urlpatterns = [ url(r'^admin/rq/', include('django_rq_dashboard.urls')), url(r'^admin/', admin.site.urls), url(r'^subscriber/', include('django_push.subscriber.urls')), ur...
url(r'^', include(('feedhq.feeds.urls', 'feeds'), namespace='feeds')),
Predict the next line after this snippet: <|code_start|> User.query.filter_by(sid=sid).delete() db.session.commit() def user_from_sid(sid): return User.query.filter_by(sid=sid).first() def graph_all_posts(): posts = Post.query.all() d = min(p.posted_date for p in posts) while d < date.today(): ...
print(e.posted_date)
Next line prediction: <|code_start|> def delete_user(sid): Post.query.filter_by(user_sid=sid).delete() User.query.filter_by(sid=sid).delete() db.session.commit() def user_from_sid(sid): return User.query.filter_by(sid=sid).first() def graph_all_posts(): posts = Post.query.all() d = min(p.poste...
upairs = users.items()
Given the following code snippet before the placeholder: <|code_start|> def delete_user(sid): Post.query.filter_by(user_sid=sid).delete() User.query.filter_by(sid=sid).delete() db.session.commit() def user_from_sid(sid): return User.query.filter_by(sid=sid).first() def graph_all_posts(): posts = P...
upairs.sort()
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import unicode_literals class MockParser(object): def __init__(self, main_sheet, sub_sheets): self.main_sheet = Sheet(main_sheet) self.sub_sheets = {k: Sheet(v) for k, v in sub_sheets.items()} def test_spreadsheetoupu...
),
Predict the next line after this snippet: <|code_start|> def child_to_xml(parent_el, tagname, child, toplevel=False, nsmap=None): if hasattr(child, "items"): child_el = dict_to_xml(child, tagname, toplevel=False, nsmap=nsmap) if child_el is not None: parent_el.append(child_el) else:...
def dict_to_xml(data, tagname, toplevel=True, nsmap=None):
Here is a snippet: <|code_start|> USING_LXML = True # Note that lxml is now "required" - it's listed as a requirement in # setup.py and is needed for the tests to pass. # However, stdlib etree still exists as an unsupported feature. except ImportError: USING_LXML = False warn("Using stdlib etree...
if USING_LXML and ":" in attr_name:
Here is a snippet: <|code_start|> # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of...
'footerbgcolor' : '#183828',
Here is a snippet: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data data = generate_data(200) # np.random.randint(2, size=(1...
initial_vmap = { rbm.v: T.matrix('v') }
Predict the next line after this snippet: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data data = generate_data(200) # np.ra...
umap = {}
Using the snippet: <|code_start|> # mean_field_for_stats is a list of units for which 'mean_field' should be used to compute statistics, rather than 'sample'. # complete units lists visible_units = rbm.complete_units_list(visible_units) hidden_units = rbm.complete_units_list(hidden_units) context_un...
v1_in_vmap.update(context_vmap) # add context
Here is a snippet: <|code_start|>emodel_train_so_far = [] edata_so_far = [] emodel_so_far = [] for epoch in range(epochs): monitoring_data_train = [(cost, energy_data, energy_model) for cost, energy_data, energy_model in train({ rbm.v: train_set_x })] mses_train, edata_train_list, emodel_train_list = zip(*moni...
plt.legend()
Continue the code snippet: <|code_start|>precision_variables = [rbm.Wp.var, rbm.bvp.var] umap = {} for var in variables: pu = var + (learning_rate/mb_size) * updaters.CDUpdater(rbm, var, s) # the learning rate is 0.001 if var in precision_variables: pu = updaters.BoundUpdater(pu, bound=0, type='upper')...
plt.imshow(d.reshape((28,28)), interpolation='gaussian')
Here is a snippet: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # load data print ">> Loading dataset..." f = gzip.open('datasets/mnist....
n_visible = train_set_x.shape[1]
Predict the next line for this snippet: <|code_start|>edata_train_so_far = [] emodel_train_so_far = [] edata_so_far = [] emodel_so_far = [] for epoch in range(epochs): monitoring_data_train = [(cost, energy_data, energy_model) for cost, energy_data, energy_model in train({ rbm.v: train_set_x })] mses_train, ed...
plt.title("MSE")
Predict the next line for this snippet: <|code_start|>print ">> Training for %d epochs..." % epochs mses_train_so_far = [] mses_valid_so_far = [] edata_train_so_far = [] emodel_train_so_far = [] edata_so_far = [] emodel_so_far = [] for epoch in range(epochs): monitoring_data_train = [(cost, energy_data, energy_mo...
plt.figure(1)
Given the following code snippet before the placeholder: <|code_start|> def sample_evolution(start, ns=100): # start = start data sample = t.compile_function(initial_vmap, mb_size=1, monitors=[m_model], name='evaluate', train=False, mode=mode) data = start plot_data(data) while True: ...
edata_train_so_far = []
Given the following code snippet before the placeholder: <|code_start|> sample = t.compile_function(initial_vmap, mb_size=1, monitors=[m_model], name='evaluate', train=False, mode=mode) data = start plot_data(data) while True: for k in range(ns): for x in sample({ rbm.v: da...
edata_so_far = []
Here is a snippet: <|code_start|> plt.figure(1) plt.clf() plt.plot(mses_train_so_far, label='train') plt.plot(mses_valid_so_far, label='validation') plt.title("MSE") plt.legend() plt.draw() plt.figure(4) plt.clf() plt.plot(edata_so_far, label='validation / data') plt.plot...
print "training set: MSE = %.6f, data energy = %.2f, model energy = %.2f" % (mse_train, edata_train, emodel_train)
Predict the next line after this snippet: <|code_start|> sample = t.compile_function(initial_vmap, mb_size=1, monitors=[m_model], name='evaluate', train=False, mode=mode) data = start plot_data(data) while True: for k in range(ns): for x in sample({ rbm.v: data }): # draw a...
edata_so_far = []
Predict the next line for this snippet: <|code_start|> # TRAINING print ">> Training for %d epochs..." % epochs mses_train_so_far = [] mses_valid_so_far = [] edata_train_so_far = [] emodel_train_so_far = [] edata_so_far = [] emodel_so_far = [] for epoch in range(epochs): monitoring_data_train = [(cost, ...
edata_valid = np.mean(edata)
Using the snippet: <|code_start|> # tensordot = T.tensordot # use theano implementation class FixedBiasParameters(Parameters): # Bias fixed at -1, which is useful for some energy functions (like Gaussian with fixed variance, Beta) def __init__(self, rbm, units, name=None): super(FixedBiasParameters, s...
self.terms[self.hu] = lambda vmap: T.dot(vmap[self.vu], W)
Continue the code snippet: <|code_start|># train = t.compile_function(initial_vmap, mb_size=32, monitors=[m], name='train', mode=mode) train = t.compile_function(initial_vmap, mb_size=100, monitors=[m, m_model], name='train', mode=mode) evaluate = t.compile_function(initial_vmap, mb_size=100, monitors=[m, m_model], nam...
epochs = 200
Given the code snippet: <|code_start|> sample = t.compile_function(initial_vmap, mb_size=1, monitors=[m_model], name='evaluate', train=False, mode=mode) data = start plot_data(data) while True: for k in range(ns): for x in sample({ rbm.v: data }): # draw a new sample ...
for epoch in range(epochs):
Using the snippet: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # load data print ">> Loading dataset..." f = gzip.open('datasets/mnist...
train_set_x, train_set_y = train_set
Predict the next line for this snippet: <|code_start|> def sample_evolution(start, ns=100): # start = start data sample = t.compile_function(initial_vmap, mb_size=1, monitors=[m_model], name='evaluate', train=False, mode=mode) data = start plot_data(data) while True: for k in range...
mses_train_so_far = []
Here is a snippet: <|code_start|> def sample_evolution(start, ns=100): # start = start data sample = t.compile_function(initial_vmap, mb_size=1, monitors=[m_model], name='evaluate', train=False, mode=mode) data = start plot_data(data) while True: for k in range(ns): for x ...
mact_valid_so_far = []
Predict the next line for this snippet: <|code_start|> # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # load data print ">> Loading dataset..." f = gzip.open('dataset...
learning_rate = 0.1
Next line prediction: <|code_start|>valid_set_x, valid_set_y = valid_set test_set_x, test_set_y = test_set # TODO DEBUG # train_set_x = train_set_x[:10000] valid_set_x = valid_set_x[:1000] n_visible = train_set_x.shape[1] n_hidden = 500 mb_size = 20 k = 15 learning_rate = 0.1 epochs = 15 print ">> Constructing RB...
umap[var] = pu
Based on the snippet: <|code_start|>edata_so_far = [] emodel_so_far = [] for epoch in range(epochs): monitoring_data_train = [(cost, energy_data, energy_model) for cost, energy_data, energy_model in train({ rbm.v: train_set_x })] mses_train, edata_train_list, emodel_train_list = zip(*monitoring_data_train) ...
plt.draw()
Given the code snippet: <|code_start|>m_model = s['model'][rbm.v] e_data = rbm.energy(s['data']).mean() e_model = rbm.energy(s['model']).mean() # train = t.compile_function(initial_vmap, mb_size=32, monitors=[m], name='train', mode=mode) train = t.compile_function(initial_vmap, mb_size=mb_size, monitors=[m, e_data, e_...
data = x[0]
Predict the next line for this snippet: <|code_start|> edata_train = np.mean(edata_train_list) emodel_train = np.mean(emodel_train_list) monitoring_data = [(cost, data, model, energy_data, energy_model) for cost, data, model, energy_data, energy_model in evaluate({ rbm.v: valid_set_x })] mses_valid,...
plt.plot(emodel_train_so_far, label='train / model')
Given the code snippet: <|code_start|> class SelfUpdater(Updater): def get_update(self): return self.variable DecayUpdater = SelfUpdater # weight decay: the update == the parameter values themselves # (decay constant is taken care of by ScaleUpdater) class MomentumUpdater(Updater): <|code...
def __init__(self, pu, momentum, variable_shape):
Given the following code snippet before the placeholder: <|code_start|>mode = None # generate data data = generate_data(200) # use the predefined binary-binary RBM, which has visible units (rbm.v), hidden units (rbm.h), # a weight matrix W connecting them (rbm.W), and visible and hidden biases (rbm.bv and rbm.bh). n_...
for epoch in range(epochs):
Given snippet: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data data = generate_data(200) # use the predefined binary-binary...
n_visible = data.shape[1]
Predict the next line after this snippet: <|code_start|> # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data data = generate_data(200) # use the predefined binary-binary ...
epochs = 50
Given the code snippet: <|code_start|>data = generate_data(200) # use the predefined binary-binary RBM, which has visible units (rbm.v), hidden units (rbm.h), # a weight matrix W connecting them (rbm.W), and visible and hidden biases (rbm.bv and rbm.bh). n_visible = data.shape[1] n_hidden = 100 rbm = rbms.BinaryBinary...
print "MSE = %.4f" % np.mean(costs)
Based on the snippet: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data data = generate_data(200) # use the predefined binary...
for var in rbm.variables:
Here is a snippet: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data data = generate_data(200) # use the predefined binary-bi...
initial_vmap = { rbm.v: T.matrix('v') }
Predict the next line for this snippet: <|code_start|># mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data data = generate_data(200) # use the predefined binary-binary RBM...
epochs = 50
Next line prediction: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data print ">> Generating dataset..." data = generate_data(...
n_context = data_context.shape[1]
Given the following code snippet before the placeholder: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data print ">> Generatin...
data_train = data[:-1000, :]
Given snippet: <|code_start|># mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data print ">> Generating dataset..." data = generate_data(1000) # np.random.randint(2, size=(10000, n_visible)) data_context = get_context(data) data_train = data[:-1000, :] dat...
umap[var] = pu
Predict the next line after this snippet: <|code_start|> plt.ion() # DEBUGGING # mode = theano.ProfileMode(optimizer='fast_run', linker=theano.gof.OpWiseCLinker()) # mode = theano.compile.DebugMode(check_py_code=False, require_matching_strides=False) mode = None # generate data print ">> Generating dataset..." d...
data_train = data[:-1000, :]
Based on the snippet: <|code_start|> loop = get_loop() @asyncio.coroutine def run(cmd, **kwargs): transport, protocol = yield from async_execute_process( create_protocol(), cmd, **kwargs) <|code_end|> , predict the immediate next line with the help of imports: from osrf_pycommon.process_utils import asy...
retcode = yield from protocol.complete
Given snippet: <|code_start|># 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 distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either exp...
stderr_master, stderr_slave = pty.openpty()
Based on the snippet: <|code_start|># Copyright 2014 Open Source Robotics Foundation, Inc. # # 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 #...
stderr_master, stderr_slave = None, None
Using the snippet: <|code_start|> class BatchJob: def __init__(self, *, python_interpreter=None): self.run = run self.run_history = [] self.python = sys.executable if python_interpreter is None else python_interpreter self.python_history = [] def pre(self): raise NotI...
raise RuntimeError("Called pop_run with an empty run history.")
Predict the next line for this snippet: <|code_start|># Copyright 2014 Open Source Robotics Foundation, Inc. # # 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/lice...
def execute_process(cmd, cwd=None, env=None, shell=False, emulate_tty=False):
Predict the next line for this snippet: <|code_start|> def _pack_attrs(foreground, background, style): return foreground + (background * 16) + style def _win_reset(handle, attrs): SetConsoleTextAttribute(handle, attrs) return attrs def _win_style(style, handle, attrs): attrs_list = _unpack_attrs(at...
attrs = _pack_attrs(*attrs_list)
Given the code snippet: <|code_start|>#!/usr/bin/env python3 # Copyright 2015 Open Source Robotics Foundation, Inc. # # 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.o...
"ros2_batch_job was imported from somewhere other than the local directory of this script"
Predict the next line for this snippet: <|code_start|> ): loop = get_loop() # Create the PTY's stdout_master, stdout_slave = pty.openpty() if stderr_to_stdout: stderr_master, stderr_slave = stdout_master, stdout_slave else: stderr_master, stderr_slave =...
def connection_made(self, transport):
Continue the code snippet: <|code_start|> # create an archive folder_name = 'ros2-' + args.os if args.os == 'linux' or args.os == 'osx': if args.os == 'osx': machine = platform.machine() else: machine = sys.implementation._multiarch.split('-', 1)[0] archive_pat...
else:
Given the code snippet: <|code_start|>#!/usr/bin/python3 # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your option) any # later version. See ht...
@unittest.skipUnless(have_nmcli, 'nmcli not installed')
Based on the snippet: <|code_start|>#!/usr/bin/python3 # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your option) any # later version. See http...
@unittest.skipUnless(have_nmcli, 'nmcli not installed')
Given snippet: <|code_start|>#!/usr/bin/python3 # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your option) any # later version. See http://www....
@unittest.skipUnless(have_nmcli, 'nmcli not installed')
Here is a snippet: <|code_start|>############################################################################### # # apogee.tools.download: download APOGEE data files # ############################################################################### _DR10_URL= 'http://data.sdss3.org/sas/dr10' _DR12_URL= 'http://data.s...
def allStar(dr=None,lite=False,mjd=58104):
Using the snippet: <|code_start|>############################################################################### # apogee.spec.lsf: Utilities to work with APOGEE LSFs ############################################################################### try: fitsread = fitsio.read except ImportError: <|code_end|> , determ...
fitsread= pyfits.getdata
Given snippet: <|code_start|>############################################################################### # apogee.spec.lsf: Utilities to work with APOGEE LSFs ############################################################################### try: fitsread = fitsio.read except ImportError: fitsread= pyfits.getd...
lsf=None,xlsf=None,dxlsf=None,fiber='combo',
Using the snippet: <|code_start|># coding: utf-8 from __future__ import division, print_function, unicode_literals, \ absolute_import class GeneratorTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.data = np.random.rand(100, 3) * 10 - 5 cls.df = pd.DataFrame(cls.data, co...
np.testing.assert_array_equal(np.sum(self.data, axis=1),
Predict the next line after this snippet: <|code_start|> results = self.generator.describe(self.df) np.testing.assert_array_equal(np.sin(self.data), results[["sin x", "sin y", "sin z"]]) np.testing.assert_array_equal(np.sum(self.data, axis=1), ...
self.assertAlmostEqual(df.iloc[0]["exp 8c-Z"], np.exp(3))
Using the snippet: <|code_start|># coding: utf-8 from __future__ import division, print_function, unicode_literals, \ absolute_import class GeneratorTest(unittest.TestCase): <|code_end|> , determine the next line of code. You have imports: import unittest import os import json import numpy as np import pand...
@classmethod
Continue the code snippet: <|code_start|> file_path = os.path.dirname(__file__) def test_func(): return 1 class TestMetrics(unittest.TestCase): @classmethod def setUpClass(cls): cls.x1 = np.array([1, 2, 3]) cls.x2 = np.array([4, 5, 6]) cls.x3 = np.array([1, 1, 1]) cls.x4 ...
def test_mse(self):
Here is a snippet: <|code_start|> file_path = os.path.dirname(__file__) def test_func(): return 1 class TestMetrics(unittest.TestCase): @classmethod def setUpClass(cls): cls.x1 = np.array([1, 2, 3]) <|code_end|> . Write the next line using the current file imports: import unittest import numpy ...
cls.x2 = np.array([4, 5, 6])
Given the following code snippet before the placeholder: <|code_start|> file_path = os.path.dirname(__file__) def test_func(): return 1 class TestMetrics(unittest.TestCase): @classmethod def setUpClass(cls): cls.x1 = np.array([1, 2, 3]) cls.x2 = np.array([4, 5, 6]) cls.x3 = np.ar...
def test_mse(self):
Given snippet: <|code_start|> def test_func(): return 1 class DummyClass: def __init__(self): self.name = 'dummy' def get_config(self): return {"config": "Dummyclass config"} class TestGeneralUtil(unittest.TestCase): @classmethod def setUpClass(cls): cls.x1 = np.array([1,...
"config": {}}, module_objects=globals()), DummyClass)
Predict the next line for this snippet: <|code_start|> # now the kernels are defined as functions # For future development the kernel should be class # with tunable parameters, this is particular useful for Bayesian methods def rbf(x1, x2, sigma): d_squared = np.sum((x1[:, None, :] - x2[None, :, :]) ** 2, axis=2) ...
'metric function identifier:', identifier)
Predict the next line for this snippet: <|code_start|> for d in self.test_pool: self.test_structures.append(d['structure']) self.test_energies.append(d['outputs']['energy']) self.test_forces.append(d['outputs']['forces']) self.test_stresses.append(d['outputs']['vir...
for stress1, stress2 in zip(test_stresses, np.array(self.test_stresses).ravel()):
Next line prediction: <|code_start|># coding: utf-8 # Copyright (c) Materials Virtual Lab # Distributed under the terms of the BSD License. from __future__ import division, print_function, unicode_literals, \ absolute_import CWD = os.getcwd() test_datapool = loadfn(os.path.join(os.path.dirname(__file__), 'datap...
self.test_stresses = []
Here is a snippet: <|code_start|> :return: list, a list of species string """ return [i.specie.name for i in self.structure if i.specie.name in self.species_map.values()] def copy(self): """ Copy a new StateStructure :return: StateStructure """ return ...
def append(self, state_dict):
Here is a snippet: <|code_start|> def to_specie_list(self): """ Convert the spin list to species list using the species_map :return: list, a list of species string """ return [i.specie.name for i in self.structure if i.specie.name in self.species_map.values()] def copy(se...
self.length = 0
Here is a snippet: <|code_start|> file_path = os.path.dirname(__file__) def test_func(): return 1 class TestKernel(unittest.TestCase): @classmethod <|code_end|> . Write the next line using the current file imports: import unittest import numpy as np import os from veidt.kernel import rbf, get_kernel and c...
def setUpClass(cls):
Given the following code snippet before the placeholder: <|code_start|> file_path = os.path.dirname(__file__) def test_func(): return 1 class TestKernel(unittest.TestCase): @classmethod def setUpClass(cls): cls.x1 = np.array([[1, 2], [1, 2]]) cls.x2 = np.array([[2, 3], [2, 3]]) c...
self.assertAlmostEqual(np.sum(test_dict).item(),
Here is a snippet: <|code_start|> class TestMultiSpeciesNN(unittest.TestCase): def test_create_atomic_nn(self): keras_input = Input(shape=(None, 3)) keras_output = create_atomic_nn(keras_input, [3, 10, 1]) model = Model(inputs=keras_input, outputs=keras_output) model.compile(loss='m...
model.fit(x, y, epochs=100, verbose=False)
Continue the code snippet: <|code_start|> class TestMultiSpeciesNN(unittest.TestCase): def test_create_atomic_nn(self): keras_input = Input(shape=(None, 3)) keras_output = create_atomic_nn(keras_input, [3, 10, 1]) model = Model(inputs=keras_input, outputs=keras_output) model.compile...
model.fit(features, outputs, epochs=100, verbose=0)
Next line prediction: <|code_start|> def binary_accuracy(y_true, y_pred): return np.mean(np.array(y_true).ravel() == np.array(y_pred).ravel()) mse = MSE = mean_squared_error mae = MAE = mean_absolute_error def serialize(metric): return serialize_veidt_object(metric) def deserialize(config): return d...
return identifier
Using the snippet: <|code_start|> self.model.fit(x, y) return self def predict(self, x): return self.model.predict(x) class TestDescrber(unittest.TestCase): @classmethod def setUpClass(cls): cls.dd = DummyDescriber() def test_fit(self): dd2 = self.dd.fit([1, 2...
def setUpClass(cls):
Next line prediction: <|code_start|> def predict(self, x): return self.model.predict(x) class TestDescrber(unittest.TestCase): @classmethod def setUpClass(cls): cls.dd = DummyDescriber() def test_fit(self): dd2 = self.dd.fit([1, 2, 3]) self.assertEqual(dd2, self.dd) ...
def test_fit(self):
Given snippet: <|code_start|># Generated by Django 2.2.8 on 2019-12-23 18:00 def synopsis(pr, make_searchable=False): self = pr def verbosify(val, units=None, pre=None, pre_whitespace=True, post=None, post_whitespace=True): elaborated = "" if val is not None and val != '': <|code_end|> , con...
try: