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 |
|---|---|---|---|---|---|---|
Specifies the name of the EventGrid Event Subscription resource. Changing this forces a new resource to be created. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: EventSubscriptionArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def event_name(self, event_name):\n self['event_name'] = event_name",
"def create_subscription(self, client_URI_en... | [
"0.65496504",
"0.60154706",
"0.5902321",
"0.5872283",
"0.5805811",
"0.57331806",
"0.5703355",
"0.56202376",
"0.56202376",
"0.53829837",
"0.5349937",
"0.5326549",
"0.5304543",
"0.52968514",
"0.52476937",
"0.52463573",
"0.52394575",
"0.52394575",
"0.5231298",
"0.5229907",
"0.52... | 0.0 | -1 |
Specifies the id where the Service Bus Queue is located. | def service_bus_queue_endpoint_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_bus_queue_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def QueueId(self):\n\t\treturn self._get_attribute('queueId')",
"def service_bus_queue_endpoint_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"service_bus_queue_endpoint_id\")",
"def __init__(self, queue_id=None):\n super().__init__()\n self.queue_id = queue_id",
"... | [
"0.6959401",
"0.6803634",
"0.6470121",
"0.63885784",
"0.6166723",
"0.60788393",
"0.60659087",
"0.59840083",
"0.59840083",
"0.59840083",
"0.5893416",
"0.5874236",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111... | 0.71073616 | 0 |
Specifies the id where the Service Bus Topic is located. | def service_bus_topic_endpoint_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_bus_topic_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic_id(self, topic_id: TopicId):\n\n self._topic_id = topic_id",
"def topic(self, topic):\n self.connection.topic(str(self), topic)",
"def topic_id(self) -> TopicId:\n return self._topic_id",
"def service_bus_topic_endpoint_id(self) -> pulumi.Output[Optional[str]]:\n return ... | [
"0.6951712",
"0.6714118",
"0.66215444",
"0.66045886",
"0.64401406",
"0.6369368",
"0.62431246",
"0.6079379",
"0.60691476",
"0.59788126",
"0.5890337",
"0.5849948",
"0.5834524",
"0.58329153",
"0.5807717",
"0.57896304",
"0.5738926",
"0.57316566",
"0.5730298",
"0.57127833",
"0.570... | 0.69207007 | 1 |
Specifies the id where the Event Hub is located. | def eventhub_endpoint_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "eventhub_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self) -> str:\n return self._event.get('id')",
"def setId(self, *args):\n return _libsbml.Event_setId(self, *args)",
"def eventhub_endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"eventhub_endpoint_id\")",
"def id(self, id: str):\n self._id = id",
"def... | [
"0.69516504",
"0.68593204",
"0.6687535",
"0.64776427",
"0.6399978",
"0.6325267",
"0.62888384",
"0.62888384",
"0.62888384",
"0.6230918",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564... | 0.6860418 | 2 |
Specifies the expiration time of the event subscription (Datetime Format `RFC 3339`). | def expiration_time_utc(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "expiration_time_utc") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expiration_time(self) -> str:\n return pulumi.get(self, \"expiration_time\")",
"def expiration_time(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"expiration_time\")",
"def set_expiration(self):\n # This is an arbitrary decision setting the expiration time\n #... | [
"0.6938237",
"0.6767116",
"0.6624807",
"0.6600456",
"0.65979075",
"0.64695776",
"0.64277744",
"0.64235485",
"0.6334567",
"0.6334567",
"0.6334567",
"0.6324719",
"0.63217336",
"0.63126534",
"0.62667197",
"0.62667197",
"0.6261941",
"0.62240297",
"0.62067884",
"0.62040174",
"0.61... | 0.66232395 | 4 |
Specifies the name of the EventGrid Event Subscription resource. Changing this forces a new resource to be created. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: EventSubscriptionArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def event_name(self, event_name):\n self['event_name'] = event_name",
"def create_subscription(self, client_URI_en... | [
"0.65496504",
"0.60154706",
"0.5902321",
"0.5872283",
"0.5805811",
"0.57331806",
"0.5703355",
"0.56202376",
"0.56202376",
"0.53829837",
"0.5349937",
"0.5326549",
"0.5304543",
"0.52968514",
"0.52476937",
"0.52463573",
"0.52394575",
"0.52394575",
"0.5231298",
"0.5229907",
"0.52... | 0.0 | -1 |
Specifies the id where the Service Bus Queue is located. | def service_bus_queue_endpoint_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_bus_queue_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def QueueId(self):\n\t\treturn self._get_attribute('queueId')",
"def service_bus_queue_endpoint_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"service_bus_queue_endpoint_id\")",
"def __init__(self, queue_id=None):\n super().__init__()\n self.queue_id = queue_id",
"... | [
"0.6959401",
"0.6803634",
"0.6470121",
"0.63885784",
"0.6166723",
"0.60788393",
"0.60659087",
"0.59840083",
"0.59840083",
"0.59840083",
"0.5893416",
"0.5874236",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111... | 0.71073616 | 1 |
Specifies the id where the Service Bus Topic is located. | def service_bus_topic_endpoint_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_bus_topic_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic_id(self, topic_id: TopicId):\n\n self._topic_id = topic_id",
"def topic(self, topic):\n self.connection.topic(str(self), topic)",
"def topic_id(self) -> TopicId:\n return self._topic_id",
"def service_bus_topic_endpoint_id(self) -> pulumi.Output[Optional[str]]:\n return ... | [
"0.6951989",
"0.6710754",
"0.66226864",
"0.66037405",
"0.6436118",
"0.6368517",
"0.62410635",
"0.6077436",
"0.6066907",
"0.59778583",
"0.5887578",
"0.58485454",
"0.58334446",
"0.5829374",
"0.5804601",
"0.5785858",
"0.5742539",
"0.5735896",
"0.5733053",
"0.5709076",
"0.5701313... | 0.6919977 | 2 |
Get an existing EventSubscription resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
advanced_filter: Optional[pulumi.Input[pulumi.InputType['EventSubscriptionAdvancedFilterArgs']]] = None,
advanced_filtering_on_arrays_enabled: Optional[pulumi.Input[bool]] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'Subscription':\n opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))\n\n __props__ = dict()\n\n __props__[\"accessed_at\"] = None\n __prop... | [
"0.64110667",
"0.5793645",
"0.5119153",
"0.510051",
"0.502469",
"0.50211143",
"0.501319",
"0.500653",
"0.49863282",
"0.49599746",
"0.49540865",
"0.49394223",
"0.4938148",
"0.49322972",
"0.4927608",
"0.49223843",
"0.49018517",
"0.48949668",
"0.48941943",
"0.48882443",
"0.48872... | 0.62401646 | 1 |
Specifies the id where the Event Hub is located. | def eventhub_endpoint_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "eventhub_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self) -> str:\n return self._event.get('id')",
"def eventhub_endpoint_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"eventhub_endpoint_id\")",
"def eventhub_endpoint_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"eventhub_endpoint_id\")",
... | [
"0.69516504",
"0.6860418",
"0.6860418",
"0.68593204",
"0.64776427",
"0.6399978",
"0.6325267",
"0.62888384",
"0.62888384",
"0.62888384",
"0.6230918",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564",
"0.6217564... | 0.6687535 | 4 |
Specifies the expiration time of the event subscription (Datetime Format `RFC 3339`). | def expiration_time_utc(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "expiration_time_utc") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expiration_time(self) -> str:\n return pulumi.get(self, \"expiration_time\")",
"def expiration_time(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"expiration_time\")",
"def set_expiration(self):\n # This is an arbitrary decision setting the expiration time\n #... | [
"0.6938142",
"0.67673314",
"0.66256654",
"0.662311",
"0.662311",
"0.66010696",
"0.65972394",
"0.64694756",
"0.6428853",
"0.64238894",
"0.6334998",
"0.6334998",
"0.6334998",
"0.6322096",
"0.6314345",
"0.6267423",
"0.6267423",
"0.62616897",
"0.62243915",
"0.62064743",
"0.620458... | 0.6324476 | 13 |
Specifies the name of the EventGrid Event Subscription resource. Changing this forces a new resource to be created. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: EventSubscriptionArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def event_name(self, event_name):\n self['event_name'] = event_name",
"def create_subscription(self, client_URI_en... | [
"0.65482944",
"0.6016414",
"0.59030026",
"0.58721536",
"0.58064395",
"0.5734535",
"0.5701719",
"0.56192267",
"0.56192267",
"0.538443",
"0.53513277",
"0.5327555",
"0.530412",
"0.5294824",
"0.5246969",
"0.5245599",
"0.52380395",
"0.52380395",
"0.5231349",
"0.5230482",
"0.521787... | 0.0 | -1 |
Specifies the id where the Service Bus Queue is located. | def service_bus_queue_endpoint_id(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "service_bus_queue_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_bus_queue_endpoint_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_bus_queue_endpoint_id\")",
"def service_bus_queue_endpoint_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_bus_queue_endpoint_id\")",
"def QueueId(self):\n\t\tr... | [
"0.71073616",
"0.71073616",
"0.6959401",
"0.6470121",
"0.63885784",
"0.6166723",
"0.60788393",
"0.60659087",
"0.59840083",
"0.59840083",
"0.59840083",
"0.5893416",
"0.5874236",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.5835111",
"0.58351... | 0.6803634 | 3 |
Specifies the id where the Service Bus Topic is located. | def service_bus_topic_endpoint_id(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "service_bus_topic_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic_id(self, topic_id: TopicId):\n\n self._topic_id = topic_id",
"def service_bus_topic_endpoint_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_bus_topic_endpoint_id\")",
"def service_bus_topic_endpoint_id(self) -> Optional[pulumi.Input[str]]:\n return p... | [
"0.6951712",
"0.69207007",
"0.69207007",
"0.6714118",
"0.66215444",
"0.64401406",
"0.6369368",
"0.62431246",
"0.6079379",
"0.60691476",
"0.59788126",
"0.5890337",
"0.5849948",
"0.5834524",
"0.58329153",
"0.5807717",
"0.57896304",
"0.5738926",
"0.57316566",
"0.5730298",
"0.571... | 0.66045886 | 5 |
Return group serial number | def group_serial(self):
return self.structure.group_serial[self.mask] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groupnumber(self):\n return self._groupnumber",
"def generate_group_id(self):\n if not hasattr(self.space, '_group_ctr'):\n self.space._group_ctr = 999\n self.space._group_ctr += 1\n return self.space._group_ctr",
"def _getNextGroupId(self):\n groupId = self._n... | [
"0.7592711",
"0.7415114",
"0.70650697",
"0.690621",
"0.68843037",
"0.68843037",
"0.67907697",
"0.6697655",
"0.6623955",
"0.66060615",
"0.66024655",
"0.66024655",
"0.66024655",
"0.65919924",
"0.6584418",
"0.6564704",
"0.65088105",
"0.6479698",
"0.64557654",
"0.6439751",
"0.642... | 0.8145749 | 0 |
Return the unique ID for this thermostat. | def unique_id(self) -> str:
return "_".join([self._name, "climate"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_id(self):\n return self._device.serial",
"def unique_id(self):\n return self.device_id",
"def unique_id(self):\n return self.device_id + '_' + self._sensor_type",
"def unique_id(self):\n return self._device_id",
"def unique_id(self) -> str:\n return pulumi.get(... | [
"0.7890332",
"0.7883406",
"0.7873493",
"0.7845099",
"0.779009",
"0.7787565",
"0.7771058",
"0.77351385",
"0.76991564",
"0.76991564",
"0.76991564",
"0.76991564",
"0.76991564",
"0.76991564",
"0.76991564",
"0.76991564",
"0.7689798",
"0.76848567",
"0.76848567",
"0.76801515",
"0.76... | 0.0 | -1 |
Generate a wrapper for calling the constructor from pure Python. Note the wrapper will only accept positional arguments. | def _set_init(cls):
init = cls.class_type.instance_type.methods['__init__']
init_sig = utils.pysignature(init)
# get postitional and keyword arguments
# offset by one to exclude the `self` arg
args = _getargs(init_sig)[1:]
cls._ctor_sig = init_sig
ctor_source = _c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def naked(**kwds):\n # get the constructor\n from .Naked import Naked\n\n # build one and return it\n return Naked(**kwds)",
"def create_constructor(self, *args, **kws):\n node = FunctionNode(\"<constructor>\", *args, **kws)\n node.class_member = True\n self.add_object(node)\n ... | [
"0.66403586",
"0.62229824",
"0.6184563",
"0.6158275",
"0.6158275",
"0.6158275",
"0.6153065",
"0.60777575",
"0.60777575",
"0.60777575",
"0.60777575",
"0.60777575",
"0.60777575",
"0.6062194",
"0.6025516",
"0.6017705",
"0.6011821",
"0.60086316",
"0.5989491",
"0.5989491",
"0.5989... | 0.0 | -1 |
String for representing the Model object (in Admin site etc.) | 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 '%s%s' % (self.name, ' - %s' % self.model if self.model else '')",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str_... | [
"0.7801933",
"0.7711563",
"0.767449",
"0.767449",
"0.7524819",
"0.74031794",
"0.7397977",
"0.7377793",
"0.7327436",
"0.72694355",
"0.7243579",
"0.72344506",
"0.72067523",
"0.71751106",
"0.71667767",
"0.7109656",
"0.7037379",
"0.7037379",
"0.7012104",
"0.69868195",
"0.696746",... | 0.66209954 | 80 |
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.8236402",
"0.79899704",
"0.7847493",
"0.7846091",
"0.7750677",
"0.762421",
"0.762421",
"0.7623445",
"0.7623445",
"0.7547878",
"0.75219196",
"0.7469617",
"0.7468823",
"0.7445783",
"0.7445783",
"0.7429821",
"0.7426174",
"0.7389077",
"0.73497665",
"0.7340129",
"0.73219186",
... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return '{0} ({1})'.format (self.name, self.link) | {
"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.8236402",
"0.79899704",
"0.7847493",
"0.7846091",
"0.7750677",
"0.762421",
"0.762421",
"0.7623445",
"0.7623445",
"0.7547878",
"0.75219196",
"0.7469617",
"0.7468823",
"0.7445783",
"0.7445783",
"0.7429821",
"0.7426174",
"0.7389077",
"0.73497665",
"0.7340129",
"0.73219186",
... | 0.0 | -1 |
standard building block for residual networks with batch normalization before convolutions | def building_block(inputs, filters, is_training, projection_shortcut, strides, data_format):
shortcut = inputs
inputs = batch_norm_relu(inputs, is_training, data_format)
# The projection shortcut should come after the first batch norm and ReLU
# since it performs a 1x1 convolution.
if projection... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_resnet(self):\r\n\r\n # INPUTS\r\n inputs_data = Input((self.data_rows, self.data_cols, 1),name='inputs_data')\r\n\r\n\r\n def residual_block(input, output_channels=64, kernel_size=(3, 3), stride=(1, 1)):\r\n x = Conv2D(output_channels, kernel_size, padding='same', strides... | [
"0.7466051",
"0.71444404",
"0.69324785",
"0.6898751",
"0.685127",
"0.68392086",
"0.681615",
"0.6803684",
"0.67611736",
"0.6747609",
"0.6746763",
"0.67443347",
"0.6708543",
"0.67051804",
"0.66832143",
"0.66304916",
"0.6605283",
"0.659058",
"0.6573603",
"0.656153",
"0.6558871",... | 0.0 | -1 |
Bottleneck block variant for residual networks with BN before convolutions. | def bottleneck_block(inputs, filters, is_training, projection_shortcut,
strides, data_format):
shortcut = inputs
inputs = batch_norm_relu(inputs, is_training, data_format)
# The projection shortcut should come after the first batch norm and ReLU
# since it performs a 1x1 convolutio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet101_base(freeze_blocks=[1,2,3], weight_regularizer=None, bias_regularizer=None):\n img_input = Input(shape=(None, None, 3))\n bn_axis = 3\n train1 = 1 not in freeze_blocks\n x = Conv2D(64, (7, 7), strides=(2, 2), padding='same', name='conv1', trainable=train1, use_bias=False,\n ... | [
"0.6864767",
"0.68166846",
"0.6682331",
"0.66433966",
"0.66374767",
"0.6503437",
"0.650018",
"0.6481248",
"0.64078444",
"0.63828945",
"0.63604105",
"0.6343007",
"0.63075227",
"0.63065225",
"0.6303216",
"0.62921685",
"0.62765133",
"0.6276392",
"0.6259955",
"0.62441397",
"0.624... | 0.0 | -1 |
Creates one layer of blocks for the ResNet model. | def block_layer(inputs, filters, block_fn, blocks, strides, is_training, name,
data_format):
# Bottleneck blocks end with 4x the number of filters as they start with
filters_out = 4 * filters if block_fn is bottleneck_block else filters
def projection_shortcut(inputs):
return conv2d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _construct_block(self, block_info):\n layer_name = block_info[0]\n if layer_name=='Conv2d':\n in_channels, out_channels, kernel_size = block_info[1:]\n return nn.Conv2d(in_channels=in_channels,\n out_channels=out_channels,\n ... | [
"0.7110695",
"0.6932771",
"0.69012946",
"0.67949784",
"0.6755838",
"0.6659467",
"0.6657102",
"0.6650306",
"0.66033155",
"0.6532092",
"0.6531614",
"0.65234965",
"0.6511553",
"0.6502128",
"0.64810467",
"0.64493424",
"0.64472485",
"0.6435234",
"0.64325476",
"0.6413801",
"0.64116... | 0.0 | -1 |
This function writes a progressbar to stdout given the progress percent and the remaining time. | def update_progress(progress, time):
barLength = 30 # Modify this to change the length of the progress bar
status = ""
if isinstance(progress, int):
progress = float(progress)
if not isinstance(progress, float):
progress = 0
status = "error: progress var must be float\r\n"
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OnProgress(bytes_read, total_bytes, percent):\n sys.stdout.write(\"progress: %.2f%% \\r\" % (percent))\n sys.stdout.flush()",
"def printProgress(self, percentage):\n #print '%s\\r' % ' '*20, # clean up row\n #print '%3d%% ' % percentage, # ending with comma prevents newline from being... | [
"0.7643847",
"0.75793004",
"0.75456077",
"0.7526471",
"0.75034934",
"0.7444257",
"0.7398441",
"0.7374087",
"0.7305788",
"0.72948366",
"0.72908473",
"0.727613",
"0.72619677",
"0.7261226",
"0.7221874",
"0.72039276",
"0.71766233",
"0.71662897",
"0.71583295",
"0.71532214",
"0.715... | 0.728016 | 11 |
Get an encrypted ENV VAR | def get_kms_var(var_name: str) -> str:
ciphertext_blob = get_var(var_name)
return decode_kms(ciphertext_blob) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_enc_secret():\n return current_app.config.get('ACCOUNT_SECRET_KEY')",
"def test_get_secret_from_env(monkeypatch):\n key = str(uuid.uuid4()).replace('-', '.')\n value = str(uuid.uuid4())\n monkeypatch.setenv(key.replace('.', '_').upper(), value)\n secret = lambdautils.utils.get_secret(... | [
"0.6844506",
"0.6636935",
"0.6579709",
"0.65151733",
"0.6427305",
"0.6417805",
"0.6234166",
"0.6234166",
"0.61943525",
"0.61624855",
"0.61624855",
"0.6162415",
"0.6146803",
"0.61411524",
"0.61131823",
"0.61131823",
"0.6075675",
"0.60645765",
"0.60583305",
"0.6039192",
"0.6018... | 0.5558739 | 70 |
Check an input value to see if it is an env_var or enc_env_var and get the value. | def check_for_env_vars(value: Union[str, dict]):
if type(value) is dict and "env_var" in value:
var_name = value["env_var"]
try:
return get_var(var_name)
except KeyError:
raise KeyError(f"missing env var: {value['env_var']}")
if type(value) is dict and "enc_env_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(key:str):\n value = environ.get(key)\n if value == None or len(str(value)) == 0:\n raise ValueError('Missing env: '+key)\n return value",
"def env_get_var_value(var_name, allow_missing=False):\n if allow_missing:\n if var_name not in os.environ.keys():\n return None\n ... | [
"0.73700356",
"0.7158917",
"0.69192725",
"0.6907078",
"0.6831348",
"0.67889446",
"0.6767283",
"0.6717435",
"0.670126",
"0.6682734",
"0.66820246",
"0.6670561",
"0.6654985",
"0.6654985",
"0.6643772",
"0.66415215",
"0.65827405",
"0.65776205",
"0.65425307",
"0.65285254",
"0.65223... | 0.8198688 | 0 |
Get an env var. | def get_var(var_name: str):
return os.environ[var_name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetEnvVariable(name):\n return os.environ.get(name)",
"def env(var):\n return os.environ[var]",
"def getenv(self, var):\n return os.environ[var]",
"def get_environment_var(env_name, default_value):\n if env_name in os.environ:\n return os.environ[env_name]\n else:\n retur... | [
"0.8241268",
"0.81780976",
"0.8055934",
"0.7856729",
"0.7816879",
"0.78049076",
"0.7804008",
"0.77591896",
"0.7736329",
"0.773161",
"0.7621551",
"0.7596207",
"0.7589866",
"0.7544355",
"0.75368094",
"0.7458575",
"0.7437355",
"0.74314004",
"0.74302214",
"0.7368336",
"0.73595667... | 0.8035194 | 3 |
Gets the id of this ResultFeedback. | def id(self) -> str:
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 get_id(self):\n ... | [
"0.68303",
"0.68303",
"0.68303",
"0.68303",
"0.68303",
"0.68303",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
"0.6827235",
... | 0.0 | -1 |
Sets the id of this ResultFeedback. | def id(self, id: str):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def id(self, id: int):\n\n self._id = id",
"def id(self, id: int):\n\n self._id = id",
"def id(self, id: int):\n\n self._id = id",
... | [
"0.7303031",
"0.7278875",
"0.7076294",
"0.69607407",
"0.69607407",
"0.69607407",
"0.69607407",
"0.69607407",
"0.69607407",
"0.69607407",
"0.69607407",
"0.69607407",
"0.69607407",
"0.69466746",
"0.69466746",
"0.69466746",
"0.69466746",
"0.69466746",
"0.69321716",
"0.6892362",
... | 0.0 | -1 |
Gets the result_id of this ResultFeedback. | def result_id(self) -> str:
return self._result_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_id(self, result_id: str):\n\n self._result_id = result_id",
"def get_run_id_from_result(model_result):\n if 'ml_flow' not in model_result:\n return None\n\n with model_result['ml_flow'].open('r') as f:\n return yaml.load(f).get('run_id')",
"def getRID(self)... | [
"0.64382327",
"0.6204624",
"0.61794865",
"0.6143628",
"0.60243523",
"0.5891776",
"0.58898044",
"0.5788648",
"0.57456195",
"0.56009173",
"0.5567063",
"0.5567063",
"0.5567063",
"0.5567063",
"0.5567063",
"0.5567063",
"0.556441",
"0.556441",
"0.556441",
"0.556441",
"0.556441",
... | 0.7879111 | 0 |
Gets the expertise_level_id of this ResultFeedback. | def expertise_level_id(self) -> int:
return self._expertise_level_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expertise_level_id(self, expertise_level_id: int):\n\n self._expertise_level_id = expertise_level_id",
"def min_edu_level(self) -> int:\n if len(self._history_edus) == 0:\n return 0\n # add one since allocating 0 for 'none'\n return int(max([e.education_lvl for e in sel... | [
"0.6930326",
"0.5666985",
"0.5651505",
"0.5414617",
"0.52784675",
"0.524075",
"0.5175979",
"0.5175979",
"0.5175979",
"0.5175979",
"0.50943905",
"0.5092737",
"0.5092737",
"0.5089368",
"0.5083698",
"0.508105",
"0.508105",
"0.5080214",
"0.49725983",
"0.494093",
"0.49346152",
"... | 0.85218173 | 0 |
Sets the expertise_level_id of this ResultFeedback. | def expertise_level_id(self, expertise_level_id: int):
self._expertise_level_id = expertise_level_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expertise_level_id(self) -> int:\n return self._expertise_level_id",
"def challenge_id(self, challenge_id):\n\n self._challenge_id = challenge_id",
"def challenge_id(self, challenge_id):\n\n self._challenge_id = challenge_id",
"def alert_id(self, alert_id):\n\n self._alert_id ... | [
"0.7050496",
"0.47598615",
"0.47598615",
"0.46611744",
"0.46601647",
"0.46087074",
"0.46087074",
"0.46087074",
"0.45958373",
"0.45564318",
"0.45502284",
"0.45434976",
"0.45345685",
"0.4478469",
"0.4478469",
"0.4478469",
"0.44568378",
"0.44566563",
"0.43826875",
"0.43826875",
... | 0.86135805 | 0 |
Gets the rating_id of this ResultFeedback. | def rating_id(self) -> int:
return self._rating_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rating(self):\n average = self.review.all().aggregate(Avg('rating'))['rating__avg']\n if not average:\n return 0\n return average",
"def get_rating(self):\n self.rating = imdb.get_title_ratings(self.ID)['rating']",
"def user_rating(self) -> int:\n return self._... | [
"0.6564797",
"0.64677864",
"0.62480444",
"0.6228991",
"0.6228991",
"0.6205059",
"0.60589695",
"0.6051603",
"0.6045927",
"0.58428097",
"0.5809289",
"0.5773237",
"0.5739441",
"0.5730468",
"0.5700404",
"0.5696567",
"0.5687094",
"0.56223744",
"0.55921245",
"0.55511975",
"0.554715... | 0.826064 | 0 |
Gets the comment of this ResultFeedback. | def comment(self) -> str:
return self._comment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment(self):\n\t\treturn self.comment_",
"def comment(self) :\n\t\ttry :\n\t\t\treturn self._comment\n\t\texcept Exception as e:\n\t\t\traise e",
"def comment(self):\n if self._comment is not None and not isinstance(self._comment, Comment):\n self._comment = Comment(self._comment)\n\n ... | [
"0.780673",
"0.7687786",
"0.7518755",
"0.7490704",
"0.7393763",
"0.72972775",
"0.67270166",
"0.67037916",
"0.66877604",
"0.66576195",
"0.6634072",
"0.6601777",
"0.65787",
"0.6509487",
"0.648337",
"0.63962656",
"0.63962656",
"0.637697",
"0.6366815",
"0.6315889",
"0.6305273",
... | 0.7720672 | 3 |
get string value from config | def get_string(self, sect, opt):
return self.get_safe(sect, opt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self) -> str:\n return self._config.get('value')",
"def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]",
"def get_value(key: str) -> str:\n Config.__get()\n assert Config.__config is not None\n return ... | [
"0.7370157",
"0.73598444",
"0.7302067",
"0.71813804",
"0.71111256",
"0.71074003",
"0.7104573",
"0.708249",
"0.6791281",
"0.6765985",
"0.6759385",
"0.67268217",
"0.6719754",
"0.66892767",
"0.65878123",
"0.65771127",
"0.65665627",
"0.65645385",
"0.6544886",
"0.6542625",
"0.6537... | 0.0 | -1 |
return the last (current) candle or None if empty | def last_candle(self):
if self.length() > 0:
return self.candles[0]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def candle(self, tf):\n candles = self._candles.get(tf)\n if candles:\n return candles[-1]\n\n return None",
"def last_close(self):\n return self.data.last('1D').close.iat[0]",
"def get_last_close(self, symbol):\n if symbol in self.symbol:\n close_price ... | [
"0.7536957",
"0.72554845",
"0.6997919",
"0.69812715",
"0.67972636",
"0.66705304",
"0.66543746",
"0.66073924",
"0.65751046",
"0.6532627",
"0.648842",
"0.6468851",
"0.6464458",
"0.6424752",
"0.64195114",
"0.641244",
"0.641244",
"0.641244",
"0.641244",
"0.641244",
"0.63898355",
... | 0.9021767 | 0 |
should we use tonce instead on nonce? tonce is current microtime and also works when messages come out of order (which happens at the mtgox server in certain siuations). They still have to be unique because mtgox will remember all recently used tonce values. It will only be accepted when the local clock is +/ 10 second... | def use_tonce(self):
return self.config.get_bool("gox", "use_tonce") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _nonce():\n return str(round(100000 * time.time()) * 2)",
"def get_nonce() -> int:\n return int(time.time() * FACTOR)",
"def _nonce(self):\n return str(int(round(time.time() * 10000)))",
"def generate_nonce():\n return str(int(round(time.time() * 1000)))",
"def nonce():\n return ... | [
"0.78583974",
"0.7785784",
"0.7602263",
"0.7533752",
"0.7487909",
"0.7487909",
"0.71934444",
"0.7094619",
"0.7094619",
"0.7071787",
"0.70685494",
"0.7067734",
"0.70097715",
"0.6973275",
"0.68652785",
"0.68118274",
"0.6686969",
"0.6616133",
"0.657566",
"0.6315083",
"0.63149893... | 0.0 | -1 |
new buy order, if price=0 then buy at market | def buy(self, price, volume):
self.order("bid", price, volume) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _buy(self, amount, price):\n params = {\"pair\": self.pair, \"type\" : \"buy\", \"rate\" : price, \"amount\" : amount}\n response = self._send_request(\"Trade\", params)\n if \"error\" in response:\n raise TradeException(response[\"error\"])",
"def buy(self):\n\n from_s... | [
"0.70462245",
"0.70121616",
"0.7011208",
"0.70064074",
"0.69337183",
"0.69123894",
"0.6899761",
"0.6849794",
"0.683146",
"0.67965996",
"0.6774955",
"0.67333776",
"0.6722896",
"0.6713324",
"0.6712716",
"0.6712067",
"0.67085457",
"0.66847444",
"0.667574",
"0.6638519",
"0.662436... | 0.7497636 | 0 |
new sell order, if price=0 then sell at market | def sell(self, price, volume):
self.order("ask", price, volume) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sell(self, amount, price):\n params = {\"pair\": self.pair, \"type\" : \"sell\", \"rate\" : price, \"amount\" : amount}\n response = self._send_request(\"Trade\", params)\n if \"error\" in response:\n raise TradeException(response[\"error\"])",
"def test_add_sale_with_price_b... | [
"0.7181917",
"0.7002634",
"0.69518137",
"0.69463843",
"0.69393617",
"0.6935553",
"0.692386",
"0.69083256",
"0.6899684",
"0.68935084",
"0.686449",
"0.6845292",
"0.6825042",
"0.6802388",
"0.6780402",
"0.676873",
"0.67671156",
"0.6729766",
"0.6704133",
"0.669546",
"0.66942114",
... | 0.7579794 | 0 |
create and initialize the window. This will also subsequently call the paint() method. | def __init__(self, stdscr):
self.stdscr = stdscr
self.posx = 0
self.posy = 0
self.width = 10
self.height = 10
self.termwidth = 10
self.termheight = 10
self.win = None
self.panel = None
self.__create_win() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(self):\n sg.theme(gui.app_theme)\n self.window = sg.Window(\n gui.app_title,\n gui.create_layout(),\n **gui.window_config,\n )\n gui.after_window_init(self.window)",
"def init_window(self, game, width, height, scale):\n self.controller ... | [
"0.7310811",
"0.716095",
"0.71141994",
"0.7096625",
"0.69444466",
"0.69218624",
"0.6897558",
"0.6890084",
"0.6884022",
"0.6865636",
"0.68298703",
"0.67473096",
"0.67365944",
"0.67336065",
"0.67082936",
"0.66621774",
"0.66611445",
"0.6621403",
"0.6588989",
"0.6585137",
"0.6581... | 0.0 | -1 |
turn on/off the tracability. | def enableTrace(tracable):
global traceEnabled
traceEnabled = tracable
if tracable:
if not logger.handlers:
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affection_status_switch_on(self):\n self._affection_status_switch = False",
"def turn_on(self, **kwargs):\n self._is_on = True",
"def turn_on(self, **kwargs: Any) -> None:\n if self.type == \"on_off\":\n _LOGGING.debug(\"Starting all torrents\")\n self._tm_client.api.... | [
"0.6772032",
"0.6697771",
"0.66860074",
"0.6598688",
"0.65538377",
"0.6508947",
"0.6435624",
"0.6337011",
"0.63356334",
"0.63287216",
"0.6313783",
"0.6278925",
"0.6233795",
"0.6223233",
"0.62219495",
"0.6218715",
"0.6189531",
"0.617915",
"0.61730486",
"0.61709523",
"0.6150916... | 0.0 | -1 |
Visualize a color image. | def vis_image(img, ax=None):
from matplotlib import pyplot as plot
if ax is None:
fig = plot.figure()
ax = fig.add_subplot(1, 1, 1)
if img is not None:
# CHW -> HWC
img = img.transpose((1, 2, 0))
ax.imshow(img.astype(np.uint8))
return ax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_image(image):\r\n plt.imshow(image, cmap='gray')\r\n plt.show()",
"def visualizeImg(img):\n plt.figure(figsize=(10,4))\n plt.imshow(img)\n plt.show()",
"def show(self, color = Color.GREEN):\n self.draw(color)\n self.image.show()",
"def plot_color_image(image):\n plt.imshow(... | [
"0.7653325",
"0.7355811",
"0.7327972",
"0.7317338",
"0.7196168",
"0.7159858",
"0.6957178",
"0.69489205",
"0.6929653",
"0.6926859",
"0.68475527",
"0.683891",
"0.67679864",
"0.67679864",
"0.67679864",
"0.67395127",
"0.6714621",
"0.6704949",
"0.66906345",
"0.66678095",
"0.666654... | 0.60078883 | 82 |
Check whether current user number and past are same | def user_is_same(current_user_number, past_user_numbers):
if current_user_number == past_user_numbers:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkIfUserIsCurrent(self,userId : str) -> bool:\n\n if userId == userId[0]:\n return True\n else:\n return False",
"def hasWin(self) :\n comparison = self.compareNumberUser()\n if (comparison == 'equal') :\n return True\n else :\n ... | [
"0.6283366",
"0.59265333",
"0.59232146",
"0.582064",
"0.5741896",
"0.57120126",
"0.5693111",
"0.5651114",
"0.5535932",
"0.5531912",
"0.55177283",
"0.55133915",
"0.5474713",
"0.54355824",
"0.5422245",
"0.54043466",
"0.5358159",
"0.53492886",
"0.53486514",
"0.53411305",
"0.5329... | 0.86092407 | 0 |
Filter a record. If the filter succeeds, returns a SeqRecord. If it fails, raises an instance of FailedFilter with an optional value. | def filter_record(self, record):
raise NotImplementedError("Override in subclass") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_record(self, record):\n l = len(record)\n if l >= self.min_length:\n return record\n else:\n raise FailedFilter(l)",
"def filter_records(self, records):\n for record in records:\n try:\n filtered = self.filter_record(record)\n... | [
"0.67412287",
"0.61258715",
"0.6080871",
"0.5898387",
"0.5864468",
"0.582818",
"0.5699735",
"0.5640018",
"0.5518135",
"0.537534",
"0.53009856",
"0.52476084",
"0.5216891",
"0.5204128",
"0.5092803",
"0.5074316",
"0.5061173",
"0.50502247",
"0.4859143",
"0.48561737",
"0.47898856"... | 0.6587475 | 1 |
Make this block not trainable. This method sets all parameters to `requires_grad=False`, and convert all BatchNorm layers to FrozenBatchNorm | def freeze(self):
for p in self.parameters():
p.requires_grad = False
FrozenBatchNorm2d.convert_frozen_batchnorm(self)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze_model(self):\n # BN layers need to be freezed explicitly since they cannot be freezed via '.requires_grad=False'\n for module in self.modules():\n if isinstance(module, (nn.BatchNorm2d, nn.GroupNorm)):\n module.eval()\n \n # freeze all parameters\n ... | [
"0.73696697",
"0.7235789",
"0.722332",
"0.7037992",
"0.69820195",
"0.69820195",
"0.6754237",
"0.6631531",
"0.66040474",
"0.6601942",
"0.6600963",
"0.65970063",
"0.65557307",
"0.6543082",
"0.6522239",
"0.6476508",
"0.64595795",
"0.63874733",
"0.6366474",
"0.63443446",
"0.63386... | 0.7630583 | 0 |
Get the Reward Tensor R[i,s,a1,...,aN,s']. | def RewardTensor(self):
dim = np.concatenate(([self.N],
[self.Z],
[self.M for _ in range(self.N)],
[self.Z]))
Risas = np.zeros(dim, dtype=object)
for index, _ in np.ndenumerate(Risas):
Risas[in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReward(self):\n return self._mdp.R[self._prev_state,self._cur_state]",
"def r(self, s, a):\n return self.reward_table[s[0]+a[0]][s[1]+a[1]]",
"def get_reward(self):\n accuracy = self.state\n # Use accuracy as reward for now.\n reward = accuracy\n return reward",... | [
"0.6310406",
"0.62030977",
"0.6022204",
"0.6008642",
"0.59118164",
"0.5906683",
"0.5858146",
"0.58420444",
"0.57313514",
"0.57294077",
"0.57186085",
"0.57077277",
"0.5676666",
"0.56732965",
"0.56688744",
"0.5664528",
"0.56266886",
"0.5588908",
"0.5586906",
"0.558669",
"0.5575... | 0.77271366 | 0 |
Mock host import on libgitlab. | def mock_gitlab_host(monkeypatch):
mock_host = mock.Mock()
monkeypatch.setattr("libgitlab.host", mock_host)
return mock_host | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def libgitlab(\n tmpdir,\n mock_layers,\n mock_hookenv_config,\n mock_charm_dir,\n mock_upgrade_package,\n mock_gitlab_socket,\n mock_apt_install,\n mock_apt_update,\n mock_add_source,\n mock_template,\n mock_gitlab_subprocess,\n mock_unit_db,\n mock_open_port,\n mock_clos... | [
"0.65938544",
"0.64280385",
"0.6410184",
"0.618672",
"0.6183961",
"0.6146403",
"0.6139739",
"0.6092987",
"0.6058357",
"0.60103774",
"0.59893286",
"0.5946104",
"0.59444356",
"0.59328794",
"0.58959776",
"0.5894308",
"0.58655405",
"0.58564895",
"0.58487475",
"0.58204263",
"0.579... | 0.6983444 | 0 |
Mock the charmhelpers fetch apt_update method. | def mock_apt_update(monkeypatch):
mocked_apt_update = mock.Mock(returnvalue=True)
monkeypatch.setattr("libgitlab.apt_update", mocked_apt_update)
return mocked_apt_update | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arbitrary(self):\n self.executor.add_command('apt_get')\n output, _error = self.executor.apt_get.update().batch()\n self.assertEqual(output, 'update finished successfully')",
"def test_smart_update(self):\n if os.getuid() != 0:\n return self.skipTest(\"root privile... | [
"0.70119274",
"0.66506547",
"0.63115287",
"0.6255376",
"0.6255376",
"0.6255376",
"0.62218213",
"0.617753",
"0.6139671",
"0.6004217",
"0.600072",
"0.59821916",
"0.59656864",
"0.59608805",
"0.5895442",
"0.5894744",
"0.5867122",
"0.5821208",
"0.58084714",
"0.5777162",
"0.576513"... | 0.7014396 | 0 |
Compute the losses related to the bounding boxes, the L1 regression loss and the GIoU loss targets dicts must contain the key "boxes" containing a tensor of dim [nb_target_boxes, 4] The target boxes are expected in format (center_x, center_y, h, w), normalized by the image size. | def loss_boxes(self, outputs, targets, indices, num_boxes):
assert "pred_boxes" in outputs
idx = self._get_src_permutation_idx(indices)
src_boxes = outputs["pred_boxes"][idx]
target_boxes = torch.cat(
[t["boxes"][i] for t, (_, i) in zip(targets, indices)], dim=0
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss_boxes(self, outputs, targets, indices, num_boxes):\n assert 'pred_boxes' in outputs\n idx = self._get_src_permutation_idx(indices)\n src_boxes = outputs['pred_boxes'][idx]\n tgt_idx = [i[torch.where(i >= 0)[0]] for i in indices]\n target_boxes = torch.cat([t['boxes'][i] ... | [
"0.77158344",
"0.7664816",
"0.7613496",
"0.75690854",
"0.7256268",
"0.71820104",
"0.6731162",
"0.6582513",
"0.6372874",
"0.6353329",
"0.63455456",
"0.63168377",
"0.6277004",
"0.62431103",
"0.62431103",
"0.61981153",
"0.6173895",
"0.6135804",
"0.61260986",
"0.6107613",
"0.6101... | 0.75852734 | 3 |
receives current state and action s,a, returns reward and next state, r, s_prime. a is either 0 (left) or 1 (right) | def one_step(s,a):
R = -1
if s == 0:
s_prime = a # left (0) goes to state 0, right (1) goes to state 1
elif s == 1:
s_prime = 2 if a ==0 else 0 # reversed motion
elif s == 2:
s_prime = 3 if a == 1 else 1
return R, s_prime | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, action):\r\n s = self.get_state()\r\n\r\n elements = np.arange(self.S)\r\n # weights = np.squeeze(self.nextStateProbability[s,action])\r\n weights = self.nextStateProbability[s, action]\r\n nexts = choices(elements, weights, k=1)[0]\r\n\r\n # p = self.nextSt... | [
"0.71952665",
"0.7168916",
"0.714477",
"0.70590866",
"0.6990567",
"0.69806194",
"0.6956675",
"0.6956291",
"0.6927308",
"0.69220966",
"0.69137657",
"0.68725204",
"0.68584985",
"0.68330014",
"0.6796051",
"0.67895114",
"0.67872137",
"0.6774037",
"0.6754842",
"0.6744278",
"0.6740... | 0.74473834 | 0 |
Key function for natural sorting using the `sorted` builtin. | def natural_key(string_):
return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _natural_sort_key(value):\n return map(try_int_cast, re.findall(r'(\\d+|\\D+)', value))",
"def natural_sorted(iterable, key=None, reverse=False):\n prog = re.compile(r\"(\\d+)\")\n\n def alphanum_key(element):\n \"\"\"Split given key in list of strings and digits\"\"\"\n return [int(c)... | [
"0.732894",
"0.732222",
"0.6998571",
"0.69709927",
"0.69148344",
"0.6790655",
"0.664415",
"0.6605364",
"0.65287584",
"0.6520625",
"0.65139085",
"0.6454465",
"0.6433404",
"0.6427895",
"0.62886685",
"0.6266099",
"0.62481815",
"0.62431276",
"0.62388384",
"0.62059253",
"0.6204781... | 0.57024395 | 58 |
Retruns a function with signature `foo(x)` equivalent to calling `int_to_one_hot(x, n=n)`. This is especially useful when using `int_to_one_hot` as preprocessing function as it would be impossible to manually assign `n` at evey call (see `utils.datasets.molecules` for an example of usage). | def int_to_one_hot_closure(n):
def int_to_one_hot_fun(x):
return int_to_one_hot(x, n=n)
return int_to_one_hot_fun | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int_to_one_hot(x, n=None):\n if isinstance(x, int):\n if n is None:\n raise ValueError('n is required to one-hot encode a single integer')\n if x >= n:\n raise ValueError('x must be smaller than n in order to one-hot encode')\n output = np.zeros((n,))\n outp... | [
"0.75091046",
"0.7190449",
"0.71587265",
"0.7109131",
"0.71062285",
"0.7098602",
"0.6935972",
"0.68858397",
"0.68475825",
"0.6841021",
"0.68112177",
"0.68109155",
"0.67891306",
"0.6723789",
"0.6714956",
"0.6668917",
"0.66588324",
"0.66579735",
"0.6630775",
"0.65677565",
"0.65... | 0.83866847 | 0 |
Creates a boolean mask with the given shape in which the elements at idx are True. | def idx_to_mask(idx, shape):
output = np.zeros(shape)
output[idx] = 1
return output.astype(np.bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boolmask(indices, shape=None):\n indices = np.asanyarray(indices)\n if indices.dtype.kind not in {'i', 'u'}:\n indices = indices.astype(int)\n if shape is None:\n shape = indices.max() + 1\n mask = np.zeros(shape, dtype=bool)\n if mask.ndim > 1:\n mask[tuple(indices.T)] = Tr... | [
"0.779151",
"0.74103785",
"0.67052615",
"0.64873755",
"0.6459047",
"0.6174251",
"0.61563116",
"0.6050538",
"0.5956882",
"0.5786397",
"0.5776038",
"0.5766803",
"0.5743635",
"0.57015985",
"0.5671963",
"0.5669624",
"0.565427",
"0.56329006",
"0.55986553",
"0.559113",
"0.5570566",... | 0.86261797 | 0 |
Permutes all possible commodity codes working up through the tree. Will return a generator of commodity codes working from the bottom of the tree upwards yielding each result. | def permute_code_hierarchy(commodity_object) -> Iterator[str]:
while commodity_object:
if not commodity_object.commodity_code:
break
yield commodity_object.commodity_code
commodity_object = commodity_object.get_parent() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk(tree):\n results = []\n for parent, children in tree.iteritems():\n perms = permute(children)\n temp = deepcopy(perms)\n # Add the parent to the perms as well\n for perm in temp:\n perms.append(add_to_head_of_perm(parent, perm))\n for perm in perms:\n ... | [
"0.6068898",
"0.565345",
"0.55508965",
"0.5541506",
"0.5369034",
"0.5363866",
"0.52901876",
"0.5278606",
"0.5258726",
"0.5235304",
"0.5223543",
"0.5206099",
"0.51823837",
"0.5178166",
"0.517602",
"0.51295197",
"0.51215726",
"0.51094335",
"0.5100141",
"0.50987804",
"0.5098428"... | 0.67810905 | 0 |
This functions returns a dictionary where each key is a part of speech tag (e.g. 'NN' for nouns) and the value is a counter object of words of that part of speech and their frequencies. It also filters out words like "is", "the". We used `nltk`'s stop words function for filtering. | def get_counts_by_pos(freqs):
sorted_words = {}
# for each word in the counter
for word in freqs.keys():
# filter out if in nltk's list of stop words, e.g. is, the
if word not in stop_words:
# get its part of speech tag from nltk's pos_tag function
tag = nltk.pos_tag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_frequency():\n\n song = open(\"data/yellow_submarine.txt\")\n d = dict()\n for line in song:\n line = line.strip()\n line = line.lower()\n punctuations = \"\"\"!()-[]{};:'\"\\,<>./?@#$%^&*_~\"\"\" # remove punctuation https://www.programiz.com/python-programming/examples/rem... | [
"0.6840443",
"0.6792632",
"0.6744969",
"0.6718671",
"0.6687633",
"0.6687485",
"0.6684467",
"0.6681724",
"0.6642817",
"0.663208",
"0.6617247",
"0.6614185",
"0.6610774",
"0.6564563",
"0.6523927",
"0.65197814",
"0.6494897",
"0.64901245",
"0.64862925",
"0.6484302",
"0.6483847",
... | 0.66770405 | 8 |
return f as a function of a numpy matrix nu | def f_nu(self,nu):
return self.A*np.sqrt(2.*self.a/np.pi)*(1. + (1./self.a/nu)**self.p)*np.sqrt(nu)*np.exp(-self.a*nu/2.) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Generate_Custom(f, n, m):\n return np.fromfunction(np.vectorize(f, otypes=[float]), (n,m))",
"def f(x):\r\n return x * np.sin(x)",
"def f(self, x: np.array) -> np.array:\n return self.m * x + self.c",
"def f(x):\n return x * np.sin(x)",
"def f(x):\n return x * np.sin(x)",
"def f(x)... | [
"0.64613926",
"0.6434064",
"0.64072555",
"0.63597375",
"0.63597375",
"0.63597375",
"0.63597375",
"0.63574845",
"0.6300843",
"0.62901235",
"0.62876326",
"0.6264891",
"0.60537875",
"0.60149026",
"0.60003465",
"0.5977302",
"0.5944743",
"0.5925246",
"0.58974516",
"0.5889166",
"0.... | 0.6650448 | 0 |
Render the home page | def home():
return render_template('home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template(\"home.html\")",
"def home():\n return render_template(\"home.html\")",
"... | [
"0.88861233",
"0.8787603",
"0.86562115",
"0.86191314",
"0.86191314",
"0.8596315",
"0.84712523",
"0.8464004",
"0.84320194",
"0.83923745",
"0.8389102",
"0.8383717",
"0.8369032",
"0.8361684",
"0.83575314",
"0.83562475",
"0.83404773",
"0.83404773",
"0.83404773",
"0.83404773",
"0.... | 0.8614767 | 15 |
Returns if the files are valid for this filetype | def isSupportedContent(cls, fileContent):
magic = bytearray(fileContent)[:4]
magics = (
p('>I', 0xfeedface),
p('>I', 0xfeedfacf),
p('>I', 0xcafebabe),
p('<I', 0xfeedface),
p('<I', 0xfeedfacf),
p('<I', 0xcafebabe),
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validFiles(self, files):\n for myfile in files:\n if not ( ( myfile.get_uri_scheme() == 'file' ) or \\\n ( myfile.get_uri_scheme() == 'smb' ) ):\n return False\n elif ( not myfile.get_mime_type() in self.oootypes ) and \\\n ( not myfile.... | [
"0.79522955",
"0.77289927",
"0.75763446",
"0.75477403",
"0.75029373",
"0.7391484",
"0.7351389",
"0.72468776",
"0.7246096",
"0.71757835",
"0.7131911",
"0.7130332",
"0.7073801",
"0.7039368",
"0.70143014",
"0.69795847",
"0.69588125",
"0.69588125",
"0.69588125",
"0.6956226",
"0.6... | 0.0 | -1 |
Gets the prefix value of a given route's netmask. | def get_prefix(self, route):
bin_nmsk = '.'.join([bin(int(x)+256)[3:] for x in route[NMSK].split('.')])
return self.len_pref(bin_nmsk) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNodeRoutePrefix(self, route_type, node_id=None, state=None):\n node_routes = self.getNodeRoutes(node_id, state)\n for node_route in node_routes.keys():\n if route_type in node_route:\n return node_routes[node_route][\"prefix\"]\n else:\n return None"... | [
"0.6693916",
"0.6673582",
"0.666532",
"0.63347286",
"0.5992421",
"0.5864881",
"0.5834712",
"0.5793867",
"0.5773377",
"0.5756373",
"0.5756373",
"0.5746765",
"0.57373357",
"0.57373357",
"0.57373357",
"0.5709026",
"0.56809556",
"0.5661008",
"0.5657279",
"0.5641298",
"0.5610181",... | 0.73951495 | 0 |
Return a prettified number, either integer or float. | def number(n):
ONE_MILLION = 1000000
ONE_BILLION = ONE_MILLION * 1000
ONE_TRILLION = ONE_BILLION * 1000
# Ensure input is proper format
if not isinstance(n, (int, float)):
raise TypeError('input format should be an integer or float')
# Ensure input is in range
if n >= ONE_TRILLION... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_num(self, value) -> typing.Any:\n return self.num_type(value)",
"def format_number(x):\n\n if isinstance(x, float):\n # Helps prevent loss of precision as using str() in Python 2 only prints 12 digits of precision.\n # However, IEEE754-1985 standard says that 17 significant de... | [
"0.6834707",
"0.6466124",
"0.6406951",
"0.6351353",
"0.62865806",
"0.62597585",
"0.62314534",
"0.6170731",
"0.616168",
"0.61186",
"0.6083214",
"0.60544217",
"0.60330456",
"0.60265976",
"0.6024341",
"0.6023101",
"0.60028446",
"0.5965937",
"0.5929963",
"0.5928808",
"0.59000033"... | 0.54930747 | 74 |
Creates a hand with empty gems collections, empty set of cards, nobles and reserved cards. | def __init__(self,
name : str = "Player") -> None:
self.name = name
self.gems_possessed = GemsCollection()
self.cards_possessed = set()
self.cards_reserved = set()
self.nobles_possessed = set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hand(self):\n for _ in range(self._handsize):\n if self._deck.size() == 0:\n self._discard.shuffle_collection()\n self._deck.replace(self._discard)\n self._discard.clear_collection()\n card = self._deck.pop()\n self._hand... | [
"0.7078063",
"0.6821331",
"0.655884",
"0.64444464",
"0.62563646",
"0.6206733",
"0.61719793",
"0.61704946",
"0.61694175",
"0.6157237",
"0.61335313",
"0.61165977",
"0.60994154",
"0.6092936",
"0.6086463",
"0.6045061",
"0.60196793",
"0.60159355",
"0.59814745",
"0.59637344",
"0.59... | 0.5318988 | 86 |
Test validate_ip function in calico_ctl utils | def test_validate_ip(self, ip, version, expected_result):
# Call method under test
test_result = validate_ip(ip, version)
# Assert
self.assertEqual(expected_result, test_result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate_ip_ok():\n ip = '1.1.1.1'\n assert howisresolved.validate_ip(ip) is None",
"def is_valid_ip(ip):\n ...",
"def validateIP():\n try:\n s = socket.inet_aton(args.target)\n except socket.error:\n print(\"\")\n print(f\"{bad_cmd} Bad IP addre... | [
"0.8092415",
"0.7800803",
"0.77163774",
"0.7369929",
"0.72639966",
"0.7263895",
"0.7207887",
"0.72016615",
"0.7121709",
"0.70307994",
"0.6994074",
"0.69378966",
"0.6937858",
"0.6920722",
"0.6915051",
"0.6902127",
"0.6874084",
"0.6838942",
"0.6805019",
"0.6790646",
"0.67768186... | 0.7655911 | 3 |
Produce a list containing a single string. | def display(self, request):
l = []
try:
result = self.stream(l.append, request)
if result is not None:
return result
return l
except:
return [webutil.formatFailure(failure.Failure())] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _strings_to_list(one_or_more_strings):\n if isinstance(one_or_more_strings, str):\n return [one_or_more_strings]\n else:\n return list(one_or_more_strings)",
"def str_list_works(x):\n import ast\n x = ast.literal_eval(x)\n x = [n.strip() for n in x]\n return (x)",
"def get_n... | [
"0.71460277",
"0.6901647",
"0.6758639",
"0.675661",
"0.6587837",
"0.658689",
"0.6570945",
"0.65131336",
"0.6463501",
"0.645145",
"0.6446192",
"0.6423625",
"0.6421211",
"0.64129376",
"0.63748753",
"0.63211066",
"0.631116",
"0.6292595",
"0.6292457",
"0.62836355",
"0.62738055",
... | 0.0 | -1 |
Returns the color for this record. | def get_color(self, record):
if record.level == CRITICAL:
return Fore.RED + Style.DIM
elif record.level == ERROR:
return Fore.RED + Style.BRIGHT
elif record.level == WARNING:
return Fore.YELLOW + Style.DIM
elif record.level == NOTICE:
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(self):\n\n return self.color",
"def color(self):\n return self['color']",
"def get_color(self):\n return self.color",
"def get_color(self):\n return self._color",
"def get_color(self):\n return self._color",
"def get_color(self):\r\n return self._co... | [
"0.8570491",
"0.8560105",
"0.8553639",
"0.8508012",
"0.8508012",
"0.8468174",
"0.8463534",
"0.8455492",
"0.8443696",
"0.84204817",
"0.8394403",
"0.8381473",
"0.8381473",
"0.8381473",
"0.8341364",
"0.8341364",
"0.83403397",
"0.82998437",
"0.82034767",
"0.8193535",
"0.816576",
... | 0.7412965 | 71 |
Set the view box in the window coordinate system. | def set_relative_viewbox(self, x0, y0, x1, y1):
# prevent too small zoombox
if (np.abs(x1 - x0) < .07) & (np.abs(y1 - y0) < .07):
return
# force the zoombox to keep its original ratio
if self.parent.constrain_ratio:
x0, y0, x1, y1 = self.constrain_viewbox(x0, y0, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_viewbox(self, x0, y0, x1, y1):\n # force the zoombox to keep its original ratio\n if self.parent.constrain_ratio:\n x0, y0, x1, y1 = self.constrain_viewbox(x0, y0, x1, y1)\n if (x1-x0) and (y1-y0):\n self.tx = -(x1+x0)/2\n self.ty = -(y1+y0)/2\n ... | [
"0.7361588",
"0.688224",
"0.6647772",
"0.6580082",
"0.65641516",
"0.65257746",
"0.64771825",
"0.6446805",
"0.6416546",
"0.6393397",
"0.636552",
"0.6344723",
"0.63218385",
"0.6295835",
"0.62430584",
"0.6206974",
"0.61987746",
"0.61280835",
"0.61078864",
"0.60748535",
"0.607459... | 0.6444695 | 8 |
Calculate sigmoid activation function. | def sigmoid(X):
return 1 / (1 + np.exp(-X)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(x):\n return 1.0/(1.0+ex... | [
"0.8527066",
"0.8371858",
"0.8371858",
"0.8290112",
"0.82865906",
"0.8281348",
"0.8277031",
"0.8277031",
"0.8277031",
"0.8277031",
"0.8277031",
"0.8277031",
"0.82547516",
"0.8251106",
"0.82443106",
"0.82379425",
"0.82372326",
"0.82363456",
"0.82268393",
"0.82200676",
"0.82185... | 0.8140382 | 29 |
Calculate ReLU activation function. | def relu(X):
return np.maximum(0, X) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_ReLU(self):\n self.value = max(0, self.value)",
"def test_relu_activation(self):\n self.assertEqual([0, 0.5], list(\n af.Relu().output(np.array([-0.5, 0.5]))))\n self.assertEqual([0, 1], list(\n af.Relu().derivative(np.array([-0.5, 0.5]))))",
"def grad_... | [
"0.7116824",
"0.7069129",
"0.70408934",
"0.67776734",
"0.67776734",
"0.67697775",
"0.67570865",
"0.6724377",
"0.6698598",
"0.6601537",
"0.65898716",
"0.65832865",
"0.6530205",
"0.64268434",
"0.64261866",
"0.6407114",
"0.64007914",
"0.63972795",
"0.63972414",
"0.6395685",
"0.6... | 0.6217288 | 50 |
Calculate softmax activation function. | def softmax(X):
num = np.exp(X)
den = np.sum(np.exp(X))
return num / den | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(inputs):\n return np.exp(inputs) / float(sum(np.exp(inputs)))",
"def softmax(inputs):\n return np.exp(inputs) / float(sum(np.exp(inputs)))",
"def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)",
"def softmax(x): \n return np.exp(x) / np.sum(np.e... | [
"0.8012144",
"0.8012144",
"0.8005641",
"0.79884243",
"0.79323983",
"0.79323983",
"0.79323983",
"0.79323983",
"0.79323983",
"0.79323983",
"0.79323983",
"0.79323983",
"0.7924952",
"0.79134",
"0.7909258",
"0.7898883",
"0.786827",
"0.786827",
"0.7864527",
"0.7859921",
"0.78595185... | 0.76386005 | 30 |
Returns position of parent node for node currently at position pos. | def parent(self, pos):
return pos//2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent(self, pos):\n return pos // 2",
"def parent(self, pos):\n return pos // 2",
"def parent(self, pos):\n if pos == 0: \n return None\n return int(math.ceil(pos / self.dary) - 1)",
"def parent(self, p):\n node = self._validate(p)\n return self._make... | [
"0.77234524",
"0.77234524",
"0.7616424",
"0.73808634",
"0.7379769",
"0.7257691",
"0.7217128",
"0.71770555",
"0.71770555",
"0.71770555",
"0.6914073",
"0.68596584",
"0.67130405",
"0.6617334",
"0.65707546",
"0.6541891",
"0.65339917",
"0.65272546",
"0.65272546",
"0.65206164",
"0.... | 0.7370048 | 5 |
Returns postition of left child for node currently at postition pos. | def left_child(self, pos):
return 2 * pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leftChild(self, pos):\n return 2 * pos",
"def leftChild(self, pos):\n return 2 * pos",
"def get_leftchild(self):\n return self._leftchild",
"def left_child(self, index):\n return 2 * index + 1",
"def left_child(self, position):\n child = 2 * position + 1\n ... | [
"0.8219664",
"0.8219664",
"0.78719246",
"0.7805148",
"0.7784164",
"0.7617409",
"0.75395215",
"0.7535409",
"0.7463121",
"0.74465966",
"0.741426",
"0.7372548",
"0.7341026",
"0.73357457",
"0.7306783",
"0.7306783",
"0.72861874",
"0.72568595",
"0.7248459",
"0.7207685",
"0.7203484"... | 0.81890064 | 2 |
Returns position of right child for node currently at postition pos. | def right_child(self, pos):
return (2 * pos) + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rightChild(self, pos):\n return (2 * pos) + 1",
"def rightChild(self, pos):\n return (2 * pos) + 1",
"def right_child(self, position):\n child = 2 * position + 2\n if child > len(self.table) - 1:\n return None\n return child",
"def get_right_child_ind... | [
"0.8561975",
"0.8561975",
"0.7717484",
"0.7602478",
"0.7597266",
"0.75390583",
"0.7451802",
"0.7431384",
"0.7419048",
"0.7397497",
"0.737437",
"0.7366085",
"0.72120243",
"0.71514195",
"0.7128074",
"0.7117657",
"0.7116739",
"0.7082937",
"0.7082937",
"0.7066932",
"0.70407546",
... | 0.8394216 | 2 |
Swaps positions between two nodes in heap. | def swap(self, pos1, pos2):
self.Heap[pos1], self.Heap[pos2] = self.Heap[pos2], self.Heap[pos1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _swap(heap, i, j):\n heap[i], heap[j] = heap[j], heap[i]",
"def swap_values(self, index1, index2):\n self.heap[index1], self.heap[index2] = self.heap[index2], self.heap[index1]",
"def __swap(self, index1, index2):\n self.heap[index1], self.heap[index2] = self.heap[index2], self.heap[index1... | [
"0.76242244",
"0.72693944",
"0.7266371",
"0.7246148",
"0.7246148",
"0.7192218",
"0.6943342",
"0.69228417",
"0.684061",
"0.68295705",
"0.67912585",
"0.6691145",
"0.6561813",
"0.65188",
"0.6471274",
"0.6437724",
"0.64214456",
"0.63760895",
"0.6356695",
"0.6329804",
"0.63261825"... | 0.76634765 | 0 |
Inserts node into heap. Maintains heap property. | def insert(self, element):
if self.size >= self.maxsize :
return
self.size+= 1
self.Heap[self.size] = element
current = self.size
while self.Heap[current] < self.Heap[self.parent(current)]:
self.swap(current, self.parent(current))
cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_insert(self):\n self.minheap.heap = [0, 1, 4, 6, 9]\n self.minheap.insert(2)\n assert self.minheap.heap == [0, 1, 2, 6, 9, 4]",
"def insert(self, k): \r\n self.heap_array.append(k)\r\n\r\n current_index = len(self.heap_array) - 1\r\n while (current_index > 0):\r\n p... | [
"0.78236437",
"0.7807921",
"0.7640365",
"0.7579324",
"0.7572829",
"0.75561166",
"0.74998987",
"0.74997586",
"0.7486923",
"0.74868035",
"0.74789655",
"0.7470009",
"0.7459629",
"0.7455234",
"0.74422604",
"0.73382246",
"0.73326755",
"0.7233061",
"0.7229761",
"0.7187561",
"0.7130... | 0.7330824 | 17 |
Builds the min heap using min_heapify. | def min_heap(self):
for pos in range(self.size//2, 0, -1):
self.min_heapify(pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_heap(self):\n n = int((len(self.array) / 2) - 1)\n\n while n >= 0:\n self.heapify_top_down(n)\n n -= 1",
"def minHeap(self):\n for pos in range(self.size // 2, 0, -1):\n self.minHeapify(pos)",
"def build_heap(self, da: DynamicArray) -> Non... | [
"0.69214267",
"0.675277",
"0.6683581",
"0.66688234",
"0.6396722",
"0.63610184",
"0.63534826",
"0.6333251",
"0.63306093",
"0.6293083",
"0.6287816",
"0.62804365",
"0.62712973",
"0.62494665",
"0.6245417",
"0.6239315",
"0.62047905",
"0.6196415",
"0.61817974",
"0.61662436",
"0.616... | 0.69811314 | 0 |
This function calculates a 3dimensional orientation error vector for use in the impedance controller. It does this by computing the delta rotation between the inputs and converting that rotation to exponential coordinates (axisangle representation, where the 3d vector is axis angle). | def orientation_error(desired, current):
rc1 = current[0:3, 0]
rc2 = current[0:3, 1]
rc3 = current[0:3, 2]
rd1 = desired[0:3, 0]
rd2 = desired[0:3, 1]
rd3 = desired[0:3, 2]
error = 0.5 * (np.cross(rc1, rd1) + np.cross(rc2, rd2) + np.cross(rc3, rd3))
return error | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_axis_to_rot3d(axis, theta):\n if isinstance(axis, string_types):\n axis = axis.lower()\n if axis == 'x':\n axis = np.array([1., 0., 0.])\n elif axis == 'y':\n axis = np.array([0., 1., 0.])\n elif axis == 'z':\n axis = np.array([0., 0., 1.])\... | [
"0.61631393",
"0.60310227",
"0.59703094",
"0.58105844",
"0.57570565",
"0.5734974",
"0.5673198",
"0.56567675",
"0.56251365",
"0.5617047",
"0.56100565",
"0.5607039",
"0.5598941",
"0.55621076",
"0.5548161",
"0.5532659",
"0.5494373",
"0.5487937",
"0.5485086",
"0.5459881",
"0.5454... | 0.6437328 | 0 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def harversine(lon1, lat1, lon2, lat2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])
# harversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = math.sin(dlat/2.)**2. + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2.)**2.
c =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.81450045",
"0.7863265",
"0.76322985",
"0.76064754",
"0.75978696",
"0.75965863",
"0.75944835",
"0.75720793",
"0.75630087",
"0.7555095",
"0.7528691",
"0.7517629",
"0.7492963",
"0.7467739",
"0.7452678",
"0.7434477",
"0.73914117",
"0.7357736",
"0.73484355",
"0.73318124",
"0.73... | 0.69580966 | 58 |
Returns a float RGB image's YIQ representation. | def rgb2yiq(im_rgb):
return multiply_by_left_matrix(YIQ_MATRIX, im_rgb) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yiq(self):\n return colorsys.rgb_to_yiq(self.red, self.green, self.blue)",
"def rgb2yiq(imRGB):\n return __image_color_conversion(imRGB, RGB_TO_YIQ_MATRIX)",
"def yiq2rgb(im_yiq):\n return multiply_by_left_matrix(np.linalg.inv(YIQ_MATRIX), im_yiq)",
"def transformYIQ2RGB(imgYIQ: np.ndarray) ... | [
"0.6936464",
"0.68316156",
"0.6711393",
"0.6557492",
"0.6529041",
"0.65044534",
"0.6449621",
"0.64304554",
"0.64040196",
"0.6402378",
"0.633643",
"0.6251743",
"0.6248717",
"0.6150527",
"0.60583335",
"0.5984397",
"0.5945186",
"0.5892939",
"0.58262366",
"0.58222175",
"0.5822174... | 0.7049066 | 0 |
Returns a float YIQ image's RGB representation. | def yiq2rgb(im_yiq):
return multiply_by_left_matrix(np.linalg.inv(YIQ_MATRIX), im_yiq) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgb_image(self):\n z3 = self.z[:,:,newaxis]\n return z3 * self.c",
"def yiq2rgb(imYIQ):\n return __image_color_conversion(imYIQ, YIQ_TO_RGB_MATRIX)",
"def yiq2rgb(imYIQ):\n trans = np.array([[1, 0.956, 0.62], [1, -0.272, -0.647], [1, -1.108, 1.705]])\n return np.dot(imYIQ, trans)",
... | [
"0.6899057",
"0.6837505",
"0.66312784",
"0.6626445",
"0.65981084",
"0.65701514",
"0.6392059",
"0.6260221",
"0.6257509",
"0.6246422",
"0.6242725",
"0.62305534",
"0.62085617",
"0.62077945",
"0.6181739",
"0.613577",
"0.6130382",
"0.6115453",
"0.6108013",
"0.6095785",
"0.60699755... | 0.6631014 | 3 |
Calculates the entropy per cell by first calculating how often each state appears in a row, and then calculating the Shannon entropy. | def entropycell(self):
cells = [0] * self.k
for i in range(self.width):
cells[int(self.config[self.t, i])] += 1
"""Calculates the Shannon entropy and the the average entropy so far."""
shannon = 0
for i in range(self.k):
if(cells[i] != 0):
probability = cells[i] / self.w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(self):\n\n \"\"\"Gets the first neighbours, which are the first 2*r+1 cells.\"\"\"\n current_neighbours = []\n amount = [0] * self.k ** (2 * self.r + 1)\n for i in range(2 * self.r + 1):\n current_neighbours.append(self.config[self.t, i % self.width])\n\n \"\"\"Calculates the rule... | [
"0.77584726",
"0.690155",
"0.6899041",
"0.6829788",
"0.6783701",
"0.67524165",
"0.6730829",
"0.66398686",
"0.6623697",
"0.66013193",
"0.6566417",
"0.65417504",
"0.6529375",
"0.651885",
"0.6484132",
"0.6477388",
"0.64177066",
"0.6412604",
"0.6357851",
"0.635209",
"0.633463",
... | 0.784776 | 0 |
Generate a NOT FOUND message for some URL | def not_found(request, wiki_url):
return render_to_response('simplewiki/simplewiki_error.html',
RequestContext(request, {'wiki_err_notfound': True,
'wiki_url': wiki_url})) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_fo... | [
"0.7992413",
"0.7992413",
"0.7992413",
"0.7992413",
"0.7992413",
"0.7992413",
"0.7992413",
"0.794244",
"0.794244",
"0.794244",
"0.794244",
"0.794244",
"0.794244",
"0.794244",
"0.794244",
"0.78422445",
"0.77646786",
"0.76807976",
"0.7610183",
"0.7553898",
"0.7539814",
"0.753... | 0.7164766 | 46 |
Return age of stellar model. This is useful for sorting purposes. | def get_age(self):
return self.glb[iage] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_age(self):\n return int(CURRENT_YEAR[:4]) - self.year # String-slice only the year",
"def get_age(self):\n age = 2021 - self.year\n return age",
"def get_age(self):\n\t\treturn self.age",
"def get_age(self):\n age = CURRENT_YEAR - self.year\n return age",
"def ge... | [
"0.7744753",
"0.77372193",
"0.7734562",
"0.77076244",
"0.7626242",
"0.7626242",
"0.75807536",
"0.7559879",
"0.7539107",
"0.7539107",
"0.7539107",
"0.74952364",
"0.74432737",
"0.7433394",
"0.7410779",
"0.7395864",
"0.7331861",
"0.7298165",
"0.72959775",
"0.72396266",
"0.723952... | 0.77563757 | 0 |
Check to see if the frequencies are in ascending order for each l value. | def freq_sorted(self):
for i in range(len(self.modes)-1):
if (self.modes['l'][i] > 0): continue
if (self.modes['l'][i] != self.modes['l'][i+1]): continue
if (self.modes['freq'][i] > self.modes['freq'][i+1]):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_sorted(l):\n return all(l[i] <= l[i+1] for i in xrange(len(l)-1))",
"def is_sorted(l):\n\tfor i in range(len(l) - 1):\n\t\tif l[i] > l[i + 1]:\n\t\t\treturn False\n\t\n\treturn True",
"def is_monotonic_increasing(self) -> bool:\n if any(-1 in code for code in self.codes):\n return ... | [
"0.64745283",
"0.627997",
"0.61472297",
"0.612801",
"0.61169976",
"0.61163425",
"0.60606885",
"0.60046166",
"0.5998594",
"0.5950367",
"0.5927369",
"0.5861645",
"0.58603454",
"0.57996494",
"0.5744942",
"0.57221496",
"0.57199055",
"0.5691923",
"0.56854635",
"0.5669997",
"0.5644... | 0.705429 | 0 |
If the days on market is 180 or above, then it's a seller's house. If the days on market is less than 180 it is a buyer's house. | def add_seller_house(houses:pd.DataFrame) -> pd.DataFrame:
houses[SELLER_HOUSE]= 2
above= houses[DAYS_ON_MARKET] >= THRESHOLD
below= (houses[DAYS_ON_MARKET] < THRESHOLD)
sold= (houses[STATUS] == SOLD)
s1= [x and y for x,y in zip(above, sold)]
s2= [x and y for x,y in zip(below, sold)]
houses.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_bull_market(self):\n return self.port_return(self.data.last('2M')) >= .2",
"def decide_trade_plan(self):\n self.trade_amount = 5\n most_demanded_goods = self.home.market.goods_demand_ratio(day_range=1)\n most_demanded_goods = sorted(most_demanded_goods.items(), key=lambda i: i[... | [
"0.56297916",
"0.5613051",
"0.5556325",
"0.5526982",
"0.5523018",
"0.55091655",
"0.5429599",
"0.5404668",
"0.54020417",
"0.5298504",
"0.5287351",
"0.5251101",
"0.52332467",
"0.5213166",
"0.5160114",
"0.51466",
"0.5138463",
"0.5138027",
"0.51271325",
"0.51154923",
"0.51020825"... | 0.5622354 | 1 |
Name to use on the Salesforce account | def account_name(self):
return self.civic_no_city() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")",
"def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")",
"def name(self) -> str:\n return getattr(\n self.auth_accounts[-1], \"name\" # pylint: disable=unsubscriptable-object\n ... | [
"0.7503588",
"0.7503588",
"0.71221787",
"0.6910271",
"0.68771076",
"0.68771076",
"0.68771076",
"0.6866516",
"0.6866516",
"0.68100363",
"0.6803482",
"0.66986156",
"0.66986156",
"0.66986156",
"0.66986156",
"0.6675839",
"0.66477174",
"0.66370285",
"0.66176",
"0.6614227",
"0.6614... | 0.6616126 | 19 |
Is this license type one we want to include | def is_valid_license_type(self):
clean = self.license_type.lower().replace('-', ' ')
return clean not in INVALID_LICENSE_TYPE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isLicensed(self):\n return True #arcpy.CheckExtension(\"3D\") and arcpy.CheckExtension(\"Aeronautical\")",
"def isrequired(self, typename):\n return typename in self.required_products",
"def isLicensed(self):\r\n return True",
"def isLicensed(self):\r\n return True",
"def isLice... | [
"0.68729407",
"0.6821527",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67476845",
"0.67407197",
"0.6724603",
"0.6724603",
... | 0.6964584 | 0 |
Name to use on the Salesforce account | def account_name(self):
name1 = self.business_trade_name
name2 = self.business_name
if not name1 and not name2:
return 'NAME MISSING - ' + self.license_number
elif name1 and not name2:
return name1
elif name2 and not name1:
return name2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")",
"def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")",
"def name(self) -> str:\n return getattr(\n self.auth_accounts[-1], \"name\" # pylint: disable=unsubscriptable-object\n ... | [
"0.7503588",
"0.7503588",
"0.71221787",
"0.6910271",
"0.68771076",
"0.68771076",
"0.68771076",
"0.6866516",
"0.6866516",
"0.6803482",
"0.66986156",
"0.66986156",
"0.66986156",
"0.66986156",
"0.6675839",
"0.66477174",
"0.66370285",
"0.66176",
"0.6616126",
"0.6614227",
"0.66142... | 0.68100363 | 9 |
return length of the `Sofomore` instance by calling ``len(.)``. The length is the number of (active and inactive) kernels and hence consistent with subscription like ``[moes[i] for i in range(len(moes)) if i in moes._active_indices]``. | def __len__(self):
return len(self.kernels) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n if self.__indices__ is not None:\n return len(self.__indices__)\n return self.len()",
"def __len__(self):\n return self.n_obs",
"def __len__(self) -> int:\n return self.objects.size",
"def __len__(self):\n total_objs = 0\n\n if self._s... | [
"0.6615482",
"0.66085875",
"0.6460084",
"0.63886994",
"0.6360404",
"0.6334707",
"0.6322326",
"0.63176316",
"0.63176316",
"0.63118094",
"0.6306498",
"0.62936324",
"0.62893295",
"0.6286249",
"0.62855",
"0.62837934",
"0.62501854",
"0.62501854",
"0.62384284",
"0.6226887",
"0.6223... | 0.6872311 | 0 |
return the nondominated solutions dominating the reference point, among the kernels' objective values. It's the image of `self.pareto_set_cut`. | def pareto_front_cut(self):
return self.NDA([kernel.objective_values for kernel in self.kernels \
if kernel.objective_values is not None],
self.reference_point) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pareto_set_cut(self):\n return [kernel.incumbent for kernel in self.kernels if \\\n kernel.objective_values in self.pareto_front_cut]",
"def pareto_front_uncut(self):\n f_pairs = [k.objective_values for k in self\n if k.objective_values is not None]\n ... | [
"0.6652555",
"0.5886855",
"0.5793383",
"0.5551944",
"0.55434203",
"0.55386376",
"0.545292",
"0.5404364",
"0.54025245",
"0.53318036",
"0.53318036",
"0.53318036",
"0.53318036",
"0.5322397",
"0.53215533",
"0.5311801",
"0.53041315",
"0.5288638",
"0.5288638",
"0.5288638",
"0.52755... | 0.66487217 | 1 |
return a dictionary of the current termination states of the kernels. | def termination_status(self):
res = {}
for i in range(len(self)):
res[i] = self.kernels[i].stop()
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_state_dict(self) -> dict:\n return {\n 'optimizers': [o.state_dict() for o in self.optimizers],\n 'schedulers': [s.state_dict() for s in self.schedulers],\n }",
"def _get_state_dict(self) -> dict:\n return {\n 'optimizers': [o.state_dict() for o in s... | [
"0.6349856",
"0.6349856",
"0.6196842",
"0.6168855",
"0.60437703",
"0.5999426",
"0.59728265",
"0.59560364",
"0.59387237",
"0.5929832",
"0.5906461",
"0.58580106",
"0.582551",
"0.58099896",
"0.58028644",
"0.5800034",
"0.5784145",
"0.5750696",
"0.57447875",
"0.5739569",
"0.573105... | 0.82010865 | 0 |
it gives the 'repaired' mean of a cmaes. For a problem with bound constraints, `self.incumbent` in inside the bounds. | def incumbent(self):
return self.boundary_handler.repair(self.mean) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(self):\n return self.cond_proba.mean",
"def _compute_mean(self, C, mag, rjb, rake):\n mean = (C['a1'] +\n self._compute_linear_magnitude_term(C, mag) +\n self._compute_quadratic_magnitude_term(C, mag) +\n self._compute_logarithmic_distance_term(... | [
"0.73375314",
"0.7015701",
"0.70004404",
"0.68452555",
"0.68452555",
"0.67797875",
"0.6709501",
"0.6705219",
"0.6702634",
"0.6656314",
"0.6625221",
"0.6624814",
"0.66190314",
"0.65938556",
"0.6574196",
"0.6564917",
"0.6545716",
"0.6533626",
"0.65234345",
"0.65198547",
"0.6514... | 0.60075396 | 69 |
Splits a list at every occurrence of an element. Similar to str.split() method. Returns a list of lists. | def split_list(l, separator):
result_list = [[]]
for a in l:
# Checks if the current element is a separator
if a == separator:
result_list += [[]]
else:
result_list[-1] += [a]
return result_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(self, s):\r\n l = [self._split(x) for x in _SPLIT_RE.split(s)]\r\n return [item for sublist in l for item in sublist]",
"def split(self) -> List[String]:\n pass",
"def _split_input_list(str_list):\r\n\r\n new_list = re.split(r'[\\n\\r\\s,]', str_list)\r\n new_list = [s.strip() for s in... | [
"0.7282191",
"0.7217527",
"0.6837276",
"0.68265814",
"0.6798347",
"0.6780082",
"0.67021626",
"0.6680017",
"0.66629875",
"0.6652666",
"0.65646726",
"0.65505314",
"0.648916",
"0.64821005",
"0.64557076",
"0.6445557",
"0.64454246",
"0.64252615",
"0.6409186",
"0.63423884",
"0.6334... | 0.7134993 | 2 |
Create a variable if it doesn't exist already; return it. | def variable_factory(p, variable_name):
if isinstance(variable_name, (Variable,)):
return variable_name
if not hasattr(p, "variable_mapping"):
setattr(p, "variable_mapping", {})
if variable_name not in p.variable_mapping:
p.variable_mapping[variable_name] = Variable(variable_name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_or_create_variable(self, cname, vname, source):\n try:\n var = self.model.get_variable_by_name(cname, source.name)\n raise KeyError()\n except KeyError:\n # Have we created it already?\n try:\n var = self.model.get_variable_by_name(... | [
"0.7405319",
"0.7198957",
"0.677572",
"0.6721281",
"0.66304034",
"0.66304034",
"0.6441056",
"0.63857085",
"0.5992805",
"0.5972275",
"0.5970095",
"0.5944313",
"0.58870316",
"0.582383",
"0.58100283",
"0.5801647",
"0.5790645",
"0.5696527",
"0.5691466",
"0.56826055",
"0.5657005",... | 0.6243935 | 8 |
Reminds you after x time member A member of the discord time Time to mute for (almost any imaginable format!) reminder dafuq did you want it for? | async def remindme(self, ctx, time=None, *, reminder=None):
time = await timeconv.ConvertStrToTime().convert(ctx, time)
if not time:
return await ctx.send(f'{ctx.author.mention}, you are missing the time!')
if not reminder:
return await ctx.send(f'{ctx.author.mention}, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _mute(ctx, user:discord.Member, time: str, self: bool):\n if user.id in PI_BOT_IDS:\n return await ctx.send(\"Hey! You can't mute me!!\")\n if time == None:\n return await ctx.send(\"You need to specify a length that this used will be muted. Examples are: `1 day`, `2 months, 1 day`, o... | [
"0.71049327",
"0.69922125",
"0.68818855",
"0.67592996",
"0.6740676",
"0.67238295",
"0.668691",
"0.65372914",
"0.64407426",
"0.64136213",
"0.6409261",
"0.6371238",
"0.6370325",
"0.6364335",
"0.63280314",
"0.63156104",
"0.62742805",
"0.62406534",
"0.6238303",
"0.6201361",
"0.61... | 0.6916316 | 2 |
Users should be able to to GET requests on resource and item. Not signups! There, users can only see their own items > extra test This implies that admins can read, too, since every admin is a user. | def test_user_can_read(app, resource):
with app.user():
# Read resource
app.client.get('/' + resource, assert_status=200)
# Create fake item and read item
_id = app.data.driver.db[resource].insert({})
app.client.get('/%s/%s' % (resource, _id),
assert_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_reusableitem_api_not_public(self):\n\n # user not logged in\n self.client.logout()\n\n response = self.client.get(get_reusable_item_1_url(self))\n\n self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)\n\n # user logged in and created the Reusable Item\n... | [
"0.72341436",
"0.71753263",
"0.7144415",
"0.69632274",
"0.6889358",
"0.68661827",
"0.68348813",
"0.67942256",
"0.67779",
"0.6775143",
"0.6768036",
"0.6757693",
"0.6718709",
"0.6653621",
"0.6622761",
"0.6618626",
"0.6595305",
"0.65757334",
"0.65757334",
"0.65734977",
"0.652574... | 0.7629331 | 0 |
Sets the severity_name of this VulnerabilityTypeDetail. | def severity_name(self, severity_name):
self._severity_name = severity_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def severity(self, severity):\n self._severity = severity",
"def severity(self, severity):\n\n self._severity = severity",
"def severity(self, severity):\n if severity is None:\n raise ValueError(\"Invalid value for `severity`, must not be `None`\") # noqa: E501\n\n self... | [
"0.6627802",
"0.6603893",
"0.6286966",
"0.62756854",
"0.60338753",
"0.545331",
"0.545331",
"0.545331",
"0.54375684",
"0.54264426",
"0.53058726",
"0.51848155",
"0.5165568",
"0.5165568",
"0.5165568",
"0.5090765",
"0.5071596",
"0.4962261",
"0.49573085",
"0.49554968",
"0.49554968... | 0.8458807 | 0 |
Sets the package_type of this VulnerabilityTypeDetail. | def package_type(self, package_type):
self._package_type = package_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_type(self, package_type):\n allowed_values = [\"ORCHESTRATION\", \"IMAGE\"]\n if not value_allowed_none_or_none_sentinel(package_type, allowed_values):\n package_type = 'UNKNOWN_ENUM_VALUE'\n self._package_type = package_type",
"def package_type(self):\n return ... | [
"0.72956806",
"0.6604801",
"0.6604801",
"0.6426638",
"0.6421302",
"0.6421302",
"0.63818926",
"0.6318409",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0.62530977",
"0... | 0.8679008 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, VulnerabilityTypeDetail):
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.8089139",
"0.8089139",
"0.8054507",
"0.79827213",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
... | 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 |
Returns an attribute attr of a task taking into account possible proxies such as owned by | def get_proxy_attribute(task, attr, proxy=True, super_cls=Task):
if proxy:
# priority to workflow proxy forwarding, fallback to sandbox proxy or super class
if attr in _forward_workflow_attributes and isinstance(task, BaseWorkflow) \
and task.is_workflow():
return getattr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getattribute__(self, name):\n if name in ('__setattr__', '__getattr__', '__delattr__', '_loop', '__curtask__'):\n return object.__getattribute__(self, name)\n return getattr(self.__curtask__, name)",
"def __getattribute__(self, name):\n if name in ('__setattr__', '__getattr_... | [
"0.6937631",
"0.62366927",
"0.62300587",
"0.60403097",
"0.59629965",
"0.5917633",
"0.5817205",
"0.5772106",
"0.5733307",
"0.57260907",
"0.57260907",
"0.57260907",
"0.57260907",
"0.57260907",
"0.5703484",
"0.5650922",
"0.56441194",
"0.5639871",
"0.56181556",
"0.5581591",
"0.55... | 0.65437084 | 1 |
Tokenize the passage text into a list of sentences | def _sent_tokenize_passages(self, passage_path):
passage_lines = open(passage_path, 'r').readlines()
passages = {}
for line in tqdm(passage_lines):
json_line = json.loads(line)
passages[json_line['id']] = sent_tok(json_line['body'])
return passages | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]",
"def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]",
"def split_sentences(text: str) -> List[str]:\n return sent_tokenize(text)",
"def spl... | [
"0.7991031",
"0.7991031",
"0.798315",
"0.79180133",
"0.79144484",
"0.7880104",
"0.7846164",
"0.7753897",
"0.77275205",
"0.7643609",
"0.76269495",
"0.7577545",
"0.7466577",
"0.74406254",
"0.73483175",
"0.73348135",
"0.7318262",
"0.73128253",
"0.73059857",
"0.7287041",
"0.72860... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.