Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given snippet: <|code_start|> @mock.patch('os_brick.remotefs.remotefs.RemoteFsClient._check_nfs_options') def test_init_nfs_calls_check_nfs_options(self, mock_check_nfs_options): remotefs.RemoteFsClient("nfs", root_helper='true', nfs_mount_point_base='/fake') mock_...
share = '%s:%s' % (cluster_name, password)
Given snippet: <|code_start|> @mock.patch.object(remotefs.RemoteFsClient, '_read_mounts', return_value=[]) def test_cifs(self, mock_read_mounts): client = remotefs.RemoteFsClient("cifs", root_helper='true', smbfs_mount_point_base='/mnt') ...
mounts = """device1 mnt_point1 ext4 rw,seclabel,relatime 0 0
Using the snippet: <|code_start|> self._conn = base_rbd.RBDConnectorMixin() @ddt.data((['192.168.1.1', '192.168.1.2'], ['192.168.1.1', '192.168.1.2']), (['3ffe:1900:4545:3:200:f8ff:fe21:67cf', 'fe80:0:0:0:200:f8ff:fe21:67cf'], ['[3ffe:1900:4545:3:...
'--mon_host', self.hosts[0] + ':' + self.ports[0],
Using the snippet: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ...
'cluster_name': self.clustername,
Next line prediction: <|code_start|># Copyright (c) 2016 VMware, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/license...
LOG = logging.getLogger(__name__)
Predict the next line after this snippet: <|code_start|># Copyright (c) 2016 VMware, Inc. # All Rights Reserved. # # 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://ww...
LOG = logging.getLogger(__name__)
Given snippet: <|code_start|># Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/license...
def __init__(self, *args, **kwargs):
Continue the code snippet: <|code_start|># Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # 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...
self.use_multipath = kwargs.pop('use_multipath', False)
Given the code snippet: <|code_start|># Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # 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...
self.use_multipath = kwargs.pop('use_multipath', False)
Given snippet: <|code_start|># Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/license...
self._iscsi_utils = utilsfactory.get_iscsi_initiator_utils()
Predict the next line after this snippet: <|code_start|># Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # 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 # # ht...
self.validate_initiators()
Based on the snippet: <|code_start|> if feature_available or not enforce_multipath: multipath_support = check_mpio( enforce_multipath=enforce_multipath) self.assertEqual(feature_available, multipath_support) else: self.assertRaises(exception.BrickExcep...
def test_get_scsi_wwn(self):
Next line prediction: <|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 t...
enforce_multipath=False):
Here is a snippet: <|code_start|> self.assertRaises(exception.BrickException, check_mpio, enforce_multipath=enforce_multipath) mock_hostutils.check_server_feature.assert_called_once_with( mock_hostutils.FEATURE_MPIO) @ddt.da...
expected_wwn = '%s%s' % (mock.sentinel.uid_type,
Predict the next line after this snippet: <|code_start|> mock_hostutils.check_server_feature.return_value = feature_available check_mpio = base_win_conn.BaseWindowsConnector.check_multipath_support if feature_available or not enforce_multipath: multipath_support = check_mpio( ...
mock_check_mpio.assert_called_once_with(enforce_multipath)
Continue the code snippet: <|code_start|># Copyright (C) 2016-2022 Lightbits Labs Ltd. # Copyright (C) 2020 Intel Corporation # All Rights Reserved. # # 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 ...
nvmec_pattern = ".*nvme[0-9]+[cp][0-9]+.*"
Using the snippet: <|code_start|># Copyright (C) 2016-2022 Lightbits Labs Ltd. # Copyright (C) 2020 Intel Corporation # All Rights Reserved. # # 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 Lice...
nvmec_match = re.compile(nvmec_pattern)
Given the following code snippet before the placeholder: <|code_start|> '/sys/class/fc_transport/target6:*/port_name', shell=True), mock.call('grep -Gil "514f0c50023f6c01" ' '/sys/class/fc_transport/target6:*/port_name', ...
execute_mock.assert_called_once_with(
Using the snippet: <|code_start|> self.assertEqual(expected, res) def test__get_hba_channel_scsi_target_lun_multiple_wwpn(self): execute_results = [ ['/sys/class/fc_transport/target6:0:1/port_name\n', ''], ['/sys/class/fc_transport/target6:0:2/port_name\n', ''], ] ...
con_props['target_lun'] = [1, 7]
Predict the next line for this snippet: <|code_start|># 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 limitations # under the License. class...
exc = FakeBrickException(code=500)
Next line prediction: <|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...
message = "default message: %(mispelled_code)s"
Predict the next line for this snippet: <|code_start|> if volume != detached: raise Exception( 'Mismatched volumes on a MockStorPool request removal') elif detached not in self.attached: raise Exception('MockStorPool request not attached yet') ...
raise Exception("Unrecognized command passed to " +
Using the snippet: <|code_start|> def test_get_share_name(self): resulted_name = self._remotefs.get_share_name(self._FAKE_SHARE) self.assertEqual(self._FAKE_SHARE_NAME, resulted_name) @ddt.data(True, False) @mock.patch.object(windows_remotefs.WindowsRemoteFsClient, '_...
mock_create_mount_point.assert_called_once_with(self._FAKE_SHARE,
Given the following code snippet before the placeholder: <|code_start|> self._smbutils.check_smb_mapping.return_value = False self._smbutils.is_local_share.return_value = is_local_share self._remotefs.mount(self._FAKE_SHARE, flags) if is_local_share: self.assertFalse(self._s...
'get_mount_point')
Predict the next line for this snippet: <|code_start|> self._remotefs.mount(self._FAKE_SHARE, flags) if is_local_share: self.assertFalse(self._smbutils.check_smb_mapping.called) self.assertFalse(self._smbutils.mount_smb_share.called) else: self._smbutils.check...
def test_create_mount_point(self, mock_os, mock_get_mount_point,
Given the following code snippet before the placeholder: <|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 # # Unl...
DEV_SEARCH_PATH = '/dev/'
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...
synchronized = lockutils.synchronized_with_prefix('os-brick-')
Given snippet: <|code_start|># Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/license...
utilsfactory_patcher = mock.patch.object(
Given snippet: <|code_start|># 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 ex...
block_devices = driver.get_all_block_devices()
Given the code snippet: <|code_start|> mock_configure_scsi_device.assert_called_with(3, 5, "0x0002000000000000") self.assertEqual(3, len(devices)) device_path = "/dev/disk/by-path/ccw-3-zfcp-5:0x0002000000000000" self.assertEqual(devic...
def test_remove_devices(self, mock_deconfigure_scsi_device,
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 ag...
devices = self.connector._get_host_devices(possible_devs)
Predict the next line for this snippet: <|code_start|># 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 CONDITIO...
self.assertEqual(3, len(devices))
Given the code snippet: <|code_start|># Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # 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...
def test_attach_volume(self):
Given the code snippet: <|code_start|># Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # 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...
'provider': 'NoOpEncryptor',
Here is a snippet: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ...
mock_import.assert_called_once_with(
Given the code snippet: <|code_start|> os_win_exc.OSWinException, None, None] self._iscsi_utils.get_device_number_and_path.return_value = ( mock.sentinel.device_number, mock.sentinel.device_path) self._connector.use_multipath = use_multipath device_info = self._connector....
ensure_mpio_claimed=use_multipath)
Given the following code snippet before the placeholder: <|code_start|># Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # 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...
device_scan_interval=mock.sentinel.rescan_interval)
Next line prediction: <|code_start|> self.assertRaises(exception.BrickException, self._connector.connect_volume, connection_properties={}) @mock.patch.object(iscsi.WindowsISCSIConnector, '_get_all_targets') def test_disconnect_volume(self, mock_get_al...
(mock.sentinel.portal_1, mock.sentinel.tg_1, mock.sentinel.lun_1)]
Predict the next line after this snippet: <|code_start|> disk_path = self._get_disk_path(connection_properties) if self._expect_raw_disk: # The caller expects a direct accessible raw disk. We'll # mount the image and bring the new disk offline, which will # allow dire...
self._vhdutils.detach_virtual_disk(disk_path)
Predict the next line for this 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 langua...
def get_connector_properties(*args, **kwargs):
Using the snippet: <|code_start|># Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # 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/lic...
True)
Given snippet: <|code_start|> fake_disk_name = 'fake_disk.vhdx' fake_conn_props = dict(name=fake_disk_name, export=fake_export_path) self._remotefs.get_mount_base.return_value = mount_base self._remotefs.get_mount_point.return_value = fake_mount_point ...
fake_export_path)
Using the snippet: <|code_start|> self._load_connector() @mock.patch.object(windows_remotefs, 'WindowsRemoteFsClient') def _load_connector(self, mock_remotefs_cls, *args, **kwargs): self._connector = smbfs.WindowsSMBFSConnector(*args, **kwargs) self._remotefs = mock_remotefs_cls.return_v...
fake_conn_props = dict(access_mode='ro' if read_only else 'rw')
Here is a snippet: <|code_start|># License for the specific language governing permissions and limitations # under the License. @ddt.ddt class WindowsSMBFSConnectorTestCase(test_base.WindowsConnectorTestBase): def setUp(self): super(WindowsSMBFSConnectorTestCase, self).setUp() self._load...
self.assertEqual(expected_info, device_info)
Continue the code snippet: <|code_start|> @mock.patch('os_brick.executor.Executor._execute') def test__close_volume(self, mock_execute): self.encryptor.detach_volume() mock_execute.assert_has_calls([ mock.call('cryptsetup', 'remove', self.dev_name, root_helper=...
connection_info=connection_info,
Predict the next line for this snippet: <|code_start|>def fake__get_key(context, passphrase): raw = bytes(binascii.unhexlify(passphrase)) symmetric_key = key.SymmetricKey('AES', len(raw) * 8, raw) return symmetric_key class CryptsetupEncryptorTestCase(test_base.VolumeEncryptorTestCase): @mock.patch('...
run_as_root=True,
Continue the code snippet: <|code_start|> self.symlink_path = self.dev_path @mock.patch('os_brick.executor.Executor._execute') def test__open_volume(self, mock_execute): self.encryptor._open_volume("passphrase") mock_execute.assert_has_calls([ mock.call('cryptsetup', 'create...
run_as_root=True, check_exit_code=True),
Predict the next line after this snippet: <|code_start|># Copyright 2018 Red Hat, Inc. # All Rights Reserved. # # 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...
def test_check_manual_scan_supported(self, mock_exec):
Based on the snippet: <|code_start|> def test_check_manual_scan_windows(self): self.assertFalse(utils.check_manual_scan()) @mock.patch('os.name', 'posix') @mock.patch('oslo_concurrency.processutils.execute') def test_check_manual_scan_supported(self, mock_exec): self.assertTrue(utils.che...
mock_lock.assert_not_called()
Based on the snippet: <|code_start|> @mock.patch.object(base_iscsi.BaseISCSIConnector, '_get_all_targets') def test_iterate_all_targets(self, mock_get_all_targets): # extra_property cannot be a sentinel, a copied sentinel will not # identical to the original one. connection_properties = {...
connection_properties = {'target_portals': portals,
Using the snippet: <|code_start|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # # 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...
'target_luns': mock.sentinel.target_luns,
Here is a snippet: <|code_start|> mock_get_all_targets.assert_called_once_with(connection_properties) self.assertEqual(1, len(list_props)) expected_props = {'target_portal': mock.sentinel.portal, 'target_iqn': mock.sentinel.iqn, 'target_lun': m...
all_targets = self.connector._get_all_targets(connection_properties)
Continue the code snippet: <|code_start|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # # 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....
self.assertEqual(dev_info['type'], 'gpfs')
Next line prediction: <|code_start|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # # 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/l...
self.assertEqual(dev_info['type'], 'gpfs')
Continue the code 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 FakeConnector(base.BaseLinuxConnector): fake_path = '/dev/vdFAKE' def connect_vo...
return ['/dev/disk/by-path/fake-volume-1',
Given snippet: <|code_start|># http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # L...
def extend_volume(self, connection_properties):
Using the snippet: <|code_start|># 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 limitations # under the License. class LocalConnectorTestCa...
self.assertEqual(expected, actual)
Continue the code snippet: <|code_start|> self._execute.assert_any_call(*expected_cmd) @mock.patch.object(rbd.WindowsRBDConnector, 'get_device_name') def test_get_volume_paths(self, mock_get_dev_name): vol_paths = self._conn.get_volume_paths(mock.sentinel.conn_props) self.assertEqual([mo...
else:
Predict the next line after this snippet: <|code_start|> mock_get_dev_name.assert_called_once_with(mock.sentinel.conn_props) @ddt.data(True, False) @mock.patch.object(rbd.WindowsRBDConnector, 'get_device_name') @mock.patch('oslo_utils.eventletutils.EventletEvent.wait') def test_wait_for_volume(...
mock_get_dev_name.assert_any_call(self.connection_properties,
Using the snippet: <|code_start|> expected_cmd = ['where.exe', 'rbd'] self._execute.assert_any_call(*expected_cmd) @mock.patch.object(rbd.WindowsRBDConnector, 'get_device_name') def test_get_volume_paths(self, mock_get_dev_name): vol_paths = self._conn.get_volume_paths(mock.sentinel.conn...
self.assertEqual(mock.sentinel.dev_name, dev_name)
Given the following code snippet before the placeholder: <|code_start|># Copyright 2020 Cloudbase Solutions Srl # All Rights Reserved. # # 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...
def setUp(self):
Predict the next line for this snippet: <|code_start|> 1, mock_rados.Rados.return_value.connect.call_count) mock_rados.Rados.return_value.open_ioctx.assert_called_once_with( utils.convert_str('test_pool')) self.assertEqual(1, mock_rados.Rados.return_value.shutdown.cal...
self.mock_volume_wrapper._rbd_volume)
Given the following code snippet before the placeholder: <|code_start|> def setUp(self): super(RBDVolumeIOWrapperTestCase, self).setUp() self.mock_volume = mock.Mock() self.mock_volume_wrapper = \ linuxrbd.RBDVolumeIOWrapper(self.mock_volume) self.data_length = 1024 ...
data = self.mock_volume_wrapper.read()
Continue the code snippet: <|code_start|> self.assertEqual(1, mock_rados.Rados.return_value.shutdown.call_count) @mock.patch.object(MockRados.Rados, 'connect', side_effect=MockRados.Error) def test_with_client_error(self, _): linuxrbd.rados = MockRados linuxrbd.rados.Error = MockRados.E...
def test_inc_offset(self):
Using the snippet: <|code_start|> def __exit__(self, *args, **kwargs): return False def close(self, *args, **kwargs): pass class Rados(object): def __init__(self, *args, **kwargs): pass def __enter__(self, *args, **kwargs): return s...
def setUp(self):
Next line prediction: <|code_start|> def test_buffer(): instance = buffers.Buffer() assert instance.requirements == [] expected = dict(a=1, b=2, c=3) instance.input(expected) instance.set_output_label('any') assert instance.output() == expected def test_detlayed_buffer(): delay = 2.5 ...
assert result == expected
Predict the next line after this snippet: <|code_start|> def test_requirements(): expected = ['message'] instance = printer.ConsolePrinter() assert instance.requirements == expected def test_input(): msg = 'Hello world' instance = printer.ConsolePrinter() instance.input(dict(message=msg)) ...
msg = 'Hello world'
Given the code snippet: <|code_start|> def test_requirements(): expected = ['value'] instance = value.Value() assert instance.requirements == expected <|code_end|> , generate the next line using the imports in this file: from robograph.datamodel.nodes.lib import value and context (functions, classes, o...
def test_input():
Given the code snippet: <|code_start|># Given an IP address, geolocate it and send the result over via e-mail def email_geolocated_ip(recipients_list, smtp_server_params, ip_addr): subject = value.Value(value='Test mail') smtp_server_params['sender'] = 'test@test.com' smtp_server_params['mime_type'] = '...
return g
Given the following code snippet before the placeholder: <|code_start|># Given an IP address, geolocate it and send the result over via e-mail def email_geolocated_ip(recipients_list, smtp_server_params, ip_addr): subject = value.Value(value='Test mail') smtp_server_params['sender'] = 'test@test.com' sm...
http_params = dict(url='https://api.ip2country.info/ip?'+ip_addr,
Here is a snippet: <|code_start|># Given an IP address, geolocate it and send the result over via e-mail def email_geolocated_ip(recipients_list, smtp_server_params, ip_addr): subject = value.Value(value='Test mail') smtp_server_params['sender'] = 'test@test.com' smtp_server_params['mime_type'] = 'text/...
g.connect(sendmail, subject, 'subject')
Based on the snippet: <|code_start|># Given an IP address, geolocate it and send the result over via e-mail def email_geolocated_ip(recipients_list, smtp_server_params, ip_addr): subject = value.Value(value='Test mail') smtp_server_params['sender'] = 'test@test.com' smtp_server_params['mime_type'] = 'te...
return g
Given snippet: <|code_start|> DATA = dict(x=[1, 2, 3]) EXPECTED = '{"x": [1, 2, 3]}' def test_requirements(): expected = ['data'] instance = transcoders.ToJSON() assert instance.requirements == expected def test_input(): instance = transcoders.ToJSON() instance.input(dict(data=DATA)) instanc...
def test_output():
Predict the next line after this snippet: <|code_start|> def test_templated_string(): expected_requirements = ['template', 'parameters'] expected_output = 'After 1 comes 2 but then there is three' instance = strings.TemplatedString( template='After {p1} comes {p2} but then there is {p3}') insta...
assert instance.requirements == expected_requirements
Continue the code snippet: <|code_start|> s = maths.Sum(name='sum') m = maths.Product(name='product') b = buffers.Buffer(name='buffer') p = printer.ConsolePrinter(name='printer') g = graph.Graph('sum_and_product', [v1, v2, s, m, p, b]) g.connect(p, b, 'message') g.connect(b, s, 'sum of v1')...
g.connect(m, v2, 'argument')
Continue the code snippet: <|code_start|> def plot(): v1 = value.Value(value=[9, -3, 8.7], name='v1') v2 = value.Value(value=[86, -0.43], name='v2') s = maths.Sum(name='sum') m = maths.Product(name='product') b = buffers.Buffer(name='buffer') p = printer.ConsolePrinter(name='printer') g = ...
g.connect(p, b, 'message')
Here is a snippet: <|code_start|> def plot(): v1 = value.Value(value=[9, -3, 8.7], name='v1') v2 = value.Value(value=[86, -0.43], name='v2') s = maths.Sum(name='sum') m = maths.Product(name='product') b = buffers.Buffer(name='buffer') p = printer.ConsolePrinter(name='printer') g = graph.Gr...
g.connect(b, s, 'sum of v1')
Given snippet: <|code_start|> v1 = value.Value(value=[9, -3, 8.7], name='v1') v2 = value.Value(value=[86, -0.43], name='v2') s = maths.Sum(name='sum') m = maths.Product(name='product') b = buffers.Buffer(name='buffer') p = printer.ConsolePrinter(name='printer') g = graph.Graph('sum_and_produ...
g.connect(b, m, 'product of v2')
Based on the snippet: <|code_start|> s = maths.Sum(name='sum') m = maths.Product(name='product') b = buffers.Buffer(name='buffer') p = printer.ConsolePrinter(name='printer') g = graph.Graph('sum_and_product', [v1, v2, s, m, p, b]) g.connect(p, b, 'message') g.connect(b, s, 'sum of v1') ...
g.connect(m, v2, 'argument')
Predict the next line for this snippet: <|code_start|> FILEPATH = os.path.abspath('robograph/datamodel/tests/file.txt') def test_requirements(): expected = ['filepath', 'encoding'] instance = files.TextFileReader() assert instance.requirements == expected def test_input(): expected = 'one\ntwo\nthr...
instance.set_output_label('any')
Based on the snippet: <|code_start|># Long delay def delayed_sum_and_product(list_of_numbers, delay): val = value.Value(value=list_of_numbers) summer = apply.Apply(function=sum) multiplier = apply.Apply(function=lambda c: reduce(lambda x, y: x * y, c)) delayed_value_buffer = buffers.DelayedBuffer(se...
g.connect(summer, val, 'argument')
Here is a snippet: <|code_start|># Long delay def delayed_sum_and_product(list_of_numbers, delay): val = value.Value(value=list_of_numbers) summer = apply.Apply(function=sum) multiplier = apply.Apply(function=lambda c: reduce(lambda x, y: x * y, c)) delayed_value_buffer = buffers.DelayedBuffer(secon...
printout, delayed_value_buffer,
Given the code snippet: <|code_start|># Long delay def delayed_sum_and_product(list_of_numbers, delay): val = value.Value(value=list_of_numbers) summer = apply.Apply(function=sum) multiplier = apply.Apply(function=lambda c: reduce(lambda x, y: x * y, c)) delayed_value_buffer = buffers.DelayedBuffer(...
return g
Predict the next line for this snippet: <|code_start|># Long delay def delayed_sum_and_product(list_of_numbers, delay): val = value.Value(value=list_of_numbers) summer = apply.Apply(function=sum) multiplier = apply.Apply(function=lambda c: reduce(lambda x, y: x * y, c)) delayed_value_buffer = buffer...
g.connect(delayed_value_buffer, multiplier, 'product value')
Given the following code snippet before the placeholder: <|code_start|> DATA_MATRIX = [[1,2,3],[4,5,6],[7,8,9]] HEADER = ['one', 'two', 'three'] DELIMITER = ',' LINESEP = '\n' EXPECTED = 'one,two,three\n1,2,3\n4,5,6\n7,8,9' def test_requirements(): expected = ['data_matrix', 'header_list', 'delimiter', 'linesep']...
header_list=HEADER,
Given the code snippet: <|code_start|> log_level = logging.INFO logging.basicConfig(level=log_level) logger = logging.getLogger(__name__) def test_requirements(): expected = ['message', 'logger', 'loglevel'] instance = printer.LogPrinter() instance.set_output_label('any') assert instance.requirements...
instance.input(dict(message=msg, logger=logger, loglevel=log_level))
Given the code snippet: <|code_start|> class Date(node.Node): _reqs = [] DEFAULT_DATE_FORMAT = '%Y-%m-%d' <|code_end|> , generate the next line using the imports in this file: import datetime from robograph.datamodel.base import node and context (functions, classes, or occasionally code) from other files:...
def output(self):
Predict the next line for this snippet: <|code_start|> instance = http.Post(url=url, mime_type=MIME_TYPE, headers=HEADERS, verify_ssl=False, post_data=FORM_DATA) assert instance.requirements == expected_reqs result = instance.output() assert result['for...
expected_reqs = ['url', 'headers', 'auth', 'timeout_secs', 'verify_ssl',
Continue the code snippet: <|code_start|># Given a text, replace occurrences of the word "hello" with "ciao" - if any. # If no occurrence is found, replace all whitespaces with "_" instead def replace_word(text): t = value.Value(value=text, name="text") s = branching.IfThenApply(condition=lambda x: "hello" i...
return g
Predict the next line for this snippet: <|code_start|># Given a text, replace occurrences of the word "hello" with "ciao" - if any. # If no occurrence is found, replace all whitespaces with "_" instead def replace_word(text): t = value.Value(value=text, name="text") s = branching.IfThenApply(condition=lambda...
g.connect(p, s, 'message')
Predict the next line for this snippet: <|code_start|># Given a text, replace occurrences of the word "hello" with "ciao" - if any. # If no occurrence is found, replace all whitespaces with "_" instead def replace_word(text): t = value.Value(value=text, name="text") s = branching.IfThenApply(condition=lambda...
function_true=lambda x: x.replace("hello", "ciao"),
Next line prediction: <|code_start|> def test_node_serializer(): instance = apply.Apply(function=lambda x: x + 2, argument=3, name='test') serialized = serializer.NodeSerializer.serialize(instance) deserialized = serializer.NodeSerializer.deserialize(serialized) assert instance.name == deserialized.nam...
assert instance.output_label == deserialized.output_label
Here is a snippet: <|code_start|> def test_node_serializer(): instance = apply.Apply(function=lambda x: x + 2, argument=3, name='test') serialized = serializer.NodeSerializer.serialize(instance) deserialized = serializer.NodeSerializer.deserialize(serialized) <|code_end|> . Write the next line using the cu...
assert instance.name == deserialized.name
Next line prediction: <|code_start|> def test_node_serializer(): instance = apply.Apply(function=lambda x: x + 2, argument=3, name='test') serialized = serializer.NodeSerializer.serialize(instance) deserialized = serializer.NodeSerializer.deserialize(serialized) assert instance.name == deserialized.nam...
def test_graph_serializer():
Given the code snippet: <|code_start|> def test_node_serializer(): instance = apply.Apply(function=lambda x: x + 2, argument=3, name='test') serialized = serializer.NodeSerializer.serialize(instance) deserialized = serializer.NodeSerializer.deserialize(serialized) <|code_end|> , generate the next line usin...
assert instance.name == deserialized.name
Predict the next line after this snippet: <|code_start|> def test_node_serializer(): instance = apply.Apply(function=lambda x: x + 2, argument=3, name='test') serialized = serializer.NodeSerializer.serialize(instance) deserialized = serializer.NodeSerializer.deserialize(serialized) assert instance.name...
assert instance.output() == deserialized.output()
Predict the next line for this snippet: <|code_start|> def test_requirements(): expected = ['data', 'condition', 'function_true', 'function_false'] instance = branching.IfThenReturn() assert instance.requirements == expected def test_input(): data = 7 condition = lambda x: x >= 0 function_tru...
function_true=function_true,
Continue the code snippet: <|code_start|> assert instance.requirements == expected def test_input(): data = 7 condition = lambda x: x >= 0 function_true = lambda x: math.sqrt(x) function_false = lambda x: 0 instance = branching.IfThenApply() instance.input(dict(data=data, ...
condition = lambda x: x >= 0
Given the following code snippet before the placeholder: <|code_start|> verify_ssl=False) v = value.Value(value=url) h = http.Get(**http_params) p = printer.ConsolePrinter() g = graph.Graph('test_get_graph', [v, h, p]) g.connect(p, h, 'message') g.connect(h, v, 'url') ...
http_params = dict(url=url, post_data=put_data, mime_type='application/json',
Predict the next line after this snippet: <|code_start|># Various HTTP calls against HTTPBin def test_get_graph(url, query_params): http_params = dict(url=url, query=query_params, mime_type='application/json', verify_ssl=False) v = value.Value(value=url) h = http.Get(**http_params)...
g.connect(h, v, 'url')