Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Using the snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2020 Nokia Software.
# 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
#
# ... | ('description', 'Description'), |
Predict the next line after this snippet: <|code_start|># Copyright 2020 Nokia Software.
#
# 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/LIC... | self._f_name = f_name |
Here is a snippet: <|code_start|># Copyright 2020 Nokia Software.
#
# 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 ... | return 'Hello %s %s!' % (self._f_name, self._l_name) |
Based on the 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.
class Member(base.Resource):
resource_name = 'Member'
class MemberManager(base.ResourceM... | if not member_id: |
Continue the code snippet: <|code_start|># Copyright 2016 Catalyst IT 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | } |
Here is a snippet: <|code_start|> result[1]
)
def test_update(self):
self.client.members.update.return_value = MEMBER
result = self.call(
member_cmd.Update,
app_args=[MEMBER_DICT['resource_id'], MEMBER_DICT['resource_type'],
'-m', ME... | def test_get(self): |
Continue the code snippet: <|code_start|>
result = self.call(
member_cmd.Update,
app_args=[MEMBER_DICT['resource_id'], MEMBER_DICT['resource_type'],
'-m', MEMBER_DICT['member_id']]
)
self.assertEqual(
('456', 'workflow', '1111', '2222', ... | app_args=[MEMBER_DICT['resource_id'], MEMBER_DICT['resource_type'], |
Here is a snippet: <|code_start|> resource_name = 'EventTrigger'
class EventTriggerManager(base.ResourceManager):
resource_class = EventTrigger
def create(self, name, workflow_id, exchange, topic, event,
workflow_input=None, workflow_params=None):
self._ensure_not_empty(
... | fields='', **filters): |
Continue the code snippet: <|code_start|># Copyright 2017, OpenStack Foundation
#
# 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... | ('event', 'Event'), |
Here is a snippet: <|code_start|># Copyright 2017, OpenStack Foundation
#
# 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
#
# ... | ('updated_at', 'Updated at') |
Given the following code snippet before the placeholder: <|code_start|>
return self._create(
'/code_sources?name=%s&scope=%s&namespace=%s' %
(name, scope, namespace),
content,
dump_json=False,
headers={'content-type': 'text/plain'}
)
def u... | limit=limit, |
Next line prediction: <|code_start|># Copyright (c) 2014 Mirantis, 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
#
# Unless required... | wfs = self.mistral_alt_user("workflow-list") |
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 ... | data.update({'source_execution_id': source_execution_id}) |
Continue the code snippet: <|code_start|> ('created_at', 'Created at'),
('updated_at', 'Updated at'),
('duration', 'Duration', True),
]
@staticmethod
def format(wf_ex=None, lister=False):
if wf_ex:
state_info = (
wf_ex.state_info if not lister
... | duration |
Given the code snippet: <|code_start|> ('state', 'State'),
('state_info', 'State info'),
('created_at', 'Created at'),
('updated_at', 'Updated at'),
('duration', 'Duration', True),
]
@staticmethod
def format(wf_ex=None, lister=False):
if wf_ex:
sta... | wf_ex.created_at, |
Next line prediction: <|code_start|> ('task_name', 'Task name'),
('task_execution_id', 'Task ID'),
('state', 'State'),
('state_info', 'State info'),
('accepted', 'Accepted'),
('created_at', 'Created at'),
('updated_at', 'Updated at'),
]
LIST_COLUMN_FIELD_N... | task_name, |
Given the following code snippet before the placeholder: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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 Lice... | mistral_url=self.TEST_URL) |
Here is a snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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.or... | 'mistralclient.auth.keystone.KeystoneAuthHandler.authenticate', |
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 th... | data = ( |
Given the code snippet: <|code_start|> ('id', 'ID'),
('name', 'Name'),
('namespace', 'Namespace'),
('project_id', 'Project ID'),
('tags', 'Tags'),
('input', 'Input'),
('scope', 'Scope'),
('created_at', 'Created at'),
('updated_at', 'Updated at')
... | data += (None,) |
Using the snippet: <|code_start|>
self.assertEqual(
tasks.Task(self.tasks, TASK).to_dict(),
task.to_dict()
)
def test_rerun(self):
url = self.TEST_URL + URL_TEMPLATE_ID % TASK['id']
self.requests_mock.put(url, json=TASK)
task = self.tasks.rerun(TASK[... | self.assertDictEqual( |
Here is a snippet: <|code_start|> def test_list_with_fields(self):
field_params = "?fields=id,name"
self.requests_mock.get(self.TEST_URL + URL_TEMPLATE + field_params,
json={'tasks': [TASK]})
self.tasks.list(fields=["id,name"])
self.assertTrue(self.req... | ) |
Given snippet: <|code_start|>
self.assertDictEqual(
tasks.Task(self.tasks, TASK).to_dict(),
task.to_dict()
)
body = {
'reset': False,
'state': 'RUNNING',
'id': TASK['id']
}
self.assertDictEqual(body, self.requests_mock.... | self.assertDictEqual(body, self.requests_mock.last_request.json()) |
Given the following code snippet before the placeholder: <|code_start|> dyn_action = dynamic_actions.DynamicAction(mock, dyn_action_dict)
self.client.dynamic_actions.create.return_value = dyn_action
result = self.call(
dyn_actions_cmd.Create,
app_args=['my_action', 'MyAc... | dyn_action_dict = DYN_ACTION_DICT.copy() |
Using the snippet: <|code_start|> self.assertEqual(
(
'1-2-3-4',
'my_action',
'MyAction',
'2-3-4-5',
'my_module',
'12345',
'public',
'1',
'1'
),
... | app_args=['my_action', '--class-name', 'MyNewAction'] |
Predict the next line after this snippet: <|code_start|> self.assertEqual(
(
'1-2-3-4',
'my_action',
'MyNewAction',
'2-3-4-5',
'my_module',
'12345',
'private',
'1',
... | '1', |
Continue the code snippet: <|code_start|> ]
LIST_COLUMN_FIELD_NAMES = [c[0] for c in COLUMNS if c[0] != 'variables']
LIST_COLUMN_HEADING_NAMES = [c[1] for c in COLUMNS if c[0] != 'variables']
@staticmethod
def format(environment=None, lister=False):
if lister:
columns = Environme... | return columns, data |
Using the snippet: <|code_start|> 'event': 'event.dummy',
'created_at': '1',
'updated_at': '1'
}
TRIGGER = event_triggers.EventTrigger(mock, TRIGGER_DICT)
class TestCLITriggersV2(base.BaseCommandTest):
@mock.patch('argparse.open', create=True)
def test_create(self, mock_open):
self.client... | def test_list(self): |
Given snippet: <|code_start|> 'workflow_input': {},
'workflow_params': {},
'exchange': 'dummy_exchange',
'topic': 'dummy_topic',
'event': 'event.dummy',
'created_at': '1',
'updated_at': '1'
}
TRIGGER = event_triggers.EventTrigger(mock, TRIGGER_DICT)
class TestCLITriggersV2(base.BaseCommand... | ), |
Predict the next line after this snippet: <|code_start|> 'workflow_id': '123e4567-e89b-12d3-a456-426655440000',
'workflow_input': {},
'workflow_params': {},
'exchange': 'dummy_exchange',
'topic': 'dummy_topic',
'event': 'event.dummy',
'created_at': '1',
'updated_at': '1'
}
TRIGGER = even... | {}, 'dummy_exchange', 'dummy_topic', 'event.dummy', '1', '1' |
Here is a snippet: <|code_start|>
self.requests_mock.post(self.TEST_URL + URL_TEMPLATE,
status_code=201,
json=data)
env = self.environments.create(**data)
self.assertIsNotNone(env)
expected_data = copy.deepcopy(data)
... | self.requests_mock.post(self.TEST_URL + URL_TEMPLATE, |
Predict the next line after this snippet: <|code_start|> def test_create_without_name(self):
data = copy.deepcopy(ENVIRONMENT)
data.pop('name')
e = self.assertRaises(api_base.APIException,
self.environments.create,
**data)
... | data = collections.OrderedDict( |
Given the code snippet: <|code_start|> 'server': 'localhost'
}
}
URL_TEMPLATE = '/environments'
URL_TEMPLATE_NAME = '/environments/%s'
class TestEnvironmentsV2(base.BaseClientV2Test):
def test_create(self):
data = copy.deepcopy(ENVIRONMENT)
self.requests_mock.post(self.TEST_URL + URL... | 'tests/unit/resources/env_v2.json' |
Predict the next line for this snippet: <|code_start|> data = collections.OrderedDict(
utils.load_content(
utils.get_contents_if_file(path)
)
)
self.requests_mock.put(self.TEST_URL + URL_TEMPLATE, json=data)
file_input = {'file': path}
env ... | json={'environments': [ENVIRONMENT]}) |
Here is a snippet: <|code_start|>ACTION_EX_WITH_INPUT = action_ex.ActionExecution(
mock,
ACTION_EX_WITH_INPUT_DICT
)
class TestCLIActionExecutions(base.BaseCommandTest):
def test_create(self):
(self.client.action_executions.create.
return_value) = ACTION_EX_WITH_OUTPUT
self.ca... | ) |
Given the following code snippet before the placeholder: <|code_start|> ]
)
self.assertDictEqual(
ACTION_EX_RESULT,
jsonutils.loads(self.app.stdout.write.call_args[0][0])
)
def test_create_run_sync_and_save_result(self):
(self.client.action_execut... | action_ex_dict['state_info'] = 'testing update' |
Next line prediction: <|code_start|>ACTION_EX_WITH_OUTPUT_DICT = ACTION_EX_DICT.copy()
ACTION_EX_WITH_OUTPUT_DICT.update(
{'output': jsonutils.dumps(ACTION_EX_RESULT)})
ACTION_EX_WITH_INPUT_DICT = ACTION_EX_DICT.copy()
ACTION_EX_WITH_INPUT_DICT.update({'input': jsonutils.dumps(ACTION_EX_INPUT)})
ACTION_EX = actio... | jsonutils.loads(self.app.stdout.write.call_args[0][0]) |
Predict the next line after 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 la... | action: nova.servers_get server="1" |
Predict the next line after this 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 WARRAN... | wf1: |
Given the following code snippet before the placeholder: <|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... | tasks: |
Continue the code snippet: <|code_start|>
WB_DEF = """
---
version: 2.0
name: wb
workflows:
wf1:
type: direct
input:
- param1
- param2
tasks:
task1:
action: std.http url="localhost:8989"
on-success:
- test_subsequent
test_subsequent:
action: st... | wf1: |
Given the following code snippet before the placeholder: <|code_start|>
name: wb
workflows:
wf1:
type: direct
input:
- param1
- param2
tasks:
task1:
action: std.http url="localhost:8989"
on-success:
- test_subsequent
test_subsequent:
action: std... | action: std.http url="localhost:8989" |
Using the snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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.or... | workflows: |
Next line prediction: <|code_start|> )
# Update a workflow with uuid.
upd_wf = self.mistral_admin(
'workflow-update',
params='{0} --id {1}'.format(self.wf_with_delay_def, wf_id)
)
self.assertTableStruct(upd_wf, ['Name', 'Created at', 'Updated at'])
... | version: "2.0" |
Using the snippet: <|code_start|> )
# Update a workflow with uuid.
upd_wf = self.mistral_admin(
'workflow-update',
params='{0} --id {1}'.format(self.wf_with_delay_def, wf_id)
)
self.assertTableStruct(upd_wf, ['Name', 'Created at', 'Updated at'])
... | version: "2.0" |
Next line prediction: <|code_start|># Copyright 2015 - StackStorm, 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
#
# U... | return self._create( |
Next line prediction: <|code_start|># See the License for the specific language governing permissions and
# limitations under the License.
class CronTrigger(base.Resource):
resource_name = 'CronTrigger'
class CronTriggerManager(base.ResourceManager):
resource_class = CronTrigger
def create(self... | else: |
Based on the snippet: <|code_start|># Copyright 2014 - Mirantis, 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
#
# Unl... | } |
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
#
# Unle... | status_code=201) |
Given the following code snippet before the placeholder: <|code_start|># Copyright 2015 Huawei Technologies Co., Ltd.
#
# 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:... | } |
Given snippet: <|code_start|># Copyright 2015 Huawei Technologies Co., Ltd.
#
# 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
#
# ... | } |
Given the code snippet: <|code_start|># Copyright 2015 Huawei Technologies Co., Ltd.
#
# 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... | def test_list(self): |
Using the snippet: <|code_start|> self.requests_mock.put(self.TEST_URL + WORKFLOW_MEMBER_URL,
json=updated_member)
mb = self.members.update(
MEMBER['resource_id'],
MEMBER['resource_type'],
MEMBER['member_id']
)
self.asse... | ) |
Continue the code snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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.a... | 'namespace': '', |
Predict the next line for this snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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
#
# ... | } |
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 Li... | action: nova.servers_get server="1" |
Given snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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/li... | 'scope': 'private', |
Predict the next line after this snippet: <|code_start|># Copyright 2014 - Mirantis, 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... | ('workflow_name', 'Workflow'), |
Using the snippet: <|code_start|># Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | @staticmethod |
Next line prediction: <|code_start|># Copyright 2015 Huawei Technologies Co., Ltd.
#
# 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
#
#... | action: std.echo output="hello, world" |
Given the following code snippet before the placeholder: <|code_start|># Copyright 2015 Huawei Technologies Co., Ltd.
#
# 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:... | def test_list(self): |
Continue the code snippet: <|code_start|>#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#... | self.assertDictEqual( |
Given the following code snippet before the placeholder: <|code_start|># Copyright 2020 Nokia Software.
# 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
#
# ... | } |
Next line prediction: <|code_start|># Copyright 2014 Mirantis, Inc.
# Copyright 2020 Nokia Software.
# 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
#
# ... | 'created_at': '1', |
Continue the code snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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
#... | ('name', 'Name'), |
Given the following code snippet before the placeholder: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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
#... | ('workflow_execution_id', 'Workflow Execution ID'), |
Based on the snippet: <|code_start|>
class TaskFormatter(base.MistralFormatter):
COLUMNS = [
('id', 'ID'),
('name', 'Name'),
('workflow_name', 'Workflow name'),
('workflow_namespace', 'Workflow namespace'),
('workflow_execution_id', 'Workflow Execution ID'),
('state'... | task.workflow_execution_id, |
Given the code snippet: <|code_start|> 'functionaltests/resources/v2/action_v2.yaml', os.getcwd()
)
cls.act_tag_def = os.path.relpath(
'functionaltests/resources/v2/action_v2_tags.yaml', os.getcwd()
)
def setUp(self):
super(MistralClientTestBase, self).setUp(... | self.clients = self._get_alt_clients() |
Given the following code snippet before the placeholder: <|code_start|># Copyright 2015 Huawei Technologies Co., Ltd.
#
# 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:... | resource_class = Service |
Given the following code snippet before the placeholder: <|code_start|> )
self.assertEqual(
[mock.call(EXEC_DICT['id'], errors_only='', max_depth=3)],
self.client.executions.get_ex_sub_executions.call_args_list
)
def test_list_with_pagination(self):
self.clien... | marker='', |
Predict the next line for this snippet: <|code_start|> def test_sub_executions_errors_only(self):
self.client.executions.get_ex_sub_executions.return_value = \
EXECS_LIST
self.call(
execution_cmd.SubExecutionsLister,
app_args=[EXEC_DICT['id'], '--errors-only']
... | ) |
Next line prediction: <|code_start|> self.client.executions.get_ex_sub_executions.return_value = \
EXECS_LIST
result = self.call(
execution_cmd.SubExecutionsLister,
app_args=[EXEC_DICT['id']]
)
self.assertEqual([EX_RESULT, SUB_WF_EX_RESULT], result[1]... | ) |
Continue the code snippet: <|code_start|> 'state': 'RUNNING',
'input': {
"person": {
"first_name": "John",
"last_name": "Doe"
}
}
}
ERROR_SUB_WF_EXEC = {
'id': "456",
'workflow_id': '123e4567-e89b-12d3-a456-426655440000',
'workflow_name': 'my_sub_wf',
... | self.requests_mock.post(self.TEST_URL + URL_TEMPLATE, |
Given the code snippet: <|code_start|> }
ex = self.executions.create(
EXEC['workflow_name'],
EXEC['workflow_namespace'],
EXEC['input']
)
self.assertIsNotNone(ex)
self.assertDictEqual(
executions.Execution(self.executions, EXEC).to... | workflow_input=EXEC['input'] |
Given the code snippet: <|code_start|>
self.assertDictEqual(body, self.requests_mock.last_request.json())
def test_create_failure1(self):
self.requests_mock.post(self.TEST_URL + URL_TEMPLATE,
json=EXEC,
status_code=201)
self.as... | body = { |
Next line prediction: <|code_start|># Copyright 2015 Huawei Technologies Co., Ltd.
# Copyright 2020 Nokia Software.
#
# 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.apach... | base-input: |
Given snippet: <|code_start|> ('name', 'Name'),
('class_name', 'Class'),
('code_source_id', 'Code source ID'),
('code_source_name', 'Code source name'),
('project_id', 'Project ID'),
('scope', 'Scope'),
('created_at', 'Created at'),
('updated_at', 'Updated ... | data = (('',)*len(DynamicActionFormatter.COLUMNS),) |
Given the following code snippet before the placeholder: <|code_start|>
class CodeSourceFormatter(base.MistralFormatter):
COLUMNS = [
('id', 'ID'),
('name', 'Name'),
('namespace', 'Namespace'),
('project_id', 'Project ID'),
('scope', 'Scope'),
('created_at', 'Created... | data = (('',) * len(CodeSourceFormatter.COLUMNS),) |
Here is a snippet: <|code_start|># Copyright 2020 Nokia Software.
#
# 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 ... | ('namespace', 'Namespace'), |
Here is a snippet: <|code_start|># See the License for the specific language governing permissions and
# limitations under the License.
ENVIRONMENT_DICT = {
'name': 'env1',
'description': 'Test Environment #1',
'scope': 'private',
'variables': {
'server': 'localhost',
'databa... | EXPECTED_EXPORT_RESULT = (ENVIRONMENT_DICT['name'], |
Here is a snippet: <|code_start|> self.client.environments.list.return_value = [ENVIRONMENT]
expected = (ENVIRONMENT_DICT['name'],
ENVIRONMENT_DICT['description'],
ENVIRONMENT_DICT['scope'],
ENVIRONMENT_DICT['created_at'],
EN... | def test_delete_with_multi_names(self): |
Here is a snippet: <|code_start|> def _test_create(self, content):
self.client.environments.create.return_value = ENVIRONMENT
with tempfile.NamedTemporaryFile() as f:
f.write(content.encode('utf-8'))
f.flush()
file_path = os.path.abspath(f.name)
result... | del env['updated_at'] |
Using the snippet: <|code_start|> client.client,
mistral_url=MISTRAL_HTTPS_URL,
username='mistral',
project_name='mistral',
api_key='password',
user_domain_name='Default',
project_domain_name='Default',
auth_url=AUTH_HTTP_URL... | auth_url=AUTH_HTTP_URL_v3, |
Using the 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 A... | "param1": "p", |
Continue the code snippet: <|code_start|> self.assertEqual([EXPECTED_TASK_RESULT], result[1])
self.assertEqual(
self.client.tasks.list.call_args[1]["fields"],
task_cmd.TaskFormatter.fields()
)
def test_list_with_workflow_execution(self):
self.client.tasks.list... | def test_get_published(self): |
Here is a snippet: <|code_start|> 'root_execution_id': 'ROOT_EXECUTION_ID',
'description': '',
'state': 'ERROR',
'state_info': None,
'created_at': '2020-02-07 08:10:32',
'updated_at': '2020-02-07 08:10:41',
'task_execution_id': '123'
}
)
TASK_SUB_WF_EX_RESULT ... | TASK_WITH_PUBLISHED_DICT = TASK_DICT.copy() |
Using the snippet: <|code_start|>
TASK_RESULT = {"test": "is", "passed": "successfully"}
TASK_PUBLISHED = {"bar1": "val1", "var2": 2}
TASK_WITH_RESULT_DICT = TASK_DICT.copy()
TASK_WITH_RESULT_DICT.update({'result': jsonutils.dumps(TASK_RESULT)})
TASK_WITH_PUBLISHED_DICT = TASK_DICT.copy()
TASK_WITH_PUBLISHED_DICT.upda... | ) |
Here is a snippet: <|code_start|>
result = self.call(task_cmd.Rerun, app_args=['id'])
self.assertEqual(EXPECTED_TASK_RESULT, result[1])
def test_rerun_no_reset(self):
self.client.tasks.rerun.return_value = TASK
result = self.call(task_cmd.Rerun, app_args=['id', '--resume'])
... | self.assertEqual(EXPECTED_TASK_RESULT, result[1]) |
Given the following code snippet before the placeholder: <|code_start|> '_convert_time_string_to_utc')
@mock.patch('argparse.open', create=True)
def test_create(self, mock_open, mock_convert):
self.client.cron_triggers.create.return_value = TRIGGER
mock_open.return_value = mock.Ma... | result = self.call( |
Given the following code snippet before the placeholder: <|code_start|># License for the specific language governing permissions and limitations
# under the License.
#
TRIGGER_DICT = {
'name': 'my_trigger',
'workflow_name': 'flow1',
'workflow_input': {},
'workflow_params': {},
'pattern': '... | result = self.call( |
Given the following code snippet before the placeholder: <|code_start|> mock_time.localtime.return_value = mock_localtime
utc_value = cmd._convert_time_string_to_utc('4242-12-20 13:37')
expected_time = '4242-12-20 17:37'
self.assertEqual(expected_time, utc_value)
@mock.patch('mist... | self.assertEqual( |
Based on the snippet: <|code_start|> '/action_executions',
data,
dump_json=True
)
def update(self, id, state=None, output=None):
self._ensure_not_empty(id=id)
if not (state or output):
raise base.APIException(
400,
... | url += "%s" |
Based on the snippet: <|code_start|>
return self._update(
url,
definition,
response_key='actions',
dump_json=False,
headers={'content-type': 'text/plain'},
is_iter_resp=True
)
def list(self, marker='', limit=None, sort_keys='',... | self._ensure_not_empty(identifier=identifier) |
Using the snippet: <|code_start|> data['id'] = identifier
else:
data['name'] = identifier
if class_name:
data['class_name'] = class_name
if code_source:
if uuidutils.is_uuid_like(code_source):
data['code_source_id'] = code_source
... | '/dynamic_actions%s' % query_string, |
Predict the next line after 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.
#
... | ) |
Given the code snippet: <|code_start|># Copyright 2016 - Catalyst IT 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | ('created_at', 'Created at'), |
Given snippet: <|code_start|> resource_name = 'Workbook'
class WorkbookManager(base.ResourceManager):
resource_class = Workbook
def _get_workbooks_url(self, resource=None, namespace=None, scope=None):
url = '/workbooks'
if resource:
url += '/%s' % resource
if scope an... | definition, |
Next line prediction: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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... | ('namespace', 'Namespace'), |
Here is a snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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.or... | def format(workbook=None, lister=False): |
Given the code snippet: <|code_start|># Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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.apac... | url = '/tasks' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.