query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return the type ID of device. | def type_id(self):
return self._device.type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_type(self):\n return Context.devtype2str[self.device_typeid]",
"def device_type(self):\n return Context.devtype2str[self.device_typeid]",
"def type(self):\n return self._device.type_name",
"def device_type(self):\n return self._meta['device_type']",
"def device_type(s... | [
"0.85065544",
"0.85065544",
"0.81526226",
"0.807428",
"0.8037553",
"0.80291253",
"0.7927899",
"0.79161036",
"0.79017574",
"0.77643144",
"0.7706918",
"0.7706918",
"0.7706918",
"0.7621275",
"0.7590515",
"0.7561336",
"0.75463873",
"0.75385123",
"0.7494253",
"0.74617535",
"0.7409... | 0.90255797 | 0 |
Return the state attributes. | def extra_state_attributes(self):
state_attr = {}
if self.vendor_id is not None:
state_attr[ATTR_VENDOR_ID] = self.vendor_id
state_attr[ATTR_VENDOR_NAME] = self.vendor_name
if self.type_id is not None:
state_attr[ATTR_TYPE_ID] = self.type_id
state_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8953404",
"0.8953404",
"0.85239846",
"0.8366765",
"0.8366765",
"0.8363429",
"0.83362615",
"0.8334551",
"0.8310377",
"0.8292682",
"0.8289349",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.828... | 0.7582648 | 63 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum(axis=0) # only difference | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.70117974 | 75 |
Gets the consumer of this Blacklist. | def consumer(self):
return self._consumer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumer(self):\n return Consumer(app=self.app, client=self.client)",
"def allocation(self):\n return self.mapping[self.consumer_name]",
"def get_consumer(conf_settings, address=Config.INSIGHTS_KAFKA_ADDRESS): # pragma: no cover\n conf = _get_consumer_config(address, conf_settings)\n L... | [
"0.67665565",
"0.6210917",
"0.6010308",
"0.5921093",
"0.5686899",
"0.558793",
"0.55777174",
"0.55445343",
"0.5527357",
"0.55258596",
"0.5522782",
"0.5506865",
"0.5493695",
"0.5465022",
"0.5409509",
"0.5351007",
"0.527671",
"0.527671",
"0.5214935",
"0.52055895",
"0.52033734",
... | 0.79356104 | 0 |
Gets the entity_type of this Blacklist. | def entity_type(self):
return self._entity_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entity_type(self):\n return self.entity_type",
"def entity_type(self) -> str:\n return self._entity_type",
"def entity_type(self) -> pulumi.Input['EntityTypes']:\n return pulumi.get(self, \"entity_type\")",
"def entity_type(self) -> Optional[str]:\n return pulumi.get(self,... | [
"0.76970685",
"0.7583411",
"0.73383826",
"0.7207361",
"0.69742095",
"0.6317898",
"0.6263057",
"0.6207199",
"0.61828905",
"0.6129832",
"0.6129832",
"0.61223614",
"0.61223614",
"0.6029619",
"0.6003703",
"0.5997195",
"0.5946732",
"0.59450793",
"0.5884026",
"0.5873492",
"0.586316... | 0.76917255 | 1 |
Sets the entity_type of this Blacklist. | def entity_type(self, entity_type):
self._entity_type = entity_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_type(self, entity_type: str):\n\n self._entity_type = entity_type",
"def entity_type(self, entity_type):\n\n self._entity_type = entity_type",
"def entity_type_desc(self, entity_type_desc):\n\n self._entity_type_desc = entity_type_desc",
"def set_type(self, type):\n sel... | [
"0.779508",
"0.7786461",
"0.61399907",
"0.5950833",
"0.5950833",
"0.58673686",
"0.56986713",
"0.56583536",
"0.56568456",
"0.5631669",
"0.56168634",
"0.56049985",
"0.5593743",
"0.5589678",
"0.55831915",
"0.5554373",
"0.5506188",
"0.5506188",
"0.5506188",
"0.5506188",
"0.548587... | 0.7754925 | 2 |
Gets the start_date of this Blacklist. | def start_date(self):
return self._start_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_date(self):\n return self.__start_date",
"def start_date(self) -> str:\n return self._start_date",
"def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")",
"def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")",
"def getStartDate(self... | [
"0.80608875",
"0.7894121",
"0.76916254",
"0.76916254",
"0.76725054",
"0.73716867",
"0.73048365",
"0.73026466",
"0.7294817",
"0.7294817",
"0.7198",
"0.7051828",
"0.70500284",
"0.6940857",
"0.68355274",
"0.68192375",
"0.677472",
"0.66698074",
"0.6638334",
"0.6613019",
"0.657542... | 0.805545 | 3 |
Sets the start_date of this Blacklist. | def start_date(self, start_date):
self._start_date = start_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_date(self, start_date):\n \n self._start_date = start_date",
"def start_date(self, start_date):\n\n self._start_date = start_date",
"def start_date(self, start_date):\n\n self._start_date = start_date",
"def start_date(self, start_date):\n\n self._start_date = sta... | [
"0.82608855",
"0.82060444",
"0.82060444",
"0.82060444",
"0.82060444",
"0.82060444",
"0.82060444",
"0.82060444",
"0.82060444",
"0.82060444",
"0.81444746",
"0.7933278",
"0.7893971",
"0.76107556",
"0.75131994",
"0.7424428",
"0.7178917",
"0.67629874",
"0.67564493",
"0.66991353",
... | 0.81995976 | 10 |
Gets the end_date of this Blacklist. | def end_date(self):
return self._end_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_date(self):\n return self.__end_date",
"def end_date(self) -> str:\n return self._end_date",
"def end_date(self) -> str:\n return pulumi.get(self, \"end_date\")",
"def end_date(self) -> str:\n return pulumi.get(self, \"end_date\")",
"def end_date(self) -> Optional[str]:\... | [
"0.81331074",
"0.79457515",
"0.7797415",
"0.7797415",
"0.7414115",
"0.7414115",
"0.7372416",
"0.72002065",
"0.7092189",
"0.7008753",
"0.6995915",
"0.6934718",
"0.69231695",
"0.6907079",
"0.6888234",
"0.68820155",
"0.68768644",
"0.6844406",
"0.68078214",
"0.6804755",
"0.669067... | 0.8106121 | 2 |
Sets the end_date of this Blacklist. | def end_date(self, end_date):
self._end_date = end_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_end_date(self, date):\n pass",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end... | [
"0.8291042",
"0.8280256",
"0.8280256",
"0.8280256",
"0.8280256",
"0.8280256",
"0.8280256",
"0.8280256",
"0.8280256",
"0.7867213",
"0.7817309",
"0.7644892",
"0.76338035",
"0.7496864",
"0.7446238",
"0.7351038",
"0.724808",
"0.72021043",
"0.7193743",
"0.69938034",
"0.6975449",
... | 0.8300196 | 0 |
Gets the updated_date of this Blacklist. | def updated_date(self):
return self._updated_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated(self) -> datetime:\n return self._updated",
"def updated(self) -> datetime:\n return datetime.strptime(self.data['updated_at'],\n '%Y-%m-%dT%H:%M:%S.%fZ')",
"def updated_at(self):\n return self._updated_at",
"def updated_at(self):\n retu... | [
"0.73349214",
"0.7222404",
"0.7209776",
"0.7209776",
"0.7209776",
"0.7155397",
"0.71410996",
"0.70614463",
"0.70614463",
"0.70614463",
"0.7031201",
"0.70264226",
"0.70264226",
"0.6998678",
"0.68869",
"0.68353975",
"0.6826992",
"0.6780685",
"0.6780685",
"0.67566264",
"0.675662... | 0.80598724 | 0 |
Sets the updated_date of this Blacklist. | def updated_date(self, updated_date):
self._updated_date = updated_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_date(self, updated_date):\n\n self._updated_date = updated_date",
"def updated_date(self, updated_date):\n\n self._updated_date = updated_date",
"def updated_date(self, updated_date):\n if updated_date is None:\n raise ValueError(\"Invalid value for `updated_date`, m... | [
"0.7600248",
"0.7600248",
"0.69059277",
"0.67740804",
"0.67740804",
"0.6659123",
"0.65882474",
"0.6401802",
"0.6401802",
"0.6401802",
"0.6401802",
"0.6335881",
"0.6335881",
"0.6335881",
"0.6318555",
"0.62670505",
"0.62329775",
"0.62329775",
"0.62329775",
"0.62329775",
"0.6232... | 0.76391864 | 0 |
Gets the disabled of this Blacklist. | def disabled(self):
return self._disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled_switch(self):\n return self.disabled",
"def get_disable(self, btn):\n return self._disabled_buttons[btn]",
"def GetDisabledColour(self):\r\n\r\n return s... | [
"0.83648384",
"0.83648384",
"0.7823889",
"0.7443722",
"0.7367214",
"0.7338052",
"0.7338052",
"0.7295817",
"0.72877556",
"0.7286718",
"0.7205753",
"0.7175788",
"0.7175788",
"0.7137311",
"0.7137311",
"0.7137311",
"0.7137311",
"0.7137311",
"0.7137311",
"0.7137311",
"0.7137311",
... | 0.79957753 | 2 |
Gets the id of this Blacklist. | def id(self):
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def id(self) -> int:\n ... | [
"0.6739614",
"0.6739614",
"0.6739614",
"0.6739614",
"0.6739614",
"0.6739614",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.6726334",
"0.67154056",
... | 0.6685109 | 66 |
Sets the id of this Blacklist. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n self.data['id'] = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._i... | [
"0.7259795",
"0.7125426",
"0.7120135",
"0.6815405",
"0.6799187",
"0.6799187",
"0.6799187",
"0.6799187",
"0.6799187",
"0.6791984",
"0.6791984",
"0.6791984",
"0.6791984",
"0.6791984",
"0.6791984",
"0.6791984",
"0.6791984",
"0.6791984",
"0.6791984",
"0.67084116",
"0.67058265",
... | 0.67479116 | 23 |
ARN of the subnet. | def arn(self) -> str:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_arns(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"subnet_arns\")",
"def subnet_arns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"subnet_arns\")",
"def subnet_arns(self) -> Optional[pulumi.Input[Sequence[pulumi... | [
"0.7032945",
"0.6964174",
"0.6964174",
"0.69457734",
"0.6942578",
"0.687479",
"0.6516003",
"0.649983",
"0.6465567",
"0.6419711",
"0.63802135",
"0.627133",
"0.6193248",
"0.6169528",
"0.6169528",
"0.612067",
"0.6072152",
"0.6072152",
"0.6072152",
"0.6072152",
"0.6072152",
"0.... | 0.6132698 | 16 |
Association ID of the IPv6 CIDR block. | def ipv6_cidr_block_association_id(self) -> str:
return pulumi.get(self, "ipv6_cidr_block_association_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ipv6_gateway_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"ipv6_gateway_id\")",
"def remote_ipv6_network_cidr(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"remote_ipv6_network_cidr\")",
"def local_ipv6_network_cidr(self) -> pulumi.Output[str]:\n return pulumi.g... | [
"0.6443837",
"0.6432788",
"0.62590975",
"0.61848944",
"0.61848944",
"0.61354315",
"0.5879698",
"0.5879698",
"0.5815388",
"0.5695789",
"0.56767064",
"0.56350374",
"0.5511748",
"0.54941803",
"0.5450306",
"0.54243255",
"0.53943956",
"0.5361335",
"0.53524584",
"0.53356594",
"0.53... | 0.9095048 | 0 |
Whether public IP addresses are assigned on instance launch. | def map_public_ip_on_launch(self) -> bool:
return pulumi.get(self, "map_public_ip_on_launch") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_public_ip(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"use_public_ip\")",
"def public_ip():\n found_public_ip = False\n try:\n metadata = get_instance_metadata()\n for key, value in metadata.items():\n LOG.info(\"{0}: {1}\".format(key, value))\n... | [
"0.779581",
"0.7655759",
"0.7653327",
"0.75577873",
"0.7226243",
"0.7108737",
"0.70332974",
"0.70332974",
"0.70332974",
"0.70332974",
"0.70332974",
"0.70332974",
"0.7013787",
"0.6965122",
"0.6908074",
"0.68105537",
"0.67377925",
"0.6720821",
"0.6657154",
"0.66236717",
"0.6595... | 0.8219342 | 0 |
ARN of the Outpost. | def outpost_arn(self) -> str:
return pulumi.get(self, "outpost_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> pulumi.Output[str]:\n return pulumi.get... | [
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"0.7198512",
"... | 0.8142618 | 0 |
ID of the AWS account that owns the subnet. | def owner_id(self) -> str:
return pulumi.get(self, "owner_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_id(self) -> str:\n return pulumi.get(self, \"subnet_id\")",
"def accountId():\n # save the lookup if we set the account to the environment\n if \"AWS_ACCOUNT_ID\" in os.environ:\n return os.environ[\"AWS_ACCOUNT_ID\"]\n conn = iamConn()\n funcs = [\n lambda: conn.get_u... | [
"0.73477757",
"0.70653987",
"0.7047699",
"0.68616456",
"0.6816389",
"0.6816389",
"0.6775587",
"0.6775587",
"0.6775587",
"0.6775587",
"0.6775587",
"0.6775587",
"0.6775587",
"0.6775587",
"0.675281",
"0.6700467",
"0.6697042",
"0.6662323",
"0.6633892",
"0.6562694",
"0.6505401",
... | 0.5852336 | 80 |
`ec2.Subnet` provides details about a specific VPC subnet. This resource can prove useful when a module accepts a subnet ID as an input variable and needs to, for example, determine the ID of the VPC that the subnet belongs to. Example Usage The following example shows how one might accept a subnet ID as a variable and... | def get_subnet(availability_zone: Optional[str] = None,
availability_zone_id: Optional[str] = None,
cidr_block: Optional[str] = None,
default_for_az: Optional[bool] = None,
filters: Optional[Sequence[pulumi.InputType['GetSubnetFilterArgs']]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet(self) -> Optional[pulumi.Input['ResourceIdArgs']]:\n return pulumi.get(self, \"subnet\")",
"def subnet(self) -> pulumi.Output[Optional['outputs.ResourceIdResponse']]:\n return pulumi.get(self, \"subnet\")",
"def get_subnet(self, subnet_id, **kwargs):\r\n if 'mask' not in kwargs:... | [
"0.78606904",
"0.7733698",
"0.7444628",
"0.7396006",
"0.7317856",
"0.71470714",
"0.7106893",
"0.7088013",
"0.7085178",
"0.7085178",
"0.70683193",
"0.7002142",
"0.69667965",
"0.6856028",
"0.6829291",
"0.6820658",
"0.6796044",
"0.67828137",
"0.67750156",
"0.6718727",
"0.6705780... | 0.72129744 | 5 |
`ec2.Subnet` provides details about a specific VPC subnet. This resource can prove useful when a module accepts a subnet ID as an input variable and needs to, for example, determine the ID of the VPC that the subnet belongs to. Example Usage The following example shows how one might accept a subnet ID as a variable and... | def get_subnet_output(availability_zone: Optional[pulumi.Input[Optional[str]]] = None,
availability_zone_id: Optional[pulumi.Input[Optional[str]]] = None,
cidr_block: Optional[pulumi.Input[Optional[str]]] = None,
default_for_az: Optional[pulumi.Input[Opt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet(self) -> Optional[pulumi.Input['ResourceIdArgs']]:\n return pulumi.get(self, \"subnet\")",
"def subnet(self) -> pulumi.Output[Optional['outputs.ResourceIdResponse']]:\n return pulumi.get(self, \"subnet\")",
"def get_subnet(self, subnet_id, **kwargs):\r\n if 'mask' not in kwargs:... | [
"0.78606904",
"0.7733698",
"0.7444628",
"0.7396006",
"0.7317856",
"0.72129744",
"0.71470714",
"0.7106893",
"0.7088013",
"0.7085178",
"0.7085178",
"0.70683193",
"0.7002142",
"0.69667965",
"0.6856028",
"0.6829291",
"0.6820658",
"0.6796044",
"0.67828137",
"0.67750156",
"0.671872... | 0.66304874 | 28 |
Common precondition checking for move operations. Returns True/False if the current state meets the preconditions | def op_move_preconditions(self):
if(self.next_move != self.FREE):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_valid(move):\n return True",
"def legal_move(self, move, state = None):\n if state is None:\n state = copy(self.state)\n else:\n state = copy(state)\n return state[move // state.shape[0], move % state.shape[0]] == 0",
"def move_check(self):\r\n \r\n... | [
"0.67875767",
"0.6744649",
"0.64758986",
"0.64090246",
"0.6374253",
"0.6288437",
"0.62350005",
"0.62100995",
"0.62066495",
"0.618822",
"0.6186001",
"0.6175128",
"0.6167867",
"0.61495614",
"0.6062313",
"0.60473734",
"0.60410905",
"0.6030074",
"0.6023568",
"0.60148126",
"0.5994... | 0.7841922 | 0 |
Check if the given piece can be jump to the northeast. piece > (x,y) starting coordinates of piece to jump ret > True/False | def op_jump_neast_pre(self,piece):
# Check particular preconditions
# Check for board-end/right-side colisions
if self.curr_player == self.PLAYER1:
if piece[1] <= 2 or piece[0] >= 7:
return False
else:
if piece[1] >= 7 or piece[0] <= 2:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_jump_nwest(self,piece):\n\n # Check common preconditions\n if(not self.op_jump_preconditions(piece)):\n return False\n\n # Check particular preconditions\n\n if not self.op_jump_nwest_pre(piece):\n return False\n\n # Variable extraction\n piece... | [
"0.7715649",
"0.7647296",
"0.7108014",
"0.69291294",
"0.6890963",
"0.6764825",
"0.6744528",
"0.66790456",
"0.6621312",
"0.65319353",
"0.65006524",
"0.6491945",
"0.64656043",
"0.6461708",
"0.64556825",
"0.64314467",
"0.6346324",
"0.63377947",
"0.63364214",
"0.62753",
"0.623609... | 0.7081245 | 3 |
Check if the given piece can capture to the west. piece > (x,y) starting coordinates of piece that captures ret > True/False | def op_capture_west_pre(self,piece):
# Check particular preconditions
# Check for side-board colisions
if self.curr_player == self.PLAYER1:
if piece[0] <= 2:
return False
else:
if piece[0] >= 7:
return False
dir_ = self.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_capture_nwest_pre(self,piece):\n\n # Check colisions with the board's end and the side-board\n if self.curr_player == self.PLAYER1:\n if piece[1] <= 2 or piece[0] <= 2:\n return False\n else:\n if piece[1] >= 7 or piece[0] >= 7:\n ret... | [
"0.7637095",
"0.7392082",
"0.7334483",
"0.72442293",
"0.7199557",
"0.6952028",
"0.6815062",
"0.67856914",
"0.67827237",
"0.67075276",
"0.65988296",
"0.6587664",
"0.65205026",
"0.65013605",
"0.64443684",
"0.643795",
"0.64268786",
"0.64148366",
"0.6392234",
"0.6349903",
"0.6316... | 0.7943336 | 0 |
Check if the given piece can capture to the east. piece > (x,y) starting coordinates of piece that captures ret > True/False | def op_capture_east_pre(self,piece):
# Check for side-board colisions
if self.curr_player == self.PLAYER1:
if piece[0] >= 7:
return False
else:
if piece[0] <= 2:
return False
dir_ = self.get_direction()
lastPieceCoords = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_capture_east(self,piece):\n\n # Check common preconditions\n if(not self.op_capture_preconditions(piece)):\n return False\n\n # Check particular preconditions\n if not self.op_capture_east_pre(piece):\n return False\n\n # Variable extraction\n ... | [
"0.7812848",
"0.7280182",
"0.7148918",
"0.71398026",
"0.70977527",
"0.7009313",
"0.69501173",
"0.68470824",
"0.6763238",
"0.6678541",
"0.6193424",
"0.6186407",
"0.61858964",
"0.61669254",
"0.6137169",
"0.6125402",
"0.61216664",
"0.6095989",
"0.60727745",
"0.60623753",
"0.6052... | 0.7878909 | 0 |
Check if the given piece can capture to the northeast. piece > (x,y) starting coordinates of piece that captures ret > True/False | def op_capture_neast_pre(self,piece):
# Check colisions with the board's end and the side-board
if self.curr_player == self.PLAYER1:
if piece[1] <= 2 or piece[0] >= 7:
return False
else:
if piece[1] >= 7 or piece[0] <= 2:
return False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_capture_nwest_pre(self,piece):\n\n # Check colisions with the board's end and the side-board\n if self.curr_player == self.PLAYER1:\n if piece[1] <= 2 or piece[0] <= 2:\n return False\n else:\n if piece[1] >= 7 or piece[0] >= 7:\n ret... | [
"0.71485114",
"0.71127135",
"0.70675254",
"0.69851667",
"0.6895211",
"0.68192613",
"0.66828364",
"0.6528521",
"0.6503925",
"0.6465997",
"0.6455093",
"0.64324",
"0.6417341",
"0.64118785",
"0.6345006",
"0.63054967",
"0.62277955",
"0.61660725",
"0.61641747",
"0.616318",
"0.61570... | 0.65641475 | 7 |
Check if the given piece can capture to the northwest. piece > (x,y) starting coordinates of piece that captures ret > True/False | def op_capture_nwest_pre(self,piece):
# Check colisions with the board's end and the side-board
if self.curr_player == self.PLAYER1:
if piece[1] <= 2 or piece[0] <= 2:
return False
else:
if piece[1] >= 7 or piece[0] >= 7:
return False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_capture_west_pre(self,piece):\n\n # Check particular preconditions\n\n # Check for side-board colisions\n if self.curr_player == self.PLAYER1:\n if piece[0] <= 2:\n return False\n else:\n if piece[0] >= 7:\n return False\n\n ... | [
"0.76864123",
"0.7476398",
"0.734638",
"0.734118",
"0.73111403",
"0.7185931",
"0.69077224",
"0.67527276",
"0.6670959",
"0.6639278",
"0.6482902",
"0.64804494",
"0.6432605",
"0.6380377",
"0.63452834",
"0.6338099",
"0.631443",
"0.63069654",
"0.63020515",
"0.62703484",
"0.6265012... | 0.7518473 | 1 |
Add a new piece to the board piece > (x,y) destination of the new piece ret > False if piece can't jump or resulting state | def op_add_piece(self, position):
# Check common preconditions
if(not self.op_add_piece_preconditions()):
return False
# Variable extraction
pos_x = position[0]
pos_y = position[1]
# Check particular preconditions
if not (pos_x >= 2 and pos_x < 8):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_piece(self, piece: Model):\n new_piece_coordinates = piece.get_block_positions()\n for coordinates in new_piece_coordinates:\n if not self.piece_encompasses_coordinates(coordinates):\n continue\n else:\n print('GAME OVER')\n r... | [
"0.773755",
"0.7431106",
"0.709067",
"0.7024138",
"0.687369",
"0.6848912",
"0.68143505",
"0.68072563",
"0.6806418",
"0.67969525",
"0.6795944",
"0.67142147",
"0.6711255",
"0.66958076",
"0.66900563",
"0.6681486",
"0.66471815",
"0.66454726",
"0.6627484",
"0.66244644",
"0.661018"... | 0.7415503 | 2 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Policy):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Get data type by parse type proto object. The name of the DataType, refer to `anf_ir_pb2.DataType` object. If data type is tensor or tuple, the data name we return is `data_type[element_type, element_type]`. | def _get_data_type_by_parse_type_proto(self, type_proto, node):
data_type_name = self._get_data_type_name_by_value(type_proto, type_proto.data_type, field_name='data_type')
if type_proto.data_type == DataType.DT_TENSOR:
tensor_type_proto = type_proto.tensor_type
value = type_prot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datatype(self):\n # datatype is type of first dataarg\n return self[self.dataargs()[0]].typename",
"def dataType(self, data):\n if isinstance(data,str):\n return STRING\n elif isinstance(data,dict):\n return ASSOC\n elif isinstance(data,int) or isinsta... | [
"0.59444714",
"0.58354336",
"0.5740663",
"0.5685997",
"0.5670374",
"0.5592567",
"0.55925214",
"0.5544859",
"0.55308944",
"0.55048025",
"0.5495222",
"0.5494881",
"0.5470246",
"0.5406084",
"0.5400648",
"0.53971636",
"0.53914994",
"0.53781277",
"0.53666115",
"0.53347135",
"0.530... | 0.8059823 | 0 |
Get the data type name by the enum value, data_type refer to `DataType` object. | def _get_data_type_name_by_value(data_type, value, field_name='data_type'):
return data_type.DESCRIPTOR.fields_by_name[field_name].enum_type.values_by_number[value].name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EnumValueName(self, enum_value, enum_type):\n return '%s_%s' % (self.ToPpapiType(enum_type).upper(),\n enum_value.name.upper())",
"def typeName (self, typecode):\n if typecode == qmf2.SCHEMA_DATA_VOID: return \"void\"\n elif typecode == qmf2.SCHEMA_DATA_BOOL: return \"bo... | [
"0.70221055",
"0.66765034",
"0.635886",
"0.6279254",
"0.6209826",
"0.6149308",
"0.60501504",
"0.6050059",
"0.5931012",
"0.5910108",
"0.5887784",
"0.57880884",
"0.57656336",
"0.57353836",
"0.5723197",
"0.57218695",
"0.57207763",
"0.569964",
"0.56882846",
"0.56836605",
"0.56637... | 0.89679587 | 0 |
Pads array with zeros by a given amount over each axis. | def pad_with_zeros(array, padding_by_axis):
shape = [
size + padding_by_axis.get(axis, 0)
for axis, size in enumerate(array.shape)
]
position = tuple(
slice(padding_by_axis.get(axis, 0) // 2,
size - (padding_by_axis.get(axis, 0) + 1) // 2, 1)
for axis, size in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_zeroes(m, axis, thick):\n\n if axis == 1:\n rows = m.shape[0]\n cols = thick\n elif axis == 0:\n rows = thick\n cols = m.shape[1]\n\n return np.concatenate((m, np.zeros((rows,cols))), \n axis)",
"def pad(arr, n):\n m = len(arr)\n ... | [
"0.7338179",
"0.71627736",
"0.71387094",
"0.70832604",
"0.69777405",
"0.6967526",
"0.685875",
"0.6823201",
"0.68072516",
"0.67449605",
"0.67216057",
"0.6718825",
"0.6628488",
"0.6561104",
"0.65309435",
"0.6515613",
"0.6425914",
"0.64178306",
"0.6405649",
"0.63762176",
"0.6366... | 0.7434305 | 0 |
Log and get the LSI model's current projection. Returns | def getstate(self):
logger.info("worker #%i returning its state after %s jobs", self.myid, self.jobsdone)
assert isinstance(self.model.projection, lsimodel.Projection)
self.finished = True
return self.model.projection | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projection(self):\n return self.projection",
"def projection(self):\n pass",
"def projection(self):\n return self.dataset.GetProjection() if self.dataset else None",
"def projection(self):\n return self._map_projection",
"def projection(self):\n return self._map_p... | [
"0.68175817",
"0.67347896",
"0.65360147",
"0.6413873",
"0.6413873",
"0.6393331",
"0.629977",
"0.6258683",
"0.6205747",
"0.59773916",
"0.5956426",
"0.5892415",
"0.58281773",
"0.5796283",
"0.5691667",
"0.56804276",
"0.5673153",
"0.56544393",
"0.56116647",
"0.56049895",
"0.55728... | 0.5608818 | 19 |
This method tests create and delete functionality for spark service instance | def create_delete_spark_instance(self, service_Id, instanceFile):
# Create Spark service instance
instance_Id = self.create_spark_instance(service_Id, instanceFile)
# Delete Spark service instance
self._delete_spark_instance(instance_Id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_virtual_service(self):\n pass",
"def test_cloud_service(self):\n cur = self.factory.create(access_token=ACCESS_TOKEN, expires_at=self.current_dt)\n with HTTMock(spark_cloud_mock):\n cloud = CloudCredentials.objects.cloud_service()\n self.assertEqual(cloud.ac... | [
"0.7010347",
"0.68728936",
"0.6668016",
"0.6633667",
"0.66299117",
"0.656999",
"0.6545101",
"0.643993",
"0.64090776",
"0.640666",
"0.6389035",
"0.6379107",
"0.6371213",
"0.6320542",
"0.6300603",
"0.6285223",
"0.62504166",
"0.6224099",
"0.6168856",
"0.61476016",
"0.6145105",
... | 0.5917391 | 39 |
This method tests create and delete functionality for cassandra service instance | def create_delete_cassandra_instance(self, service_Id, instanceFile):
# Create Cassandra service instance
instance_Id = self.create_cassandra_instance(service_Id, instanceFile)
# Delete Cassandra service instance
self._delete_cassandra_instance(instance_Id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_installation(cassandra_service):\n verify_client_can_write_read_and_delete()",
"def test_delete_virtual_service(self):\n pass",
"def test_delete(self):\n pass",
"def test_delete_client(self):\n pass",
"def test_delete_cloud(self):\n pass",
"def test_otorosh... | [
"0.7053154",
"0.67712414",
"0.6732967",
"0.6658686",
"0.6580953",
"0.6526577",
"0.6491715",
"0.64886314",
"0.64502436",
"0.64496255",
"0.64496255",
"0.6447909",
"0.64349735",
"0.6412264",
"0.640535",
"0.6396037",
"0.63909614",
"0.63393307",
"0.6303159",
"0.62759036",
"0.62545... | 0.63483423 | 17 |
This method tests create and delete functionality for vertica service instance | def create_delete_vertica_instance(self, service_Id, instanceFile):
# Create Vertica service instance
instance_Id = self.create_vertica_instance(service_Id, instanceFile)
# Delete Vertica service instance
self._delete_vertica_instance(instance_Id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_virtual_service(self):\n pass",
"def test_aws_service_api_vm_delete(self):\n pass",
"def test_create_confirm_service_details(self):\n pass",
"def test_client_create(self):\n pass",
"def test_delete_instances(self, instances_count, create_instance):\n insta... | [
"0.7264958",
"0.6934214",
"0.69164944",
"0.6853396",
"0.680113",
"0.67760515",
"0.67620635",
"0.67330253",
"0.6726119",
"0.66888016",
"0.66414255",
"0.6607978",
"0.6532957",
"0.6516533",
"0.6515283",
"0.64856434",
"0.6475229",
"0.64703065",
"0.64627934",
"0.63831645",
"0.6353... | 0.6224042 | 27 |
This method tests create and delete functionality for mongo DB service instance | def create_delete_mongoDb_instance(self, service_Id, instanceFile):
# Create Mongo DB service instance
instance_Id = self.create_mongoDb_instance(service_Id, instanceFile)
# Delete Mongo DB service instance
self._delete_mongoDb_instance(instance_Id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create(self):\n pass",
"def test_create(self):\n self.app\n pass",
"def test_create_collection(self):\n pass",
"def setUp(self):\n self.db_name = '_mongolog_test'\n self.collection_name = 'log'\n\n self.conn = pymongo.MongoClient()\n self.db = ... | [
"0.7159152",
"0.6977844",
"0.69198644",
"0.6909919",
"0.6864463",
"0.6854583",
"0.68213195",
"0.6754248",
"0.66720957",
"0.66605985",
"0.6636881",
"0.66231716",
"0.65903604",
"0.65740013",
"0.6554753",
"0.65450144",
"0.6542294",
"0.652863",
"0.6514291",
"0.651234",
"0.6502951... | 0.6252507 | 55 |
Counts numbers if they're not next to themselves with a range | def count_singlesA(key, alist):
result = 0
for x in range(len(alist)):
if alist[x] == key:
if not is_next_to(x, alist):
result += 1
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_in_range(start, end, check):\n count = 0\n for val in range(start, end):\n if check(val):\n count += 1\n\n return count",
"def count_ranges(a):\n ranges = []\n count = 0\n for i, v in enumerate(a):\n if v == 1: # same as previous value\n count += 1... | [
"0.6712565",
"0.6609973",
"0.6541053",
"0.6381768",
"0.6282015",
"0.6225943",
"0.6039543",
"0.59320694",
"0.58274",
"0.5787715",
"0.5769599",
"0.57598966",
"0.5739813",
"0.57387483",
"0.5712763",
"0.570462",
"0.57031584",
"0.57010466",
"0.56993765",
"0.5689055",
"0.56682324",... | 0.0 | -1 |
Calculate total blocks to build a 2D pyramid for ROW_COUNT rows | def main():
print('Calculating for {} rows:'.format(ROW_COUNT))
print()
print('Recursive function:', calculate_pyramid_rows(ROW_COUNT))
print('With a loop:', calculate_pyramid_rows_loop(ROW_COUNT)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_pyramid_rows_loop(number_of_rows):\n total_blocks = 0\n for x in range(1, number_of_rows + 1):\n total_blocks += x\n return total_blocks",
"def calculate_pyramid_rows(number_of_rows):\n if number_of_rows <= 1:\n return number_of_rows\n return number_of_rows + calculate_... | [
"0.8070073",
"0.6892588",
"0.6568954",
"0.62784857",
"0.6220173",
"0.6101706",
"0.60693455",
"0.6064664",
"0.6059548",
"0.5994849",
"0.59530795",
"0.59441245",
"0.59319395",
"0.58425575",
"0.5837831",
"0.5833357",
"0.5826614",
"0.57941926",
"0.5783178",
"0.5778858",
"0.576168... | 0.60446817 | 9 |
Clip boxes to image boundaries. boxes must be tensor or Variable, im_shape can be anything but Variable | def clip_boxes(boxes, im_shape):
if not hasattr(boxes, 'data'):
boxes_ = boxes.numpy()
boxes = boxes.view(boxes.size(0), -1, 4)
boxes = torch.stack( \
[boxes[:, :, 0].clamp(0, im_shape[1] - 1),
boxes[:, :, 1].clamp(0, im_shape[0] - 1),
boxes[:, :, 2].clamp(0, im_shape[1] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_boxes(boxes, im_shape):\n boxes[:, 0::2]=threshold(boxes[:, 0::2], 0, im_shape[1]-1)\n boxes[:, 1::2]=threshold(boxes[:, 1::2], 0, im_shape[0]-1)\n return boxes",
"def clip_boxes(boxes, im_shape):\n boxes[:, 0::2]=threshold(boxes[:, 0::2], 0, im_shape[1]-1)\n boxes[:, 1::2]=threshold(boxe... | [
"0.8290456",
"0.8290456",
"0.81815654",
"0.81124896",
"0.8080543",
"0.8059756",
"0.8059756",
"0.8025521",
"0.78801155",
"0.7838151",
"0.78273296",
"0.7573959",
"0.75504094",
"0.737302",
"0.7216797",
"0.7071484",
"0.70260656",
"0.69091374",
"0.66593295",
"0.660861",
"0.6597305... | 0.81464744 | 3 |
Returns the position of the given writer. For streams with single writers this is equivalent to `get_current_token`. | def get_current_token_for_writer(self, instance_name: str) -> int:
return self.get_current_token() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_token(self) -> int:\n\n # Currently we don't support this operation, as it's not obvious how to\n # condense the stream positions of multiple writers into a single int.\n raise NotImplementedError()",
"def get_current_token_for_writer(self, instance_name: str) -> int:\n\n ... | [
"0.71692765",
"0.6753285",
"0.6549249",
"0.6168159",
"0.58815813",
"0.58604056",
"0.57770294",
"0.57257223",
"0.5703287",
"0.56810254",
"0.5673124",
"0.56469375",
"0.56469375",
"0.56452894",
"0.56381536",
"0.56236196",
"0.5600573",
"0.55691564",
"0.5561714",
"0.5561649",
"0.5... | 0.7031112 | 1 |
Returns the position of the given writer. | def get_current_token_for_writer(self, instance_name: str) -> int:
with self._lock:
return self._return_factor * self._current_positions.get(instance_name, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position(self):\n\n return self.scanner.position()",
"def getPos(self, walker):\n if walker not in self.walkers:\n raise ValueError(\"No such Walker exist in our space!\")\n return self.walkers[walker]",
"def pos(self):\n return self.file.tell()",
"def position(self... | [
"0.63169396",
"0.63128287",
"0.623479",
"0.6229579",
"0.61288655",
"0.61288655",
"0.60618556",
"0.6039889",
"0.59937024",
"0.5988809",
"0.5907935",
"0.5866479",
"0.5839263",
"0.58311075",
"0.5830174",
"0.5825639",
"0.57827324",
"0.5766424",
"0.5766424",
"0.576318",
"0.5742122... | 0.5469952 | 70 |
Get the max position where all previous positions have been persisted. | def get_persisted_upto_position(self) -> int:
with self._lock:
return self._return_factor * self._persisted_upto_position | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_max_pos(self):\n query = text('select max(song_position) as \"max_position\" from setlist where show_id = :id')\n query = query.bindparams(id=self.id)\n\n result = db.engine.execute(query)\n\n for row in result:\n max_position = row['max_position']\n if m... | [
"0.794527",
"0.7887543",
"0.78280085",
"0.7670549",
"0.7519496",
"0.7516804",
"0.7449702",
"0.7433437",
"0.740143",
"0.735379",
"0.72688633",
"0.7265686",
"0.7265686",
"0.72276586",
"0.72276586",
"0.72276586",
"0.7208004",
"0.7200069",
"0.71620786",
"0.71555066",
"0.7093644",... | 0.0 | -1 |
This function generates the DCM corresponding to the input PRV coordinates Taken from Part1/5_Principal_rotation_vector_PRV.pdf page 58 | def prv_to_dcm(angle, unit_vector):
r = angle
e = unit_vector
s = 1 - np.cos(r)
dcm = [[s*e[0]**2 + np.cos(r), e[0]*e[1]*s + e[2]*np.sin(r), e[0]*e[2]*s - e[1]*np.sin(r)],
[e[1]*e[0]*s - e[2]*np.sin(r), s*e[1]**2 + np.cos(r), e[1]*e[2]*s + e[0]*np.sin(r)],
[e[2]*e[0]*s + e[1]*np.si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dcm_to_crp(dcm):\n c = np.trace(dcm) + 1\n return (1/c)*np.array([dcm[1, 2] - dcm[2, 1], dcm[2, 0] - dcm[0, 2], dcm[0, 1] - dcm[1, 0]])",
"def crp_to_dcm(q):\n s = q @ q\n return (1/(1 + s))*((1 - s)*np.identity(3) + 2*np.outer(q, q) - 2*ut.cross_product_operator(q))",
"def dcm_to_mrp(dcm):\n ... | [
"0.6673871",
"0.64608544",
"0.62403107",
"0.606799",
"0.5978398",
"0.59590334",
"0.58830965",
"0.5787039",
"0.5787039",
"0.5756409",
"0.5651027",
"0.564243",
"0.5618265",
"0.5605316",
"0.560352",
"0.55627316",
"0.55450994",
"0.55401194",
"0.55242866",
"0.551206",
"0.5509628",... | 0.639442 | 2 |
This function generates the quaternion coordinates corresponding to the DCm input. This is called sheppard's method, which does not contain a singularity like the 'common' way to do this. See Part1/6_EulerParameters_Quaternions_.pdf page 68 | def dcm_to_quaternions(dcm):
trace = np.trace(dcm)
b_2 = (1/4)*np.array([(1+trace), (1 + 2*dcm[0, 0] - trace), (1 + 2*dcm[1, 1] - trace), (1 + 2*dcm[2, 2] - trace)])
argmax = np.argmax(b_2)
b = np.zeros(4)
b[argmax] = np.sqrt(b_2[argmax])
# There is probably a cleaner way to do these checks
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dcm_to_quaternions_bad(dcm):\n b0 = (1/2)*np.sqrt(np.trace(dcm) + 1)\n return np.array([b0, (dcm[1, 2] - dcm[2, 1])/(4*b0), (dcm[2, 0] - dcm[0, 2])/(4*b0),\n (dcm[0, 1] - dcm[1, 0]) / (4*b0)])",
"def quat2dcm(q):\n q0q0 = q[0] * q[0]\n q0q1 = q[0] * q[1]\n q0q2 = q[0] * q[2... | [
"0.6418956",
"0.6218048",
"0.6195954",
"0.5960042",
"0.5885814",
"0.58637357",
"0.5861446",
"0.5851375",
"0.58053863",
"0.58010423",
"0.58001775",
"0.5748331",
"0.5708925",
"0.56814307",
"0.56647253",
"0.56518394",
"0.5585827",
"0.5576915",
"0.55521",
"0.55258447",
"0.5475765... | 0.6788403 | 0 |
Calculates log(xm) since mlog(x) will fail when m, x = 0. | def logpow(x, m):
# return m * log(x)
return tt.switch(tt.eq(x, 0), -np.inf, m * tt.log(x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logpow(x, m):\n # return m * log(x)\n return pt.switch(pt.eq(x, 0), pt.switch(pt.eq(m, 0), 0.0, -np.inf), m * pt.log(x))",
"def log(self, x, base=2):\n if x == 0:\n return 0\n return math.log(x, base)",
"def logm(self, x):\n\n if K.backend() == 'theano':\n #... | [
"0.7836792",
"0.7795391",
"0.76946455",
"0.7612447",
"0.7505014",
"0.7336194",
"0.7333879",
"0.7310866",
"0.7243556",
"0.7222918",
"0.7169865",
"0.71242654",
"0.70531833",
"0.70466876",
"0.7011839",
"0.6999271",
"0.69981575",
"0.696667",
"0.69562936",
"0.6946504",
"0.6923862"... | 0.7899951 | 0 |
The raw unprocessed content of the file (a string) | def raw_content(self, file_name):
if file_name not in self._raw_content:
raise FileNotAnalyzed(file_name)
return self._raw_content[file_name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_body(self):\n return file_ops.read_utf8(self.raw_file_name)",
"def content(self):\n if hasattr(self.raw_content, 'read'):\n if hasattr(self.raw_content, 'seek'):\n self.raw_content.seek(0)\n data = self.raw_content.read()\n else:\n data... | [
"0.8158673",
"0.7358526",
"0.7288942",
"0.7279297",
"0.72320086",
"0.72062546",
"0.7187214",
"0.70793676",
"0.704665",
"0.704665",
"0.70380807",
"0.69895965",
"0.69665027",
"0.69372064",
"0.69372064",
"0.69116205",
"0.6890702",
"0.6881077",
"0.6851906",
"0.6834419",
"0.680990... | 0.7482583 | 1 |
Creates a rowcol function similar to the rowcol function of a view | def make_rowcol(string):
rowlens = [len(x) + 1 for x in string.split("\n")]
rowpos = []
acc = 0
for i in rowlens:
acc += i
rowpos.append(acc)
def rowcol(pos):
last = 0
for i, k in enumerate(rowpos, 0):
if pos < k:
return (i, pos - last)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rowcol(self, file_name):\n return make_rowcol(self.raw_content(file_name))",
"def genRowColCell(self, args):\n if len(args) == 2:\n x = int(args[0])\n y = int(args[1])\n if x == 0 and y == 0:\n return self.genMatrix()\n elif x == 0:\n ... | [
"0.6092809",
"0.5985254",
"0.5903149",
"0.5771719",
"0.57138526",
"0.5700687",
"0.5639679",
"0.5572499",
"0.5538085",
"0.5492243",
"0.5492243",
"0.54907167",
"0.5476356",
"0.5443089",
"0.54314184",
"0.54187113",
"0.5381782",
"0.53444856",
"0.52973926",
"0.52444804",
"0.521755... | 0.5087837 | 26 |
generates 16 random bytes | def generate_key():
key = [ randint(0,255) for i in range(16) ]
return bytes( key ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandomBytes(n=16):\n\n with open(\"/dev/urandom\") as f:\n _bytes = f.read(n)\n\n return binascii.hexlify(_bytes)",
"def _get_encode_random(self):\n return os.urandom(16).encode('hex')",
"def gensalt():\n return hexlify(os.urandom(24)).decode()",
"def random(n: int) ... | [
"0.7786692",
"0.7709148",
"0.7561159",
"0.74697345",
"0.7456036",
"0.74270153",
"0.7426677",
"0.7262658",
"0.7203128",
"0.7201832",
"0.71947557",
"0.7167366",
"0.711619",
"0.7028483",
"0.70252395",
"0.70213175",
"0.7013659",
"0.7013127",
"0.700447",
"0.6919248",
"0.6884835",
... | 0.75897574 | 2 |
Cleans the words according to the specifications to be considered as a word | def processText(text):
no_punc = [word for word in text.split() if word.isalpha()] # and word not in stopwords.words('english')]
#removes non-letter characters and only includes words not included in stopwords
no_punc = " ".join(no_punc)
clean_words = nltk.word_tokenize(no_punc) #splits the punctuati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean(word):\n word = word.lower()\n stopwords = ['of', 'and','to', 'at', 'in', '@']\n word = re.sub(r'[\\&/\\-\\(\\)\\|\\@,\\]\\[]+', ' ', word)\n for stopword in stopwords:\n pattern = r'\\b' + stopword + r'\\b'\n pattern = re.compile(pattern)\n word = re.sub(pattern, '', wor... | [
"0.75174266",
"0.7480522",
"0.7184207",
"0.7107454",
"0.7096827",
"0.70648223",
"0.70612895",
"0.6974351",
"0.69683987",
"0.6965347",
"0.6886696",
"0.686534",
"0.68168193",
"0.67940974",
"0.67636395",
"0.67618334",
"0.67611116",
"0.6761026",
"0.6760374",
"0.674916",
"0.671730... | 0.6467112 | 54 |
r""" Finds an arbitrary perpendicular vector to v. | def perpendicular_vector(v):
if v[1] == 0 and v[2] == 0:
if v[0] == 0:
raise ValueError("zero vector")
else:
return np.cross(v, [0, 1, 0])
return np.cross(v, [1, 0, 0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_perpendicular_vector(vt):\n x, y = vt\n return np.array([y, -x])",
"def perpendicularTo(self, vector):\n perpendicular = self.subtractVector(self.parallelTo(vector))\n return perpendicular",
"def get_perpendicular2d(vector):\n if vector[1] == 0:\n return np.asarray([0.,1.... | [
"0.85335606",
"0.85114884",
"0.8206129",
"0.780971",
"0.7748301",
"0.7714229",
"0.7539104",
"0.7358264",
"0.73506993",
"0.7297056",
"0.70058644",
"0.6980482",
"0.6799213",
"0.6759398",
"0.6754805",
"0.66883516",
"0.6580795",
"0.6461187",
"0.644593",
"0.6408327",
"0.6404169",
... | 0.9032531 | 0 |
p, n = plane_fit(points) Given an array, points, of shape (d,...) representing points in ddimensional space, fit an ddimensional plane to the points. Return a point, p, on the plane (the pointcloud centroid), and the normal, n. | def plane_fit(points):
import numpy as np
from numpy.linalg import svd
points = np.reshape(
points, (np.shape(points)[0], -1)
) # Collapse trialing dimensions
assert (
points.shape[0] <= points.shape[1]
), "There are only {} points in {} dimensions.".format(
points.shap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plane_fit(points):\n points = np.reshape(points, (np.shape(points)[0], -1)) # Collapse trialing dimensions\n assert points.shape[0] <= points.shape[1], \"There are only {} points in {} dimensions.\".format(points.shape[1],\n ... | [
"0.7676507",
"0.75403357",
"0.7513275",
"0.7412904",
"0.7169095",
"0.71590596",
"0.6806354",
"0.6806354",
"0.67510617",
"0.65506285",
"0.6487182",
"0.6433936",
"0.643341",
"0.63729197",
"0.62794304",
"0.62794304",
"0.6265822",
"0.6259819",
"0.6232445",
"0.6203658",
"0.6095789... | 0.76906705 | 0 |
Given two lines defined by numpy.array pairs (a0,a1,b0,b1) Return the closest points on each segment and their distance, | def closest_distance_between_lines(
a0,
a1,
b0,
b1,
clamp_all=False,
clamp_a0=False,
clamp_a1=False,
clamp_b0=False,
clamp_b1=False,
):
# If clampAll=True, set all clamps to True
if clamp_all:
clamp_a0 = True
clamp_a1 = True
clamp_b0 = True
cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __two_nearest_line__(b1, b2):\n distances = []\n for p in b1:\n for q in b2:\n distances.append([__distance__(p, q), (p, q)])\n distances = sorted(distances, key=lambda d: d[0])\n a1, b1 = distances[0][1][0], distances[0][1][1]\n a2, b2 = distances[1][1][0], distances[1][1][1]\... | [
"0.7783154",
"0.73707515",
"0.7249534",
"0.694964",
"0.69107634",
"0.6793999",
"0.67527974",
"0.675067",
"0.67037797",
"0.66811633",
"0.66682494",
"0.6631506",
"0.6548031",
"0.6532035",
"0.6527338",
"0.6471778",
"0.64235115",
"0.6413072",
"0.6399683",
"0.63990635",
"0.6390164... | 0.75355685 | 1 |
Get random direction vector | def random_direction_vector(return_angles=False):
xi1 = np.random.rand()
xi2 = np.random.rand()
# theta = np.arccos(np.sqrt(1.0-xi1))
theta = np.arccos(1.0 - (xi1 * 1))
phi = xi2 * 2 * np.pi
xs = np.sin(theta) * np.cos(phi)
ys = np.sin(theta) * np.sin(phi)
zs = np.cos(theta)
vecto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rand_direction(dim, rand):\n direction = rand.normal(size=dim)\n return direction / la.norm(direction)",
"def random_direction():\n\n if randrange(2):\n return Direction.RIGHT\n else:\n return Direction.DOWN",
"def sample_direction():\r\n gamma = random.random(... | [
"0.80494213",
"0.7736295",
"0.7529004",
"0.7401544",
"0.7241382",
"0.7140471",
"0.7121198",
"0.70036495",
"0.694621",
"0.694621",
"0.69158244",
"0.68758285",
"0.6848401",
"0.67785",
"0.667505",
"0.6635932",
"0.6598511",
"0.65959764",
"0.6582548",
"0.6553977",
"0.6528179",
"... | 0.74408233 | 3 |
Produces random vector along selected axis | def random_vector_along_axis(sigma=1.0, size=1, axis_order=[0, 1, 2]):
beta = np.random.normal(scale=sigma, size=size)
# alpha - dokola
alpha = 2 * np.pi * np.random.rand(size)
# alpha = [0.] * size
beta = 0.5 * np.pi - np.asarray(beta)
z = [np.sin(beta), -np.cos(beta) * np.sin(alpha), np.cos(be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_vector(size):\n return np.random.uniform(-0.1, 0.1, size)",
"def initial_vector(self):\n\n return asarray([np.random.uniform(l, u) for l, u in self.bounds])",
"def random_vector_in_unit_ball():\n x = np.random.normal(loc=0.0, scale=1.0, size=(numSamples, self.dim))\n ... | [
"0.7312881",
"0.7011162",
"0.6939167",
"0.6899393",
"0.679447",
"0.6765668",
"0.6763797",
"0.6707225",
"0.67005265",
"0.67005265",
"0.6685143",
"0.6663434",
"0.66529405",
"0.6635823",
"0.66054034",
"0.6578599",
"0.6522094",
"0.64865816",
"0.6484885",
"0.63688844",
"0.63683236... | 0.62453187 | 28 |
detects collision betwen two boundingboxes. | def bbox_collision(bbox1, bbox2):
bbox1 = np.asarray(bbox1)
bbox2 = np.asarray(bbox2)
max1 = np.max(bbox1, axis=1)
min1 = np.min(bbox1, axis=1)
max2 = np.max(bbox2, axis=1)
min2 = np.min(bbox2, axis=1)
out = (min1 <= max2) & (max1 >= min2)
return np.all(out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collide(b1,b2):\n if mag(b1.pos-b2.pos) < (b1.radius + b2.radius - .05):\n return True",
"def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRight.x >= other.upperLeft.x and\n self.upperLeft.y >= other.lowerRight.y and... | [
"0.762046",
"0.75459814",
"0.7374841",
"0.7311485",
"0.72526056",
"0.71774435",
"0.7169385",
"0.711689",
"0.711608",
"0.71063125",
"0.7104524",
"0.71043354",
"0.71027696",
"0.7095979",
"0.7087133",
"0.7084089",
"0.7083037",
"0.7052653",
"0.70123196",
"0.70097",
"0.69775355",
... | 0.7443714 | 2 |
Compute equivalent radius to obtain same surface as circle. \theta = \frac{2 \pi}{n} r_{eqs} = \sqrt{\frac{\theta r^2}{\sin{\theta}}} | def regular_polygon_area_equivalent_radius(n, radius=1.0):
theta = 2 * np.pi / n
r = np.sqrt((theta * radius ** 2) / np.sin(theta))
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polar_radius(self):\n return self.r * (1 - self.f)",
"def circleCirc(radius):\n radius = float(radius)\n return 2*math.pi*radius",
"def radius_square(self):\n try: \n return self._radius_2\n except AttributeError:\n center = self.center()\n self._... | [
"0.7372188",
"0.70749843",
"0.6936107",
"0.6825785",
"0.67990077",
"0.67479444",
"0.67432266",
"0.6718933",
"0.6718933",
"0.66962326",
"0.6684743",
"0.66762435",
"0.6673513",
"0.66099536",
"0.6597256",
"0.6580017",
"0.6543288",
"0.65369546",
"0.6520295",
"0.648659",
"0.646461... | 0.62499547 | 48 |
Compute equivalent radius to obtain same perimeter as circle. \theta = \frac{2 \pi}{n} r_{eqp} = \frac{\theta r}{2 \sin{\frac{\theta}}{2}} | def regular_polygon_perimeter_equivalent_radius(n, radius=1.0):
theta = 2 * np.pi / n
r = (theta * radius) / (2 * np.sin(theta / 2.0))
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polar_radius(self):\n return self.r * (1 - self.f)",
"def area_circle(r):\n return (r ** 2) * math.pi",
"def circle_area(r):\n if r < 0:\n raise ValueError(\"Radius cannot be negative\")\n\n return pi*(r**2)",
"def area_of_circle(r):\n a = r**2 * math.pi\n return a",
"def a... | [
"0.74825394",
"0.7200281",
"0.7186608",
"0.7186056",
"0.7186056",
"0.71742076",
"0.69157314",
"0.6913797",
"0.68870604",
"0.679858",
"0.6795114",
"0.6762314",
"0.66519475",
"0.6641099",
"0.6628847",
"0.66042423",
"0.659246",
"0.6585881",
"0.657935",
"0.657111",
"0.65543574",
... | 0.7224521 | 1 |
Returns True if X is a prime | def prime(self,X):
if X < 2:
raise ValueError("domain error: X<2")
if 2 <= X <= self.lkdp:
return X in self.dp
if X in self.sp:
return True
if not self.firstdiv(X):
self.sp.add(X)
return True
return F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(x: int) -> bool:\n if x < 2:\n return False\n if x != 2 and x % 2 == 0:\n return False\n for i in range(3, x // 2 + 1):\n if x % i == 0:\n return False\n return True",
"def is_prime(x):\n if x < 2:\n return False\n for i in range(2, x // 2 + 1... | [
"0.83886486",
"0.8386542",
"0.8334641",
"0.831355",
"0.8305813",
"0.82775164",
"0.80811775",
"0.8061082",
"0.79519916",
"0.7939163",
"0.79166657",
"0.7887779",
"0.78855747",
"0.7875794",
"0.7871901",
"0.7847186",
"0.7832276",
"0.7798566",
"0.7766518",
"0.77603596",
"0.7757025... | 0.81386393 | 6 |
Get UNIX timestamp for the start of a day. date_string string representing a day | def get_timestamp(date_string):
start_moment = datetime.strptime(date_string, '%d-%m-%Y')
delta_utctime = start_moment - datetime.utcfromtimestamp(0)
return int(delta_utctime.total_seconds()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unix_time_for_date(date_string, end_of_day=False):\n try:\n if len(date_string) != 8:\n raise ValueError()\n result_time=(0,0,0)\n if end_of_day:\n result_time = (23,59,59)\n\n result_date = datetime(int(date_string[0:4]),int(date_string[4:6]),int(date_strin... | [
"0.65573865",
"0.6540172",
"0.6274609",
"0.61729723",
"0.6159173",
"0.6089673",
"0.6065613",
"0.5973171",
"0.5919994",
"0.58980274",
"0.57889223",
"0.57527965",
"0.57133365",
"0.5659154",
"0.5632506",
"0.5629182",
"0.5612509",
"0.56050766",
"0.5596619",
"0.5593876",
"0.557328... | 0.6647234 | 0 |
Adds days do a date and returns the result. date_string string representing a date offset number of days to add | def next_date_string(date_string, offset):
date = datetime.strptime(date_string, '%d-%m-%Y')
date += timedelta(days=offset)
return datetime.strftime(date, '%d-%m-%Y') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dayadd(date, numdays):\n return date + datetime.timedelta(days=numdays)",
"def add_days_to_date(date: str, additional_days: int) -> str:\n year, month, day = get_year_month_day_from_date(date)\n days_in_month = get_days_in_month(month, year)\n new_day = int(day) + additional_days\n # addition ... | [
"0.7504087",
"0.71015215",
"0.6391617",
"0.6290375",
"0.6264595",
"0.6126288",
"0.6093602",
"0.59450394",
"0.5846056",
"0.5842373",
"0.57879925",
"0.57879925",
"0.5767592",
"0.57080907",
"0.56578034",
"0.55341274",
"0.5518598",
"0.5503895",
"0.5474108",
"0.545114",
"0.5434332... | 0.7000529 | 2 |
Generates definition of 'ethmac' peripheral. | def generate_ethmac(peripheral, **kwargs):
buf = kwargs['buffer']()
result = """
ethmac: Network.LiteX_Ethernet @ {{
sysbus <{}, +0x100>;
sysbus new Bus.BusMultiRegistration {{ address: {};
size: {};
region: "buffer" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_mac(topology_id):\n tid = int(topology_id)\n global mac_counter\n global used_macs\n base = '52:54:00:00:00:00'\n ba = base.split(':')\n ba[2] = '%02x' % int(tid / 256)\n ba[3] = '%02x' % int(tid % 256)\n ba[4] = '%02x' % int(len(used_macs[topology_id]) / 256)\n ba[5] = '%0... | [
"0.6657819",
"0.64743024",
"0.63347757",
"0.6317756",
"0.6317756",
"0.61995304",
"0.6042048",
"0.60334146",
"0.5972943",
"0.5963627",
"0.5944099",
"0.5927912",
"0.58899385",
"0.5820855",
"0.57687867",
"0.5755278",
"0.57476217",
"0.56970817",
"0.5685438",
"0.56603384",
"0.5657... | 0.78813607 | 0 |
This method generates a classname from the current context UID. | def getKssUIDClass(self):
uid = IUUID(aq_inner(self.context))
return "kssattr-atuid-%s" % uid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_class_name(self):\n self.class_name = self.profile_id_dict[self.profile_id]\n return self.class_name",
"def uidfy(self, cls):\n return \"{0}.{1}\".format(cls.__module__, cls.__name__)",
"def uidfy(self, cls):\n return \"{0}.{1}\".format(cls.__module__, cls.__name__)",
... | [
"0.73517007",
"0.719826",
"0.719826",
"0.6969845",
"0.68884444",
"0.6853819",
"0.683192",
"0.6750139",
"0.66568786",
"0.65893716",
"0.6564185",
"0.642076",
"0.6411704",
"0.6406933",
"0.637574",
"0.6291744",
"0.62566286",
"0.6219041",
"0.61752546",
"0.6140191",
"0.61269224",
... | 0.65529925 | 11 |
Sets the user_name of this ComputeProjectVmPasswordReset. | def user_name(self, user_name):
if self.local_vars_configuration.client_side_validation and user_name is None: # noqa: E501
raise ValueError("Invalid value for `user_name`, must not be `None`") # noqa: E501
self._user_name = user_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_name(self, user_name):\n\n self._user_name = user_name",
"def set_user_name_override(name: str) -> None:\r\n global _user_name_override\r\n _user_name_override = name",
"def change_username(self, name):\n self.username = name",
"def set_user(self, user: User):\n self.__use... | [
"0.726355",
"0.63401866",
"0.6164315",
"0.6150344",
"0.61441",
"0.609859",
"0.60474366",
"0.59222984",
"0.58533823",
"0.5851197",
"0.58406943",
"0.58082944",
"0.57258534",
"0.5656534",
"0.5654255",
"0.5648055",
"0.5630686",
"0.55781776",
"0.5574593",
"0.5569073",
"0.55400956"... | 0.7037343 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ComputeProjectVmPasswordReset):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, ComputeProjectVmPasswordReset):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Test that a warning is returned when the reference test directory has no corresponding subdirectory for the specified repo. | def test_reference_test_dir_has_no_subdir_for_repo(self, default_hooks):
result = default_hooks.act_on_cloned_repo(NO_TEST_DIR_REPO)
assert result.status == Status.ERROR
assert "no reference test directory for" in result.msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repo_does_not_exist(tmp_path):\n ProjectMock(tmp_path).style(\n \"\"\"\n [[\".pre-commit-config.yaml\".repos]]\n repo = \"local\"\n \"\"\"\n ).pre_commit(\n \"\"\"\n repos:\n - hooks:\n - id: whatever\n \"\"\"\n ).api_check_then_fix... | [
"0.683627",
"0.68222684",
"0.67618865",
"0.6684273",
"0.6579872",
"0.6440584",
"0.63637036",
"0.6297753",
"0.6287503",
"0.62867624",
"0.6231155",
"0.6210511",
"0.6208012",
"0.6202066",
"0.6193851",
"0.619218",
"0.6189101",
"0.6185695",
"0.6185095",
"0.6148107",
"0.6080444",
... | 0.7814678 | 0 |
Test that a warning is returned when the reference test directory has a corresponeding subdirectory for the repo, but there are no test files in it. | def test_no_tests_for_repo(self, default_hooks):
result = default_hooks.act_on_cloned_repo(NO_TESTS_REPO)
assert result.status == Status.WARNING
assert "no files ending in `Test.java` found" in result.msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_reference_test_dir_has_no_subdir_for_repo(self, default_hooks):\n result = default_hooks.act_on_cloned_repo(NO_TEST_DIR_REPO)\n\n assert result.status == Status.ERROR\n assert \"no reference test directory for\" in result.msg",
"def test_missing_repo_dir(self):\r\n\r\n self._... | [
"0.771919",
"0.65982145",
"0.65829396",
"0.6566112",
"0.6480621",
"0.64486736",
"0.6397717",
"0.6387366",
"0.638563",
"0.6334958",
"0.63299817",
"0.6321312",
"0.6316586",
"0.6309518",
"0.6293794",
"0.62505454",
"0.6239975",
"0.62353283",
"0.62338245",
"0.621712",
"0.6213111",... | 0.70580846 | 1 |
Make a scatter plot of saccades with all starting points moved to the origin. see pyarbus.data for details on the Saccade class | def plot_saccade_scatter(sac, ax=None):
if ax is None:
f,ax = plt.subplots(subplot_kw=dict(polar=True))
dx = sac.xf - sac.xi
dy = sac.yf - sac.yi
radii = sac.amplitude
thetas = np.arctan2(dy, dx)
ax.scatter(thetas,radii,alpha=.5,s=sac.vpeak/10.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_plot(self):\n x, y = next(self.stream).T\n c = None\n s = 100\n self.scat = self.ax.scatter(x, y, c=c, s=s, \n vmin=0, vmax=1,\n cmap=\"jet\", edgecolor=\"k\")\n self.ax.axis([0, 16.5, 0, 5])\n ... | [
"0.65363467",
"0.65271336",
"0.6455338",
"0.6405804",
"0.64038694",
"0.6344787",
"0.6288009",
"0.6228171",
"0.620982",
"0.620982",
"0.612561",
"0.60390526",
"0.59550536",
"0.59463525",
"0.5923994",
"0.58995503",
"0.5892262",
"0.5883826",
"0.5872059",
"0.5867863",
"0.58254147"... | 0.7273613 | 0 |
Apply the inverse sigmoid operation. y = ln(1x/x) | def inverse_sigmoid(x):
y = -1 * np.log((1-x)/x)
return y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asigmoid(x):\n return -log(1 / x - 1)",
"def sigmoid(x):\n return 1 / (1 - (power(e,-x)))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",... | [
"0.831418",
"0.8312971",
"0.83123684",
"0.83123684",
"0.82213426",
"0.8197265",
"0.8197018",
"0.8179121",
"0.8179121",
"0.81689394",
"0.81665087",
"0.81665087",
"0.81665087",
"0.81665087",
"0.81665087",
"0.81665087",
"0.8165519",
"0.81568307",
"0.81385845",
"0.8116482",
"0.80... | 0.8911247 | 0 |
Returns the sign of x. | def numeric(self, values):
x = values[0].copy()
x[x > 0] = 1.0
x[x <= 0] = -1.0
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(x):\n if x >= 0:\n return 1\n else:\n return -1",
"def sign(x):\n return(copysign(1, x))",
"def sign(x):\n if x >= 0:\n return 1\n return -1",
"def sign(x):\n if x < 0.0:\n sign = -1\n elif x == 0.0:\n sign = 0\n elif x > 0.0:\n sign ... | [
"0.83971727",
"0.8338641",
"0.83356017",
"0.7681114",
"0.76701367",
"0.745532",
"0.7414003",
"0.7380113",
"0.71693647",
"0.7108677",
"0.6995146",
"0.691418",
"0.68324226",
"0.68057984",
"0.66455907",
"0.6609326",
"0.65489024",
"0.6536486",
"0.6527349",
"0.6476659",
"0.6440911... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Calculate the nth power of the complex Tensor x. | def nth_pow(x, n, name=None):
if not n >= 0:
raise ValueError("n (power) has to be >= 0. Currently, n={}".format(n))
power = to_complex(1.)
for _ in range(n):
power *= x
return power | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiply_by_i(z: torch.Tensor):\n return to_complex(-z.imag, z.real)",
"def power(x, n):\n value = 1\n for i in range(n):\n value = multiply(value, x)\n return value",
"def power(x, n):\n power = 1\n for i in range(abs(n)):\n power = multiply(power, x) \n return power",
... | [
"0.67856187",
"0.6498569",
"0.6476001",
"0.6470317",
"0.6458178",
"0.63543636",
"0.63283885",
"0.63282853",
"0.62942284",
"0.6242852",
"0.62283564",
"0.62283564",
"0.6182413",
"0.61436164",
"0.6140807",
"0.61162865",
"0.60972077",
"0.6071728",
"0.6053789",
"0.5995593",
"0.598... | 0.75057644 | 0 |
Test ``fix_file`` for ``cl``. | def test_cl_fix_file(mock_get_filepath, cl_file, tmp_path):
mock_get_filepath.return_value = os.path.join(tmp_path,
'fixed_cesm2_waccm_cl.nc')
fix = Cl(None)
fixed_file = fix.fix_file(cl_file, tmp_path)
mock_get_filepath.assert_called_once_with(tmp_path,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_fix(self):\n with patch('esmvalcore.cmor._fixes.fix.Fix.get_fixes',\n return_value=[self.mock_fix]) as mock_get_fixes:\n file_returned = fix_file(\n file='filename',\n short_name='short_name',\n project='project',\n ... | [
"0.7396706",
"0.6793997",
"0.6781917",
"0.6763084",
"0.6566454",
"0.62871915",
"0.6139587",
"0.60370976",
"0.5754476",
"0.57021797",
"0.56612754",
"0.56081945",
"0.56049544",
"0.5563765",
"0.5538848",
"0.5496042",
"0.5390587",
"0.52548534",
"0.52529085",
"0.5234037",
"0.51925... | 0.7236893 | 1 |
Test fix for ``clw``. | def test_clw_fix():
assert Clw is Cl | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_clw_fix():\n fix = Fix.get_fixes('CMIP6', 'CESM2-WACCM', 'Amon', 'clw')\n assert fix == [Clw(None)]",
"def test_get_cl_fix():\n fix = Fix.get_fixes('CMIP6', 'CESM2-WACCM', 'Amon', 'cl')\n assert fix == [Cl(None)]",
"def test_get_cl_fix():\n fix = Fix.get_fixes('CMIP6', 'CIESM', 'Amo... | [
"0.796473",
"0.6612866",
"0.648505",
"0.63771534",
"0.6324917",
"0.6263852",
"0.60694456",
"0.60323006",
"0.6028124",
"0.5922974",
"0.5911632",
"0.59088856",
"0.58982694",
"0.57909745",
"0.5720493",
"0.55119586",
"0.55068785",
"0.5489398",
"0.54352623",
"0.5434859",
"0.540595... | 0.8035878 | 0 |
Return an aioclient session that only fails. | async def raising_session(event_loop):
return Mock(get=Mock(side_effect=aiohttp.ClientError)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_bad_endpoint(aresponses, create_session_response):\n aresponses.add(\n \"production.tile-api.com\",\n f\"/api/v1/clients/{TILE_CLIENT_UUID}\",\n \"put\",\n aresponses.Response(\n text=load_fixture(\"create_client_response.json\"), status=200\n ),\n ... | [
"0.5906911",
"0.59008527",
"0.5845983",
"0.5835848",
"0.577206",
"0.5679259",
"0.5657949",
"0.5634163",
"0.56229603",
"0.55914503",
"0.55739015",
"0.5556815",
"0.5541905",
"0.5540552",
"0.5520024",
"0.5493653",
"0.5461125",
"0.54445064",
"0.54063946",
"0.53526664",
"0.5350309... | 0.6105886 | 0 |
Test getting the distance between given coordinates in km. | def test_get_kilometers() -> None:
kilometers = location_util.vincenty(COORDINATES_PARIS, COORDINATES_NEW_YORK)
assert round(kilometers, 2) == DISTANCE_KM | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_distance() -> None:\n meters = location_util.distance(\n COORDINATES_PARIS[0],\n COORDINATES_PARIS[1],\n COORDINATES_NEW_YORK[0],\n COORDINATES_NEW_YORK[1],\n )\n\n assert meters / 1000 - DISTANCE_KM < 0.01",
"def test_get_distance(self):\n meters = locati... | [
"0.815921",
"0.7919498",
"0.7510166",
"0.7383834",
"0.72414726",
"0.7226634",
"0.70816404",
"0.698509",
"0.69735104",
"0.69527847",
"0.6946436",
"0.6945232",
"0.69167244",
"0.69128066",
"0.68650657",
"0.6856772",
"0.6810716",
"0.678611",
"0.67857456",
"0.6753498",
"0.6731161"... | 0.7465727 | 3 |
Test getting the distance between given coordinates in miles. | def test_get_miles() -> None:
miles = location_util.vincenty(COORDINATES_PARIS, COORDINATES_NEW_YORK, miles=True)
assert round(miles, 2) == DISTANCE_MILES | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_distance() -> None:\n meters = location_util.distance(\n COORDINATES_PARIS[0],\n COORDINATES_PARIS[1],\n COORDINATES_NEW_YORK[0],\n COORDINATES_NEW_YORK[1],\n )\n\n assert meters / 1000 - DISTANCE_KM < 0.01",
"def test_get_miles(self):\n miles = location_u... | [
"0.769751",
"0.75978184",
"0.7417775",
"0.7326419",
"0.6904987",
"0.68773264",
"0.6817008",
"0.68120635",
"0.6721182",
"0.669337",
"0.66848165",
"0.6658225",
"0.65893614",
"0.6589266",
"0.6580442",
"0.6513405",
"0.6422351",
"0.64185816",
"0.6415801",
"0.6399355",
"0.63985205"... | 0.75026697 | 2 |
r""" Rotates a 3D image and creates an angled view for rough 2D visualization. Because it rotates the image it can be slow for large images, so is mostly meant for rough checking of small prototype images. | def show_3D(im): # pragma: no cover
im = ~np.copy(im)
if im.ndim < 3:
raise Exception('show_3D only applies to 3D images')
im = spim.rotate(input=im, angle=22.5, axes=[0, 1], order=0)
im = spim.rotate(input=im, angle=45, axes=[2, 1], order=0)
im = spim.rotate(input=im, angle=-17, axes=[0, 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_3D(image, angle, axes=(1, 2)):\n rotated_image = scipy.ndimage.interpolation.rotate(\n image, angle, axes, reshape=False)\n return rotated_image",
"def rotate(self, image, angle):\n # Get the image size\n # No that's not an error - NumPy stores image matricies backwards\n ... | [
"0.71162045",
"0.6870408",
"0.67476016",
"0.67144823",
"0.6685031",
"0.6617645",
"0.6600851",
"0.6507746",
"0.6482093",
"0.6466029",
"0.64630985",
"0.6457509",
"0.64349747",
"0.6434905",
"0.6427413",
"0.6406574",
"0.63829213",
"0.63818514",
"0.635086",
"0.6308429",
"0.6270013... | 0.66519666 | 5 |
Initialize an annotated dataset via additional annotations dataframe. E.g. the dataset could be SMILES and the annotations could be single or multi task labels. | def __init__(
self,
annotations_filepath: str,
dataset: AnyBaseDataset,
annotation_index: Union[int, str] = -1,
label_columns: Union[List[int], List[str]] = None,
dtype: torch.dtype = torch.float,
device: torch.device = None,
**kwargs,
) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate(self, annotation_=None):\n # Important: Need a copy, not the reference to the original object\n annotation_ = copy.deepcopy(annotation_)\n annotation_.annotate(self, from_dataset=True)\n history_record = annotation_.create_history_record()\n self.annotations.append(h... | [
"0.618609",
"0.61824745",
"0.61581284",
"0.614808",
"0.6118904",
"0.6082589",
"0.60269034",
"0.6005669",
"0.59904706",
"0.5987395",
"0.59819514",
"0.59694415",
"0.59535164",
"0.5950877",
"0.5893425",
"0.588407",
"0.588366",
"0.5868693",
"0.58620995",
"0.58475673",
"0.5798857"... | 0.7212519 | 0 |
Cleans the tweet text of URLs, user tags, hashtags, pictures, and smart punctuation. Whitespace does not need to be normalized since it is ignored anyways when generating the stylecloud. | def clean_tweet(tweet):
pattern = r'http\S+|pic.\S+|@[a-zA-Z0-9_]+|#[a-zA-Z0-9_]+|[‘’“”’–—…]|\xa0'
return re.sub(pattern, '', tweet) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanTweet(text, appostrophes=True, emojis=True, html=True, url=True, misspellings=True, punctuation=True, lemming=True,\\\r\n stop=True):\r\n if appostrophes:\r\n #convert appostrophes\r\n filtered_string = decontracted(text)\r\n if emojis:\r\n #decoding, removing emoj... | [
"0.77689105",
"0.77515507",
"0.7723691",
"0.76525265",
"0.7587736",
"0.74691874",
"0.74236506",
"0.7387772",
"0.7387772",
"0.737716",
"0.72797436",
"0.72782737",
"0.72752815",
"0.7194995",
"0.7194995",
"0.7194995",
"0.7194995",
"0.7194995",
"0.7194995",
"0.7177189",
"0.717055... | 0.7298502 | 10 |
method validates user's phone number | def validate_phoneNumber(number):
return isinstance(number, int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_format_user_phone(phone):\n match = re.match(r'^\\+[0-9]{10,}$', phone)\n if not match:\n raise exceptions.ValidationError('phone is not valid!')\n return phone",
"def validate_phone(self, data):\n value = data.strip()\n if re.match(constant.NUMBER_ONLY, va... | [
"0.8410003",
"0.8034566",
"0.7977272",
"0.79770505",
"0.79581946",
"0.78909963",
"0.7828726",
"0.76332414",
"0.76034385",
"0.75889045",
"0.74785566",
"0.7473208",
"0.74246967",
"0.73678",
"0.7330521",
"0.7327545",
"0.73220515",
"0.73092455",
"0.71783936",
"0.71651816",
"0.713... | 0.73726976 | 13 |
function checks if a user is an admin | def check_is_admin(current_user):
return current_user['isAdmin'] == True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_admin(user):\n return user in admins",
"def isAdmin(user):\n return isUserType(user, Admin)",
"def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')",
"def is_admin(self, user):\n return user.name in self.admins",
"def isAdmin(self, user):... | [
"0.88699734",
"0.86930746",
"0.8459153",
"0.8452522",
"0.83714634",
"0.83580816",
"0.8353519",
"0.83266526",
"0.8269166",
"0.82423466",
"0.82381934",
"0.8166754",
"0.8158875",
"0.8116348",
"0.81148386",
"0.8112061",
"0.80501133",
"0.80213463",
"0.7991749",
"0.7940142",
"0.793... | 0.82241726 | 11 |
Returns computed area of the circle. | def area(self):
#print (self.radius*self.radius*math.pi)
circle_area = (self.radius*self.radius*math.pi)
return circle_area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circle_area(circle):\n return pi * circle.radius * circle.radius",
"def area(self):\n return self.radius*self.radius*math.pi",
"def area(self):\n return (self.__radius ** 2 * math.pi)",
"def area(self):\n return math.pi * self.radius ** 2",
"def area(self):\n return math.... | [
"0.86026263",
"0.84441936",
"0.8436547",
"0.8368452",
"0.8368452",
"0.8331319",
"0.8323462",
"0.8314367",
"0.82692254",
"0.8267663",
"0.8265265",
"0.82421976",
"0.81117386",
"0.8084378",
"0.79661334",
"0.79621905",
"0.7929598",
"0.79008734",
"0.7876034",
"0.781265",
"0.775660... | 0.876799 | 0 |
Compute softmax values for each sets of scores in x. | def softmax_my(x):
dim = 1
try:
dim = x.ndim
except AttributeError:
return cal_1D_softmax(x)
if dim == 1:
return cal_1D_softmax(x)
elif dim == 2:
return cal_2D_softmax(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7798361",
"0.7762321",
"0.77613515",
"0.77583665",
"0.765929",
"0.765929",
"0.765929",
"0.765929",
"0.7587397",
"0.74330676",
"0.740982",
"0.7394604",
"0.7360498",
"0.7319299",
"0.727085",
"0.72644556",
"0.7263164",
"0.72587997",
"0.72316796",
"0.721682",
"0.7203816",
"0... | 0.6951985 | 96 |
\ Prints a string representation of an instance type TYPE with id ID. | def do_show(self, arg):
arg_list = arg.split(" ") if type(arg) == str else arg
if not arg:
print("** class name missing **")
return
if arg_list[0] not in HBNBCommand.class_list:
print("** class doesn't exist **")
return
if len(arg_list) < 2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{0}(name='{1}', type={2}(0x{2:x}), id='{3}')\".format(\n self.__class__.__name__, self.type_name, self.type, self.id\n )",
"def __str__(self):\n return self.type_id",
"def show_type(type_):\n click.echo(format_type(type_))",
"def help_show(self... | [
"0.69647926",
"0.688597",
"0.6840369",
"0.6585427",
"0.65703905",
"0.6514573",
"0.6394809",
"0.63619477",
"0.63588405",
"0.6304068",
"0.62790024",
"0.6214264",
"0.61707103",
"0.6165195",
"0.6146786",
"0.61441886",
"0.61193866",
"0.61061436",
"0.60853",
"0.6074384",
"0.6065874... | 0.0 | -1 |
Retrieves the current root folder wether running in dev or application | def getRootPath()->str:
if '--develop' in sys.argv:
return eel._get_real_path('public') + '/'
return eel._get_real_path('build') + '/' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_dir():\r\n return Path(__file__).parent.parent",
"def get_root_dir():\n return os.path.dirname(os.path.dirname(__file__))",
"def root_dir():\n return dirname(dirname(__file__))",
"def get_root_folder() -> Path:\n return Path(__file__).parent.parent",
"def get_appdir():\n\n return AP... | [
"0.7820419",
"0.78110343",
"0.77180725",
"0.7602458",
"0.75406283",
"0.7536302",
"0.7518848",
"0.7518848",
"0.7465478",
"0.74521536",
"0.7381564",
"0.73740894",
"0.73469",
"0.72927266",
"0.7282953",
"0.72189146",
"0.7192927",
"0.719114",
"0.719114",
"0.71268857",
"0.7116827",... | 0.7807806 | 2 |
Check that a rank 1 tensor is exactly represented by the 1truncation of the HOSVD. | def test_truncate():
# rank 1 tensor
X = outer(rand(3), rand(4), rand(5))
T = hosvd(X)
assert find_truncation_rank(T.X, 1e-12) == (1,1,1)
T1 = T.truncate(1)
assert np.allclose(X, T1.asarray()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_1DNN(self):\n if not self.dims == 1:\n return False\n if not set(self.__m__.keys()) <= set(((0,),(1,),(-1,))):\n return False\n\n return True",
"def _is_1(expr):\r\n try:\r\n v = opt.get_scalar_constant_value(expr)\r\n return numpy.allclose(v, 1)... | [
"0.62708634",
"0.6037196",
"0.59385115",
"0.5790036",
"0.577494",
"0.5769608",
"0.5759064",
"0.5736992",
"0.56680584",
"0.5632156",
"0.5624231",
"0.56152076",
"0.560614",
"0.56035495",
"0.5568928",
"0.5547796",
"0.55213755",
"0.5512007",
"0.54972744",
"0.5485921",
"0.5467444"... | 0.7012011 | 0 |
Tune hyperparameters using nevergrad. | def tune(
inductive_setting: str,
dataset_name: str,
dataset_version: str,
max_num_qualifier_pairs: int,
create_inverse_triples: bool,
training_approach: str,
num_epochs: int,
num_hpo_iterations: int,
early_stopping_patience: int,
use_wandb: bool,
eval_batch_size: int,
mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fine_tune(self):\n for params in self.encoder.parameters():\n params.requires_grad = self.if_fine_tune",
"def freeze_params(model: nn.Module):\n for par in model.parameters():\n par.requires_grad = False",
"def freeze_parameters(module: nn.Module):\n for p in module.parameter... | [
"0.6888522",
"0.67927283",
"0.6692273",
"0.66117036",
"0.65113693",
"0.6505531",
"0.6503846",
"0.64882076",
"0.64484334",
"0.63790685",
"0.63227016",
"0.62634665",
"0.6246198",
"0.6238687",
"0.62319934",
"0.62276524",
"0.6227297",
"0.6222145",
"0.6221068",
"0.6219871",
"0.621... | 0.0 | -1 |
Plots the 2 asset efficient frontier | def plot_ef2(self,er,cov,n_points):
if er.shape[0] != 2:
raise ValueError('Plot ef2 can only plot two asset efficient frontier')
weights = [np.array([w, 1-w]) for w in np.linspace(0,1,n_points)]
rets = [self.portfolio_returns(w,er) for w in wei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotCombinedIncludingOceanFloors(self):\n self.CombinedPlotHelper(minc=70,maxc=170,num=50)",
"def plot_risk():\n mua,vra,pra = pgen.get_pdf(plot=False,write=False)\n deadline = ptsl.D\n\n a1 = range(1,17)\n a2 = range(1,17)\n shape = (len(a1),len(a2))\n X,Y = meshgrid(a1,a2)\... | [
"0.61643004",
"0.60950553",
"0.6037656",
"0.6027361",
"0.60085773",
"0.59050494",
"0.58379006",
"0.579551",
"0.57948226",
"0.57923365",
"0.5777094",
"0.57708627",
"0.57475835",
"0.57316524",
"0.57299256",
"0.5727215",
"0.57262135",
"0.57240945",
"0.5715858",
"0.57054627",
"0.... | 0.5790915 | 10 |
Plots the 2 asset efficient frontier | def plot_ef(self,er,cov,n_points):
weights = self.optimal_weights(n_points,er,cov)
rets = [self.portfolio_returns(w,er) for w in weights]
vols = [self.portfolio_vol(w,cov) for w in weights]
ef = pd.DataFrame({
'Returns':rets,
'V... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotCombinedIncludingOceanFloors(self):\n self.CombinedPlotHelper(minc=70,maxc=170,num=50)",
"def plot_risk():\n mua,vra,pra = pgen.get_pdf(plot=False,write=False)\n deadline = ptsl.D\n\n a1 = range(1,17)\n a2 = range(1,17)\n shape = (len(a1),len(a2))\n X,Y = meshgrid(a1,a2)\... | [
"0.61643004",
"0.60950553",
"0.6037656",
"0.6027361",
"0.60085773",
"0.59050494",
"0.58379006",
"0.579551",
"0.57948226",
"0.57923365",
"0.5790915",
"0.5777094",
"0.57708627",
"0.57475835",
"0.57316524",
"0.57299256",
"0.5727215",
"0.57262135",
"0.57240945",
"0.5715858",
"0.5... | 0.0 | -1 |
Determines if a file contains a supported format types. | def _GetTypeIndicators(
cls, signature_scanner, specification_store, remainder_list, path_spec,
resolver_context=None):
type_indicator_list = []
file_object = resolver.Resolver.OpenFileObject(
path_spec, resolver_context=resolver_context)
scan_state = pysigscan.scan_state()
signatu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_filetype(img_path, formats=[\"jpg\", \"png\", \"gif\", \"pgm\", \"tif\", \"ppm\"]):\n # formats = [\"jpg\", \"png\", \"gif\", \"pgm\"]\n end = img_path[-3:]\n return os.path.isfile(img_path) and (end in formats)",
"def is_supported_document_type(path):\n return any([str(path).lower().endswith(... | [
"0.757576",
"0.7058038",
"0.7030724",
"0.69593614",
"0.69507104",
"0.69359475",
"0.68455416",
"0.6821835",
"0.66647303",
"0.6642892",
"0.6639783",
"0.6639783",
"0.6636032",
"0.65783846",
"0.65606725",
"0.6530669",
"0.65233594",
"0.6518663",
"0.6467565",
"0.6462649",
"0.644839... | 0.0 | -1 |
Determines if a file contains a supported archive types. | def GetArchiveTypeIndicators(cls, path_spec, resolver_context=None):
if (cls._archive_remainder_list is None or
cls._archive_store is None):
specification_store, remainder_list = cls._GetSpecificationStore(
definitions.FORMAT_CATEGORY_ARCHIVE)
cls._archive_remainder_list = remainder_li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_archive(afile):\n return file_ext(os.path.basename(afile)) in ARCHIVE_COMPRESS_FORMATS",
"def _is_archive(local_path: str) -> bool:\n archive_mimetypes = [\n \"application/zip\",\n \"application/x-tar\",\n \"application/x-gzip\",\n ... | [
"0.74781334",
"0.73507965",
"0.7313394",
"0.71154225",
"0.69458574",
"0.68799955",
"0.68107855",
"0.6739415",
"0.66980845",
"0.66834474",
"0.6595346",
"0.64875376",
"0.64855677",
"0.6477282",
"0.64758474",
"0.64305",
"0.6381517",
"0.6331357",
"0.632997",
"0.62889487",
"0.6286... | 0.0 | -1 |
Determines if a file contains a supported compressed stream types. | def GetCompressedStreamTypeIndicators(cls, path_spec, resolver_context=None):
if (cls._compressed_stream_remainder_list is None or
cls._compressed_stream_store is None):
specification_store, remainder_list = cls._GetSpecificationStore(
definitions.FORMAT_CATEGORY_COMPRESSED_STREAM)
cls... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _file_can_be_compressed(filename):\n content_type = ''\n with open(filename, 'rb') as f:\n content_type = _get_content_type(f)\n return content_type in TEXT_TYPES",
"def is_archive(afile):\n return file_ext(os.path.basename(afile)) in ARCHIVE_COMPRESS_FORMATS",
"def _is_archive(local_pat... | [
"0.7702941",
"0.6716499",
"0.65970683",
"0.65688056",
"0.65515673",
"0.6468866",
"0.6450742",
"0.63921905",
"0.6347811",
"0.6306621",
"0.6281809",
"0.6213686",
"0.61886764",
"0.6095751",
"0.6093798",
"0.606338",
"0.6036476",
"0.59831434",
"0.5973013",
"0.59699506",
"0.5958501... | 0.5695351 | 43 |
Company Detail View Retrieve Company details as specified by company.pk. Middleware See SETTINGS for active Middleware. Decorators request.user.is_authenticated() must be True | def detail(request, company_id):
company = get_object_or_404(Company, pk=company_id)
company_form = CompanyForm(instance=company)
contact_form = ContactCreationForm()
return render(request, 'companies/detail.html', {
'company_detail': company,
'company_form': company_form,
'con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_one(self, company_id, *args, **kw):\n log.debug('company_id {} {}'.format(company_id, type(company_id)))\n\n company = M.Company.query.get(index=company_id)\n log.debug('company {}'.format(company))\n if(company):\n kw['_id'] = company._id\n return super(Compan... | [
"0.6596353",
"0.6497218",
"0.6294941",
"0.62782705",
"0.62537575",
"0.6250397",
"0.62394494",
"0.6164841",
"0.6089437",
"0.6082118",
"0.603606",
"0.60139275",
"0.5970605",
"0.59652346",
"0.59386086",
"0.58893013",
"0.5876792",
"0.57877487",
"0.5785507",
"0.57295525",
"0.57146... | 0.6944347 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.