query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Add existing storage volume on the storage system into Oneview [Arguments] | def fusion_api_add_existing_storage_volume(self, body, api=None, headers=None):
return self.volume.add_existing(body=body, api=api, headers=headers) | [
"def add_volume(self, volume):",
"def add_volume(cmd):\n exaconf = read_exaconf(cmd.exaconf)\n vol_nodes = [ n.strip() for n in cmd.nodes.split(\",\") if n.strip() != \"\" ]\n vol_owner = tuple( o.strip() for o in cmd.owner.split(\":\") if o.strip() != \"\" ) if cmd.owner != None else None\n exaconf.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get storage volume attachments. [Arguments] | def fusion_api_get_storage_volume_attachments(self, uri=None, param='', api=None, headers=None):
return self.volume_attachment.get(uri=uri, param=param, api=api, headers=headers) | [
"def get_disk_attachments(name, object_type='vm', get_href=False):\n api = get_api(object_type, \"%ss\" % object_type)\n obj = api.find(name)\n return DISK_ATTACHMENTS_API.getElemFromLink(obj, get_href=get_href)",
"def get_instance_volume_attachments(self, instance):\n instance_info = self.get_ins... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create, update, and delete volume attachments via patch [Arguments] | def fusion_api_patch_storage_volume_attachments(self, body, param='', api=None, headers=None):
return self.volume_attachment.patch(body=body, param=param, api=api, headers=headers) | [
"def test_aws_service_api_volume_attachment_put(self):\n pass",
"def test_aws_service_api_volume_attachment_delete(self):\n pass",
"def test_manage_volume_attachments(self, volume, instance, volumes_steps):\n volumes_steps.attach_instance(volume.name, instance.name)\n volumes_steps.d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates a Switch. [Arguments] | def fusion_api_edit_switch(self, body, uri, api=None, headers=None):
return self.switch.update(body, uri, api, headers) | [
"def update(self):\n uri = common.genuri('lswitch', self.uuid)\n return super(LSwitch, self)._action('PUT', uri)",
"def command_update_hw(self, cmd):\n # TODO\n pass",
"def switch_changed(self, switch, name):\n section, option = name\n v = (\"1\" if switch.value else \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Refreshes a Switch based on uri provided [Arguments] | def fusion_api_refresh_switch(self, uri, api=None, headers=None):
return self.switch.refresh(uri, api, headers) | [
"def refresh(self, url, args, cancellationSignal):\n pass",
"def update(self):\n uri = common.genuri('lswitch', self.uuid)\n return super(LSwitch, self)._action('PUT', uri)",
"def StartSRefresh(self, *args, **kwargs):\n payload = { \"Arg1\": self.href }\n for i in range(len(ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a Switch based on name OR uri provided [Arguments] | def fusion_api_remove_switch(self, name=None, uri=None, api=None, headers=None):
return self.switch.delete(name, uri, api, headers) | [
"def delSwitch( self, sw ):\n command = \"delswitch \" + str( sw )\n try:\n response = self.execute(\n cmd=command,\n prompt=\"mininet>\",\n timeout=10 )\n if re.search( \"no switch named\", response ):\n main.log.warn( ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a default or paginated collection of Switches without ports info [Arguments] | def fusion_api_get_switches_without_ports(self, uri=None, api=None, headers=None):
return self.switch.get(uri=uri, api=api, headers=headers, param='/withoutPorts') | [
"def list_switches(self):\n return [x for x,y in self.devices.items() if y.device_type == \"Switch\"]",
"def get_switches_all(self):\n return self.get_values(class_id=0x27, genre='System', type='List', readonly=False, writeonly=False)",
"def get_switches(\n self, node_id: Optional[int] = No... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a default or paginated collection of Switch Types. [Arguments] | def fusion_api_get_switch_types(self, param='', api=None, headers=None):
return self.swtypes.get(api=api, headers=headers, param=param) | [
"def list_switches(self):\n return [x for x,y in self.devices.items() if y.device_type == \"Switch\"]",
"def get_switches_all(self):\n return self.get_values(class_id=0x27, genre='System', type='List', readonly=False, writeonly=False)",
"def type_list():\n for type_ in orm.DataFlagType.select()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Uplink Set [Arguments] | def fusion_api_create_uplink_set(self, body, param='', api=None, headers=None):
return self.uplink_set.create(body, param, api, headers) | [
"def command_writeup_attach(syn, args):\n submission.attach_writeup(syn, args.writeupqueue, args.submissionqueue)",
"def addOnUserCreate(call, args=(), kwargs={}, nodeClass='*'):\n pass",
"def cli_createLinko():\n\n info = ('Creates a linkograph from an (inverse) labeling json'\n ' and an onto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates an Uplink Set [Arguments] | def fusion_api_edit_uplink_set(self, body, uri, api=None, headers=None):
return self.uplink_set.update(body, uri, api, headers) | [
"def fusion_api_create_uplink_set(self, body, param='', api=None, headers=None):\n return self.uplink_set.create(body, param, api, headers)",
"def links_update(link_from: str, link_to: str):\n if len(link_from) < 6:\n raise RuntimeError(\"from length must be at least 6\")\n if len(link_to)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes an Uplink Set from the appliance based on name OR uri [Arguments] | def fusion_api_delete_uplink_set(self, name=None, uri=None, api=None, headers=None):
return self.uplink_set.delete(name, uri, api, headers) | [
"def delete(self, name):\n if name:\n try:\n del self._uris[name]\n except KeyError:\n pass",
"def fusion_api_delete_network_set(self, name=None, uri=None, api=None, headers=None):\n return self.network_set.delete(name, uri, api, headers)",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a default or paginated collection of Uplink Sets. [Arguments] | def fusion_api_get_uplink_set(self, uri=None, param='', api=None, headers=None):
return self.uplink_set.get(uri=uri, api=api, headers=headers, param=param) | [
"def fusion_api_create_uplink_set(self, body, param='', api=None, headers=None):\n return self.uplink_set.create(body, param, api, headers)",
"def listSets(self, *args, **kwargs):\n \n pass",
"def getSets():",
"def listSets(*args, **kwargs):\n\n pass",
"def getSets(unique_name=None):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a User from the appliance based on name OR uri [Arguments] | def fusion_api_remove_user(self, name=None, uri=None, api=None, headers=None):
return self.user.delete(name, uri, api, headers) | [
"def delete_user():",
"def dropUser(userID):",
"def api_remove_user(username):\n db.removeUser(username)\n return redirect(url_for(\"api_show_users\"))",
"def revoke(self, user, name):\n raise NotImplementedError",
"def _remove_user(self):\n name = False\n while not name: #While n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the appliance's supported API versions [Example] ${resp} = Fusion Api Get Appliance Api Versions | | | def fusion_api_get_appliance_api_versions(self, api=None, headers=None):
return self.version.get(api=api, headers=headers) | [
"def server_api_versions(self):\n res = self._session.get(self._base_url, authenticated=False,\n raise_exc=False)\n # HTTP Not Found is a valid response for older (2.0.0) servers\n if res.status_code >= 400 and res.status_code != 404:\n ClientError.rais... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the XAPIVersion header to the specified value for all future requests. If no value is supplied, the value of ${XAPIVersion} is used if it exists else the appliances current version is queried and used [Example] ${resp} = |Fusion Api Set Default Api Version | | | def fusion_api_set_default_api_version(self, api=None):
return self.version.set(api=api) | [
"def add_api_version_header(response):\n response.headers.setdefault('X-API-Version', g.api_version)\n return response",
"def update_headers(headers, api_version):\n\n if api_version and api_version.ver_minor != 0:\n headers[\"OpenStack-API-Version\"] = \"volume \" + api_version.get_string()",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a POST rest call to the EM RIS interface through the Fusion appliance | def hal_api_post_em_ris(self, fusion_ip, em_ip, resource, data=None, header=None, retries=5): # pylint: disable=unused-argument
dcs = BuiltIn().get_variable_value("${DCS}")
nic = BuiltIn().get_variable_value("${FUSION_NIC}")
ssh = paramiko.client.SSHClient()
ssh.load_sys... | [
"def post_req(self, endpoint : str, data : dict):\r\n return self.session.post('https://127.0.0.1:' + self.app_port + endpoint, data = data, verify = False)",
"def post(self):\n text = 'HELLO from socnet API Server!'\n return push_to_mattermost(text)",
"def PostRequest(self):\n if se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a Claim call to the Perm Webapp on Fusion | def perm_api_perform_claim(self, fusion_ip, fusion_claim_ip, retries=5):
# Build URL
url = "https://" + fusion_ip + "/perm/rest/resources/atlas/tbird/fts?ipAddress=" + fusion_claim_ip
response = None
# Retry in case rest call fails.
# Currently calls to the w... | [
"def claim(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"claim\")",
"def createClaim(self,appId,currentOwnerId,resourceId,userClaimerId):\n data = {'idApp':appId,'idCurrentOwner':currentOwnerId,'idResource':resourceId,'idUserClaimer':userClaimerId}\n return ExecuteQuery().Query(self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compare two IP addresses. Return True if they are equal. False otherwise | def ip_address_match(self, ip1, ip2):
# Build IP objects
converted_ip1 = IPy.IP(ip1)
converted_ip2 = IPy.IP(ip2)
if converted_ip1 == converted_ip2:
return True
else:
return False | [
"def compare_ip(ip1, ip2):\n return cmp(normalize_ip(ip1), normalize_ip(ip2))",
"def is_ip_address_equal(ip1, ip2):\n if Convert.is_valid_ipv6_address(ip1) and Convert.is_valid_ipv6_address(ip2):\n if Convert.is_ipv6_equal(ip1, ip2):\n return True\n else:\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a Deployment Manager. [Arguments] | def fusion_api_get_deployment_manager(self, uri=None, param='', api=None, headers=None):
return self.dep_mgr.get(uri=uri, api=api, headers=headers, param=param) | [
"def get_manager(api_version=None):\n from manager import get_keystone_manager\n return get_keystone_manager(get_local_endpoint(), get_admin_token(),\n api_version)",
"def _get_deployment_group_manager(groups_dict_list, node_lookup):\n return DeploymentGroupManager(groups_d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Deployment Manager. [Arguments] | def fusion_api_create_deployment_manager(self, body, api=None, headers=None):
return self.dep_mgr.create(body=body, api=api, headers=headers) | [
"def create_podmanager(cls, values):\n return cls.dbdriver.create_podmanager(values)",
"def create_manager(self, username, tenancy):\n raise NotImplementedError",
"def create_deployment(self, request, namespace):\n return self._create(\n request,\n u\"deplo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates a Deployment Manager. [Arguments] | def fusion_api_update_deployment_manager(self, body=None, uri=None, api=None, headers=None):
return self.dep_mgr.update(body=body, uri=uri, api=api, headers=headers) | [
"def manager_update(self, manager, config):\n self.request('/v1.1/managers/configs/%s' % manager, 'POST', body=config)",
"def update_podmanager(cls, podmanager_uuid, values):\n return cls.dbdriver.update_podmanager(podmanager_uuid, values)",
"def fusion_api_update_hypervisor_manager(self, body=Non... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a Deployment Manager. [Arguments] | def fusion_api_delete_deployment_manager(self, name=None, uri=None, api=None, headers=None):
return self.dep_mgr.delete(name=name, uri=uri, api=api, headers=headers) | [
"def delete_podmanager(cls, podmanager_uuid):\n cls.dbdriver.delete_podmanager(podmanager_uuid)",
"def manager_remove(self, manager):\n self.request('/v1.1/managers/configs/%s' % manager, 'DELETE')",
"def delete_deployment(request, deployment, **_kwargs):\n pass",
"def fusion_api_delete_hyper... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a hypervisor Manager. [Arguments] | def fusion_api_get_hypervisor_manager(self, uri=None, param='', api=None, headers=None):
return self.hypervisor_mgr.get(uri=uri, api=api, headers=headers, param=param) | [
"def get_manager(self) -> \"ManagerAPI\":\n ...",
"def get_manager():\n\n return multiprocessing.Manager()",
"def get_manager(api_version=None):\n from manager import get_keystone_manager\n return get_keystone_manager(get_local_endpoint(), get_admin_token(),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a hypervisor Manager. [Arguments] | def fusion_api_create_hypervisor_manager(self, body, api=None, headers=None):
return self.hypervisor_mgr.create(body=body, api=api, headers=headers) | [
"def create_manager(self, username, tenancy):\n raise NotImplementedError",
"def fusion_api_get_hypervisor_manager(self, uri=None, param='', api=None, headers=None):\n return self.hypervisor_mgr.get(uri=uri, api=api, headers=headers, param=param)",
"def _create(params, *, stdout, stderr):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates a hypervisor Manager. [Arguments] | def fusion_api_update_hypervisor_manager(self, body=None, uri=None, api=None, headers=None):
return self.hypervisor_mgr.update(body=body, uri=uri, api=api, headers=headers) | [
"def manager_update(self, manager, config):\n self.request('/v1.1/managers/configs/%s' % manager, 'POST', body=config)",
"def setHostManager(self, manager):\n self._hostManager = manager\n self.updateActionState()",
"def fusion_api_create_hypervisor_manager(self, body, api=None, headers=Non... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a hypervisor Manager. [Arguments] | def fusion_api_delete_hypervisor_manager(self, name=None, uri=None, api=None, headers=None):
return self.hypervisor_mgr.delete(name=name, uri=uri, api=api, headers=headers) | [
"def delete_podmanager(cls, podmanager_uuid):\n cls.dbdriver.delete_podmanager(podmanager_uuid)",
"def manager_remove(self, manager):\n self.request('/v1.1/managers/configs/%s' % manager, 'DELETE')",
"def remove_node(client, logger, hostname):\n check_manager_exists(client.manager.get_managers(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a Hypervisor clusters. [Arguments] | def fusion_api_get_hypervisor_clusters(self, uri=None, param='', api=None, headers=None):
return self.hypervisor_clusters.get(uri=uri, api=api, headers=headers, param=param) | [
"def get_clusters():\n return clusters",
"def get_clusters():\n try:\n cd('/JMSSystemResources')\n clusters = cmo.getClusters()\n lista = []\n for cluster in clusters:\n a = str(cluster)\n a = a.split(\"=\")\n a = a[1].split(\",\")\n li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a Hypervisor cluster profile. [Arguments] | def fusion_api_get_hypervisor_cluster_profile(self, uri=None, param='', api=None, headers=None):
return self.cluster_profile.get(uri=uri, api=api, headers=headers, param=param) | [
"def fusion_api_get_hypervisor_host_profile(self, uri=None, param='', api=None, headers=None):\n return self.host_profile.get(uri, api, headers, param)",
"def get_profile():\n return Profile.get_profile()",
"def minikube_profile():\n try:\n ''.join(shell(\"which minikube\"))\n except ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a hypervisor cluster profile. [Arguments] | def fusion_api_create_hypervisor_cluster_profile(self, body, api=None, headers=None):
return self.cluster_profile.create(body=body, api=api, headers=headers) | [
"def test_create_hyperflex_cluster_profile(self):\n pass",
"def create_cluster():\n config = get_kube_config()\n command = CLUSTER_CREATE_COMMAND.replace('\\n','').format(cluster_name=config['cluster_name'],\n project_name=config['project_na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates a hypervisor cluster profile. [Arguments] | def fusion_api_update_hypervisor_cluster_profile(self, uri=None, body=None, api=None, headers=None):
return self.cluster_profile.update(body=body, uri=uri, api=api, headers=headers) | [
"def update_profile(client, logger):\n logger.info('Fetching the cluster nodes list...')\n nodes = client.manager.get_managers().items\n _update_profile_cluster_settings(nodes, logger=logger)\n logger.info('Profile is up to date with {0} nodes'\n .format(len(env.profile.cluster)))",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a hypervisor cluster profile. [Arguments] | def fusion_api_delete_hypervisor_cluster_profile(self, name=None, uri=None, api=None, headers=None):
return self.cluster_profile.delete(name, uri, api, headers) | [
"def test_delete_hyperflex_cluster_profile(self):\n pass",
"def delete_network_profile(arn=None):\n pass",
"def delete(profile, name):\n client = boto3client.get(\"iam\", profile)\n params = {}\n params[\"InstanceProfileName\"] = name\n return client.delete_instance_profile(**params)",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a virtual switch layout. [Arguments] | def fusion_api_create_virtual_switch_layout(self, body, api=None, headers=None):
return self.cluster_profile.create(body=body, api=api, headers=headers, param='/virtualswitch-layout') | [
"def create_layout(self):\n self.place_instances()\n self.route_all()\n # self.add_lvs_correspondence_points()\n self.add_boundary()\n self.DRC_LVS()",
"def create_svs(self, svs_name, vmnic, num_ports=8):\n\n svs = vim.host.VirtualSwitch.Specification()\n svs.numPo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a Hypervisor host profile. [Arguments] | def fusion_api_get_hypervisor_host_profile(self, uri=None, param='', api=None, headers=None):
return self.host_profile.get(uri, api, headers, param) | [
"def get_profile():\n return Profile.get_profile()",
"def fusion_api_get_hypervisor_cluster_profile(self, uri=None, param='', api=None, headers=None):\n return self.cluster_profile.get(uri=uri, api=api, headers=headers, param=param)",
"def get_instance_profile(self, profile):\n try:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates a hypervisor host profile. [Arguments] | def fusion_api_update_hypervisor_host_profile(self, uri=None, body=None, api=None, headers=None):
return self.host_profile.update(body, uri, api, headers) | [
"def fusion_api_update_hypervisor_cluster_profile(self, uri=None, body=None, api=None, headers=None):\n return self.cluster_profile.update(body=body, uri=uri, api=api, headers=headers)",
"def UpdateProfile(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)",
"def u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Edit the remote support to initiate remote support registration [Example] ${resp} = Fusion Api Edit Remote Support | | | | def fusion_api_edit_remote_support(self, body, api=None, headers=None):
return self.remote_support.update(body, api=api, headers=headers) | [
"def i_support_api(self):",
"def do_response(data):\n def on_done(i):\n if i == -1:\n return\n\n cite_key = data[i][2]\n view = sublime.active_window().active_view()\n view.run_command(\"dblp_insert_result\", {\"text\": cite_key})\n\n sublime.active_window().show_quick... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the remote support configuration details [Example] ${resp} = Fusion Api Get Configuration | | | | def fusion_api_get_configuration(self, uri=None, param='', api=None, headers=None):
return self.configuration.get(uri=uri, api=api, headers=headers, param=param) | [
"def get_config (self):\n # ret = core.adaptation.controller_adapter.domains.components[\n # 'OPENSTACK'].rest_adapter.get_config()\n # print \"Return: \", ret\n # print core.adaptation.controller_adapter.domains.components[\n # 'OPENSTACK'].rest_adapter._response.text\n pass",
"def get():\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create OS Deployment Server. [Arguments] | def fusion_api_create_os_deploymentserver(self, body, api=None, headers=None):
return self.osds.create(body, api, headers) | [
"def create(ctx, cpu, speed, memory, password, attach_drive, create_drive, boot_cdrom, smp):\n output(ctx.obj.create_server(ctx.obj.server_name, cpu, speed, memory, password, attach_drive, create_drive, boot_cdrom, smp))",
"def main():\n args = parse_arguments()\n log_level = 'INFO'\n if args.debug:\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete OS Deployment server. [Arguments] | def fusion_api_delete_os_deploymentserver(self, name=None, uri=None, param='', api=None, headers=None):
return self.osds.delete(name=name, uri=uri, param=param, api=api, headers=headers) | [
"def delete_server(self):\n self._command_direct(self.command_delete_server, self.env['pwd'])",
"def server_delete(self, name):\n raw_output = self.openstack('server delete ' + name)\n self.assertOutput('', raw_output)",
"def delete_server(conn,server):\n\n conn.compute.delete_server(ser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets value of the OS Deployment Server is available [Arguments] | def fusion_api_get_os_deploymentserver(self, uri=None, param='', api=None, headers=None):
return self.osds.get(uri=uri, api=api, headers=headers, param=param) | [
"def _get_os_version(self):\n\n output = self.command(\"sonic-cfggen -y /etc/sonic/sonic_version.yml -v build_version\")\n return output[\"stdout_lines\"][0].strip()",
"def server_version(self) -> Any:\n return pulumi.get(self, \"server_version\")",
"def get_xen_api_server(self):\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets value of an i3s appliance [Arguments] | def fusion_api_get_i3sappliance_uri(self, uri=None, param='', api=None, headers=None):
return self.osds.geti3suri(uri=uri, api=api, headers=headers, param=param) | [
"def get_value(self, bucket):\n return bucket[\"key\"]",
"def get(self, item_type, entry_name):\n armor = ArmorData(name=entry_name)\n if not hasattr(armor, 'level'):\n return {\"Error\": f\"'{entry_name}' not found in {item_type} armor. \"\n f\"Try this: '{NS.ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets OS Deployment Plan [Arguments] | def fusion_api_get_os_deploymentplan(self, uri=None, param='', api=None, headers=None):
return self.osds.getosdp(uri=uri, api=api, headers=headers, param=param) | [
"def get_deployment_parameters(plan_name):\n pass",
"def i3s_api_get_deploymentplan(self, uri=None, param='', api=None, headers=None):\n return self.deploymentplan.get(uri=uri, api=api, headers=headers, param=param)",
"def deployment_plan(self):\n if self.__deployment_plan is None:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds Fabric Manager to One View [Arguments] | def fusion_api_create_fabric_manager(self, body, api=None, headers=None):
return self.fabricmanager.post(body, api, headers) | [
"def setViewManager(vm, prefClass=Prefs):\n prefClass.settings.setValue(\"UI/ViewManager\", vm)",
"def add_view(self, *args, **kwargs):\n return self._resources_manager.add_view(*args, **kwargs)",
"def addView(self):\n canv = self.newView()\n if len(self.all) > 0:\n # copy def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the Fabric Manager details for the provided name or list of all Fabric Managers if name is not provided [Arguments] | def fusion_api_get_fabric_manager(self, uri=None, param='', api=None, headers=None):
return self.fabricmanager.get(uri=uri, api=api, headers=headers, param=param) | [
"def query_usr_manager(self, manager_name):",
"def fusion_api_get_fabric_manager_tenants(self, uri, name=None, param='', api=None, headers=None):\n param = '/tenants/'\n if name:\n param += '?&filter=\"\\'name\\' == \\'%s\\'\"' % (name)\n return self.fabricmanager.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes the Fabric Manager [Arguments] | def fusion_api_delete_fabric_manager(self, name, uri=None, api=None, headers=None):
return self.fabricmanager.delete(name=name, uri=uri, api=api, headers=headers) | [
"def delete(args, config):\n print('Deletes a selected HPC fleet with name \"{}\"'.format(args.fleet_name))",
"def FabricServerPool_delete():\n\n req = {\n 'cmd':'$FabricServerPool.delete',\n 'args':{\n 'arg1': 'arg1v',\n 'arg2': 'arg2v'\n }\n }\n\n errorNYI(req['cmd'])\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Edits Fabric Manager [Arguments] | def fusion_api_edit_fabric_manager(self, body, uri, api=None, headers=None):
return self.fabricmanager.put(body=body, uri=uri, api=api, headers=headers) | [
"def cli_edit(args):\n bm.edit()",
"def edit_cmd(args):\n cmd = commands.Edit(args.args, color=args.color)\n return cmd",
"def edit_cmd(args):\n cmd = commands.Edit(args.alias, cmd_args=args.cmd_args, color=args.color)\n return cmd",
"def edit(argv):\n output = lib.output.CLIoutput(\"vadapte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets Tenants for the provided Fabric Manager [Arguments] | def fusion_api_get_fabric_manager_tenants(self, uri, name=None, param='', api=None, headers=None):
param = '/tenants/'
if name:
param += '?&filter="\'name\' == \'%s\'"' % (name)
return self.fabricmanager.get(uri=uri, api=api, headers=headers, param=param) | [
"def get_tenants():\n # these are the tenant_id strings configured for the service -\n tenants_strings = conf.tenants\n result = []\n # the tenants service is a special case, as it must be a) configured to serve all tenants and b) actually maintains\n # the list of tenants in its own DB. in this case... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initiates Fabric Manager Refresh using Snapshot API [Arguments] | def fusion_api_fabric_manager_refresh(self, body, uri, api=None, headers=None):
param = '/snapshot/'
return self.fabricmanager.put(body=body, uri=uri, param=param, api=api, headers=headers) | [
"def request_refresh(*args):\n return _ida_kernwin.request_refresh(*args)",
"def execute_refresh_action(retriever: 'Retriever', section: 'AoE2FileSection', uuid: UUID) -> None:\n handle_retriever_dependency(retriever, \"refresh\", section, uuid)",
"def system_snapshot(self):\n logging.warn('Requestin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets Reports for Fabric Manager [Arguments] Uri of the existing Fabric Manager or Tenant | def fusion_api_get_fabric_manager_report(self, uri, api=None, headers=None):
param = '/report/'
return self.fabricmanager.get(uri=uri, api=api, headers=headers, param=param) | [
"def fusion_api_get_fabric_manager(self, uri=None, param='', api=None, headers=None):\n return self.fabricmanager.get(uri=uri, api=api, headers=headers, param=param)",
"def fusion_api_get_fabric_manager_tenants(self, uri, name=None, param='', api=None, headers=None):\n param = '/tenants/'\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds an rackmaager to the appliance [Arguments] | def fusion_api_add_rack_manager(self, body, api=None, headers=None):
return self.rackmanager.post(body, api, headers) | [
"def add_app(parser):\n parser.add_argument('-a', '--app', help='Spinnaker Application name', required=True)",
"def fusion_api_add_rack(self, body, api=None, headers=None):\n return self.rack.create(body, api, headers)",
"def create_rack(self, datacenter, name, vlan_id_min, vlan_id_max, nrsq):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a Rack Manager [Arguments] | def fusion_api_get_rack_manager(self, uri=None, api=None, headers=None):
return self.rackmanager.get(uri=uri, api=api, headers=headers) | [
"def get_manager(self) -> \"ManagerAPI\":\n ...",
"def args(self):\n return self.args_parser.parse_args()",
"def fusion_api_get_hypervisor_manager(self, uri=None, param='', api=None, headers=None):\n return self.hypervisor_mgr.get(uri=uri, api=api, headers=headers, param=param)",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes Rack Manager from the appliance based on uri [Arguments] | def fusion_api_delete_rack_manager(self, uri, name=None, param='', api=None, headers=None):
return self.rackmanager.delete(uri=uri, name=name, param=param, api=api, headers=headers) | [
"def fusion_api_remove_rack(self, name=None, uri=None, api=None, headers=None):\n return self.rack.delete(name, uri, api, headers)",
"def fusion_api_remove_san_manager(self, name=None, uri=None, api=None, headers=None):\n return self.dm.delete(name, uri, api, headers)",
"def fusion_api_del... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize particles to be consistent with a uniform prior. Each particle is a tuple of ghost positions. Use self.numParticles for | def initializeParticles(self):
import itertools
import random
#create a list of possible ghost permutations, where each of three ghosts can be on any of the legal positions in the boards.
permutations = list(itertools.product(self.legalIntentions, repeat=self.numAgents))
... | [
"def init_particles(self, num_particles):\n self.num_particles = num_particles\n self.particle_pos = self.rng.uniform(-np.pi, np.pi, size=self.num_particles)\n self.particle_wgts = np.ones(num_particles) * 1/num_particles # uniform weight initialization",
"def initialize(self, particles):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the value of the ADDONSPATH variable. | def get_cached_addon_path():
settingspath = get_cached_setting_path()
if not settingspath:
logger.error("#SETTINGSPATH# resolution required but was not found")
return
return os.path.join(settingspath, "Addons") + "\\" | [
"def getUtilityPath(self):\n return self.getParameter(\"UTILITY_PATH\")",
"def _GetSystemPath():\n return encoding_util.GetEncodedValue(os.environ, \"PATH\")",
"def getapxs_location():\n return getconfigure_option(\"APXS\")",
"def get_PATH():\n return os.getenv(\"PATH\")",
"def get_path():\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the VOLTHA PORT object for this port | def get_port(self):
if self._port is None:
self._port = Port(port_no=self._port_no,
label=self._label,
type=Port.PON_OLT,
admin_state=AdminState.ENABLED,
oper_status=OperStatus.ACT... | [
"def get_port(self):\n return self.__port",
"def getPort(self):\n return _yarp.Contact_getPort(self)",
"def orPort(self):\n return self.port",
"def _get_port_speed(self):\n return self.__port_speed",
"def get_port_number(self):\n return self.port",
"def viewPort(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the VOLTHA logical port for this port. For PON ports, a logical port is not currently created, so always return None | def get_logical_port(self):
return None | [
"def get_port(self):\n if self._port is None:\n self._port = Port(port_no=self._port_no,\n label=self._label,\n type=Port.PON_OLT,\n admin_state=AdminState.ENABLED,\n oper_status=Ope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process PON status poll request | def process_status_poll(self, status):
self.log.debug('process-status-poll', status=status)
if self._admin_state != AdminState.ENABLED:
return
# Get new/missing from the discovered ONU leaf. Stale ONUs from previous
# configs are now cleaned up during h/w re-sync/reflow.
... | [
"def _poll(self) -> None:\n\n while not self.finished():\n self.update_status()\n while not self.finished():\n self._delay()\n self.update_status()\n\n if self._failed(self.status()):\n raise OperationFailed(\"Operation failed or canceled\")\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process ONU status for this PON | def _update_onu_status(self, onus):
for onu_id, onu_status in onus.iteritems():
if onu_id in self._onu_by_id:
self._onu_by_id[onu_id].rssi = onu_status.rssi
self._onu_by_id[onu_id].equalization_delay = onu_status.equalization_delay
self._onu_by_id[onu_... | [
"def process_status_poll(self, status):\n self.log.debug('process-status-poll', status=status)\n\n if self._admin_state != AdminState.ENABLED:\n return\n\n # Get new/missing from the discovered ONU leaf. Stale ONUs from previous\n # configs are now cleaned up during h/w re-sy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse through available xPON information for ONU configuration settings | def _get_onu_info(self, serial_number):
try:
from flow.demo_data import get_tconts, get_gem_ports, get_onu_id
if self.activation_method == "autoactivate":
onu_id = get_onu_id(serial_number)
if onu_id is None:
onu_id = self.... | [
"def _parse_juniper(config):",
"def _parse_knx(self, config):\n\t\tif \"knx\" in config:\n\t\t\tself._knx = config[\"knx\"]\n\t\tfor item in self._knx[\"sensors\"]:\n\t\t\tif not \"address\" in item:\n\t\t\t\traise ValueError(\"Missing address for KNX sensor\")\n\t\tfor item in self._knx[\"switches\"]:\n\t\t\tif ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when a new ONU is discovered and VOLTHA device adapter needs to be informed | def activate_onu(self, onu):
if self.olt.autoactivate:
self.log.info('activate-onu', onu=onu)
olt = self.olt
adapter = self.adapter_agent
channel_id = onu.onu_vid
proxy = onu.proxy_address
# NOTE: The following method will be deprecated.... | [
"def discover(self):\n self.ola_thread.run_discovery(self.universe.get(), self._upon_discover)\n if self.auto_disc.get():\n self.ola_thread.add_event(5000, self.discover)\n else: \n print \"auto_disc is off\"",
"def device_connect(self):\n pass",
"def connectAdapter(self):\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete/enable/disable a specified channel partition on this PON. When creating a new Channel Partition, create it disabled, then define any associated Channel Pairs. Then enable the Channel Partition. | def channel_partition(self, name, partition=0, xpon_system=0, operation=None):
if operation.lower() not in ['delete', 'enable', 'disable']:
raise ValueError('Unsupported operation: {}'.format(operation))
try:
xml = 'interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"'... | [
"def channel_pair(self, name, partition, operation=None, **kwargs):\n if operation.lower() not in ['delete', 'enable', 'disable']:\n raise ValueError('Unsupported operation: {}'.format(operation))\n\n try:\n xml = 'interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create/delete a channel pair on a specific channel_partition for a PON | def channel_pair(self, name, partition, operation=None, **kwargs):
if operation.lower() not in ['delete', 'enable', 'disable']:
raise ValueError('Unsupported operation: {}'.format(operation))
try:
xml = 'interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"'
... | [
"def channel_partition(self, name, partition=0, xpon_system=0, operation=None):\n if operation.lower() not in ['delete', 'enable', 'disable']:\n raise ValueError('Unsupported operation: {}'.format(operation))\n\n try:\n xml = 'interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evaluates calls from call_queue and places the results in result_queue. This worker is run in a separate process. | def _process_worker(call_queue, result_queue):
while True:
call_item = call_queue.get(block=True)
if call_item is None:
# Wake up queue management thread
result_queue.put(os.getpid())
return
try:
r = call_item.fn(*call_item.args, **call_item.kw... | [
"def _process_worker(call_queue, result_queue, shutdown):\n while True:\n try:\n call_item = call_queue.get(block=True, timeout=0.1)\n except queue.Empty:\n if shutdown.is_set():\n return\n else:\n try:\n r = call_item.fn(*call_i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a BGR color tuple (e.g. (0, 147, 255)) to a color tuple that can be used by Matplotlib (e.g. (0, 0.5764705882352941, 1)). | def color_tuple_bgr_to_plt(color_tuple):
return (color_tuple[2]/255, color_tuple[1]/255, color_tuple[0]/255) | [
"def convert_color_to_matplotlib_tuple(rgb_list):\n rgb_list = [col/255 for col in rgb_list]\n return tuple(rgb_list)",
"def int2color_tuple(x):\n red_val = int(1000 * x % 255)\n green_val = int(10000 * x % 255)\n blue_val = int(100000 * x % 255)\n return red_val, green_val, blue_val",
"def co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs the KolmogorovSmirnov 1or2sided tests modified for right censored timetodeath data, based on residues calculated from functions KSm_2samples or KSm_gof. The test statistic is based on a timetransformed Brownian bridge, more precisely, the sumprema of a Brownian bridge restricted to (0, maxcdf). Asymptotic dist... | def KSm_test(residues, maxcdf, alternative='two-sided', alpha=0.05):
Ystats = residues
R_MaxCDF = maxcdf
R_func = np.sqrt(R_MaxCDF-R_MaxCDF*R_MaxCDF)
if alternative=='two-sided':
A_MaxAbsY = np.max(np.abs(Ystats))
prob_BrownianBridge = 1-norm.cdf(A_MaxAbsY/R_func)... | [
"def kolmogorov_smirnov(data, alternative):\n\n if len(data) != 2:\n raise ValueError(\"2 groups are needed\")\n\n if alternative != \"<>\":\n raise ValueError(\"KS doesn't work on 1-sided problems\")\n\n a = data[0]\n b = data[1]\n\n _, p = stats.ks_2samp(a, b)\n return p",
"def k... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Precreate N partitions ahead of time according to the specified interval unit and interval. | def postgres_auto_partition(
model: PostgresPartitionedModel,
count: int,
interval_unit: PostgresAutoPartitioningIntervalUnit,
interval: int,
start_from: Optional[date] = None,
using="default",
):
connection = connections[using]
with connection.cursor() as cursor:
table = conne... | [
"def createSmoothPartition(*arg):\n createPartition()\n for smoothSet in smoothSetList():\n addToPartition(smoothSet)",
"def test_partitioner(self):\n\n np.random.seed(TEST_SEED)\n record_batches = [\n pa.RecordBatch.from_arrays([pa.array([x])], ['a'])\n for x in np.random.randint... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render Hebrew in a dataframe. | def pretty_hebrew(val):
return 'font-size:20px; font-family: Times New Roman; text-align: right; max-width: 500px' | [
"def ascii_print(df):\n print(ascii_table(df))",
"def test_dataframe_as_html(self):\n import pandas as pd\n import sho\n df = pd.DataFrame([{\"a\":\"b\"}])\n sho.w(df)\n #import seaborn as sns\n #iris_df = sns.load_dataset('iris')\n #sho.w(iris_df)",
"def df_h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Highlights values of significance (Fishers > or < 1.3) | def highlight_sig(s, sig_up=1.3, sig_down=-1.3):
if s > sig_up:
color = 'red'
elif sig_down and s < sig_down:
color = 'blue'
else:
color = ''
return f'color: {color}' | [
"def get_asterisks_for_pvalues(p_value: float) -> str:\n if p_value > 0.05:\n p_text = 'ns' # above threshold => not significant\n elif p_value < 1e-4:\n p_text = '****'\n elif p_value < 1e-3:\n p_text = '***'\n elif p_value < 1e-2:\n p_text = '**'\n else:\n p_text... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show proportion dataframe with highlighting. | def df_highlighter(pr_df, rule='max'):
if rule == 'max':
return pr_df.style.apply(highlight_max, 1)
elif rule == 'fishers':
return pr_df.style.applymap(highlight_sig)
else:
return pr_df.style | [
"def visualize(df:DataFrame) -> dict:\n pass",
"def leitner_proportions(df):\n denom = df.shape[0]\n prop_dict = {}\n\n for i in range(1,6):\n df_i = df[df['comfort_level'] == i]\n numer = df_i.shape[0]\n prop_dict[i] = numer / denom\n\n prop_df = pd.DataFrame.from_dict([pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a client item from pypodio, from the app_id given to the podioApi object when it was created. Optionally it receives an app_token; in that case it doesn't need to fetch it from the database | def _getClient(self, app_token=None):
if app_token is None:
from . import models
app_token = models.Aplicacion.objects.get(app_id=self.app_id).app_token
return api.OAuthAppClient(settings.CLIENT_ID, settings.CLIENT_SECRET, self.app_id, app_token) | [
"def client(app=None):\n fs_client = _utils.get_app_service(app, _FIRESTORE_ATTRIBUTE, _FirestoreClient.from_app)\n return fs_client.get()",
"def find_client(self, client_id):\n return self.__repo.find(client_id)",
"def get(client_id):\n return Client.query.filter_by(client_id=client_id).first()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns raw information of the api object's application, as a Python dictionary. | def getAppInfo(self):
data = self._client.Application.find(self.app_id)
return data | [
"def get_app_info(self):\n return {'name': self.app_name,\n 'language': self.app_lang,\n 'version': self.app_version,\n 'model': self.app_model}",
"def app_info(self):\n return self._app_info",
"def get_application_information(self):\n\n\t\treturn self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all items belonging to a certain view, given by its ID. As all new methods, it automatically asks for the external ID | def get_items_by_view(self, view_id, depth=1):
data = self.filter_by_view(
int(self.app_id), int(view_id),{
'limit': 500,
},
)["items"]
fields = [self.make_dict(item, external_id=False, depth=depth, optimize=True) for item in data]
return fields | [
"def get_by_id(self, view_id):\n resourcePath = self.resource_path + \"/getbyid('{0}')\".format(view_id)\n view = View(self.context, resourcePath)\n return view",
"def view_item(request, id_item):\n item = get_object_or_404(Item, id=id_item)\n return render(request, 'inventory/item.html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a dictionary with the external_id of the item's fields ad keys, and their values as the dictionary values. | def makeDict(self, item, nested=False, no_html=False):
dictionary = dict([(field["external_id"], self.getFieldValue(field, nested, no_html)) for field in item["fields"]])
return {'item': item["item_id"], 'values':dictionary} | [
"def make_dict(self, item, external_id=True, no_html=False, depth=1, optimize=False):\n if external_id:\n key_type = \"external_id\"\n else:\n key_type = \"field_id\"\n\n dictionary = dict([(field[key_type], {\"label\":field[\"label\"], \"type\": field[\"type\"], \"value\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a dictionary with the external_id of the item's fields ad keys, and their values as the dictionary values. This second versions allows to choose between the field_id or the external_id for the dictionary's key, and adds the field type to the generated dictionary. | def make_dict(self, item, external_id=True, no_html=False, depth=1, optimize=False):
if external_id:
key_type = "external_id"
else:
key_type = "field_id"
dictionary = dict([(field[key_type], {"label":field["label"], "type": field["type"], "value": self.getFieldValue(fiel... | [
"def makeDict(self, item, nested=False, no_html=False):\n dictionary = dict([(field[\"external_id\"], self.getFieldValue(field, nested, no_html)) for field in item[\"fields\"]])\n return {'item': item[\"item_id\"], 'values':dictionary}",
"def _item_to_dict(self, raw_response):\n\n if 'Item' n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method takes an item's values and copies them to a new item in the target app. | def copy_item(self, origin_item_id, target_app_id, field_conversor, extra_data = None, silent=False, hook=True):
source_item = self.get_item(origin_item_id, external_id=False)
if extra_data is None:
destination_dict = {}
else:
destination_dict = extra_data
try:
... | [
"def copy_item(self, i, target):\n (k, d) = self.get_item(i)\n target.add_item(k, d)",
"def copy(self,item,destName,destDir=None):\n if item == self.lastKey: return\n destDir = destDir or self.dir\n apath = self.dir.join(item)\n apath.copyTo(destDir.join(destName))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move the fist based on mouse position. | def update(self):
pos = pygame.mouse.get_pos()
self.rect.midtop = pos
if self.punching:
self.rect.move_ip(5, 10) # move fist position in place | [
"def follow_mouse(self, mouse):\n half_width = self.width() / 2\n self.left = mouse.get_x() - half_width\n self.right = mouse.get_x() + half_width",
"def refresh_pos(self):\r\n\r\n self.mouse_pos = pygame.mouse.get_pos()",
"def movePoint(self):\r\n\t\tif self.isClicked:\r\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move the monkey across the scree, turnaround when it reaches the end. | def _walk(self):
new_pos = self.rect.move((self.move, 0)) # move 9 pixel to the right per frame
if self.rect.left < self.area.left or self.rect.right > self.area.right:
self.move = -self.move # move to the opposite direction when the chimp position exceeds the screen
new_pos = ... | [
"def back_to_pile():\n turn_around()\n move_to_first_free()\n turn_around()\n move()",
"def step(self):\n \n self.steer()\n self.wobble()\n self.move()",
"def move_and_sew():\r\n pass",
"def default_move(self):\r\n while True:\r\n self.start_button[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that two candidates with the same name is considered equal. | def test_equal(self):
candidate1 = pyrankvote.Candidate("Per")
candidate2 = pyrankvote.Candidate("Per")
candidate3 = pyrankvote.Candidate("Aase")
self.assertEqual(candidate1, candidate2, "These candidates should be equal/the same candidate.")
self.assertNotEqual(candidate1, can... | [
"def __eq__(self, name):\n return self.name == name",
"def __eq__(self, other: 'Pair') -> bool:\n return self.names == other.names",
"def __eq__(self, other):\n return self.name == other.name and self.gender == other.gender",
"def __eq__(self, other):\n return self.last_name == oth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that voting with two equal candidates raises DuplicateCandidateError | def test_raise_duplicate_candidate_error(self):
candidate1 = pyrankvote.Candidate("Per")
candidate2 = pyrankvote.Candidate("Per")
candidate3 = pyrankvote.Candidate("Aase")
def tester(_):
pyrankvote.Ballot(ranked_candidates=[candidate1, candidate2, candidate3])
msg ... | [
"def test_equal(self):\n\n candidate1 = pyrankvote.Candidate(\"Per\")\n candidate2 = pyrankvote.Candidate(\"Per\")\n candidate3 = pyrankvote.Candidate(\"Aase\")\n\n self.assertEqual(candidate1, candidate2, \"These candidates should be equal/the same candidate.\")\n self.assertNotE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that if one of the candidate that are voted for are not a cadidate, that a TypeError is raised | def test_raise_error_if_not_all_obj_are_candidate_objects(self):
candidate1 = pyrankvote.Candidate("Per")
candidate2 = "Aase"
def tester(_):
pyrankvote.Ballot(ranked_candidates=[candidate1, candidate2])
msg = "Candidate 2 is a string, not a Candidate, and should raise a Ty... | [
"def test_tally_no_candidates(self):\n self.init_elect_types()\n\n userA = models.User(\n name = \"UserA\",\n email = \"userA@eLect.com\",\n password = \"asdf\")\n\n session.add(userA)\n session.commit()\n\n electionA = models.Election(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a sum of integrals CpT for calculate dST and dHT | def CpT(dict_, T_react): # T_column - name of the column in of Cp temperature in Data
T = T_react
if not dict_['T(Cp)']:
return 0, 0
else:
CpT_S_ = dict_['a']*(math.log(T/298)) + dict_['b']*math.pow(10,-3)*(T-298) - 0.5*dict_['c']*math.pow(10,6)*(math.pow(T, -2) - math.pow(298,-2)) + dict_['d']*(0.5*math.pow(... | [
"def calculateTetTwt(C):\n tt = []\n fmu = np.arange(0,10,0.01)\n for c in C:\n fsat = sig(fmu,c)\n tt.append(1./fsat[fmu==1])\n ttnp = np.array(tt)\n return ttnp",
"def T_c(I, T_amb, V, D, R_list, N_cond=1, T_range=[298,323,348], a_s=0.9, e_s=0.9, I_sun=900.0, temp_factor=1, wind_fac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
'Accepted a dictionary of thermodynamic data and return Gibbs Free Energy of compound' | def gibbs_(dict_, T):
dST = dict_['S298'] + CpT(dict_, T)[0]
dHT = dict_['dH298'] + CpT(dict_, T)[1]/1000
return (dHT - T*dST/1000) | [
"def get_energy(pardict):\n return orm.Float(pardict['FreeE'])",
"def wf_gibbs_free_energy(structure, c=None):\n c = c or {}\n\n vasp_cmd = c.get(\"VASP_CMD\", VASP_CMD)\n db_file = c.get(\"DB_FILE\", DB_FILE)\n eos = c.get(\"EOS\", \"vinet\")\n qha_type = c.get(\"QHA_TYPE\", \"debye_model\")\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Action on one light by light_id. | def action_on_light_by_id(bridge, light_id, action):
if action == 'on':
bridge.set_light(light_id, 'on', True)
elif action == 'off':
bridge.set_light(light_id, 'on', False)
elif action == 'toggle':
current_state = bridge.get_light(light_id, 'on')
bridge.set_light(light_id, 'o... | [
"def addLight(self, id):\r\n\t\t\r\n\t\tnewLight = Light(id)\r\n\t\tself.lights[id] = newLight",
"async def Turn_On_Light_With_Color(\n light_id: int = Path(..., title=\"Numeric light identifier\", ge=0),\n color: str = Path(..., title=\"Color name or hexadecimal string\"),\n) -> Dict[str, Any]:\n busyli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Running the list of conf in a multiprocess pool | def pooling(lconf, poolsize=10):
pool = Pool(poolsize)
pool.map(worker, lconf) | [
"def forqs_parallel(configs):\n pool = Pool(21)\n pool.map(forqs_sim, configs)\n pool.close()\n pool.join()",
"def run_configurations(configurations, parallel=False):\n if parallel:\n config_results = \\\n mp.Pool().map(run_single_configuration, configurations)\n else:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Walk the raw_metrics and pass them over to the agent as a counter or gauge type and with the correct units defined | def add_stats(self):
units = self.get_unit_map()
for metric in self.raw_metrics:
unit, metric_type = units.get(metric, (DEFAULT_UNIT, DEFAULT_TYPE))
if metric_type == "counter":
# Unit/Second
unit = "/".join((unit, "Second"))
self.a... | [
"def to_metric(self):\r\n if self.units != 'metric':\r\n self.units = 'metric'\r\n for statement in self.statements:\r\n statement.to_metric()\r\n for tool in iter(self.tools.values()):\r\n tool.to_metric()\r\n for primitive in self.pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Walk the META dict and build a category/metric => [unit, type] map | def get_unit_map(self):
units = dict()
for t in META:
for c in META[t]:
for i in META[t][c]:
unit = DEFAULT_UNIT
if (isinstance(i, (tuple, list))):
val, unit = i
else:
... | [
"def to_metric(self):\r\n if self.units != 'metric':\r\n self.units = 'metric'\r\n for statement in self.statements:\r\n statement.to_metric()\r\n for tool in iter(self.tools.values()):\r\n tool.to_metric()\r\n for primitive in self.pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a list of names, return the values collected for those names as a list. If any are missing, then return None. | def get_values(self, names):
r = []
for n in names:
if n in self.raw_metrics:
r.append(self.raw_metrics[n])
else:
return None
return r | [
"def as_list(cls, names):\n if not names:\n return []\n split = [n.strip() for n in names.split(',')]\n return filter(lambda n: len(n) > 0, split)",
"def get_many_values(names):\n return {var.name: var.value for var in Variable.query.filter(Variable.name.in_(names)).all()}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a list of metric names, return the sum of their values if all of them exist in the raw metrics, otherwise return None. | def sum_of(self, names):
vals = self.get_values(names)
if vals is None:
return None
return sum(vals) | [
"def sum_keys(self, keys: List[str]) -> Optional[float]:\n total = None\n for key in keys:\n val = self.get_float(key)\n if val is not None:\n total = val if total is None else total + val\n return total",
"def get_values(self, names):\n r = []\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a list of metric names, return the result of the first subtracted by all others (a b c d ...). If any metric names do not exist, return None. | def diff_of(self, names):
vals = self.get_values(names)
if vals is None:
return None
return vals[0] - (sum(vals[1:])) | [
"def subtract(*args):\n return args[0] - reduce(lambda x, y: x + y, args[1:])",
"def subtract(*args):\n\n # TODO: Fill sum with the correct value, based on the\n # args provided.\n difference = str(args[0] - args[1])\n return difference",
"def get_union_metrics(metric_a, metric_b):\n if metric... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the raw metrics for a particular metric name if the value is a number. | def update_metric(self, metric, value):
if self.is_number(value):
self.logger.debug("Collected raw metric: %s = %s" % (metric, value))
self.raw_metrics[metric] = value | [
"def update(self, name: str, value: Union[Number, np.number]) -> None:\n self._metrics[name].update(name, value)",
"def set(self, name, value):\n self._metrics[name] = value",
"def update_metrics(self, round_num: int, metrics_to_append: Dict[str, Any]):\n raise NotImplementedError",
"def _upd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derive all of the custom newrelic metric data from what we've collected. | def derive_newrelic_stats(self):
self.logger.debug("Collecting stats for newrelic")
self.derive_newrelic_volume()
self.derive_newrelic_throughput()
self.derive_newrelic_innodb()
self.derive_newrelic_qcache()
self.derive_newrelic_slaves() | [
"def populate_metric_values(self):\n self.new_counter_metrics: Dict[iter8id, Dict[iter8id, CounterDataPoint]] = get_counter_metrics(\n self.counter_metric_specs, \n [version.spec for version in self.detailed_versions.values()],\n self.eip.start_time\n )\n \n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derive the newrelic read/write volume metrics | def derive_newrelic_volume(self):
# read and write volume
self.update_metric("newrelic/volume_reads", self.sum_of(["status/com_select", "status/qcache_hits"]))
self.update_metric("newrelic/volume_writes", self.sum_of(["status/com_insert", "status/com_insert_select",
... | [
"def derive_newrelic_stats(self):\n self.logger.debug(\"Collecting stats for newrelic\")\n self.derive_newrelic_volume()\n self.derive_newrelic_throughput()\n self.derive_newrelic_innodb()\n self.derive_newrelic_qcache()\n self.derive_newrelic_slaves()",
"def derive_newre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derive the newrelic throughput metrics | def derive_newrelic_throughput(self):
# read and write throughput
self.update_metric("newrelic/bytes_reads", self.sum_of(["status/bytes_sent"]))
self.update_metric("newrelic/bytes_writes", self.sum_of(["status/bytes_received"]))
# Connection management
vals = self.get_values(["s... | [
"def derive_newrelic_stats(self):\n self.logger.debug(\"Collecting stats for newrelic\")\n self.derive_newrelic_volume()\n self.derive_newrelic_throughput()\n self.derive_newrelic_innodb()\n self.derive_newrelic_qcache()\n self.derive_newrelic_slaves()",
"def metrics(self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derive the newrelic innodb metrics | def derive_newrelic_innodb(self):
# InnoDB Metrics
vals = self.get_values(["status/innodb_pages_created", "status/innodb_pages_read",
"status/innodb_pages_written", "status/innodb_buffer_pool_read_requests",
"status/innodb_buffer_pool_reads... | [
"def derive_newrelic_stats(self):\n self.logger.debug(\"Collecting stats for newrelic\")\n self.derive_newrelic_volume()\n self.derive_newrelic_throughput()\n self.derive_newrelic_innodb()\n self.derive_newrelic_qcache()\n self.derive_newrelic_slaves()",
"def test_get_all... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derive the newrelic qcache metrics | def derive_newrelic_qcache(self):
# Query Cache
vals = self.get_values(["status/qcache_hits", "status/com_select", "status/qcache_free_blocks",
"status/qcache_total_blocks", "status/qcache_inserts", "status/qcache_not_cached"])
if vals:
qc_hits, reads,... | [
"def derive_newrelic_stats(self):\n self.logger.debug(\"Collecting stats for newrelic\")\n self.derive_newrelic_volume()\n self.derive_newrelic_throughput()\n self.derive_newrelic_innodb()\n self.derive_newrelic_qcache()\n self.derive_newrelic_slaves()",
"def test_get_der... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derive newrelic status metrics about slaves | def derive_newrelic_slaves(self):
if self.has_slave_data is True:
self.update_metric("newrelic/replication_lag", self.sum_of(["slave/seconds_behind_master"]))
# both need to be YES, which is 1
running = self.sum_of(["slave/slave_io_running", "slave/slave_sql_running"])
... | [
"def slave_status():\n run_mysql_command(\"SHOW SLAVE STATUS\\G;\")",
"def GetSlaveStatuses(self):\n return self._slave_statuses",
"def _FetchSlaveStatuses(self):\n # Wait for slaves if we're a master, in production or mock-production.\n # Otherwise just look at our own status.\n slave_statuses =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the values from mysql, converting them to floats when necessary on|yes|true => 1 off|no|false => 0 null => 1 | def parse_metric_value(self, value):
if isinstance(value, str):
if value == "":
return None
# yes|true|on
if self.is_true.match(value):
return 1
# no|false|off
if self.is_false.match(value):
return 0
... | [
"def _map_database_value(val):\n if val == 'true':\n return True\n elif val == 'false':\n return False\n\n try:\n return int(val)\n except ValueError:\n pass\n\n try:\n return float(val)\n except ValueError:\n pass\n\n return val",
"def convertToFloat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the innodb status results and pull interesting metrics from it. | def parse_innodb_status_stats(self, cursor):
rows = list(cursor)
metrics = {
"history_list_length": "^History list length\s+(\d+)",
"log_sequence_number": "^Log sequence number\s+(\d+)",
"last_checkpoint": "^Last checkpoint at\s+(\d+)",
"queries_inside_inn... | [
"def nginx_status_metrics(self):\n\n try:\n nginx_status_conn = urllib2.urlopen(self.url)\n nginx_status_data = nginx_status_conn.read()\n self.nginx_status_available = True\n except urllib2.URLError:\n print 'status err URLError: check the URL and that Ngin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens compressed file .bz2 | def bz2_file_reader(path):
return bz2.open(path, 'rt') | [
"def bz2open(cls, name, mode=\"r\", fileobj=None, compresslevel=9, **kwargs):\n if mode not in (\"r\", \"w\", \"x\"):\n raise ValueError(\"mode must be 'r', 'w' or 'x'\")\n\n try:\n import bz2\n except ImportError:\n raise CompressionError(\"bz2 module is not av... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens compressed file .bz2 in bytes mode | def bz2_file_bytes_reader(path):
return bz2.open(path, 'rb') | [
"def compress_bz2(filename):\n bz2_filename = filename + '.bz2'\n\n with open(filename, 'rb') as og_file, bz2.BZ2File(bz2_filename, 'wb') as bz2_file:\n for data in iter(lambda : og_file.read(100 * 1024), b''):\n bz2_file.write(data)\n\n return bz2_filename",
"def bz2_file_reader(path):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens a txt file and loads tabseparated columns into a dictionary | def load_dict_from_txt_file(path, key_type=str, value_type=str):
with txt_file_reader(path) as txt_file:
return {key_type(key): value_type(value) for key, value in [line.strip().split('\t') for line in txt_file]} | [
"def load_data_from_text_file(filename):\n with open(filename) as fptr:\n lines = (line.split('\\t') for line in fptr)\n return dict((word, number) for word, number in lines)",
"def loadtwocol(infile):\n kvdict = {}\n with open(infile) as f:\n for nline, line in enumerate(f):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |