Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Based on the snippet: <|code_start|>from __future__ import print_function def test_sampling_and_containment(test_object, d, contained, not_contained): for _ in range(5): test_object.assertTrue(d.contains(d.sample())) for contained_spec in contained: try: contained = d.contains(contained_spec) e...
d = distribs.Continuous('x', minval, maxval)
Predict the next line for this snippet: <|code_start|># limitations under the License. # ============================================================================ # python2 python3 """Exploration task used in COBRA. There is no reward for this task, as it is used for task-free curiosity-drive exploration. Episodes...
factors = distribs.Product([
Given the following code snippet before the placeholder: <|code_start|>""" from __future__ import absolute_import from __future__ import division from __future__ import print_function def get_config(mode=None): """Generate environment config. Args: mode: Unused. Returns: config: Dictionary defining ...
sprite_gen = sprite_generators.generate_sprites(
Given the following code snippet before the placeholder: <|code_start|>from __future__ import absolute_import from __future__ import division from __future__ import print_function def get_config(mode=None): """Generate environment config. Args: mode: Unused. Returns: config: Dictionary defining task/...
task = tasks.NoReward()
Given the code snippet: <|code_start|> def get_config(mode=None): """Generate environment config. Args: mode: Unused. Returns: config: Dictionary defining task/environment configuration. Can be fed as kwargs to environment.Environment. """ del mode # No train/test split for pure exploration ...
'action_space': common.action_space(),
Continue the code snippet: <|code_start|> """Construct sprite. This class is agnostic to the color scheme, namely (c1, c2, c3) could be in RGB coordinates or HSV, HSL, etc. without this class knowing. The color scheme conversion for rendering must be done in the renderer. Args: x: Float in [0...
path = mpl_path.Path(constants.SHAPES[self._shape])
Based on the snippet: <|code_start|> """ if not set(factors).issubset(set(sprite_lib.FACTOR_NAMES)): raise ValueError('Factors have to belong to {}.'.format( sprite_lib.FACTOR_NAMES)) self._num_sprites = None self._factors = factors self._per_object_spec = { factor: specs.Arr...
value = constants.ShapeType[value].value
Given the code snippet: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Un...
def __init__(self, factors=sprite_lib.FACTOR_NAMES):
Based on the snippet: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unle...
class SpriteFactors(abstract_renderer.AbstractRenderer):
Based on the snippet: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unle...
class PILRenderer(abstract_renderer.AbstractRenderer):
Here is a snippet: <|code_start|># https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for t...
distribs.SetMinus(
Predict the next line after this snippet: <|code_start|> """Generate environment config. Args: mode: 'train' or 'test'. Returns: config: Dictionary defining task/environment configuration. Can be fed as kwargs to environment.Environment. """ shared_factors = distribs.Product([ distribs.D...
target_sprite_gen = sprite_generators.generate_sprites(
Using the snippet: <|code_start|> shared_factors = distribs.Product([ distribs.Discrete('shape', ['square', 'triangle', 'circle']), distribs.Discrete('scale', [0.13]), distribs.Continuous('c1', 0.3, 1.), distribs.Continuous('c2', 0.9, 1.), ]) target_hue = distribs.Continuous('c0', 0., 0.4)...
task = tasks.FindGoalPosition(
Using the snippet: <|code_start|> distribs.Continuous('c2', 0.9, 1.), ]) target_hue = distribs.Continuous('c0', 0., 0.4) distractor_hue = distribs.Continuous('c0', 0.5, 0.9) target_factors = distribs.Product([ MODES_TARGET_POSITIONS[mode], target_hue, shared_factors, ]) distractor_fac...
'action_space': common.action_space(),
Predict the next line after this snippet: <|code_start|># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ # pytho...
'distrib': distribs.Continuous('c0', 0.9, 1.), # red
Continue the code snippet: <|code_start|>def get_config(mode='train'): """Generate environment config. Args: mode: 'train' or 'test'. Returns: config: Dictionary defining task/environment configuration. Can be fed as kwargs to environment.Environment. """ # Create the subtasks and their corre...
sprite_generators.generate_sprites(factors, num_sprites=1))
Here is a snippet: <|code_start|> { 'distrib': distribs.Continuous('c0', 0.27, 0.37), # green 'goal_position': np.array([0.25, 0.75]) }, { 'distrib': distribs.Continuous('c0', 0.73, 0.83), # purple 'goal_position': np.array([0.25, 0.25]) }, { 'distrib': distr...
subtasks.append(tasks.FindGoalPosition(
Continue the code snippet: <|code_start|> distribs.Continuous('c2', 0.9, 1.), )) sprite_gen_per_subtask.append( sprite_generators.generate_sprites(factors, num_sprites=1)) # Consider all combinations of subtasks subtask_combos = list( itertools.combinations(np.arange(len(SUBTASKS))...
'action_space': common.action_space(),
Next line prediction: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unle...
_distrib_0 = distribs.Product([
Continue the code snippet: <|code_start|>from __future__ import print_function _distrib_0 = distribs.Product([ distribs.Discrete('x', [0.5]), distribs.Discrete('y', [0.5]), distribs.Discrete('shape', ['square', 'triangle']), distribs.Discrete('c0', [255]), distribs.Discrete('c1', [255]), distr...
self.assertIsInstance(sprite_list[0], sprite.Sprite)
Continue the code snippet: <|code_start|>"""Tests for sprite_generators.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function _distrib_0 = distribs.Product([ distribs.Discrete('x', [0.5]), distribs.Discrete('y', [0.5]), distribs.Discrete('shape',...
g = sprite_generators.generate_sprites(_distrib_0, num_sprites=num_sprites)
Based on the 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 permissions and #...
sprites = [sprite.Sprite(**factor_dist.sample()) for _ in range(n)]
Given the following code snippet before the placeholder: <|code_start|> @parameterized.parameters((1, ('x', 'y', 'scale', 'c0', 'c1', 'c2', 'shape', 'angle', 'x_vel', 'y_vel')), (1, ('x', 'y', 'scale', 'c0', 'c1', 'c2', 'shape')), ...
self.assertEqual(outputs['shape'], const.ShapeType[shape].value)
Continue the code snippet: <|code_start|># You may obtain a copy of the License at # # https://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...
sprite = sprite_lib.Sprite(
Using the snippet: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
handcrafted.SpriteFactors(factors=('x', 'y', 'scale'))
Continue the code snippet: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # #...
sprite.Sprite(
Given the code snippet: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Un...
'train': distribs.Discrete('shape', ['square']),
Based on the snippet: <|code_start|> TERMINATE_DISTANCE = 0.075 NUM_TARGETS = 1 MODES_SHAPES = { 'train': distribs.Discrete('shape', ['square']), 'test': distribs.Discrete('shape', ['triangle', 'circle']), } def get_config(mode='train'): """Generate environment config. Args: mode: 'train' or 'test'....
sprite_gen = sprite_generators.generate_sprites(
Given the code snippet: <|code_start|> 'train': distribs.Discrete('shape', ['square']), 'test': distribs.Discrete('shape', ['triangle', 'circle']), } def get_config(mode='train'): """Generate environment config. Args: mode: 'train' or 'test'. Returns: config: Dictionary defining task/environmen...
task = tasks.FindGoalPosition(terminate_distance=TERMINATE_DISTANCE)
Given the code snippet: <|code_start|> def get_config(mode='train'): """Generate environment config. Args: mode: 'train' or 'test'. Returns: config: Dictionary defining task/environment configuration. Can be fed as kwargs to environment.Environment. """ factors = distribs.Product([ MODE...
'action_space': common.action_space(),
Given the code snippet: <|code_start|># https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License ...
'red': distribs.Continuous('c0', 0.9, 1.),
Predict the next line for this snippet: <|code_start|> Args: mode: 'train' or 'test'. Returns: config: Dictionary defining task/environment configuration. Can be fed as kwargs to environment.Environment. """ # Select clusters to use, and their c0 factor distribution. c0_clusters = [CLUSTERS_DI...
sprite_generators.generate_sprites(
Based on the snippet: <|code_start|> c0_clusters = [CLUSTERS_DISTS[cluster] for cluster in MODES[mode]] print('Clustering task: {}, #sprites: {}'.format(MODES[mode], NUM_SPRITES_PER_CLUSTER)) other_factors = distribs.Product([ distribs.Continuous('x', 0.1, ...
task = tasks.Clustering(c0_clusters, terminate_bonus=0., reward_range=10.)
Predict the next line for this snippet: <|code_start|> other_factors = distribs.Product([ distribs.Continuous('x', 0.1, 0.9), distribs.Continuous('y', 0.1, 0.9), distribs.Discrete('shape', ['square', 'triangle', 'circle']), distribs.Discrete('scale', [0.13]), distribs.Continuous('c1', 0.3...
'action_space': common.action_space(),
Predict the next line after 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
action_space = action_spaces.SelectMove(scale=scale)
Predict the next line for this snippet: <|code_start|> class SelectMoveTest(parameterized.TestCase): @parameterized.named_parameters( ('Motion', 1, np.array([0.5, 0.5, 0.2, 0.75]), (-0.3, 0.25)), ('SameMotion', 1, np.array([0.2, 0.5, 0.2, 0.75]), (-0.3, 0.25)), ('SmallerScale', 0.5, np.array([0.2...
sprites = [sprite.Sprite(x=0.55, y=0.5), sprite.Sprite(x=0.5, y=0.5)]
Predict the next line after this snippet: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/...
'triangle': shapes.polygon(num_sides=3, theta_0=np.pi/2),
Here is a snippet: <|code_start|># Copyright 2019 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
sprite.Sprite(
Next line prediction: <|code_start|># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ # python2 python3 """Tests ...
renderer = pil_renderer.PILRenderer(image_size=(64, 64))
Predict the next line for this snippet: <|code_start|> def _repr_info(self): info = super()._repr_info() info.append('ID=%s' % self.message_id) return info async def _wait(task_future): await task_future.backend.channels.connect() result = await task_future return result clas...
return serializers[serializer].encode(message)
Predict the next line after this snippet: <|code_start|> class TaskPaths(TaskSetting): name = "task_paths" validator = validate_list default = [] desc = """\ List of python dotted paths where tasks are located. This parameter can only be specified during initialization or in a :...
choices = tuple(serializers)
Given the following code snippet before the placeholder: <|code_start|> self.manager.store_message(message), self.channels.publish(message.type, event, message) ] if message.id: coro.append( self.channels.publish(message.type, message.id, message) ...
if model == concurrency.THREAD_IO:
Given snippet: <|code_start|> register_broker('redis', 'pq.backends.redis:MQ') class ConsumerMessage(MessageDict): type = 'consumer' class Producer(EventHandler): """Produce tasks by queuing them Abstract base class for both task schedulers and task consumers """ app = None ONE_TIME_EVEN...
self.manager = (self.cfg.callable or Manager)(self)
Given snippet: <|code_start|> __all__ = ['TaskError', 'TaskNotAvailable', 'TaskTimeout', 'Task'] class TaskError(PulsarException): status = states.FAILURE class TaskNotAvailable(TaskError): MESSAGE = 'Task {0} is not registered' def __init__(self, task_name): ...
class Task(Message):
Next line prediction: <|code_start|>"""Tests connection errors""" class Tester: def __init__(self): self.end = Future() def __call__(self, *args, **kwargs): if not self.end.done(): self.end.set_result((args, kwargs)) class TestConnectionDrop(unittest.TestCase): app = None...
self.app = api.QueueApp(
Here is a snippet: <|code_start|> # - queue the task at the right time # - otherwise proceed to next # - Set status to STARTED and consume the task logger = self.logger task_id = task.id time_ended = time.time() job = None JobClass = self.registry.get(t...
raise TaskTimeout
Based on the snippet: <|code_start|> if worker: self._concurrent_tasks.pop(task_id, None) await self.backend.publish('done', task) if job: if worker: await self.broker.decr(job.name) if self._should_retry(job): await self._requ...
lambda: StreamProtocol(job),
Predict the next line for this snippet: <|code_start|> await self.backend.publish('done', task) if job: if worker: await self.broker.decr(job.name) if self._should_retry(job): await self._requeue_task(job) return task def _consume(se...
PROCESS_FILE,
Predict the next line for this snippet: <|code_start|> if job.max_concurrency and concurrent > job.max_concurrency: raise TooManyTasksForJob('max concurrency %d reached', job.max_concurrency) kwargs = task.kwargs or {} ...
task.result = string_exception(exc)
Next line prediction: <|code_start|> logger.error(task.lazy_info()) except Exception as exc: exc_info = sys.exc_info() task.result = string_exception(exc) task.status = states.FAILURE task.stacktrace = traceback.format_tb(exc_info[2]) task.e...
if model == concurrency.THREAD_IO:
Based on the snippet: <|code_start|> class ShellError(RuntimeError): @property def returncode(self): return self.args[1] if len(self.args) > 1 else 1 class RegistryMixin: @lazyproperty def registry(self): '''The :class:`.JobRegistry` for this backend. ''' return Jo...
'concurrency': concurrency_name.get(job.concurrency),
Predict the next line for this snippet: <|code_start|> def cfg(self): """Configuration object from :attr:`backend`""" return self.backend.cfg @property def green_pool(self): return self.backend.green_pool @property def wait(self): return self.backend.green_pool.wait...
return self.concurrency or ASYNC_IO
Given the following code snippet before the placeholder: <|code_start|> concurrent_tasks = None tq_app = None rpc = None schedule_periodic = False message_serializer = 'json' @classmethod def name(cls): return cls.__name__.lower() @classmethod def rpc_name(cls): retu...
pq = api.PulsarQueue(**params)
Using the snippet: <|code_start|>"""Tests the api""" class TestTasks(unittest.TestCase): def app(self, task_paths=None, **kwargs): task_paths = task_paths or ['tests.example.sampletasks.*'] <|code_end|> , determine the next line of code. You have imports: import unittest from datetime import datetime ...
app = api.QueueApp(task_paths=task_paths, **kwargs)
Continue the code snippet: <|code_start|>"""Tests the api""" class TestTasks(unittest.TestCase): def app(self, task_paths=None, **kwargs): task_paths = task_paths or ['tests.example.sampletasks.*'] app = api.QueueApp(task_paths=task_paths, **kwargs) app.backend.tasks.queue = mock.MagicM...
st = format_time(dt)
Continue the code snippet: <|code_start|> def test_close(self): t = api.QueueApp().api() self.assertEqual(t.closing(), False) t.close() self.assertEqual(t.closing(), True) self.assertEqual(t.tasks.closing(), True) warn = mock.MagicMock() t.tasks.logger.warning ...
self.assertEqual(poll_time(1, 4, 0), 1)
Based on the snippet: <|code_start|>"""Tests the api""" class TestTasks(unittest.TestCase): def app(self, task_paths=None, **kwargs): task_paths = task_paths or ['tests.example.sampletasks.*'] app = api.QueueApp(task_paths=task_paths, **kwargs) app.backend.tasks.queue = mock.MagicMock()...
job_cls = api.job('bla foo', v0=6)(simple_task)
Using the snippet: <|code_start|>"""Tests task execution with MsgPack serialiser""" try: except ImportError: msgpack = None @unittest.skipUnless(msgpack, "Requires msgpack library") <|code_end|> , determine the next line of code. You have imports: import unittest import msgpack from tests import app and ...
class TestMsgPackQueue(app.TaskQueueApp, unittest.TestCase):
Predict the next line for this snippet: <|code_start|> .. attribute:: total_run_count Total number of times this periodic task has been executed by the :class:`.TaskBackend`. ''' def __init__(self, name, run_every, anchor=None): self.name = name self.run_every = run_every ...
times = int(timedelta_seconds(last_run_at - anchor) /
Given the following code snippet before the placeholder: <|code_start|> HEARTBEAT = 2 class Consumer(Producer): """The consumer is used by the server side application """ def __repr__(self): return 'consumer <%s>' % self.broker @property def is_consumer(self): return True def...
await self.publish('status', ConsumerMessage(info))
Predict the next line after this snippet: <|code_start|> >>> do("cat -", stdin=b"ELBE") [CMD] cat - >>> do("cat - && false", stdin=b"ELBE") # doctest: +ELLIPSIS Traceback (most recent call last): ... elbepack.shellhelper.CommandError: ... >>> do("false") # doctest: +ELLIPSIS Traceback (...
async_logging(r, w, soap, log)
Given the following code snippet before the placeholder: <|code_start|> sels = [] for l in fp.readlines(): if not l: continue if l[0] == '#': continue sp = l.split() print("%s %s" % (sp[0], sp[1])) if sp[1] == 'install': sels.append...
xml = etree(args[0])
Next line prediction: <|code_start|> pass class ValidationMode: NO_CHECK = 1 CHECK_BINARIES = 2 CHECK_ALL = 0 def replace_localmachine(mirror, initvm=True): if initvm: localmachine = "10.0.2.2" else: localmachine = "localhost" return mirror.replace("LOCALMACHINE", localmach...
self.xml = etree(fname)
Continue the code snippet: <|code_start|> return retval class NoInitvmNode(Exception): pass class ValidationMode: NO_CHECK = 1 CHECK_BINARIES = 2 CHECK_ALL = 0 def replace_localmachine(mirror, initvm=True): if initvm: localmachine = "10.0.2.2" else: localmachine = "loc...
validation = validate_xml(fname)
Continue the code snippet: <|code_start|> else: localmachine = "localhost" return mirror.replace("LOCALMACHINE", localmachine) class ElbeXML: # pylint: disable=too-many-public-methods def __init__( self, fname, buildtype=None, skip_validate=Fals...
self.defs = ElbeDefaults(buildtype)
Given the following code snippet before the placeholder: <|code_start|> for e in other.node('debootstrappkgs'): tree.append_treecopy(e) def get_initvmnode_from(self, other): ivm = other.node('initvm') if ivm is None: raise NoInitvmNode() tree = self.xml.ensu...
ver_text = elbe_version + '-devel'
Given the code snippet: <|code_start|> return for e in other.node('debootstrappkgs'): tree.append_treecopy(e) def get_initvmnode_from(self, other): ivm = other.node('initvm') if ivm is None: raise NoInitvmNode() tree = self.xml.ensure_child('init...
if is_devel:
Predict the next line for this snippet: <|code_start|> oparser.add_option("--verbose", action="store_true", dest="verbose", default=False, help="show detailed project informations") oparser.add_option("--skip-validation", action="store_true", ...
xml = etree(args[0])
Given the code snippet: <|code_start|> def run_command(argv): # pylint: disable=too-many-branches oparser = OptionParser(usage="usage: %prog show [options] <filename>") oparser.add_option("--verbose", action="store_true", dest="verbose", default=False, help=...
validation = validate_xml(args[0])
Given the code snippet: <|code_start|> oparser.add_option("--cpuset", default=-1, type="int", help="Limit cpuset of pbuilder commands (bitmask) " "(defaults to -1 for all CPUs)") oparser.add_option("--profile", dest="profile", default="", ...
PBuilderAction.print_actions()
Predict the next line after this snippet: <|code_start|> " will use this environment.") oparser.add_option("--no-ccache", dest="noccache", default=False, action="store_true", help="Deactivates the compiler cache 'ccache'") oparser.add_op...
except PBuilderError as e:
Given snippet: <|code_start|> default=[], action="append", help="upload orig file") oparser.add_option("--output", dest="outdir", default=None, help="directory where to save downloaded Files") oparser.add_option("--cpuset", default=-1, type="int", ...
PreprocessWrapper.add_options(oparser)
Here is a snippet: <|code_start|> "sdkgccpkg": "g++-powerpc-linux-gnu", "elfcode": "PowerPC or cisco 4500", } ppcspe_defaults = { "arch": "powerpcspe", "interpreter": "qemu-system-ppc", "interpreterversion": "0.0.0", "userinterpr": "qemu-ppc-static", "console": "ttyS0,115200n1", "machine...
"interpreter": find_kvm_exe()["exec_name"],
Given the following code snippet before the placeholder: <|code_start|> xml = combinearchivedir(xml) preprocess_mirror_replacement(xml) preprocess_proxy_add(xml, proxy) # Change public PGP url key to raw key preprocess_pgp_key(xml) # Replace old debootstrapvariant with...
except ArchivedirError:
Next line prediction: <|code_start|> tag.attrib.pop('variant') else: # tag has a variant attribute but the variant was not # specified: remove the tag delayed rmlist.append(tag) for tag in rmlist: tag.get...
xml = combinearchivedir(xml)
Given snippet: <|code_start|> valid = iso_option_valid(opt.tag, opt.text) if valid is True: continue tag = '<%s>%s</%s>' % (opt.tag, opt.text, opt.tag) if valid is False: violation = "Invalid ISO option %s" % tag elif isinstance(valid, int): v...
host.text == cfg['sshport'] and benv.text == '22' or
Given snippet: <|code_start|> pretty_print=True, compression=9) # the rest of the code is exception and error handling return except etree.XMLSyntaxError: raise XMLPreprocessError("XML Parse error\n" + str(sys.exc_info()[1])) except ArchivedirError...
cmd = '%s preprocess %s -o %s %s' % (elbe_exe,
Predict the next line for this snippet: <|code_start|> except etree.XMLSyntaxError: raise XMLPreprocessError("XML Parse error\n" + str(sys.exc_info()[1])) except ArchivedirError: raise XMLPreprocessError("<archivedir> handling failed\n" + str(sys.exc_info()[1])) ...
ret, _, err = command_out_stderr(cmd)
Predict the next line for this snippet: <|code_start|> raise XMLPreprocessError("<archivedir> handling failed\n" + str(sys.exc_info()[1])) except BaseException: raise XMLPreprocessError( "Unknown Exception during validation\n" + str(sys.exc_info()[1])) ...
raise CommandError(cmd, ret)
Here is a snippet: <|code_start|> old_node = xml.find(".//debootstrapvariant") if old_node is None: return print("[WARN] <debootstrapvariant> is deprecated. Use <debootstrap> instead.") bootstrap = Element("debootstrap") bootstrap_variant = Element("variant") bootstrap_variant.text = o...
valid = iso_option_valid(opt.tag, opt.text)
Next line prediction: <|code_start|> # Replace old debootstrapvariant with debootstrap preprocess_bootstrap(xml) preprocess_iso_option(xml) preprocess_initvm_ports(xml) preprocess_mirrors(xml) if schema.validate(xml): # if validation succedes write xml fil...
raise XMLPreprocessError("\n".join(error_log_to_strings(schema.error_log)))
Given the following code snippet before the placeholder: <|code_start|> with open(fname, "rb") as f: buf = f.read(65536) while buf: m.update(buf) buf = f.read(65536) if m.hexdigest() != expected_hash: raise HashValidationFailed( 'file "%s" failed to...
system('wget -O "%s" "%s"' % (local_fname, url))
Given snippet: <|code_start|> buf = f.read(65536) while buf: m.update(buf) buf = f.read(65536) if m.hexdigest() != expected_hash: raise HashValidationFailed( 'file "%s" failed to verify ! got: "%s" expected: "%s"' % (fname, m.hexdigest()...
except CommandError:
Here is a snippet: <|code_start|> "debianize/panels/base.py", "debianize/panels/kernel.py", "debianize/widgets/button.py", "debianize/widgets/edit.py", "debianize/widgets/form.py", "d...
system("pylint3 %s %s" % (' '.join(self.pylint_opts), self.param))
Given the code snippet: <|code_start|> "debianize/panels/kernel.py", "debianize/widgets/button.py", "debianize/widgets/edit.py", "debianize/widgets/form.py", "debianize/widgets/grid.py", ...
except ElbeTestException as e:
Given the following code snippet before the placeholder: <|code_start|> for path in [ "daemons/soap/esoap.py", # These are not needed to be fixed since # debianize is going to be rewritten "...
files = system_out("find %s -iname '*.py'" % pack_dir).splitlines()
Given the code snippet: <|code_start|># ELBE - Debian Based Embedded Rootfilesystem Builder # Copyright (c) 2020 Olivier Dion <dion@linutronix.de> # # SPDX-License-Identifier: GPL-3.0-or-later class TestPylint(ElbeTestCase): pylint_opts = ["--reports=n", "--score=n", "--rcf...
failure_set = {os.path.join(pack_dir, path)
Predict the next line after this snippet: <|code_start|> in [ "daemons/soap/esoap.py", # These are not needed to be fixed since # debianize is going to be rewritten "debianize/base/tui.py", ...
files.append(elbe_exe)
Predict the next line for this snippet: <|code_start|># ELBE - Debian Based Embedded Rootfilesystem Builder # Copyright (c) 2020 Olivier Dion <dion@linutronix.de> # # SPDX-License-Identifier: GPL-3.0-or-later class TestPylint(ElbeTestCase): pylint_opts = ["--reports=n", "--score=n", <|code_en...
"--rcfile=%s" % os.path.join(elbe_dir, ".pylintrc"),
Predict the next line for this snippet: <|code_start|> def authenticated_uid(func): """ decorator, which Checks, that the current session is logged in, and also passes the current uid to the function Allows for being wrapped in a soapmethod... Example: @soapmethod (String, _r...
raise SoapElbeNotLoggedIn()
Next line prediction: <|code_start|> def authenticated_admin(func): """ decorator, which Checks, that the current session is logged in as an admin Allows for being wrapped in a soapmethod... Example: @soapmethod (String, _returns=Array(SoapFile)) @authenticated_uid ...
raise SoapElbeNotAuthorized()
Given the code snippet: <|code_start|> action="store_true", help="Deactivates the compiler cache 'ccache'") oparser.add_option("--ccache-size", dest="ccachesize", default="10G", action="store", type="string", help="set a lim...
ClientAction.print_actions()
Next line prediction: <|code_start|> action="store", type="string", help="set a limit for the compiler cache size " "(should be a number followed by an optional " "suffix: k, M, G, T. Use 0 for no limit.)") devel =...
control = ElbeSoapClient(
Given the following code snippet before the placeholder: <|code_start|> opt.passwd, debug=opt.debug, retries=int( opt.retries)) except URLError as e: print("Failed to connect to Soap server %s:%s\n" % (opt.host, opt.port), file=sys.stderr) ...
if v_server != elbe_version:
Predict the next line for this snippet: <|code_start|> dest="pbuilder_only", default=False, help="Only list/download pbuilder Files") oparser.add_option("--cpuset", default=-1, type="int", help="Limit cpuset of pbuilder commands (bitmask) (default...
dest="url_validation", default=ValidationMode.CHECK_ALL,
Given the following code snippet before the placeholder: <|code_start|># ELBE - Debian Based Embedded Rootfilesystem Builder # Copyright (c) 2019 Olivier Dion <dion@linutronix.de> # # SPDX-License-Identifier: GPL-3.0-or-later class RadioPolicy(object): HORIZONTAL = 0 VERTICAL = 1 <|code_end|> , predict...
class RadioGroup(Grid):
Given the following code snippet before the placeholder: <|code_start|> """A method to determine absolute path for a relative path inside project's directory.""" return os.path.abspath( os.path.join( os.path.dirname(__file__), path)) class my_install(install): def run(self): i...
version=elbe_version,
Given the code snippet: <|code_start|> help="enable only tags with empty or given variant") oparser.add_option("-p", "--proxy", dest="proxy", default=None, help="add proxy to mirrors") def run_command(argv): oparser = OptionParser(usage="usa...
except XMLPreprocessError as e:
Here is a snippet: <|code_start|> default=None, help="enable only tags with empty or given variant") oparser.add_option("-p", "--proxy", dest="proxy", default=None, help="add proxy to mirrors") def run_command(argv): o...
xmlpreprocess(args[0], opt.output, variants, opt.proxy)
Given the code snippet: <|code_start|> for p in cache: if not p.is_installed: continue if p.is_auto_removable: p.mark_delete(purge=True) logging.info("MARKED AS AUTOREMOVE %s", p.name) cache.commit(apt.progress.base.AcquireProgress(), ...
xml = etree(args[0])