query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Creates a new identity provider in your tenancy. For more information, see `Identity Providers and Federation`__. You must specify your tenancy's OCID as the compartment ID in the request object. Remember that the tenancy is simply the root compartment. For information about OCIDs, see `Resource Identifiers`__. You mus... | def create_identity_provider(self, create_identity_provider_details, **kwargs):
resource_path = "/identityProviders"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_retry_token"
]
extra_kwargs = [_key for _... | [
"def create_identity_provider(module, sdk, cloud, name):\n\n if module.check_mode:\n return True, None\n\n description = module.params.get('description')\n enabled = module.params.get('enabled')\n domain_id = module.params.get('domain_id')\n remote_ids = module.params.get('remote_ids')\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new MFA TOTP device for the user. A user can have one MFA TOTP device. | def create_mfa_totp_device(self, user_id, **kwargs):
resource_path = "/users/{userId}/mfaTotpDevices"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_retry_token"
]
extra_kwargs = [_key for _key in six.iter... | [
"def create_drf_token(self):\n Token.objects.get_or_create(user=self.user)",
"def activate_mfa_totp_device(self, user_id, mfa_totp_device_id, mfa_totp_token, **kwargs):\n resource_path = \"/users/{userId}/mfaTotpDevices/{mfaTotpDeviceId}/actions/activate\"\n method = \"POST\"\n\n # Don... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new network source in your tenancy. You must specify your tenancy's OCID as the compartment ID in the request object (remember that the tenancy is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies) reside within the tenancy itself, unlike cloud resources s... | def create_network_source(self, create_network_source_details, **kwargs):
resource_path = "/networkSources"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_retry_token"
]
extra_kwargs = [_key for _key in si... | [
"def new_source(self, name):\n params = {\"name\": name}\n return JSONRPCRequest(self, \"newSource\", params)",
"def network_create(ctx, name, blueprint):\n network = ctx.obj['CLIENT'].network.create(name, blueprint)\n click.echo('Created network: %s' % network.name)",
"def source_ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a subscription to a region for a tenancy. | def create_region_subscription(self, create_region_subscription_details, tenancy_id, **kwargs):
resource_path = "/tenancies/{tenancyId}/regionSubscriptions"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_retry_token"
... | [
"def create_subscription(self):\n\n self.clear_subscriptions()\n\n # creating new subscription\n r = self.fitbit_service.post('http://api.fitbit.com/1/user/-/apiSubscriptions/%s.json' % self.userid, data={}, header_auth=True)\n logging.info('Adding new subscription for user %s. The code: %s Message: %s'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new SMTP credential for the specified user. An SMTP credential has an SMTP user name and an SMTP password. You must specify a description for the SMTP credential (although it can be an empty string). It does not have to be unique, and you can change it anytime with | def create_smtp_credential(self, create_smtp_credential_details, user_id, **kwargs):
resource_path = "/users/{userId}/smtpCredentials"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_retry_token"
]
extra_kw... | [
"def create_credential(user_name, sitename, accountname, password):\n new_credential = Credential(user_name, sitename, accountname, password)\n return new_credential",
"def create_new_credential(account,userName,password):\n new_credential = Credentials(account,userName,password)\n return new_credenti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new tag in the specified tag namespace. The tag requires either the OCID or the name of the tag namespace that will contain this tag definition. You must specify a name for the tag, which must be unique across all tags in the tag namespace and cannot be changed. The name can contain any ASCII character except... | def create_tag(self, tag_namespace_id, create_tag_details, **kwargs):
resource_path = "/tagNamespaces/{tagNamespaceId}/tags"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_retry_token"
]
extra_kwargs = [_k... | [
"def create_namespace_tags(self, namespace, **kwargs):\n url = 'metadefs/namespaces/%s/tags' % namespace\n data = json.dumps(kwargs)\n resp, body = self.post(url, data)\n self.expected_success(201, resp.status)\n body = json.loads(body)\n return rest_client.ResponseBody(res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new tag default in the specified compartment for the specified tag definition. If you specify that a value is required, a value is set during resource creation (either by the user creating the resource or another tag defualt). If no value is set, resource creation is blocked. If the `isRequired` flag is set t... | def create_tag_default(self, create_tag_default_details, **kwargs):
resource_path = "/tagDefaults"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_retry_token",
"opc_request_id"
]
extra_kwargs =... | [
"def __init__(self, default=NO_DEFAULT, required=False):\n self.default = default\n self.required = required",
"def register_option_pair(key, default_value):\n\n _OPTION_TEMPLATE[key] = default_value",
"def createDevIDAttr(shapefileName, defaultVal):\n\n inputds = ogr.Open(shapefileName,upda... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new tag namespace in the specified compartment. You must specify the compartment ID in the request object (remember that the tenancy is simply the root compartment). You must also specify a name for the namespace, which must be unique across all namespaces in your tenancy and cannot be changed. The name can c... | def create_tag_namespace(self, create_tag_namespace_details, **kwargs):
resource_path = "/tagNamespaces"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_retry_token"
]
extra_kwargs = [_key for _key in six.i... | [
"def create_namespace(self, request):\n return self._create(request, u\"namespaces\")",
"def create_namespaced_resource(namespace, body):\n api = get_api(body[\"apiVersion\"], body[\"kind\"])\n return api.create(namespace=namespace, body=body)",
"def create_namespace_tags(self, namespace, **kwa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes the specified compartment. The compartment must be empty. | def delete_compartment(self, compartment_id, **kwargs):
resource_path = "/compartments/{compartmentId}"
method = "DELETE"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]
extra_kwargs = [_key for _key in six.iterkey... | [
"def remove_compartment(compartment_id):\n logger = logging.getLogger(__name__)\n # Get the compartment then removes it\n compartment = Compartment.objects.get(id=compartment_id)\n try:\n with transaction.atomic():\n compartment.delete()\n except Database... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes the specified MFA TOTP device for the specified user. | def delete_mfa_totp_device(self, user_id, mfa_totp_device_id, **kwargs):
resource_path = "/users/{userId}/mfaTotpDevices/{mfaTotpDeviceId}"
method = "DELETE"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]
extra_kw... | [
"def delete_user_token(user_obj):\n Token.objects.filter(user=user_obj).delete()",
"def delete_user(self, user):\n # noinspection PyUnresolvedReferences\n self.delete(user)",
"def delete_user(user):\n logging.debug('{CRUD_operations} BEGIN function delete_user()')\n logging.debug('{CRUD_o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes the specified network source | def delete_network_source(self, network_source_id, **kwargs):
resource_path = "/networkSources/{networkSourceId}"
method = "DELETE"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]
extra_kwargs = [_key for _key in s... | [
"def delete_source(self, source_id):\n body = {\"sourceId\": source_id}\n url = f\"{self.base_url}/api/v1/sources/delete\"\n response = requests.post(url, json=body)\n return response.status_code",
"def delete(self, source):\n _source = self._source_prefix+source\n assert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes the specified SMTP credential for the specified user. | def delete_smtp_credential(self, user_id, smtp_credential_id, **kwargs):
resource_path = "/users/{userId}/smtpCredentials/{smtpCredentialId}"
method = "DELETE"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]
extra_... | [
"def delete_credential(self, credential):\r\n return self.delete(self.credential_path % (credential))",
"def delete_credential(self):\n\n Credentials.credential_list.remove(self)",
"def delete_credentials(self):\n Credentials.credential_details.remove(self)",
"def delete_credential(self)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes the the specified tag default. | def delete_tag_default(self, tag_default_id, **kwargs):
resource_path = "/tagDefaults/{tagDefaultId}"
method = "DELETE"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"opc_request_id",
"if_match"
]
extra_kwargs = [... | [
"def remove_default(self):\n if self.default_present:\n self.removeItem(0)\n self.default_present = False",
"def delete_default_value(self, attribute_name, classifier=None):\n if self.is_deleted:\n raise CException(f\"can't delete default value '{attribute_name!s}' o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the authentication policy for the given tenancy. You must specify your tenant\u2019s OCID as the value for the compartment ID (remember that the tenancy is simply the root compartment). | def get_authentication_policy(self, compartment_id, **kwargs):
resource_path = "/authenticationPolicies/{compartmentId}"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
... | [
"def get_credentials(tenant):\n print('Get credentials for: {}\\n'.format(tenant))\n path = 'secret/{}'.format(tenant)\n document = client.read(path)\n print('Credentials: {}\\n'.format(document))\n return document",
"def _get_tenant_ocid(self):\n if isinstance(self._provider, oci.signer.Sig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the specified compartment's information. This operation does not return a list of all the resources inside the compartment. There is no single API operation that does that. Compartments can contain multiple types of resources (instances, block storage volumes, etc.). To find out what's in a compartment, you must c... | def get_compartment(self, compartment_id, **kwargs):
resource_path = "/compartments/{compartmentId}"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
raise Value... | [
"def select_compartment(config_dict, prompt):\n try:\n oci_identity = oci.identity.IdentityClient(config_dict)\n oci_compartments = oci_identity.list_compartments(config_dict['tenancy'])\n except oci.exceptions.ServiceError as e:\n print_g('*** AUTHORISATION ERROR ***')\n sys.exit(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the specified MFA TOTP device for the specified user. | def get_mfa_totp_device(self, user_id, mfa_totp_device_id, **kwargs):
resource_path = "/users/{userId}/mfaTotpDevices/{mfaTotpDeviceId}"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if e... | [
"def GetOTP(user):\r\n return _ComputeOTP(_GetUserSecret(user),\r\n long(time.time() / _GRANULARITY))",
"def GetOTP(user):\n return _ComputeOTP(_GetUserSecret(user),\n long(time.time() / _GRANULARITY))",
"def create_mfa_totp_device(self, user_id, **kwargs):\n res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the specified tenancy's information. | def get_tenancy(self, tenancy_id, **kwargs):
resource_path = "/tenancies/{tenancyId}"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
raise ValueError(
... | [
"def tenancy(self):\n return self._tenancy",
"def get_tenancy(vm_):\n return config.get_cloud_config_value(\"tenancy\", vm_, __opts__, search_global=False)",
"def get_tenant_info(schema_name):\n with schema_context(schema_name):\n return Pharmacy.objects.filter(schema_name=schema_name).first... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the specified UserGroupMembership's information. | def get_user_group_membership(self, user_group_membership_id, **kwargs):
resource_path = "/userGroupMemberships/{userGroupMembershipId}"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if e... | [
"def user_get_group_membership(self, group):\n try:\n return GroupMembership.objects.get(user=self, group=group)\n except GroupMembership.DoesNotExist:\n return None",
"def fetch_their_members(our_group):\n\tgroup_id = our_group[\"groupId\"]\n\turl = f'{BASE_URL}/groups/{group_id}/members'\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets details on a specified work request. The workRequestID is returned in the opcworkrequestid header for any asynchronous operation in the Identity and Access Management service. | def get_work_request(self, work_request_id, **kwargs):
resource_path = "/workRequests/{workRequestId}"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
raise Val... | [
"def doi_info(self,doi):\n \n doi = _clean_doi(doi)\n \n url = self.BASE_URL + 'works/' + doi\n \n try:\n return self._make_get_request(url,models.work_single)\n except errors.RequestError:\n #TODO: Check for 404\n #last_response.stat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the API signing keys for the specified user. A user can have a maximum of three keys. Every user has permission to use this API call for their own user ID. An administrator in your organization does not need to write a policy to give users this ability. | def list_api_keys(self, user_id, **kwargs):
resource_path = "/users/{userId}/apiKeys"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
raise ValueError(
... | [
"def get_keys_from_user_id(self, user_id: int) -> list:\n path = os.path.join(self.api_address, 'users/{}/keys'.format(user_id))\n response = self.process_response_from_server(path)\n keys = [i[\"key\"] for i in response]\n return keys",
"def get_keys(user_id):\n\n db_conn = sqlite3... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the availability domains in your tenancy. Specify the OCID of either the tenancy or another of your compartments as the value for the compartment ID (remember that the tenancy is simply the root compartment). See `Where to Get the Tenancy's OCID and User's OCID`__. Note that the order of the results returned can ... | def list_availability_domains(self, compartment_id, **kwargs):
resource_path = "/availabilityDomains"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
raise Valu... | [
"def get_availability_domains(identity_client, compartment_id):\n result = pagination.list_call_get_all_results(\n identity_client.list_availability_domains,\n compartment_id\n )\n return result.data",
"def select_availability_domain(config_dict, compartment_id):\n try:\n oci_iden... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the compartments in a specified compartment. The members of the list returned depends on the values set for several parameters. With the exception of the tenancy (root compartment), the ListCompartments operation returns only the firstlevel child compartments in the parent compartment specified in `compartmentId`... | def list_compartments(self, compartment_id, **kwargs):
resource_path = "/compartments"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit",
"access_level",
"compartment_id_in_subtr... | [
"def getListOfCompartments(self):\n return self.model.getListOfCompartments()",
"def compartment_tree_build(conf: OCIConfig):\n global identity_client\n identity_client = oci.identity.IdentityClient(conf.config)\n #get_regions(conf)\n tree = []\n\n def _get_nested_resources(api_list_call: id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists all the tags enabled for costtracking in the specified tenancy. For information about costtracking tags, see `Using Costtracking Tags`__. | def list_cost_tracking_tags(self, compartment_id, **kwargs):
resource_path = "/tagNamespaces/actions/listCostTrackingTags"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit"
]
extra_kwarg... | [
"def getAllTags(self):",
"def list_tags():\n r = requests.get('http://api.greynoise.io:8888/v1/query/list')\n if r.status_code == 200:\n if 'tags' in r.json():\n return r.json()['tags']\n else:\n print(\"No tags found.\")\n else:\n return {}",
"def tag_list(re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the secret keys for the specified user. The returned object contains the secret key's OCID, but not the secret key itself. The actual secret key is returned only upon creation. | def list_customer_secret_keys(self, user_id, **kwargs):
resource_path = "/users/{userId}/customerSecretKeys"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
rai... | [
"def get_user_secret_keys(self):\n log.info('Getting all secrets for current api user (me)')\n return self.conn.get(url='object/secret-keys')",
"def get_keys_from_user_id(self, user_id: int) -> list:\n path = os.path.join(self.api_address, 'users/{}/keys'.format(user_id))\n response = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the dynamic groups in your tenancy. You must specify your tenancy's OCID as the value for the compartment ID (remember that the tenancy is simply the root compartment). See `Where to Get the Tenancy's OCID and User's OCID`__. | def list_dynamic_groups(self, compartment_id, **kwargs):
resource_path = "/dynamicGroups"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit"
]
extra_kwargs = [_key for _key in six.iterkey... | [
"def list(request):\n return render_to_response('rteacher/manage_groups_list.html', request, **klist(\n request=request\n ))",
"def list_groups(self):\n pass",
"def list_groups(request):\n return Group.objects.all()",
"def list_groups():\n init_dao(env('client_id'), env('clie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the Fault Domains in your tenancy. Specify the OCID of either the tenancy or another of your compartments as the value for the compartment ID (remember that the tenancy is simply the root compartment). See `Where to Get the Tenancy's OCID and User's OCID`__. | def list_fault_domains(self, compartment_id, availability_domain, **kwargs):
resource_path = "/faultDomains"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
rai... | [
"def get_tenant_list(conn: dict) -> dict:\n return get(conn, PCC_TENANT + \"/list\")",
"def get_availability_domains(identity_client, compartment_id):\n result = pagination.list_call_get_all_results(\n identity_client.list_availability_domains,\n compartment_id\n )\n return result.data",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists all the identity providers in your tenancy. You must specify the identity provider type (e.g., `SAML2` for identity providers using the SAML2.0 protocol). You must specify your tenancy's OCID as the value for the compartment ID (remember that the tenancy is simply the root compartment). See `Where to Get the Tena... | def list_identity_providers(self, protocol, compartment_id, **kwargs):
resource_path = "/identityProviders"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit"
]
extra_kwargs = [_key for _... | [
"def list(conn):\n try:\n return conn.get(url='/auth-providers')['providers']\n except SystemError as e:\n raise e",
"def get_providers(context):\n request = context[\"request\"]\n adapter = get_adapter(request)\n providers = adapter.list_providers(request)\n return sorted(provider... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the group mappings for the specified identity provider. | def list_idp_group_mappings(self, identity_provider_id, **kwargs):
resource_path = "/identityProviders/{identityProviderId}/groupMappings"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit"
]
... | [
"def list_groups(self):\n pass",
"def get_identity_groups(self):\n\t\tresult = {\n\t\t\t'success': False,\n\t\t\t'response': '',\n\t\t\t'error': '',\n\t\t}\n\n\t\tself.ise.headers.update({'Accept': 'application/vnd.com.cisco.ise.identity.identitygroup.1.0+xml'})\n\n\t\tresp = self.ise.get('{0}/config/ident... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the MFA TOTP devices for the specified user. The returned object contains the device's OCID, but not the seed. The seed is returned only upon creation or when the IAM service regenerates the MFA seed for the device. | def list_mfa_totp_devices(self, user_id, **kwargs):
resource_path = "/users/{userId}/mfaTotpDevices"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit",
"sort_by",
"sort_order"
... | [
"def list_user_devices(self, request):\n self.check_xsrf_token(self.request_state)\n user = user_lib.get_user_email()\n guest_permitted = config_model.Config.get('allow_guest_mode')\n device_message_list = []\n for device in device_model.Device.list_by_user(user):\n device_message_list.append(\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the network sources in your tenancy. You must specify your tenancy's OCID as the value for the compartment ID (remember that the tenancy is simply the root compartment). See `Where to Get the Tenancy's OCID and User's OCID`__. | def list_network_sources(self, compartment_id, **kwargs):
resource_path = "/networkSources"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit"
]
extra_kwargs = [_key for _key in six.iterk... | [
"def get_connected_sources(self):\n body = {\"workspaceId\": AIRBYTE_WORKSPACE_ID}\n url = f\"{self.base_url}/api/v1/sources/list\"\n response = requests.post(url, json=body)\n try:\n response_json = response.json()['sources']\n except Exception as e:\n loggi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the policies in the specified compartment (either the tenancy or another of your compartments). See `Where to Get the Tenancy's OCID and User's OCID`__. To determine which policies apply to a particular group or compartment, you must view the individual statements inside all your policies. There isn't a way to au... | def list_policies(self, compartment_id, **kwargs):
resource_path = "/policies"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit"
]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) i... | [
"def list_policies(self):\n client = self.connect(VAULT_TOKEN)\n return client.list_policies()",
"def get_policies():\n data = connect('GET', '/policies/')\n return dict((p['name'], p['template_uuid']) for p in data['policies'])",
"def list_policies(policystore_url, verbose):\n\n if verbo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the region subscriptions for the specified tenancy. | def list_region_subscriptions(self, tenancy_id, **kwargs):
resource_path = "/tenancies/{tenancyId}/regionSubscriptions"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
... | [
"def get_regions(conf: OCIConfig):\n\n global identity_client\n # loop over the full list of regions as we don't know in advance what are the subscribed regions\n for r in REGIONS:\n conf.workon_region = r\n identity_client = oci.identity.IdentityClient(conf.config)\n try:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the SMTP credentials for the specified user. The returned object contains the credential's OCID, the SMTP user name but not the SMTP password. The SMTP password is returned only upon creation. | def list_smtp_credentials(self, user_id, **kwargs):
resource_path = "/users/{userId}/smtpCredentials"
method = "GET"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
if extra_kwargs:
raise Valu... | [
"def list_credentials(user):\n return Credentials.list_credentials(user)",
"def credentials():\n user_name = request.args.get('user_name') # type: str\n if user_name is None or len(user_name) <= 0:\n raise BadRequest('Missing user_name parameter.')\n # TODO return fake credentials if user does... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the tag defaults for tag definitions in the specified compartment. | def list_tag_defaults(self, **kwargs):
resource_path = "/tagDefaults"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit",
"id",
"compartment_id",
"tag_definition_id",
... | [
"def default_tags(self):\n return self._default_tags",
"def initDefaults(self):\n return _libsbml.CompartmentGlyph_initDefaults(self)",
"def initDefaults(self):\n return _libsbml.Compartment_initDefaults(self)",
"def get_default_vpas(self, composition_space):\n\n default_vpas = {}\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the tag namespaces in the specified compartment. | def list_tag_namespaces(self, compartment_id, **kwargs):
resource_path = "/tagNamespaces"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit",
"include_subcompartments",
"lifecycle... | [
"async def list_namespaces(self) -> list:\n return await self.AD.state.list_namespaces()",
"def namespaceList(self):\n \n pass",
"def list_namespace_tags(self, namespace, **params):\n url = 'metadefs/namespaces/%s/tags' % namespace\n if params:\n url += '?%s' % urllib.u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the tagging work requests in compartment. | def list_tagging_work_requests(self, compartment_id, **kwargs):
resource_path = "/taggingWorkRequests"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit",
"resource_identifier"
]
... | [
"def GetMergeRequests(self):\n # resource=\"merge_requests?state=opened\"\n # GET /projects/:id/merge_requests\n # GET /projects/:id/merge_requests?state=opened\n # GET /merge_requests?labels=bug,reproduced\n # GET /merge_requests?milestone=release\n resource = \"merge_requ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the `UserGroupMembership` objects in your tenancy. You must specify your tenancy's OCID as the value for the compartment ID (see `Where to Get the Tenancy's OCID and User's OCID`__). | def list_user_group_memberships(self, compartment_id, **kwargs):
resource_path = "/userGroupMemberships"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"user_id",
"group_id",
"page",
"limit"
... | [
"def view_group(request, group_id):\n users = models.UserProfile.all().order('email')\n if group_id:\n group = models.UserGroup.get_by_id(int(group_id))\n if group.users:\n users = models.UserProfile.get(group.users)\n else:\n users = []\n return utility.respond(request, 'admin/view_group', {'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the work requests in compartment. | def list_work_requests(self, compartment_id, **kwargs):
resource_path = "/workRequests"
method = "GET"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"page",
"limit",
"resource_identifier"
]
extra_kwarg... | [
"def listRequests(self):\n reqmgr = RequestManagerImpl()\n retval = []\n for request in reqmgr.listRequests(self.endpoint):\n tmpRequest = Request()\n tmpRequest.setReqmgrUrl( self.endpoint )\n tmpRequest.setWorkflowName( request['request_name'] )\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move the compartment to a different parent compartment in the same tenancy. When you move a compartment, all its contents (subcompartments and resources) are moved with it. Note that the `CompartmentId` that you specify in the path is the compartment that you want to move. | def move_compartment(self, compartment_id, move_compartment_details, **kwargs):
resource_path = "/compartments/{compartmentId}/actions/moveCompartment"
method = "POST"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match",
"op... | [
"def test_patch_project_move_child(self):\n new_category = self.make_project(\n 'NewCategory', PROJECT_TYPE_CATEGORY, self.category\n )\n self.make_assignment(new_category, self.user, self.role_owner)\n url = reverse(\n 'projectroles:api_project_update',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets the OAuth2 client credentials for the SCIM client associated with this identity provider. | def reset_idp_scim_client(self, identity_provider_id, **kwargs):
resource_path = "/identityProviders/{identityProviderId}/actions/resetScimClient"
method = "POST"
expected_kwargs = ["retry_strategy"]
extra_kwargs = [_key for _key in six.iterkeys(kwargs) if _key not in expected_kwargs]
... | [
"def ClearCredentials(self):\r\n self._consumer_key = None\r\n self._consumer_secret = None\r\n self._access_token_key = None\r\n self._access_token_secret = None\r\n self._bearer_token = None\r\n self.__auth = None # for request upgrade\r",
"def logout(self):\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the specified compartment's description or name. You can't update the root compartment. | def update_compartment(self, compartment_id, update_compartment_details, **kwargs):
resource_path = "/compartments/{compartmentId}"
method = "PUT"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]
extra_kwargs = [_ke... | [
"def update_collaboration(self, name=None,\r\n description=None, config=None):\r\n data_path = \"%s/updateInfo\" % self._basepath\r\n params = {\"f\" : \"json\"}\r\n if name:\r\n params['name'] = name\r\n if description:\r\n params['descr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the specified dynamic group. | def update_dynamic_group(self, dynamic_group_id, update_dynamic_group_details, **kwargs):
resource_path = "/dynamicGroups/{dynamicGroupId}"
method = "PUT"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]
extra_kwarg... | [
"def update_group(self, group_name):\n self._runtime_error_if_called_during_showtime('update_group')\n self._current_update_group = group_name",
"def update_group(self, group, **attrs):\n return self._update(_group.Group, group, prepend_key=False, **attrs)",
"def update_group():\n _id = request.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the specified identity provider. | def update_identity_provider(self, identity_provider_id, update_identity_provider_details, **kwargs):
resource_path = "/identityProviders/{identityProviderId}"
method = "PUT"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]... | [
"def update_resource_provider(context, provider_id, values):\n return _get_dbdriver_instance().update_resource_provider(\n context, provider_id, values)",
"def update_identity_provider(module, sdk, cloud, idp):\n\n description = module.params.get('description')\n enabled = module.params.get('enabl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the specified network source. | def update_network_source(self, network_source_id, update_network_source_details, **kwargs):
resource_path = "/networkSources/{networkSourceId}"
method = "PUT"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]
extra_... | [
"def update_dataset_source(self, source=DATASET_SOURCES[0]):\n self.datum.source = source",
"def update_state(self,\n source_id: str,\n serial_num: int,\n state: int,\n last_received: datetime.datetime\n ):\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the specified tag default. If you specify that a value is required, a value is set during resource creation (either by the user creating the resource or another tag defualt). If no value is set, resource creation is blocked. If the `isRequired` flag is set to \"true\", the value is set during resource creation.... | def update_tag_default(self, tag_default_id, update_tag_default_details, **kwargs):
resource_path = "/tagDefaults/{tagDefaultId}"
method = "PUT"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match",
"opc_request_id"
]... | [
"def _update_default(self, default_value):\n name = \"\" if not self.name else f\"{self.name!r} \"\n msg_prefix = f\"Default value of Input {name}\"\n if not self._is_primitive_type and default_value is not None:\n msg = f\"{msg_prefix}cannot be set: Non-primitive type Input has no d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the capabilities of the specified user. | def update_user_capabilities(self, user_id, update_user_capabilities_details, **kwargs):
resource_path = "/users/{userId}/capabilities"
method = "PUT"
# Don't accept unknown kwargs
expected_kwargs = [
"retry_strategy",
"if_match"
]
extra_kwargs = ... | [
"def update_service_capabilities(self, capabilities):\n self.last_capabilities = capabilities",
"def UpdateCapability(self, session, name, **kwargs):\n CController._capabilityModel.Update(name, **kwargs)\n return True, True",
"def update_user(AccountId=None, UserId=None, LicenseType=None):\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the classroom that has given classroomId. Otherwise return None | def getClassroomById(classroomId):
for classroom in classroomEntities:
if classroom["classroomId"] == classroomId:
return classroom.copy()
return None | [
"def find_by_room_id(self, room_id: str) -> Optional[Room]:\n return next((room for room in self if room.uid == room_id), None)",
"def find_class(self, class_id):\n for clas in self.classes:\n if clas.id == class_id:\n return clas\n return None",
"def get_related_c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
store the classroom inside the classroom data list. return True if operation is successful | def addClassroom(classroomName, capacity,location):
for classroom in classroomEntities:
if classroom["classroomName"] == classroomName:
print("Two classrooms can not have same name")
return False
if classroomEntities==[]:
lastSavedIdNumber = "0"
else:
lastSav... | [
"def modifyClassroom(classroomId, classroomName, capacity,location):\n for classroom in classroomEntities:\n if classroom[\"classroomId\"] == classroomId:\n selectedClassroom = classroom\n selectedClassroom[\"classroomName\"] = classroomName\n selectedClassroom[\"capacity\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
modify content of a already stored classroom. return True if operation is successful | def modifyClassroom(classroomId, classroomName, capacity,location):
for classroom in classroomEntities:
if classroom["classroomId"] == classroomId:
selectedClassroom = classroom
selectedClassroom["classroomName"] = classroomName
selectedClassroom["capacity"] = capacity
... | [
"def addClassroom(classroomName, capacity,location):\n for classroom in classroomEntities:\n if classroom[\"classroomName\"] == classroomName:\n print(\"Two classrooms can not have same name\")\n return False\n\n if classroomEntities==[]:\n lastSavedIdNumber = \"0\"\n el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete a classroom from the system. return True if operation is successful | def deleteClassroom(classroomId):
for classroom in classroomEntities:
if classroom["classroomId"] == classroomId:
selectedClassroom = classroom
classroomEntities.remove(selectedClassroom)
return True
return False | [
"def delete(self, classroom_id: str) -> None:\n classroom_config_services.delete_classroom(classroom_id)\n self.render_json(self.values)",
"def test_remove_classroom_specific_for_coach_pt1(self):\n self.assertTrue(self.coach1.has_perm('auth.remove_classroom', self.classrooms[0]))",
"def del... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
saves classroomEntities in the ClassRoomData file | def saveClassroomData():
with open("ClassRoomData.txt","wb") as classroomData:
pickle.dump(classroomEntities,classroomData) | [
"def save(cls):\n playerdata = getAttributes(cls)\n Data.object_dump(playerdata, \"savedata.dat\")\n del playerdata",
"def saveTeachersData():\n with open(\"TeacherData.txt\",\"wb\") as teacherData:\n pickle.dump(teacherEntities,teacherData)",
"def persist(self):\n pass",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the environment variable TERM is unset try with `fallback` if not empty. vt100 is a popular terminal supporting ANSI X3.64. | def load_terminfo(terminal_name=None, fallback='vt100'):
terminal_name = os.getenv('TERM')
if not terminal_name:
if not fallback:
raise TerminfoError('Environment variable TERM is unset and no fallback was requested')
else:
terminal_name = fallback
if os.getenv('... | [
"def TerminalSupportsAnsiColors():\n return (sys.stdout.isatty() and sys.platform[:3] != \"win\")",
"def get_term_colors():\n term = getenv('TERM')\n if not is_term() or not term:\n return 1\n if term in ('xterm-color', 'ansi', 'screen'):\n return 16\n if term in ('xterm-256color'):\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will create foreign table under the existing dummy schema. | def create_foreign_table(server, db_name, schema_name, fsrv_name,
foreign_table_name):
try:
connection = get_db_connection(db_name,
server['username'],
server['db_password'],
... | [
"def create_local_table(self, cur, schema, new_table, foreign_table):\n\n stmt = (\"create table {}.{} (like {}.{} including all);\"\n .format(self.quote_ident(schema), self.quote_ident(new_table),\n self.quote_ident(schema),\n self.quote_ident(for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will verify current foreign table. | def verify_foreign_table(server, db_name, fsrv_name):
try:
connection = get_db_connection(db_name,
server['username'],
server['db_password'],
server['host'],
... | [
"def foreign_key_check(self):\n # MyRocks doesn't support foreign key\n if self.is_myrocks_table:\n log.info(\n \"SKip foreign key check because MyRocks doesn't support \" \"this yet\"\n )\n return True\n foreign_keys = self.query(\n sq... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns partition sum without electronic contribution, v = vibrational frequency in m^1, m = mass in kg, I=moment of inertia either number or list of three [kgm^2], V= Volume in m^3, sym=number of similar rotation axis | def partition(v,m,I,V,sym):
T = s.Symbol("T")
return qvib(v) + qtrans(m,V) + qrot(I,sym) | [
"def get_effective_mass():\n\n H_BAR = 6.582119514e-16 # eV*s\n M_0 = 9.10938356e-31 # kg\n N_KPTS = 6 # Number of k-points included in the parabola.\n\n spin_up = Spin(1)\n\n band_structure = Vasprun('vasprun.xml').get_band_structure()\n\n # Locations of CBM and VBM in band_structure.bands\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function subscribes to the secondaryCam topic and updates its state in the global scope. | def secondayCamCallback(msg):
global secondaryCamString
secondaryCamString = msg.data | [
"def _on_connect(self, client, userdata, flags, rc):\n self.subscribe(self.topic)",
"def _subscribe_update_callback(self, client, userdata, message):\n logger.info('Message recieved from {} topic'.format(message.topic))\n payload = message.payload\n try:\n payload_dict = jso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function first determines which camera is the primary and which is secondary. The image streams from the respective primary and seconday cameras are resized and republished | def resizeAndRepubThread():
# reference globals
global primaryCamString
global secondaryCamString
global armCamImage
global headCamImage
# initialize image publishers
primaryPub = rospy.Publisher(primaryCamRepub, Image, queue_size=1)
secondaryPub = rospy.Publisher(secondaryCamRepub, Im... | [
"def query_camera(self):\n ok, orig_pic = self.vs.read() # Read video stream\n if ok: # If no errors\n orig_pic = imutils.rotate(orig_pic, angle=self.camera_rot)\n curr_pic = imutils.resize(orig_pic, width=self.image_width)\n return curr_pic, orig_pic\n else:\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checkout code for CESM If sandbox exists, check that the right tag has been checkedout. Otherwise, download the code, checkout the tag and run manage_externals. The scripts don't seem to like multiple applications of manage_externals. | def code_checkout(cesm_repo, coderoot, tag):
sandbox = os.path.split(coderoot)[-1]
if os.path.exists(coderoot):
print('Check for right tag: '+coderoot)
p = Popen('git status', shell=True, cwd=coderoot, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
stdout = stdout.d... | [
"def checked_out_MPS():\n\n checked_out_packages = os.path.join(os.environ[\"CMSSW_BASE\"], \"src\", \".git\",\n \"info\", \"sparse-checkout\")\n checked_out = False\n git_initialized = False\n try:\n with open(checked_out_packages, \"r\") as f:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test adding basic Deterministic InnerNode. | def test_addInner(self):
print("\nTest 1: Adding InnerNode")
try:
builder = StaticBuilder()
builder.addInput(10, name="In")
enc_name = builder.addInner(3, name="In")
except AttributeError:
print("\nCAUGHT! Trying to assign the same name to two nodes! "
"AttributeError exc... | [
"def test_add_node(self):\n # will call add_edges, so no extensive test are necessary\n node = Node(data={\"id\": \"0\"})\n expected_nodes = [\n Node(data={\"id\": \"0\"}, position={}),\n ]\n expected_edges = []\n\n graph = Graph()\n graph.add_node(node)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test adding basic OutputNode | def test_addOutput(self):
print("\nTest 2: Adding OutputNode")
builder = StaticBuilder()
builder.addInput(10, name="In")
builder.addInner(3, name="Det")
o_name = builder.addOutput(name="Out")
o1 = builder.nodes[o_name]
print("\nNode keys in builder:", list(builder.nodes.keys()))
pri... | [
"def test_get_node_outputs(self):\n pass",
"def add_output(self, output):\n self._outputs.append(output)",
"def add_output_nodes_argument(self, help, required = True):\n\t\tself.parser.add_argument(\n\t\t\t\"--output-nodes\",\n\t\t\tnargs = \"+\",\n\t\t\ttype = str,\n\t\t\trequired = required,\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test building a model with 2 outputs. Test Cloning an output | def test_BuildModel1(self):
print("\nTest 5: Building a Model with cloning")
builder = StaticBuilder("Clone")
in1 = builder.addInput(10)
enc1 = builder.addInner(3)
out1 = builder.addOutput(name="Out1")
out2 = builder.addOutput(name="Out2")
builder.addDirectedLink(in1, enc1)
builder.... | [
"def test_custom_model_n_outputs():\n\n @custom_model\n def model(x, y, n_outputs=2):\n return x + 1, y + 1\n\n m = model()\n assert not isinstance(m.n_outputs, Parameter)\n assert isinstance(m.n_outputs, int)\n assert m.n_outputs == 2\n assert m.outputs == (\"x0\", \"x1\")\n assert (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds a model with 2 inputs. Test ConcatNode | def test_BuildModel2(self):
print("\nTest 6: Building a Model with Concat")
builder = StaticBuilder("Concat")
in1 = builder.addInput(10)
in2 = builder.addInput(20)
enc1 = builder.addInner(3, num_islots=2)
out1 = builder.addOutput()
builder.addDirectedLink(in1, enc1, islot=0)
builder.add... | [
"def concat_model():\n x = tf.keras.Input(shape=[10, 10, 3, ])\n x1 = tf.keras.layers.Conv2D(5, (2, 2))(x)\n x2 = tf.keras.layers.Conv2D(6, (2, 2))(x)\n x3 = tf.keras.layers.Conv2D(7, (2, 2))(x)\n z = tf.keras.layers.concatenate([x2, x1, x3], axis=-1)\n z1 = tf.keras.layers.Conv2D(10, (2, 2))(z)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given the IP ADDRESS of the camera, to which you are connected and ACQUISITION MODE into which you want to put the camera, this command will send the according request to the camera. | def command(mode, ip, log):
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging_config[log])
# Using the default dict to get a valid format string no matter what
phantom_socket = PhantomSocket(ip)
phantom_socket.connect()
click.echo('CONNECTED TO THE PHA... | [
"def camera_control(camera_host, camera_port, camera_user, camera_pass, q):\n\n try:\n camera = IPCamera(camera_host, camera_port, camera_user, camera_pass)\n q.put(camera.get_rtsp_url())\n except RuntimeError as exc:\n q.put(exc)\n\n try:\n while True:\n camera.move_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempts to insert the supplied genome. If the genome is inserted, this method will return True, otherwise it will return False. | def try_insert_genome(self, genome):
raise Exception("called abstract insert_genome method") | [
"def can_insert(data):\n return False",
"def _can_insert(self, index, value):\n return not bool(self._insert_callback(index, value))",
"def insert_whole_genome_if_not_exist(self, head, head_id, sequence):\n id_wholeDNA = self.get_id_whole_genome_by_head_and_head_id(head, head_id)\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate a evaluator class. | def build_evaluator(cfg: CfgNode) -> EvaluatorBase:
name = cfg["name"]
evaluator = simple_build(name, cfg, EVALUATORS)
return evaluator | [
"def create_evaluator_class(T, base_name):\n class Evaluator(e2eGAN):\n def get_name(self):\n return 'Testers/Eval_{}'.format(base_name)\n\n def gen_encoder_model(self):\n return T.gen_encoder_model(self)\n\n def gen_decoder_model(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate a evaluate helper class. | def build_evaluate_helper(cfg: CfgNode) -> EvaluateHelper:
evaluator = build_evaluator(cfg.evaluator)
helper = EvaluateHelper(evaluator)
return helper | [
"def create_evaluator_class(T, base_name):\n class Evaluator(e2eGAN):\n def get_name(self):\n return 'Testers/Eval_{}'.format(base_name)\n\n def gen_encoder_model(self):\n return T.gen_encoder_model(self)\n\n def gen_decoder_model(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plot x and y axis of dfs in common graph. | def plot(x, y, *dfs):
ax = None
for df in dfs:
ax = df[[x, y]].set_index(x).plot(kind='line', ylim=(0, None), xlim=(0, None), ax=ax) | [
"def draw_plot(ax, dfs, legend, x, y, xscale, yaxis_max):\n xticks = dfs_all_values(dfs, x)\n # loop over all pandas.DataFrame objects\n for df in dfs:\n # setting the x-column as an index is required to draw the y-column\n # as a function of x argument\n df = df.set_index(x)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
8 microed stepping by faking distance twice as long. | def micro_8(steps, a):
df = pd.DataFrame(index=np.arange(0, steps * 16), columns=('v', 's', 'd', 't'))
t = 0.0
m = 8 # micro level
d = d0 = math.sqrt(1/a/m) # faster accel since distance is longer
s = 0 # steps
p = 0 # position
p_d = 1/m # position delta
for s i... | [
"def drive_eight(n):\n # Variables for the go_diff function\n fast_speed = 80 \n slow_speed = 25\n # Half a lap time, this is the time the robot turns in a direction before switching\n half_lap_time =6.2 \n # To avoid having tu manually stop the robot we set it to drive continuously for x amount of seconds.\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the elements in ref_gen to an existing index. | def update_index(self, ref_gen):
testing = True
logging.warning('Updating index')
es_insert.index(es, ref_gen, self.index_name, testing, action="update")
logging.warning('Finished updating') | [
"def addIndex(indexDef):",
"def build_index(self, descriptors):",
"def generate_index(self):\r\n # Reset the index as we are regenerating it from scratch\r\n self.document_index.drop_collection()\r\n # Add an index entry for each document\r\n for doc in self.get_queryset(self.documen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return True if `assignment` is complete (i.e., assigns a value to each crossword variable); return False otherwise. | def assignment_complete(self, assignment):
# print("Entered assignment_complete Function")
for var in assignment:
if assignment[var] is None:
return False
return self.consistent(assignment)
# raise NotImplementedError | [
"def assignment_complete(self, assignment):\n # for each variable in the crossword\n for variable in self.crossword.variables:\n # if the variable is not assigned a value\n if variable not in assignment:\n # the crossword is not complete\n return Fal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return True if `assignment` is consistent (i.e., words fit in crossword puzzle without conflicting characters); return False otherwise. | def consistent(self, assignment):
# print("Entered consistent Function")
# print("assignment")
# print(assignment)
overlaps = self.crossword.overlaps
value_set = set()
for variable in assignment:
#checking overlaps with neighbors
neighbors = ... | [
"def consistent(self, assignment):\n #iterate through variables in assignment\n for var in assignment:\n #check all other values in assignment for duplication\n for var_2 in assignment:\n #don't check itself\n if var_2 == var:\n co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Using Backtracking Search, take as input a partial assignment for the crossword and return a complete assignment if possible to do so. `assignment` is a mapping from variables (keys) to words (values). If no assignment is possible, return None. | def backtrack(self, assignment):
# print("Entered backtrack Function")
# Check if assignment is complete
if len(assignment) == len(self.domains):
return assignment
# Try a new variable
var = self.select_unassigned_variable(assignment)
word_list = self.order_d... | [
"def backtrack(self, assignment):\n # Checks if the assignment is complete\n if self.assignment_complete(assignment):\n return assignment\n\n # Select an unassigned variable\n var = self.select_unassigned_variable(assignment)\n\n # Loop through all the words in the doma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws text onto a given surface. | def draw_text(self, text, font, color, surface, x, y): #use for narrative in end sequence
text_obj = font.render(text, True, color)
text_rect = text_obj.get_rect()
text_rect.center = (x, y)
surface.blit(text_obj, text_rect) | [
"def render_text_on_surface(text, surface, font, color=BLACK, top_padding=0, left_pading=0):\n rect = surface.get_rect()\n \n last_top = rect.top + top_padding\n for index, line in enumerate(text.split(\"\\n\")):\n text_surf = font.render(line, True, color)\n text_rect = text_surf.get_rect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Split the file and save chunks to separate files | def split(self):
print 'Splitting file', self.__filename
print 'Number of chunks', self.__numchunks, '\n'
try:
f = open(self.__filename, 'rb')
except (OSError, IOError), e:
raise FileSplitterException, str(e)
bname = (os.path.split(self.__filena... | [
"def split_file(self, number_of_splits):\n file_size = os.path.getsize(self.input_file_path)\n unit_size = file_size / number_of_splits + 1\n original_file = open(self.input_file_path, \"r\")\n file_content = original_file.read()\n original_file.close()\n (index, current_sp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Combine existing chunks to recreate the file. The chunks must be present in the cwd. The new file will be written to cwd. | def combine(self):
import re
print 'Creating file', self.__filename
bname = (os.path.split(self.__filename))[1]
bname2 = bname
# bugfix: if file contains characters like +,.,[]
# properly escape them, otherwise re will fail to match.
fo... | [
"def combine_chunks(total_parts, total_size, source_folder, dest):\n\n if not os.path.exists(os.path.dirname(dest)):\n os.makedirs(os.path.dirname(dest))\n with open(dest, 'wb+') as destination:\n for i in range(total_parts):\n part = os.path.join(source_folder, str(i))\n w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
two BaseWrapper instances are equal enough | def assert_wrappers_equal(first, second):
assert first.sk_params == second.sk_params
assert first.history_ == second.history_
if not first.model_ or not second.model_:
assert first.model_ == second.model_
else:
assert_models_equal(first.model, second.model) | [
"def test_same_id(self):\n b1 = Base(1)\n b2 = Base(1)\n self.assertEqual(b1.id, 1)\n self.assertEqual(b2.id, 1)",
"def test_inheritedClassesEquality(self):\n self.assertTrue(Record(1, 2) == DerivedRecord(1, 2))\n self.assertFalse(Record(1, 2) == DerivedRecord(1, 3))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The names of the arguments to the function which are contained in the PyArgKeywords list | def arg_names(self):
return self._arg_names | [
"def get_func_arg_names(func):\n return get_func_code(func).co_varnames",
"def extract_keywords(func):\n if hasattr(func, 'im_func'):\n func = func.im_func\n\n try:\n return func.func_code.co_varnames[-len(func.func_defaults):]\n except (TypeError, ValueError, IndexError):\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create FunctionDef responsible for casting python argument to C | def Python_to_C(c_object):
try :
cast_function = py_to_c_registry[(c_object.dtype, c_object.precision)]
except KeyError:
errors.report(PYCCEL_RESTRICTION_TODO, symbol=c_object.dtype,severity='fatal')
cast_func = FunctionDef(name = cast_function,
body = [],
... | [
"def C_to_Python(c_object):\n try :\n cast_function = c_to_py_registry[(c_object.dtype, c_object.precision)]\n except KeyError:\n errors.report(PYCCEL_RESTRICTION_TODO, symbol=c_object.dtype,severity='fatal')\n\n cast_func = FunctionDef(name = cast_function,\n body ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create FunctionDef responsible for casting c argument to python | def C_to_Python(c_object):
try :
cast_function = c_to_py_registry[(c_object.dtype, c_object.precision)]
except KeyError:
errors.report(PYCCEL_RESTRICTION_TODO, symbol=c_object.dtype,severity='fatal')
cast_func = FunctionDef(name = cast_function,
body = [],
... | [
"def Python_to_C(c_object):\n try :\n cast_function = py_to_c_registry[(c_object.dtype, c_object.precision)]\n except KeyError:\n errors.report(PYCCEL_RESTRICTION_TODO, symbol=c_object.dtype,severity='fatal')\n cast_func = FunctionDef(name = cast_function,\n body = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate function Call of c/python api PyErr_SetString | def PyErr_SetString(exception, message):
func = FunctionDef(name = 'PyErr_SetString',
body = [],
arguments = [Variable(dtype = PyccelPyObject(), name = 'o'),
Variable(dtype = NativeString(), name = 's')],
results = [])
... | [
"def PyErr_Warn(space, w_category, message):\n return PyErr_WarnEx(space, w_category, message, 1)",
"def PyErr_SetExcInfo(space, py_type, py_value, py_traceback):\n w_type = get_w_obj_and_decref(space, py_type)\n w_value = get_w_obj_and_decref(space, py_value)\n w_traceback = get_w_obj_and_decref(spac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate TypeError exception from the variable information (datatype, precision) | def generate_datatype_error(variable):
dtype = variable.dtype
if isinstance(dtype, NativeBool):
precision = ''
if isinstance(dtype, NativeComplex):
precision = '{} bit '.format(variable.precision * 2 * 8)
else:
precision = '{} bit '.format(variable.precision * 8)
messag... | [
"def test_value_error_for_computing_missing_type():\n with pytest.raises(ValueError):\n compute_type(\"missing_type\", {})",
"def type_error(var, type_var):\n raise TypeError('reliapy (Error 1) - the type of ' + var + ' must be: ' + type_var)",
"def test_invalid_expression_type(self, parse_input_mo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
exercising some Letter methods | def test_letter_methods(self):
# shift
l = get_character("G")
self.assertEqual(l.x, 0)
self.assertEqual(l.y, 0)
l.shift(2, 2)
self.assertEqual(l.x, 2)
self.assertEqual(l.y, 2)
# scale adjusts the scale attributes
orig_width = l.scale_x
orig... | [
"def display_letters(word, guesses):\n pass",
"def letter_for(label):\n return \"ABCDEFGHIJ\"[label]",
"def getAlphabet(self):\n return self.alpha",
"def letters_to_be_capitalized(all_possible_letters,direction):\n\n Delta_y = direction[0]\n Delta_x = direction[1]\n list_first_letter = a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper method to get baseline file. | def get_test_baseline(self, file_name):
return os.path.abspath(
os.path.join(
os.path.abspath(__file__),
u'..',
u'baselines',
file_name)) | [
"def get_baseline(file_name):\r\n return os.path.abspath(\r\n os.path.join(\r\n os.path.abspath(__file__),\r\n u'..',\r\n u'baselines',\r\n file_name))",
"def _getbaseline(self):\r\n if self._baseline == None:\r\n resu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a list of all the cells in the grid. We start increasing x first, i.e. 0th cell is the first cell, 1cell is the one with the next x in the list and y unchanged, .... Return array An array of size n_cells n_dims. | def cells_list(self):
xx, yy = np.meshgrid(self.x_spacings, self.y_spacings)
return np.vstack([yy.ravel(), xx.ravel()]).transpose() | [
"def living_cells(self):\n cells = [(i,j) for i in range(self.x_dim)\n for j in range(self.y_dim) if self.grid[i][j] == 1]\n return zip(*cells)",
"def make_grid():\n return [[make_cell(x, y) for y in range(3)] for x in range(3)]",
"def create_cells_from_dims(num_verts_x: int, num_ver... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper to run Praat 'To Textgrid (silences)' function. | def detect_silences(sound, sil_threshold, sil_duration):
textgrid = call(sound, 'To TextGrid (silences)', 100, 0.0, sil_threshold, sil_duration, 0.1, 'silence', 'speech')
return textgrid | [
"def toTextToolMode(self):\n\n self.log.debug(\"Entered toTextToolMode()\")\n\n # Only do something if it is not currently in this mode.\n if self.toolMode != PriceBarChartWidget.ToolMode['TextTool']:\n self.toolMode = PriceBarChartWidget.ToolMode['TextTool']\n self.graphi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves chunked speech intervals as WAV file. | def save_chunks(chunk_sound, out_path, video_id):
chunk_start_ms = int(chunk_sound.get_start_time()*1000)
chunk_end_ms = int(chunk_sound.get_end_time()*1000)
chunk_duration = chunk_end_ms - chunk_start_ms
chunk_fn = '{0}_{1}_{2}.wav'.format(video_id, chunk_start_ms, chunk_end_ms)
chunk_file_path = ... | [
"def save_wav(sounds_arr, wav_file, sample_rate, sound_length):\n nchannels = 1\n sampwidth = 2\n nframes = len(sounds_arr)\n comptype = 'NONE'\n compname = 'not compressed'\n wav_file.setparams((nchannels, sampwidth, sample_rate, nframes, comptype, compname))\n\n for sample in sounds_arr:\n for _ in rang... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes input ends of all feed pipes and feeds odd numbers starting from low until high both inclusive. in a round robin fashion. process ends by feeding 1 to all pipes. 1 is a sentinel value. | def distributor(ls_feed_pipe_open,low,high):
def getNumber(low,high):
i = low
if i%2 == 0: #if i is even, then start from i+1 odd.
i += 1
while i<=high:
yield i
i+=2 #no need to check for even numbers, so skip it here at begining
... | [
"def odd():\n num = 0\n while True:\n yield num * (num & 1)\n num += 1",
"def infinite_odd_generator():\n current = 1\n while True:\n yield current\n current = current + 2",
"def skip(head=0, tail=0):\n def process(pipe):\n buf = []\n for i, line in enume... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
will take numbers sequentially from feed_pipe, verify if it is prime. any primes found will be returned as a dict to main process. dict contains only one key value pair. val is always a list. | def generatePrime(ls_primes, feed_pipe,return_dict):
local_primes = []
while True:
n = feed_pipe.recv()
if n == -1: # sentinel given by distributor.
break
else:
is_prime = True
##check for divisibility
## no need to check for 2... | [
"def distributor(ls_feed_pipe_open,low,high):\n def getNumber(low,high):\n i = low\n if i%2 == 0: #if i is even, then start from i+1 odd.\n i += 1\n while i<=high:\n yield i\n i+=2 #no need to check for even numbers, so skip it here at begin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reject unsuported chain parts | def _select_simple_chainparts(chain_parts):
for cp in chain_parts:
if reject_substr_res.search(cp['chainPartName']):
return False
return True | [
"def eliminate_equivalents(chains):\n cleaned_chains = list(chains)\n\n for i1 in range(len(chains)):\n print '## progress: %d/%d' % (i1, len(chains))\n for i2 in range(i1 + 1, len(chains)):\n if not chains[i1] in cleaned_chains:\n continue\t\n if not chains[i2] in cleaned_chains:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Marshal information deom the selected chainParts to create a 'simple_partition' label. | def _make_simple_partition_label(chain_dict):
cps = chain_dict['chainParts']
if not (_select_simple_chainparts(cps)):
raise NotImplementedError(
'chain fails substring selection: not "simple": %s' % (
chain_dict['chainName']))
label = 'simplepartition(['
for cp ... | [
"def provide_partition_info(self):\n self.partition_info = True",
"def FormatPartition(self, partition):\n\n fstab = self.fstab\n if fstab:\n p = fstab[partition]\n self.script.append('format(\"%s\", \"%s\", %s, \"%s\", \"%s\");' %\n (p.fs_type, common.PARTITION_TYPE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Marshal information from the selected chainParts to create a vbenf label. Use a Reducer for elimination of unusable jets | def _make_vbenf_label(chain_parts):
# toy label for development: run simple and dijet independently.
# simple makes Et cuts on two jets. Independently (sharing possible)
# of jets choosean by simple, the dijet
# scenario requires a dijet of mass > 900, and opening angle in phi > 2.6
assert len(ch... | [
"def generate_label(protein_chain):\n label_process = [\n generate_seq_mask,\n generate_atom14_positions,\n generate_backbone_affine,\n generate_rigidgroups,\n generate_torsion_angles,\n generate_pseudo_beta,\n # generate_template_mask,\n # generate_hhblits_profile,\n # generate_masked_m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
dijet label. supports dijet cuts, and cuts on particpating jets | def _make_dijet_label(chain_parts):
assert len(chain_parts) == 1
scenario = chain_parts[0]['hypoScenario']
assert scenario.startswith('dijet')
arg_res = [
re.compile(r'^(?P<lo>\d*)(?P<key>djmass)(?P<hi>\d*)$'),
re.compile(r'^(?P<lo>\d*)(?P<key>j1et)(?P<hi>\d*)$'),
re.compi... | [
"def CellLabeling(self,channel,singnal,file, features,feature_channel):\n\n if self.cell_channel != None :\n\n name=\"segmentation_map\"\n\n if not os.path.exists(\"output/\"+str(file)+\"/\"+name):\n os.makedirs(\"output/\"+str(file)+\"/\"+name)\n\n\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ht label. ht cuts, and cuts on particpating jets | def _make_ht_label(chain_parts):
assert len(chain_parts) == 1, '_make_ht_label, no. of chain parts != 1'
scenario = chain_parts[0]['hypoScenario']
assert scenario.startswith('HT'), '_make_ht_label(): scenario does not start with HT'
arg_res = [
re.compile(r'^(?P<lo>\d*)(?P<key>ht)(?P<hi>\... | [
"def beginJob(self):\n \n # CUTFLOW HISTOGRAM\n self.cutflow = TH1D('cutflow','cutflow',25,0,25)\n self.cut_none = 0\n self.cut_trig = 1\n self.cut_muon = 2\n self.cut_tau = 3\n self.cut_pair = 4\n self.cutflow.GetXaxis().SetBinLabel(1+self.cut_none, \"no cut\" )\n self.cutflow.GetX... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make test label for combinations helper with two simple children. | def _make_combinationsTest_label(chain_parts):
assert len(chain_parts) == 1
scenario = chain_parts[0]['hypoScenario']
assert scenario == 'combinationsTest'
return """
combgen(
[(2)(20et, 0eta320)]
simple([(40et, 0eta320) (50et, 0eta320)])
simple([... | [
"def test_many_bdd_labels_for_one_function():\n pass",
"def test_recipe_nutrition_label_widget(self):\n pass",
"def test_select_label(self):\n title = ('Transportation Challenges Limit Education Choices for '\n 'Denver Parents')\n summary = \"\"\"\n Many famili... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(Set, float, float, int, str) > list Filters a set of Products according to the parameters. This function is responsible to determine if filtering with tags should be applied or not. | def get_matching_products(products, lat, lng, radius, tags):
if tags:
tag_list = tags.split(',')
return list([
product for product in products
if is_matching_product_with_tags(
product,
lat,
ln... | [
"def test_filter_by_product(self):\r\n mozlogger.info(\"test_filter_by_product\")\r\n\r\n # create fixtures\r\n product1 = self.F.ProductFactory()\r\n tag1 = self.factory\r\n tag1.product = product1\r\n tag1.save()\r\n tag2 = self.factory\r\n tag2.product = pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(Product, float, float, radius) > boolean Check if the coordinates of a shop is within a radius (in meters) using the Vincenty's formulae. | def is_matching_product(product, lat, lng, radius):
return vincenty(
(lat, lng),
(product.shop.lat, product.shop.lng)
).meters <= radius | [
"def is_matching_product_with_tags(product, lat, lng, radius, tags):\n return vincenty(\n (lat, lng),\n (product.shop.lat, product.shop.lng)\n ).meters <= radius and any(tag in product.shop.tags for tag in tags)",
"def in_roi(x_y, w_h, center, radius):\n x, y = x_y\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(Product, float, float, radius, list) > boolean Check if the coordinates of a shop is within a radius (in meters) using the Vincenty's formulae and if the shop contains any of the tags provided. | def is_matching_product_with_tags(product, lat, lng, radius, tags):
return vincenty(
(lat, lng),
(product.shop.lat, product.shop.lng)
).meters <= radius and any(tag in product.shop.tags for tag in tags) | [
"def is_matching_product(product, lat, lng, radius):\n return vincenty(\n (lat, lng),\n (product.shop.lat, product.shop.lng)\n ).meters <= radius",
"def shops_within_radius(self, lat, lng, radius, tags=None):\n center_point = geoindex.GeoPoint(lat, lng)\n poi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a copy of a facemap proc file, but pointing to a new video. By default, the new proc file is created in the same folder as the new videofile and named videofile_proc.npy. | def copy_facemap_roi(procfile, videofile, outputfile=None):
videodata = np.load(procfile, allow_pickle=True).item()
videodata['filenames'] = [[videofile]]
if outputfile is None:
outputfile = os.path.splitext(videofile)[0]+'_proc.npy'
if os.path.isfile(outputfile):
print(f'File {outputf... | [
"def create_video(input_file, output_file):\n input_video = VideoFileClip(input_file)\n output_video = input_video.fl_image(detect_lane.fit_and_plot)\n output_video.write_videofile(output_file, audio=False)",
"def process_video(lane, fname, output):\n\tclip = VideoFileClip(fname)\n\toutput_name = output\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the onsets in the array representing the synchronization light. This function assumes the onsets are periodic (with randomness within 0.5T and 1.5T). The function can also fix missing onsets. | def find_sync_light_onsets(sync_light, invert=True, fixmissing=False):
# -- Find changes in synch light --
sync_light_diff = np.diff(sync_light, prepend=0)
if invert:
sync_light_diff = -sync_light_diff
sync_light_diff[sync_light_diff < 0] = 0
sync_light_threshold = 0.2*sync_light_diff.max()
... | [
"def detect_onsets(bool_arr):\n int_arr = bool_arr.astype(int)\n onsets = np.diff(int_arr, axis=1)\n onsets[onsets < 0] = 0\n\n return onsets",
"def onsets_to_onset_times(onsets, fs, N, hop):\n\n onset_times = (onsets * np.arange(0, len(onsets)) * hop + N / 2) / fs \n return onset_times[onset_times ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Estimate whether the animal was running during each trial. This function first smooths the running trace according to smoothsize (noncausal), it then uses the average of N presamples before the onset to to estimate whether running was higher than the threshold. | def estimate_running_each_trial(running_trace, trial_onset, smoothsize=10, presamples=4,
threshold=3, showfig=False):
smoothwin = np.ones(smoothsize)/(smoothsize)
running_trace_smooth = np.convolve(running_trace, smoothwin, mode='same')
trial_onset_ind = np.where(trial_onset)... | [
"def stationarity(self, nfactor=20):\n \n tau = self.sampler.get_autocorr_time(tol=0)\n converged = np.all(tau * nfactor < self.sampler.iteration)\n return converged",
"def _check_ntrial(trial_bool, category_thresh=8):\n return np.sum(trial_bool) >= category_thresh",
"def stop_on_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |