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 |
|---|---|---|---|---|---|---|
Sets max sentence length to process, by default 128. | def setMaxSentenceLength(self, value):
return self._set(maxSentenceLength=value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMaxSentenceLength(self, maxSentenceLength):\n return self._set(maxSentenceLength=maxSentenceLength)",
"def setMaxSentenceLength(self, maxSentenceLength):\n return self._set(maxSentenceLength=maxSentenceLength)",
"def setMaxSentenceSize(self, value):\n return self._set(maxSentenceSiz... | [
"0.8123694",
"0.8123694",
"0.8111426",
"0.7868658",
"0.6736564",
"0.66611046",
"0.66611046",
"0.66611046",
"0.65857756",
"0.6577836",
"0.6577836",
"0.6577836",
"0.6577836",
"0.6531549",
"0.6494815",
"0.6442197",
"0.64406",
"0.6436367",
"0.6324801",
"0.6312985",
"0.6308857",
... | 0.81601447 | 8 |
Returns labels used to train this model | def getClasses(self):
return self._call_java("getClasses") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_labels(self):\n return self._train_labels",
"def get_train_labels(self):\n raise NotImplementedError",
"def get_labels(self):\n return self.labels",
"def get_labels(model):\n return model._labels",
"def get_labels(model):\n return model._labels",
"def get_labe... | [
"0.87055945",
"0.8630082",
"0.7926736",
"0.7918763",
"0.7918763",
"0.7918763",
"0.7918763",
"0.7868222",
"0.7861747",
"0.7804594",
"0.77882135",
"0.7786394",
"0.7762736",
"0.7738323",
"0.7738323",
"0.7738323",
"0.7738323",
"0.7738323",
"0.7738323",
"0.7678056",
"0.7666861",
... | 0.0 | -1 |
Sets configProto from tensorflow, serialized into byte array. | def setConfigProtoBytes(self, b):
return self._set(configProtoBytes=b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setConfigProtoBytes(self, v):\n return self._set(configProtoBytes=v)",
"def make_config_proto(c):\n # tensorflow config\n use_gpu = os.environ.get('use_gpu', c.get('tf.config.use_gpu', c.get('use_gpu', 1)))\n cfg = tf.ConfigProto(device_count={'GPU': use_gpu})\n\n # scan config for tf conf... | [
"0.75618696",
"0.6219305",
"0.6167628",
"0.59814763",
"0.59055257",
"0.5844697",
"0.5599306",
"0.55863786",
"0.5412146",
"0.53233427",
"0.5217989",
"0.52129155",
"0.51678354",
"0.51494646",
"0.50938296",
"0.5053427",
"0.50138324",
"0.49860623",
"0.4972503",
"0.49635026",
"0.4... | 0.7518328 | 17 |
Sets max sentence length to process, by default 128. | def setMaxSentenceLength(self, value):
return self._set(maxSentenceLength=value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMaxSentenceLength(self, maxSentenceLength):\n return self._set(maxSentenceLength=maxSentenceLength)",
"def setMaxSentenceLength(self, maxSentenceLength):\n return self._set(maxSentenceLength=maxSentenceLength)",
"def setMaxSentenceSize(self, value):\n return self._set(maxSentenceSiz... | [
"0.8123694",
"0.8123694",
"0.8111426",
"0.7868658",
"0.6736564",
"0.66611046",
"0.66611046",
"0.66611046",
"0.65857756",
"0.6577836",
"0.6577836",
"0.6577836",
"0.6577836",
"0.6531549",
"0.6494815",
"0.6442197",
"0.64406",
"0.6436367",
"0.6324801",
"0.6312985",
"0.6308857",
... | 0.81601447 | 4 |
Returns labels used to train this model | def getClasses(self):
return self._call_java("getClasses") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_labels(self):\n return self._train_labels",
"def get_train_labels(self):\n raise NotImplementedError",
"def get_labels(self):\n return self.labels",
"def get_labels(model):\n return model._labels",
"def get_labels(model):\n return model._labels",
"def get_labe... | [
"0.87055945",
"0.8630082",
"0.7926736",
"0.7918763",
"0.7918763",
"0.7918763",
"0.7918763",
"0.7868222",
"0.7861747",
"0.7804594",
"0.77882135",
"0.7786394",
"0.7762736",
"0.7738323",
"0.7738323",
"0.7738323",
"0.7738323",
"0.7738323",
"0.7738323",
"0.7678056",
"0.7666861",
... | 0.0 | -1 |
Sets configProto from tensorflow, serialized into byte array. | def setConfigProtoBytes(self, b):
return self._set(configProtoBytes=b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setConfigProtoBytes(self, v):\n return self._set(configProtoBytes=v)",
"def make_config_proto(c):\n # tensorflow config\n use_gpu = os.environ.get('use_gpu', c.get('tf.config.use_gpu', c.get('use_gpu', 1)))\n cfg = tf.ConfigProto(device_count={'GPU': use_gpu})\n\n # scan config for tf conf... | [
"0.75618696",
"0.6219305",
"0.6167628",
"0.59814763",
"0.59055257",
"0.5844697",
"0.5599306",
"0.55863786",
"0.5412146",
"0.53233427",
"0.5217989",
"0.52129155",
"0.51678354",
"0.51494646",
"0.50938296",
"0.5053427",
"0.50138324",
"0.49860623",
"0.4972503",
"0.49635026",
"0.4... | 0.7518328 | 14 |
Sets max sentence length to process, by default 128. | def setMaxSentenceLength(self, value):
return self._set(maxSentenceLength=value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMaxSentenceLength(self, maxSentenceLength):\n return self._set(maxSentenceLength=maxSentenceLength)",
"def setMaxSentenceLength(self, maxSentenceLength):\n return self._set(maxSentenceLength=maxSentenceLength)",
"def setMaxSentenceSize(self, value):\n return self._set(maxSentenceSiz... | [
"0.8123694",
"0.8123694",
"0.8111426",
"0.7868658",
"0.6736564",
"0.66611046",
"0.66611046",
"0.66611046",
"0.65857756",
"0.6577836",
"0.6577836",
"0.6577836",
"0.6577836",
"0.6531549",
"0.6494815",
"0.6442197",
"0.64406",
"0.6436367",
"0.6324801",
"0.6312985",
"0.6308857",
... | 0.81601447 | 5 |
Sets configProto from tensorflow, serialized into byte array. | def setConfigProtoBytes(self, b):
return self._set(configProtoBytes=b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setConfigProtoBytes(self, v):\n return self._set(configProtoBytes=v)",
"def make_config_proto(c):\n # tensorflow config\n use_gpu = os.environ.get('use_gpu', c.get('tf.config.use_gpu', c.get('use_gpu', 1)))\n cfg = tf.ConfigProto(device_count={'GPU': use_gpu})\n\n # scan config for tf conf... | [
"0.75618696",
"0.6219305",
"0.6167628",
"0.59814763",
"0.59055257",
"0.5844697",
"0.5599306",
"0.55863786",
"0.5412146",
"0.53233427",
"0.5217989",
"0.52129155",
"0.51678354",
"0.51494646",
"0.50938296",
"0.5053427",
"0.50138324",
"0.49860623",
"0.4972503",
"0.49635026",
"0.4... | 0.7518328 | 13 |
Sets minimum length of the sequence to be generated. | def setMinOutputLength(self, value):
return self._set(minOutputLength=value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMinLength(self, value):\n return self._set(minLength=value)",
"def setMinLength(self, value):\n return self._set(minLength=value)",
"def setMinLength(self, value):\n return self._set(minLength=value)",
"def setMinLength(self, value):\n return self._set(minLength=value)",
... | [
"0.72301304",
"0.72301304",
"0.72301304",
"0.72301304",
"0.7109453",
"0.7083925",
"0.67660934",
"0.66888845",
"0.6635175",
"0.6566798",
"0.6498164",
"0.64897525",
"0.64824986",
"0.6419169",
"0.6393876",
"0.63645357",
"0.63483065",
"0.6234562",
"0.6214494",
"0.62058073",
"0.61... | 0.70598656 | 6 |
Sets maximum length of output text. | def setMaxOutputLength(self, value):
return self._set(maxOutputLength=value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_max_sentence_length(self):\n new_max = int(self.set_max_sentence.get())\n cur_min = self.min_sentence_length\n\n if new_max > cur_min:\n self.max_sentence_length = new_max\n else:\n old_max = self.max_sentence_length\n old_max_var = tk.StringVar(... | [
"0.76438797",
"0.7224288",
"0.7224288",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
"0.7106958",
... | 0.8116591 | 0 |
Sets size of ngrams that can only occur once. If set to int > 0, all ngrams of that size can only occur once. | def setNoRepeatNgramSize(self, value):
return self._set(noRepeatNgramSize=value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sized_ngrams(self, size):\n return self.__sized_ngrams(size, ())",
"def sized_ngrams(self, size):\n return self.root.sized_ngrams(size)",
"def sized_ngrams_with_ele(self, target, size):\n return self.__sized_ngrams_with_ele(target, size, (), False)",
"def sized_ngrams_with_ele(self, ... | [
"0.6985705",
"0.6568407",
"0.6108986",
"0.6051465",
"0.60421574",
"0.60348934",
"0.59227365",
"0.5921151",
"0.5893946",
"0.5817044",
"0.58017254",
"0.5752732",
"0.56904835",
"0.5687905",
"0.5618103",
"0.5603635",
"0.5585382",
"0.55335814",
"0.55265516",
"0.55059046",
"0.54672... | 0.7424706 | 1 |
Sets minCount, the minimum number of times a token must appear | def setMinCount(self, minCount):
return self._set(minCount=minCount) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMinCount(self, count):\n return self._set(minCount=count)",
"def min_count(request) -> int:\n return request.param",
"def compute_optimal_token_minimum(token_counts) -> int:\n q1, q3 = compute_quartiles(token_counts)\n iqr = q3 - q1\n low_threshold = q1 - 1.5 * iqr\n return low_thres... | [
"0.6783607",
"0.62797415",
"0.6237415",
"0.62136716",
"0.61635566",
"0.61593914",
"0.59757274",
"0.59580743",
"0.5875767",
"0.580098",
"0.57416725",
"0.57416725",
"0.57416725",
"0.57416725",
"0.5740358",
"0.5729719",
"0.5729719",
"0.5705471",
"0.55790925",
"0.55095774",
"0.54... | 0.6640353 | 2 |
Generate a random string of fixed length | def randomString(stringLength):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",... | [
"0.8680464",
"0.8573714",
"0.85486245",
"0.85297275",
"0.85209286",
"0.84331024",
"0.8432044",
"0.84157014",
"0.84120053",
"0.8389201",
"0.8345882",
"0.8343962",
"0.83406156",
"0.83348686",
"0.83240855",
"0.82986933",
"0.82911193",
"0.8281826",
"0.82818025",
"0.82811046",
"0.... | 0.77845794 | 81 |
Return True if black queenside castling is possible. | def black_queenside_castling(self):
return (self.castling[3] and self.empty((1, 5)) and self.empty((1, 4))
and self.empty((1, 3)) and not self.attacked((1, 6), WHITE)
and not self.attacked((1, 5), WHITE)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def white_queenside_castling(self):\n return (self.castling[1] and self.empty((10, 5))\n and self.empty((10, 4)) and self.empty((10, 3)) and not\n self.attacked((10, 6), BLACK) and not\n self.attacked((10, 5), BLACK))",
"def black_kingside_castling(self):\n ... | [
"0.83101803",
"0.77009773",
"0.74148107",
"0.67016625",
"0.65503335",
"0.64945275",
"0.6435833",
"0.63789505",
"0.637187",
"0.6359089",
"0.63321126",
"0.6315693",
"0.6315693",
"0.62765574",
"0.62568295",
"0.62568295",
"0.6239617",
"0.6239568",
"0.62322485",
"0.62117445",
"0.6... | 0.85604614 | 0 |
Return True if white queenside castling is possible. | def white_queenside_castling(self):
return (self.castling[1] and self.empty((10, 5))
and self.empty((10, 4)) and self.empty((10, 3)) and not
self.attacked((10, 6), BLACK) and not
self.attacked((10, 5), BLACK)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def black_queenside_castling(self):\n return (self.castling[3] and self.empty((1, 5)) and self.empty((1, 4))\n and self.empty((1, 3)) and not self.attacked((1, 6), WHITE)\n and not self.attacked((1, 5), WHITE))",
"def white_kingside_castling(self):\n return (self.castl... | [
"0.80126375",
"0.7700376",
"0.72132164",
"0.6421028",
"0.64169383",
"0.6371821",
"0.6339281",
"0.6263046",
"0.61829054",
"0.6178676",
"0.6165536",
"0.6156113",
"0.60818976",
"0.60658884",
"0.6058627",
"0.60505724",
"0.6045022",
"0.59987706",
"0.5991831",
"0.5969223",
"0.59611... | 0.85905784 | 0 |
Validates a user supplied user/password against an expected value. The expected value is pulled from the pecan config. Note that this value is currently stored in the clear inside that config, so we are assuming that the config is protected using file perms, etc. This function provides some resistance to timing attacks... | def login(ra_name, user, secret):
auth_conf = jsonloader.authentication_for_registration_authority(ra_name)
# convert input to strings
user = str(user)
secret = str(secret)
# expected values
try:
expected_user = str(auth_conf['user'])
expected_secret = str(auth_conf['secret'])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_password(self):\n pass_field = Field(\"\".join(['x' * (int(self.app.config['MAX_PWD_LEN']))]))\n\n valid_password(None, pass_field)",
"def validate_password(value):\n try:\n if value != \"MAGIC\":\n raise ValueError\n except ValueError:\n print(\"Invali... | [
"0.7043161",
"0.6544148",
"0.65102386",
"0.6411977",
"0.6404492",
"0.6382731",
"0.6366867",
"0.6326085",
"0.63080263",
"0.63012165",
"0.6243862",
"0.6222437",
"0.61866766",
"0.617138",
"0.6154424",
"0.61416",
"0.6116124",
"0.6109381",
"0.60262346",
"0.60168034",
"0.5993314",
... | 0.0 | -1 |
The region in which to obtain the V2 networking client. A networking client is needed to create a port. If omitted, the `region` argument of the provider is used. Changing this creates a new security group rule. | def region(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_group_region(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_region(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def copy_to_region(self, region, name=None):\r\n if region.n... | [
"0.6253612",
"0.62256604",
"0.5930105",
"0.5894251",
"0.5871557",
"0.5748033",
"0.56574655",
"0.56574655",
"0.56574655",
"0.55082476",
"0.55082476",
"0.55082476",
"0.55082476",
"0.54801226",
"0.5458828",
"0.5430784",
"0.5430784",
"0.5428809",
"0.54139805",
"0.5404902",
"0.535... | 0.53173506 | 38 |
The remote group id, the value needs to be an Openstack ID of a security group in the same tenant. Changing this creates a new security group rule. | def remote_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "remote_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"remote_group_id\")",
"def firewall_rule_group_id(self) -> str:\n return pulumi.get(self, \"firewall_rule_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"security_group_... | [
"0.7037488",
"0.6704285",
"0.64277655",
"0.64277655",
"0.632804",
"0.62633216",
"0.62633216",
"0.61667365",
"0.61667365",
"0.61480385",
"0.61480385",
"0.61473036",
"0.61473036",
"0.61473036",
"0.61473036",
"0.61473036",
"0.6092511",
"0.6031948",
"0.6014576",
"0.59850115",
"0.... | 0.73068684 | 1 |
The owner of the security group. Required if admin wants to create a port for another tenant. Changing this creates a new security group rule. | def tenant_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "tenant_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def security_group(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"security_group\")",
"def get_owner(self):\n owner = gdef.PSID()\n lpbOwnerDefaulted = gdef.BOOL()\n winproxy.GetSecurityDescriptorOwner(self, owner, lpbOwnerDefaulted)\n # Return None of owner ... | [
"0.5959408",
"0.5938503",
"0.5848064",
"0.57682604",
"0.5753326",
"0.57493156",
"0.5740296",
"0.5740296",
"0.5705388",
"0.5705388",
"0.5703526",
"0.5691906",
"0.5690987",
"0.5690749",
"0.5679757",
"0.5641907",
"0.5637258",
"0.56258476",
"0.5614194",
"0.55692315",
"0.5568234",... | 0.0 | -1 |
The region in which to obtain the V2 networking client. A networking client is needed to create a port. If omitted, the `region` argument of the provider is used. Changing this creates a new security group rule. | def region(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_group_region(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_region(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def copy_to_region(self, region, name=None):\r\n if region.n... | [
"0.6253612",
"0.62256604",
"0.5930105",
"0.5894251",
"0.5871557",
"0.5748033",
"0.56574655",
"0.56574655",
"0.56574655",
"0.55082476",
"0.55082476",
"0.55082476",
"0.55082476",
"0.54801226",
"0.5458828",
"0.5430784",
"0.5430784",
"0.5428809",
"0.54139805",
"0.5404902",
"0.535... | 0.53173506 | 37 |
The remote group id, the value needs to be an Openstack ID of a security group in the same tenant. Changing this creates a new security group rule. | def remote_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "remote_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"remote_group_id\")",
"def firewall_rule_group_id(self) -> str:\n return pulumi.get(self, \"firewall_rule_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"security_group_... | [
"0.7037488",
"0.6704285",
"0.64277655",
"0.64277655",
"0.632804",
"0.62633216",
"0.62633216",
"0.61667365",
"0.61667365",
"0.61480385",
"0.61480385",
"0.61473036",
"0.61473036",
"0.61473036",
"0.61473036",
"0.61473036",
"0.6092511",
"0.6031948",
"0.6014576",
"0.59850115",
"0.... | 0.73068684 | 0 |
The owner of the security group. Required if admin wants to create a port for another tenant. Changing this creates a new security group rule. | def tenant_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "tenant_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def security_group(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"security_group\")",
"def get_owner(self):\n owner = gdef.PSID()\n lpbOwnerDefaulted = gdef.BOOL()\n winproxy.GetSecurityDescriptorOwner(self, owner, lpbOwnerDefaulted)\n # Return None of owner ... | [
"0.5959408",
"0.5938503",
"0.5848064",
"0.57682604",
"0.5753326",
"0.57493156",
"0.5740296",
"0.5740296",
"0.5705388",
"0.5705388",
"0.5703526",
"0.5691906",
"0.5690987",
"0.5690749",
"0.5679757",
"0.5641907",
"0.5637258",
"0.56258476",
"0.5614194",
"0.55692315",
"0.5568234",... | 0.0 | -1 |
The region in which to obtain the V2 networking client. A networking client is needed to create a port. If omitted, the `region` argument of the provider is used. Changing this creates a new security group rule. | def region(self) -> pulumi.Output[str]:
return pulumi.get(self, "region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_group_region(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_region(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def copy_to_region(self, region, name=None):\r\n if region.n... | [
"0.6253612",
"0.62256604",
"0.5930105",
"0.5894251",
"0.5871557",
"0.5748033",
"0.56574655",
"0.56574655",
"0.56574655",
"0.55082476",
"0.55082476",
"0.55082476",
"0.55082476",
"0.54801226",
"0.5458828",
"0.5430784",
"0.5430784",
"0.5428809",
"0.54139805",
"0.5404902",
"0.535... | 0.48939896 | 73 |
The remote group id, the value needs to be an Openstack ID of a security group in the same tenant. Changing this creates a new security group rule. | def remote_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "remote_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"remote_group_id\")",
"def remote_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"remote_group_id\")",
"def firewall_rule_group_id(self) -> str:\n return pulumi.get(self, \"firew... | [
"0.73068684",
"0.73068684",
"0.6704285",
"0.64277655",
"0.64277655",
"0.632804",
"0.62633216",
"0.62633216",
"0.61667365",
"0.61667365",
"0.61480385",
"0.61480385",
"0.61473036",
"0.61473036",
"0.61473036",
"0.61473036",
"0.61473036",
"0.6092511",
"0.6031948",
"0.6014576",
"0... | 0.7037488 | 2 |
The owner of the security group. Required if admin wants to create a port for another tenant. Changing this creates a new security group rule. | def tenant_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "tenant_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def security_group(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"security_group\")",
"def get_owner(self):\n owner = gdef.PSID()\n lpbOwnerDefaulted = gdef.BOOL()\n winproxy.GetSecurityDescriptorOwner(self, owner, lpbOwnerDefaulted)\n # Return None of owner ... | [
"0.5959408",
"0.5938503",
"0.5848064",
"0.57682604",
"0.5753326",
"0.57493156",
"0.5740296",
"0.5740296",
"0.5705388",
"0.5705388",
"0.5703526",
"0.5691906",
"0.5690987",
"0.5690749",
"0.5679757",
"0.5641907",
"0.5637258",
"0.56258476",
"0.5614194",
"0.55692315",
"0.5568234",... | 0.0 | -1 |
Gets a list of category ids for a video that have no children in the ontology; i.e. can't get more specific | def get_specific_categories_for_video(self, video_id):
clip = self.id_to_index[video_id]
return [label for label in clip.labels if self.ontology.is_specific(label)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_general_categories_for_video(self, video_id):\n clip = self.id_to_index[video_id]\n return set([self.ontology.get_most_general_id(label) for label in clip.labels])",
"def video_categories(self):\r\n return v3.VideoCategories(self)",
"def categories(self):\n game_categories =... | [
"0.7004463",
"0.65768874",
"0.6227395",
"0.6111393",
"0.59822625",
"0.5834533",
"0.5797031",
"0.57957774",
"0.57686126",
"0.567614",
"0.5646111",
"0.5623014",
"0.56133676",
"0.5595228",
"0.5580349",
"0.5578556",
"0.5577779",
"0.5571781",
"0.55702764",
"0.55401844",
"0.5538675... | 0.69159013 | 1 |
Checks n divisibilty by list of primes in order from sqrt(n) to 2 | def prime_division(n):
primes = primes1(int(math.sqrt(n)))
for prime in reversed(primes):
if n % prime == 0:
print((prime, int(n/prime)))
return (prime, int(n/prime)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n sqrtN=n**0.5\n odds=[2]\n odds+=[i for i in range(3,n) if i%2>0]\n\n for i in odds:\n if i!=0 and i<=sqrtN:\n for j in odds[odds.index(i)+1:]:\n if j%i==0:\n odds[odds.index(j)]=0\n return [i for i in odds if i!=0]",
"def primes_... | [
"0.80932647",
"0.7945425",
"0.76445866",
"0.7643058",
"0.76336575",
"0.7608331",
"0.76075315",
"0.76075315",
"0.75579804",
"0.75465214",
"0.7535267",
"0.7535267",
"0.7529621",
"0.7497231",
"0.74817014",
"0.74211955",
"0.7403951",
"0.74010444",
"0.7376252",
"0.73723155",
"0.73... | 0.70389426 | 73 |
(str of len == 1) > str >>> es_parentesis('(') 'Es parentesis' >>> es_parentesis('x') 'No es parentesis' >>> es_parentesis('xa') | def es_parentesis(caracter):
if len(caracter) != 1:
raise TypeError(str(caracter) + ' no es un parentesis')
elif caracter in '()': # caracter == '(' or caracter == ')':
return 'Es parentesis'
return 'No es parentesis' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parentheses_expr(self):\n self.assertEqual(\"(a(b(c(d))))\", grammar._PARENTHESES_EXPR.parseString(\"(a(b(c(d))))\")[0])",
"def proper_parenthetics(string):\n if isinstance(string, str):\n paren_q = Q()\n for i in range(len(string)):\n paren_q.enqueue(string[i])\n ... | [
"0.632658",
"0.6073909",
"0.5815935",
"0.56020725",
"0.5553137",
"0.55361795",
"0.5533204",
"0.54078084",
"0.53930235",
"0.5374939",
"0.5370021",
"0.5367285",
"0.5284919",
"0.5257389",
"0.52384233",
"0.52077246",
"0.5193712",
"0.5137738",
"0.5133004",
"0.5118097",
"0.51039195... | 0.8064885 | 0 |
Test case for get_recipe_information_bulk | def test_get_recipe_information_bulk(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_recipe_information(self):\n pass",
"def test_retrieve_recipes(self):\n sample_recipe(name=\"Avocado toast\")\n sample_recipe(name='Baklava')\n\n res = self.client.get(RECIPES_URL)\n\n recipes = Recipe.objects.all()\n serializer = RecipeSerializer(recipes, ma... | [
"0.8050659",
"0.681849",
"0.6799144",
"0.6774251",
"0.6750939",
"0.67397535",
"0.66411275",
"0.6631762",
"0.661585",
"0.6594499",
"0.6573442",
"0.65352833",
"0.63587373",
"0.6339223",
"0.6236998",
"0.62282294",
"0.6214923",
"0.61857843",
"0.6184369",
"0.61723846",
"0.61270577... | 0.94528073 | 0 |
Test case for get_recipe_ingredients_by_id | def test_get_recipe_ingredients_by_id(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visualize_recipe_ingredients_by_id(self):\n pass",
"def test_ingredients_by_id_image(self):\n pass",
"def test_search_recipes_by_ingredients(self):\n pass",
"def test_search_by_ingredients(self):\n recipe_id = self.request_mgr.search_by_ingredients(['butter', 'sugar', 'eg... | [
"0.8464364",
"0.7724831",
"0.76722383",
"0.7670152",
"0.7563322",
"0.75030804",
"0.74472886",
"0.7415406",
"0.73326224",
"0.72545785",
"0.72139615",
"0.720817",
"0.7184504",
"0.7162655",
"0.71452814",
"0.7134799",
"0.7118266",
"0.71159816",
"0.709469",
"0.70659935",
"0.706338... | 0.9481151 | 0 |
Test case for ingredients_by_id_image | def test_ingredients_by_id_image(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_recipe_nutrition_by_id_image(self):\n pass",
"def test_get_recipe_ingredients_by_id(self):\n pass",
"def test_visualize_recipe_ingredients_by_id(self):\n pass",
"def test_recipe_taste_by_id_image(self):\n pass",
"def test_equipment_by_id_image(self):\n pass",
"... | [
"0.83131963",
"0.7963843",
"0.7871874",
"0.7844485",
"0.747281",
"0.6946853",
"0.6813706",
"0.6651271",
"0.6651106",
"0.65670604",
"0.6483167",
"0.6436493",
"0.6425422",
"0.64163995",
"0.6415803",
"0.6330197",
"0.6325412",
"0.63211036",
"0.62472916",
"0.6220362",
"0.6220142",... | 0.9327548 | 0 |
Test case for price_breakdown_by_id_image | def test_price_breakdown_by_id_image(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visualize_recipe_price_breakdown_by_id(self):\n pass",
"def test_get_recipe_price_breakdown_by_id(self):\n pass",
"def test_ingredients_by_id_image(self):\n pass",
"def test_recipe_nutrition_by_id_image(self):\n pass",
"def test_recipe_taste_by_id_image(self):\n ... | [
"0.790877",
"0.7769054",
"0.69967914",
"0.66699874",
"0.6634333",
"0.6550664",
"0.65429276",
"0.5643303",
"0.562136",
"0.5534283",
"0.5506268",
"0.5488159",
"0.53689885",
"0.5302205",
"0.5224743",
"0.5212492",
"0.5196289",
"0.51961845",
"0.51932126",
"0.5146528",
"0.5128548",... | 0.9498864 | 0 |
Test case for recipe_nutrition_by_id_image | def test_recipe_nutrition_by_id_image(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visualize_recipe_nutrition_by_id(self):\n pass",
"def test_ingredients_by_id_image(self):\n pass",
"def test_recipe_taste_by_id_image(self):\n pass",
"def test_recipe_nutrition_label_image(self):\n pass",
"def test_equipment_by_id_image(self):\n pass",
"def tes... | [
"0.8161094",
"0.8152423",
"0.77994984",
"0.76379424",
"0.7226741",
"0.7152037",
"0.70098674",
"0.6949961",
"0.6882642",
"0.6668931",
"0.6511413",
"0.6380939",
"0.62400794",
"0.62331855",
"0.6116831",
"0.6094102",
"0.60878384",
"0.608587",
"0.60849833",
"0.6075021",
"0.6040745... | 0.9496631 | 0 |
Test case for search_recipes_by_ingredients | def test_search_recipes_by_ingredients(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_by_ingredients(self):\n recipe_id = self.request_mgr.search_by_ingredients(['butter', 'sugar', 'eggs'])\n self.assertGreater(recipe_id, 0)",
"def test_search_recipes(self):\n pass",
"def test_search_recipes_by_nutrients(self):\n pass",
"def test_get_recipe_ingredie... | [
"0.8786852",
"0.8459064",
"0.841401",
"0.795318",
"0.783171",
"0.7800368",
"0.76856315",
"0.76380724",
"0.76105547",
"0.758803",
"0.7553738",
"0.7444155",
"0.7423693",
"0.74207085",
"0.73035145",
"0.7295499",
"0.726909",
"0.71299917",
"0.7101924",
"0.7041485",
"0.68218315",
... | 0.94295865 | 0 |
Test case for visualize_recipe_ingredients_by_id | def test_visualize_recipe_ingredients_by_id(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visualize_recipe_nutrition_by_id(self):\n pass",
"def test_visualize_recipe_equipment_by_id(self):\n pass",
"def test_get_recipe_ingredients_by_id(self):\n pass",
"def test_visualize_recipe_taste_by_id(self):\n pass",
"def test_visualize_recipe_price_breakdown_by_id(sel... | [
"0.85043824",
"0.78925407",
"0.7839842",
"0.7727733",
"0.75544155",
"0.753724",
"0.7308781",
"0.7119187",
"0.7017145",
"0.6899681",
"0.6874153",
"0.6585506",
"0.64351463",
"0.6430402",
"0.64200425",
"0.63494223",
"0.6345735",
"0.63339305",
"0.63257456",
"0.6324464",
"0.630863... | 0.9474554 | 0 |
Test case for visualize_recipe_price_breakdown_by_id | def test_visualize_recipe_price_breakdown_by_id(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_recipe_price_breakdown_by_id(self):\n pass",
"def test_visualize_price_breakdown(self):\n pass",
"def test_price_breakdown_by_id_image(self):\n pass",
"def test_visualize_recipe_ingredients_by_id(self):\n pass",
"def test_visualize_recipe_nutrition_by_id(self):\n ... | [
"0.85518444",
"0.78767306",
"0.7794116",
"0.7125773",
"0.70123255",
"0.6844156",
"0.670238",
"0.6104603",
"0.60088545",
"0.597805",
"0.5965709",
"0.5655137",
"0.5636527",
"0.56146675",
"0.54980856",
"0.5405772",
"0.53551203",
"0.52215666",
"0.5200816",
"0.51856995",
"0.516216... | 0.9446565 | 0 |
Return the nearest element in an array of a specified value | def find_nearest(value,array):
idx = numpy.abs(value-array).argmin()
return idx,array[idx] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_nearest(array, value):\n idx = (np.abs(array - value)).argmin()\n return array[idx]",
"def find_nearest(array, value):\n idx = (np.abs(array-value)).argmin()\n return array[idx]",
"def find_nearest(array, value):\n idx = (np.abs(array-value)).argmin()\n return array[idx]",
"def fin... | [
"0.8537651",
"0.85200596",
"0.85200596",
"0.85042024",
"0.84876245",
"0.84759045",
"0.84332836",
"0.8314874",
"0.8314874",
"0.8229347",
"0.813822",
"0.8094796",
"0.80836946",
"0.8033519",
"0.8008941",
"0.7997906",
"0.7965616",
"0.79523057",
"0.7893887",
"0.77991295",
"0.77847... | 0.8324205 | 7 |
Gets the dentist_id of this InlineResponse200. | def dentist_id(self) -> float:
return self._dentist_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_id(self):\n return self._entity_id",
"def entity_id(self):\n return self._entity_id",
"def entity_id(self):\n return self._entity_id",
"def entity_id(self):\n return self._entity_id",
"def entity_id(self):\n return self._entity_id",
"def id(self):\n re... | [
"0.5872222",
"0.5872222",
"0.5872222",
"0.5872222",
"0.5872222",
"0.5779776",
"0.5675966",
"0.56217736",
"0.56083316",
"0.55632997",
"0.5526933",
"0.5514718",
"0.5514718",
"0.5514718",
"0.5514718",
"0.5514718",
"0.5514718",
"0.5514718",
"0.5514718",
"0.5514718",
"0.5514718",
... | 0.7013903 | 0 |
Sets the dentist_id of this InlineResponse200. | def dentist_id(self, dentist_id: float):
self._dentist_id = dentist_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dentist_id(self) -> float:\n return self._dentist_id",
"def entity_id(self, entity_id):\n\n self._entity_id = entity_id",
"def entity_id(self, entity_id: str):\n\n self._entity_id = entity_id",
"def entity_id(self, entity_id):\n if entity_id is None:\n raise ValueEr... | [
"0.59998006",
"0.589406",
"0.5866896",
"0.56663823",
"0.5584895",
"0.54668474",
"0.5451177",
"0.53824914",
"0.5376786",
"0.5336933",
"0.53239864",
"0.52981365",
"0.52900374",
"0.52352846",
"0.5227635",
"0.5226512",
"0.5213786",
"0.5199721",
"0.51848984",
"0.51816475",
"0.5175... | 0.7705871 | 0 |
Get the state of the motion sensor. | def info(self):
data = await self.get_data(INFO)
return data['motion'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n return self.device.device_data[self.device_id][self._sensor_type]",
"def state(self):\n if self.coordinator.data:\n return self.coordinator.data[self._sensor]",
"def state(self):\n if not self.device.motion_detection_enabled:\n return 'disabled'\n ... | [
"0.75006926",
"0.72572166",
"0.7243431",
"0.7241679",
"0.7231245",
"0.72310615",
"0.71791804",
"0.71748894",
"0.7145692",
"0.712552",
"0.7084522",
"0.6964597",
"0.69470537",
"0.69106424",
"0.6892919",
"0.68385607",
"0.68365294",
"0.6829633",
"0.68229777",
"0.6789058",
"0.6716... | 0.65683293 | 30 |
Get the state of the hardware. | def puck(self):
data = await self.get_data(PUCK)
if self.data is not None:
return {'firmware': data['fw']['version'], 'hardware': data['hw']['version']} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n return self.device.value()",
"def get_state(self):\n return self.env.sim.get_state()",
"def state(self) -> 'outputs.DeviceStateResponse':\n return pulumi.get(self, \"state\")",
"def state(self):\n return self._device.value",
"def get_state(self):\n rais... | [
"0.75524163",
"0.7501286",
"0.7451899",
"0.74205995",
"0.7258343",
"0.7174549",
"0.7160294",
"0.71590894",
"0.71248865",
"0.71235365",
"0.7043554",
"0.7042705",
"0.7042705",
"0.7031319",
"0.7015834",
"0.7005337",
"0.6986668",
"0.69602484",
"0.694765",
"0.69467044",
"0.694044"... | 0.0 | -1 |
Get the state of the motion sensor. | def motion(self):
data = await self.get_data(MOTION)
return data['motion'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n return self.device.device_data[self.device_id][self._sensor_type]",
"def state(self):\n if self.coordinator.data:\n return self.coordinator.data[self._sensor]",
"def state(self):\n if not self.device.motion_detection_enabled:\n return 'disabled'\n ... | [
"0.75006926",
"0.72572166",
"0.7243431",
"0.7241679",
"0.72310615",
"0.71791804",
"0.71748894",
"0.7145692",
"0.712552",
"0.7084522",
"0.6964597",
"0.69470537",
"0.69106424",
"0.6892919",
"0.68385607",
"0.68365294",
"0.6829633",
"0.68229777",
"0.6789058",
"0.6716356",
"0.6692... | 0.7231245 | 4 |
Camel case the given string | def camel(s):
return s[0].upper() + s[1:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel_case(string: str):\n return ''.join(string_component.title() for string_component in string.split('_'))",
"def string_to_camel_case(string:str) -> str:\n\tresult_camel_case = str()\n\tsym = iter(string)\n\tfor symb in sym:\n\t if symb == \"_\":\n\t symbol = next(sym)\n\t ... | [
"0.79684937",
"0.7919343",
"0.78574234",
"0.7846468",
"0.78290665",
"0.7804365",
"0.7776036",
"0.7742743",
"0.7739984",
"0.77377224",
"0.7726667",
"0.7723372",
"0.7707988",
"0.76892966",
"0.76869816",
"0.767074",
"0.7658005",
"0.764919",
"0.76004946",
"0.76004946",
"0.7597727... | 0.8240134 | 0 |
Compute the action directly from x, at inverse coupling beta. | def action(
self,
x: Any,
beta: Any,
) -> Any:
wloops = self.wilson_loops(x)
assert wloops is not None
return self._action(wloops, beta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertJacobiToBeta(self,x):\n u = 0.5*(self.high+self.low)\n s = 0.5*(self.high-self.low)\n return s*x+u",
"def compute_act(self, x):\n self.p = self.weights @ x.T #+ self.bias\n self.z = self.__act_f(self.p)\n \n return self.z",
"def _inverse(self, x):\n alpha, bet... | [
"0.673435",
"0.6731642",
"0.66729444",
"0.6467007",
"0.6380124",
"0.6320803",
"0.63155854",
"0.6270848",
"0.6269304",
"0.61527497",
"0.61389464",
"0.6113015",
"0.6084256",
"0.6076445",
"0.6057711",
"0.60541874",
"0.6053809",
"0.6032002",
"0.60213816",
"0.6017323",
"0.60079145... | 0.6827742 | 0 |
Returns a timestring readable by Javascript | def time_to_js(obj):
if isinstance(obj, (datetime.date, datetime.datetime)):
return obj.isoformat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time() -> str:\n return strftime(\"%H:%M:%S\")",
"def timestr():\n return dt.strftime(dt.now(),'%H:%M:%S')",
"def getTimeString():\n\tfrom time import strftime\n\treturn strftime(\"%d-%m-%Y__%H-%M-%S\")",
"def get_time_str():\n return time.strftime(time_fmt)",
"def _time_str(self):\n ... | [
"0.7527617",
"0.7389378",
"0.73427224",
"0.73406845",
"0.72987324",
"0.7249002",
"0.7226847",
"0.71583736",
"0.70912904",
"0.7062788",
"0.70449203",
"0.69801354",
"0.697162",
"0.69298947",
"0.6878719",
"0.68583983",
"0.6850911",
"0.6846534",
"0.6836714",
"0.6810256",
"0.67982... | 0.6416983 | 55 |
Build a str representation of a dict. | def dict2str(dic):
return ','.join("%s=%s" % (key, val)
for key, val in sorted(dic.items())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dict_str(d: dict) -> str:\n\treturn str({str(u): str(v) for u, v in d.items()})",
"def _to_string(self) -> str:\n\n string_list = []\n for key, value in self.__dict__.items():\n if isinstance(value, dict):\n string_list.append(key)\n string_list.exte... | [
"0.808947",
"0.7662338",
"0.76534957",
"0.754318",
"0.744231",
"0.73078346",
"0.73012596",
"0.72439384",
"0.7092436",
"0.7031809",
"0.7000028",
"0.69732255",
"0.6937466",
"0.69187695",
"0.6902232",
"0.68907434",
"0.68697137",
"0.6863165",
"0.682087",
"0.6811668",
"0.67781395"... | 0.69463927 | 12 |
Build a tuple from a dict. | def dict2tuple(d):
items = list(d.items())
items.sort()
return tuple(items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ntuple_from_dict(d):\n return namedtuple('TupleFromDict', d.keys())(**d)",
"def make_tuple(in_dict,tupname='values'):\n the_tup = namedtuple(tupname, in_dict.keys())\n the_tup = the_tup(**in_dict)\n return the_tup",
"def _tupleize(d):\n return [(key, value) for key, value in d.items()]",
"... | [
"0.80398446",
"0.7820055",
"0.7555169",
"0.73804283",
"0.7300218",
"0.7194239",
"0.67606854",
"0.67462856",
"0.6392764",
"0.6333309",
"0.63162315",
"0.63162315",
"0.6156443",
"0.6141858",
"0.61364853",
"0.6113487",
"0.60816765",
"0.5992704",
"0.5982395",
"0.5971933",
"0.58804... | 0.7224723 | 5 |
Get a random hex string of the specified length. | def get_random_string(length):
return "{0:0{1}x}".format(random.getrandbits(length * 4), length) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",
"def random_hexstring(self, string_len = 10240):\n alphabet = string.digits + 'abcdef'\n hex_string = ''.join(random.choice(alphabet) for... | [
"0.8268445",
"0.82375145",
"0.8182844",
"0.79433006",
"0.78954524",
"0.7869732",
"0.7837367",
"0.7797109",
"0.77138734",
"0.7644898",
"0.7640454",
"0.7639724",
"0.76242894",
"0.7619639",
"0.7618753",
"0.76137686",
"0.7599419",
"0.7586683",
"0.75787604",
"0.75600904",
"0.75297... | 0.86409736 | 0 |
Camelize a str that uses _ as a camelize token. | def camelize(s):
return ''.join(s.replace('_', ' ').title().split()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camelize_param(self, s):\n\n final = ''\n parts = s.split('_')\n final += parts.pop(0)\n\n for p in parts:\n final += p[0].upper() + p[1:]\n\n return final",
"def camelize(string):\n # NOTE(retr0h): Taken from jpvanhal/inflection\n # https://github.com/jpva... | [
"0.7482481",
"0.73567945",
"0.7304786",
"0.6803965",
"0.6728883",
"0.6696206",
"0.6687246",
"0.66657096",
"0.66388667",
"0.6621513",
"0.6592239",
"0.6565384",
"0.65635353",
"0.65469956",
"0.6503283",
"0.64373606",
"0.6418701",
"0.6406746",
"0.6396248",
"0.63541293",
"0.634164... | 0.7993207 | 0 |
Make a weak reference to a function accounting for bound methods. | def make_weak_ref(f):
return weak_method(f) if hasattr(f, '__self__') else weakref.ref(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weakref_proxy(*args, **kwargs):\n\n pass",
"def weakref_proxy(*args, **kwargs):\n\n pass",
"def _proxify(func) -> weakref.ProxyType:\r\n _keep_alive.append(func)\r\n return weakref.proxy(func)",
"def bound_method_wrapper(*args, **kwargs):\n # __wrapped__ allows AutoGraph to swap in a conve... | [
"0.76167476",
"0.76167476",
"0.71644294",
"0.6845789",
"0.65650624",
"0.6409968",
"0.6229162",
"0.6136982",
"0.60612804",
"0.5846414",
"0.57676613",
"0.5660116",
"0.56138515",
"0.561009",
"0.5581212",
"0.549452",
"0.5487773",
"0.548082",
"0.54652506",
"0.54553235",
"0.5450239... | 0.84029096 | 0 |
Retrieve Q value from given order of elements and information from parent matrix. | def create_q(size, b, order, m):
s = np.matrix(np.zeros(size))
for i in order:
s[0,i] = 1
a = np.dot(np.dot(s, b), s.T)
a = a * (1. / (2. * m))
return a.item(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getq(self, q=None):\n if q is None:\n return self.q\n elif isvector(q, self.n):\n return getvector(q, self.n)\n else:\n return getmatrix(q, (None, self.n))",
"def obtain_Q(self):\n \n #create the initial triangular matrix as a copy of the m... | [
"0.68841934",
"0.65192556",
"0.63427955",
"0.61450654",
"0.6007229",
"0.59466875",
"0.58721733",
"0.58662146",
"0.5792204",
"0.5693443",
"0.56871617",
"0.56780833",
"0.5627266",
"0.5589443",
"0.5588087",
"0.55589175",
"0.55470943",
"0.554545",
"0.55423576",
"0.55395323",
"0.5... | 0.54374796 | 30 |
Test validating the expiration of a Job returns False if the job has expiration and has expired. It also tests that the job is marked as expired with the proper message as error. | def test_validate_expiration3(client):
with client.application.app_context():
pytest.skip("Not implemented") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ticket_expired(self):\n st = ServiceTicketFactory(expire=True)\n self.assertTrue(st.is_expired())",
"def test_ticket_not_expired(self):\n st = ServiceTicketFactory()\n self.assertFalse(st.is_expired())",
"def _has_expired(self):\r\n expired = False\r\n if hasa... | [
"0.64936715",
"0.625464",
"0.6182909",
"0.6139733",
"0.61367255",
"0.6113325",
"0.6091726",
"0.60913163",
"0.6050927",
"0.60507715",
"0.6044618",
"0.60270613",
"0.5984112",
"0.5957067",
"0.5936612",
"0.5929913",
"0.5912414",
"0.5912096",
"0.5899286",
"0.5892259",
"0.58906627"... | 0.58087987 | 31 |
The name of the user the incident is assigned to. | def assigned_to(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "assigned_to") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_name(self) -> str:\n return pulumi.get(self, \"user_name\")",
"def name(self) -> str:\n return self.user.name",
"def user_name(self):\n return self._user_name",
"def user_name(self):\n\n return self._user_name",
"def user_name(self) -> pulumi.Output[str]:\n retur... | [
"0.8094068",
"0.7866106",
"0.7817142",
"0.77593815",
"0.7727819",
"0.7683057",
"0.76699394",
"0.7665654",
"0.7622655",
"0.76140463",
"0.75087357",
"0.7368241",
"0.7358698",
"0.7358698",
"0.7358698",
"0.73430336",
"0.73179716",
"0.7296959",
"0.72633255",
"0.7250648",
"0.719158... | 0.0 | -1 |
The email of the user the incident is assigned to. | def email(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "email") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')",
"def log_useremail(self):\n return self.user.email",
"def email(self, instance):\r\n return instance.user.email",
"def user_email(self) -> pulumi.Output[str]:\n ... | [
"0.8194349",
"0.8066281",
"0.8050516",
"0.78744596",
"0.7741861",
"0.76794606",
"0.7655536",
"0.76137245",
"0.7601129",
"0.7601129",
"0.7601129",
"0.7601129",
"0.75767946",
"0.75767946",
"0.75767946",
"0.75207645",
"0.7517445",
"0.7512313",
"0.7509984",
"0.7508814",
"0.746746... | 0.68486637 | 44 |
The object id of the user the incident is assigned to. | def object_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "object_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n return self.user_id",
"def get_user_id(self):\n return self.id_user",
"def user_id(self):\n return self.status.user[\"id\"]",
"def get_id(self) -> int:\n return self.user_id",
"def user_id(self):\n return self._user_id",
"def user_id(self):\n ... | [
"0.7861296",
"0.78378105",
"0.7733174",
"0.7713729",
"0.77081215",
"0.77081215",
"0.77081215",
"0.77081215",
"0.77081215",
"0.76701456",
"0.7572127",
"0.7549465",
"0.7549465",
"0.74442875",
"0.7294971",
"0.72907114",
"0.7260721",
"0.7260721",
"0.7260721",
"0.72007614",
"0.717... | 0.65998316 | 89 |
The user principal name of the user the incident is assigned to. | def user_principal_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "user_principal_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_principal_name(self):\n if \"userPrincipalName\" in self._prop_dict:\n return self._prop_dict[\"userPrincipalName\"]\n else:\n return None",
"def user_principal_name(self):\n if \"userPrincipalName\" in self._prop_dict:\n return self._prop_dict[\"use... | [
"0.8529282",
"0.8529282",
"0.84515756",
"0.84515756",
"0.7722209",
"0.75396407",
"0.74736196",
"0.7374115",
"0.7327286",
"0.7327286",
"0.7327286",
"0.7288555",
"0.727553",
"0.72735935",
"0.72554994",
"0.7254357",
"0.7235545",
"0.7212888",
"0.7210328",
"0.7107249",
"0.7107249"... | 0.81165713 | 4 |
The object id of the user. | def object_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "object_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n return self.user_id",
"def id(self) -> int:\n return self.user.id",
"def get_id(self) -> int:\n return self.user_id",
"def get_user_id(self):\n return self.id_user",
"def user_id(self):\n return self._user_id",
"def user_id(self):\n return sel... | [
"0.84045523",
"0.83387136",
"0.83367753",
"0.8276082",
"0.8188974",
"0.8188974",
"0.8188974",
"0.8188974",
"0.8188974",
"0.811926",
"0.811926",
"0.79855996",
"0.79562014",
"0.7922144",
"0.78816235",
"0.7790545",
"0.7790545",
"0.7790545",
"0.77779466",
"0.7761165",
"0.77477854... | 0.75916356 | 36 |
Name of the watchlist item | def watchlist_item_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "watchlist_item_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getName(self,item):\n return item.s",
"def get_item_name(self):\n return self.__item_name",
"def name(self):\r\n return self.component.get(\"Name\", \"\")",
"def name(self):\r\n return self.component.get(\"Name\", \"\")",
"def name(self):\n return self[\"name\"]",
"... | [
"0.707294",
"0.6892161",
"0.653715",
"0.653715",
"0.65069056",
"0.64959466",
"0.6495566",
"0.6467871",
"0.64566463",
"0.64566463",
"0.6450628",
"0.64262897",
"0.6411207",
"0.63970995",
"0.63970995",
"0.63947266",
"0.63916725",
"0.6380453",
"0.6374824",
"0.6371694",
"0.6357315... | 0.8051561 | 0 |
Wraps hidden states in new Tensors, to detach them from their history. | def repackage_hidden(h):
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach_hidden(hidden: Any) -> Any:\n return apply_to_tensor(hidden, Tensor.detach)",
"def reset_hidden(self, hidden, reset_flags):\n # detach it from history (pytorch mechanics)\n if self.rnn_type in ['lstm', 'mylstm']:\n h = Variable(hidden[0].data)\n c = Variable(hidd... | [
"0.6896774",
"0.6564761",
"0.6440056",
"0.63181335",
"0.62956357",
"0.61828166",
"0.61425817",
"0.61264986",
"0.61264986",
"0.6120289",
"0.6029193",
"0.60253143",
"0.6020807",
"0.5987143",
"0.5969475",
"0.5969475",
"0.5932672",
"0.5932672",
"0.591887",
"0.5889544",
"0.5871412... | 0.55754465 | 37 |
Get the maximum number of Hybrid Connections allowed in an App Service plan. Description for Get the maximum number of Hybrid Connections allowed in an App Service plan. | def get_hybrid_connection_plan_limit(
self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.get_hybrid_connection_plan_limit.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("reso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adaptive_limit(self) -> int:\n return pulumi.get(self, \"adaptive_limit\")",
"def getmaxnumcon(self): # 3\n res,resargs = self.__obj.getmaxnumcon()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _maxnumcon_return_value = resargs\n ... | [
"0.67096615",
"0.65819854",
"0.6566298",
"0.6455404",
"0.6355841",
"0.6355257",
"0.6354031",
"0.6312357",
"0.6297786",
"0.6291243",
"0.616526",
"0.61196864",
"0.6073961",
"0.6067031",
"0.60512435",
"0.60512435",
"0.60362345",
"0.6005923",
"0.5994896",
"0.59561855",
"0.5941722... | 0.64693046 | 3 |
Retrieve all Hybrid Connections in use in an App Service plan. Description for Retrieve all Hybrid Connections in use in an App Service plan. | def list_hybrid_connections(
self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list_hybrid_connections.metadata['url']
pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getConnectionList(self):\n return []",
"async def get_all(self) -> typing.List[Connection]:\n return [Connection.from_dict(conn) for conn in await self.query(CONNECTION_URL)]",
"def get_all(self) -> typing.List[Connection]:\n return [Connection.from_dict(conn) for conn in self.query(CO... | [
"0.6461421",
"0.63071775",
"0.6306027",
"0.62960196",
"0.6273299",
"0.6169892",
"0.6169892",
"0.60204965",
"0.5976196",
"0.59285015",
"0.5872543",
"0.5786372",
"0.57574123",
"0.57534325",
"0.57424396",
"0.5619253",
"0.5586757",
"0.5579379",
"0.555312",
"0.5532007",
"0.5513188... | 0.6432232 | 1 |
Constructor for PolicyGradient_tf class. | def __init__(self, input_dim: int, output_dim: int):
super().__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.batchNorm1 = layers.BatchNormalization()
self.dense1 = layers.Dense(
64, input_shape=(input_dim+output_dim,),
kernel_ini... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, n_features, n_actions):\n self._graph = tf.Graph()\n self._writer = None\n\n with self._graph.as_default():\n self.state = tf.placeholder(shape=(1,n_features), dtype=tf.float32, name='state')\n self.action = tf.placeholder(shape=None, dtype=tf.i... | [
"0.63359845",
"0.6331563",
"0.6308307",
"0.6308264",
"0.6272105",
"0.6255074",
"0.62432975",
"0.62036014",
"0.6178566",
"0.6106352",
"0.6091708",
"0.60660475",
"0.6050144",
"0.60265565",
"0.6021224",
"0.59907055",
"0.5938788",
"0.5935974",
"0.5924001",
"0.5920488",
"0.5907149... | 0.0 | -1 |
Constructor for PolicyGradient_pt class. | def __init__(self, input_dim: int, output_dim: int):
super().__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.batchNorm1 = nn.BatchNorm1d(input_dim)
self.dense1 = nn.Linear(input_dim+output_dim, 64)
self.relu1 = nn.ReLU()
self.dense2 = nn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PolicyGradient(input_dim: int, output_dim: int, mod: str='pytorch'):\n\n if mod == 'pytorch':\n return PolicyGradient_pt(input_dim, output_dim)\n elif mod == 'tensorflow':\n return PolicyGradient_tf(input_dim, output_dim)\n else:\n raise Exception('Parameter \"mod\" should be one ... | [
"0.61972725",
"0.6187151",
"0.60536695",
"0.6003962",
"0.5916879",
"0.5895222",
"0.5815872",
"0.5809625",
"0.57473",
"0.57473",
"0.57473",
"0.5728297",
"0.57179534",
"0.56982183",
"0.5675443",
"0.5666597",
"0.56651855",
"0.5663649",
"0.5656505",
"0.5644448",
"0.56430525",
"... | 0.0 | -1 |
Update weights by one step | def update_weights(x_train, y_train, weights, learning_rate):
predictions = compute_prediction(x_train, weights)
weights_delta = np.dot(x_train.T, y_train - predictions)
m = y_train.shape[0]
weights += learning_rate / float(m) * weights_delta
return weights | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()",
"def update_weights(self):\n\n self.wei... | [
"0.8801319",
"0.8790046",
"0.85257936",
"0.8106246",
"0.80620784",
"0.79160404",
"0.7851149",
"0.78053564",
"0.7771207",
"0.7735158",
"0.7634865",
"0.75403994",
"0.746698",
"0.74437726",
"0.73169446",
"0.73119795",
"0.7294702",
"0.7285199",
"0.7285199",
"0.7285199",
"0.728519... | 0.72604394 | 23 |
Returns model state and optimizer state. Check `previous_save_available` first! | def load_latest_save(self, device=None):
return torch.load(str(self.previous_saves()[-1].absolute()), map_location=device) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return {\n \"epoch\": self.epoch,\n \"weights\": self.model.get_weights(),\n \"optimizer_weights\": self.model.optimizer.get_weights()\n }",
"def get_saved_state( self ):\n try:\n return torch.load(\"{}/model.torch\".format( ... | [
"0.7192111",
"0.7002202",
"0.6977709",
"0.67912203",
"0.6680403",
"0.6536174",
"0.6532145",
"0.65246034",
"0.6504081",
"0.64070183",
"0.6374068",
"0.63667554",
"0.6282577",
"0.6264658",
"0.6211301",
"0.6172267",
"0.6147381",
"0.61184746",
"0.6112773",
"0.60979545",
"0.6055306... | 0.0 | -1 |
Initializes the hidden state of the recurrent layers | def init_hidden(self, mini_batch_size):
#######################################
### BEGIN YOUR CODE HERE
#######################################
self.hidden = Variable(torch.zeros(2,mini_batch_size, self.hidden_size))
if torch.cuda.is_available():
self.hidden = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n # TODO ========================\n # initialize the hidden states to zero\n\n initial_hidden = torch.zeros(self.num_layers, self.batch_size, self.hidden_size)\n return initial_hidden # a parameter tensor of shape (self.num_layers, self.batch_size, self.hidden_si... | [
"0.7930228",
"0.7740411",
"0.7565454",
"0.7327644",
"0.7137251",
"0.7061761",
"0.7017809",
"0.7017809",
"0.70067084",
"0.70067084",
"0.6905426",
"0.68878037",
"0.68878037",
"0.6871331",
"0.6819395",
"0.67537093",
"0.6727493",
"0.6654492",
"0.66544265",
"0.66411793",
"0.664117... | 0.6622462 | 23 |
Runtime platform associated with this target. | def runtime_platform(self):
return JvmPlatform.global_instance().get_runtime_platform_for_target(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform(self):\n # type: () -> string_types\n return self._platform",
"def get_platform(self):\n return self._platform",
"def platform(self) -> Platform:\n _args: list[Arg] = []\n _ctx = self._select(\"platform\", _args)\n return _ctx.execute_sync(Platform)",
"d... | [
"0.7738818",
"0.7735276",
"0.75974226",
"0.74944997",
"0.74583226",
"0.7456715",
"0.73329765",
"0.72593725",
"0.72350323",
"0.7152069",
"0.7126995",
"0.7109982",
"0.7084655",
"0.6930147",
"0.6927522",
"0.69197196",
"0.68736494",
"0.68694174",
"0.6840743",
"0.68051386",
"0.679... | 0.88084507 | 0 |
Get a datetime object or a int() Epoch timestamp and return a pretty string like 'an hour ago', 'Yesterday', '3 months ago', 'just now', etc | def pretty_date(time=False):
now = datetime.now()
if type(time) is int:
diff = now - datetime.fromtimestamp(time)
elif isinstance(time, datetime):
diff = now - time
elif not time:
diff = now - now
else:
diff = now - now
seco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_ts(timestamp=False):\n now = datetime.now()\n diff = now - datetime.fromtimestamp(timestamp)\n second_diff = diff.seconds\n day_diff = diff.days\n\n if day_diff < 0:\n return ''\n\n if day_diff == 0:\n if second_diff < 10:\n return \"just now\"\n if se... | [
"0.78835124",
"0.7736727",
"0.77089244",
"0.764892",
"0.751493",
"0.7103594",
"0.6907433",
"0.68928826",
"0.6841786",
"0.6820627",
"0.6812584",
"0.6655114",
"0.66550106",
"0.6654776",
"0.6621602",
"0.65855",
"0.65540254",
"0.65286803",
"0.651423",
"0.6503161",
"0.64691204",
... | 0.7691921 | 3 |
Convert a timestamp to human readable time since | def timesince(timestamp):
mapping = {'minute': 'min',
'hour': 'hr',
'week': 'wk',
'month': 'mo',
'year': 'yr'}
if timestamp is None:
return "Never"
text = timesince.timesince(timestamp)
for key in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_ts(timestamp=False):\n now = datetime.now()\n diff = now - datetime.fromtimestamp(timestamp)\n second_diff = diff.seconds\n day_diff = diff.days\n\n if day_diff < 0:\n return ''\n\n if day_diff == 0:\n if second_diff < 10:\n return \"just now\"\n if se... | [
"0.71316135",
"0.70679355",
"0.7052304",
"0.69198066",
"0.6885199",
"0.68752253",
"0.6853983",
"0.68027043",
"0.6723508",
"0.6711727",
"0.66830736",
"0.6681404",
"0.6612867",
"0.6605707",
"0.65917885",
"0.6589348",
"0.6585172",
"0.65838236",
"0.6578166",
"0.65742475",
"0.6555... | 0.6871925 | 6 |
Try to join a nonexistant room. | def test_missing_room(self, mock_join):
mock_join.side_effect = KeyError('Unknown room.')
response = self.fetch('/rooms/1234', method='GET')
self.assertTrue(mock_join.called)
self.assertEqual(response.code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_room(room):\n return request.namespace.join_room(room)",
"def join(self, name):\n \n if name in self.roomList:\n pass\n else:\n self.sendCommand(\"global /join\",name)",
"def exists(self):\n logging.warning(\n \"IRC back-end does not supp... | [
"0.6726618",
"0.65259475",
"0.63552046",
"0.63137156",
"0.630574",
"0.62221485",
"0.61266065",
"0.6124407",
"0.6122893",
"0.60876673",
"0.6026931",
"0.60190123",
"0.60105294",
"0.5984033",
"0.5933212",
"0.5932419",
"0.5925719",
"0.58792627",
"0.58718324",
"0.58185506",
"0.581... | 0.67186177 | 1 |
Connect to the room channel. | def test_explicit_room_channel(self, mock_get, mock_subscribe):
mock_get.return_value = {'XXX': False}
token = jwt.encode({'room': '123', 'uuid': 'XXX'}, 'XXXX').decode('utf-8')
ws = yield self.ws_connect('/socket?token={}&channel=123'.format(token))
mock_get.assert_called_with('123')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(self):\n\n label = self.scope[\"url_route\"][\"kwargs\"][\"label\"]\n self.user = self.scope[\"user\"]\n\n try:\n room = Relationship.objects.get(label=label)\n except Relationship.DoesNotExist:\n log.warning('No relationship have this label=%s', label)... | [
"0.7833067",
"0.7701878",
"0.7628195",
"0.7126731",
"0.707813",
"0.70650816",
"0.7048586",
"0.7005716",
"0.69557995",
"0.69165784",
"0.6643888",
"0.66377646",
"0.6627073",
"0.65623665",
"0.6504641",
"0.6483778",
"0.6469444",
"0.6442589",
"0.6433245",
"0.64086694",
"0.6406828"... | 0.0 | -1 |
Connect to a channel for the current user. | def test_user_channel(self, mock_get, mock_subscribe):
mock_get.return_value = {'XXX': False}
token = jwt.encode({'room': '123', 'uuid': 'XXX'}, 'XXXX').decode('utf-8')
ws = yield self.ws_connect('/socket?token={}&channel=XXX'.format(token))
mock_get.assert_called_with('123')
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def connect(self):\n self.user = self.scope['user']\n self.room_name = self.scope['url_route']['kwargs']['room_name']\n self.room_group_name = 'chat_{}'.format(self.room_name)\n\n await self.channel_layer.group_add(\n self.room_group_name,\n self.channel_name... | [
"0.70625585",
"0.6882076",
"0.67964107",
"0.6633646",
"0.6605473",
"0.65538484",
"0.65502846",
"0.6527293",
"0.65145546",
"0.6511356",
"0.6446983",
"0.641466",
"0.6397471",
"0.63646656",
"0.6341068",
"0.6327764",
"0.63000774",
"0.6180517",
"0.61620414",
"0.61509126",
"0.61356... | 0.0 | -1 |
Try to connect to channel which the user is already subscribed. | def test_already_subscribed(self, mock_get, mock_subscribe):
mock_get.return_value = {'XXX': True}
mock_subscribe.side_effect = ValueError('Already subscribed.')
token = jwt.encode({'room': '123', 'uuid': 'XXX'}, 'XXXX').decode('utf-8')
ws = yield self.ws_connect('/socket?token={}'.forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe(self, client, api_key, channel):\n if channel not in self.clients:\n return False\n pair = (client, api_key)\n if pair in self.clients[channel]:\n return False\n\n self.clients[channel].append(pair)\n return True",
"def test_channel_join_alre... | [
"0.6548996",
"0.6391974",
"0.6250292",
"0.6225095",
"0.6133955",
"0.6107215",
"0.61063683",
"0.6101024",
"0.61001325",
"0.6095968",
"0.6088547",
"0.6078734",
"0.6052126",
"0.6036742",
"0.6033107",
"0.5996779",
"0.5993865",
"0.5989643",
"0.59580654",
"0.594004",
"0.5924887",
... | 0.569406 | 41 |
Current location is an allowed origin. | def test_default_origina(self, mock_get, mock_subscribe):
mock_get.return_value = {'XXX': False}
token = jwt.encode({'room': '123', 'uuid': 'XXX'}, 'XXXX').decode('utf-8')
url = 'ws://localhost:{}/socket?token={}'.format(self.get_http_port(), token)
headers = {'Origin': 'http://localhost... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_origin(self, origin):\n return True",
"def check_origin(self, origin):\n return True",
"def check_origin(self, origin):\n return True",
"def check_origin(self, origin):\n return True",
"def valid_origin(self, parsed_origin):\n # None is not allowed unless all ho... | [
"0.8097337",
"0.8097337",
"0.8097337",
"0.8097337",
"0.70885843",
"0.6908993",
"0.67847764",
"0.6780356",
"0.6688339",
"0.65172553",
"0.6433313",
"0.63112104",
"0.62657416",
"0.62589633",
"0.622894",
"0.6223601",
"0.61833715",
"0.61234474",
"0.61135626",
"0.61135626",
"0.6113... | 0.0 | -1 |
Returns a list of arguments to write secondary dependencies to the given dep_file path. | def depfile_args(self, dep_file):
return ["-Wp,-MMD,%s" % (dep_file)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dependency_files(context):\n path_to_direct_file = os.path.abspath('data/gemini_scan_data/direct-dependencies.txt')\n path_to_transitive_file = os.path.abspath('data/gemini_scan_data/transitive-dependencies.txt')\n context.dependency_files = list()\n with open(path_to_direct_file, 'rb') as f:\n... | [
"0.57710135",
"0.5650425",
"0.53813064",
"0.5377756",
"0.52785206",
"0.5270091",
"0.5241595",
"0.51578677",
"0.51530474",
"0.51423836",
"0.50711185",
"0.5015191",
"0.5015169",
"0.49909863",
"0.49392992",
"0.48982725",
"0.48894703",
"0.4877685",
"0.4840551",
"0.48404014",
"0.4... | 0.7209664 | 0 |
This function tokenizes the given text in a list of single words ============================================================================================ | def tokenize(text, sw):
#get lines from text
lines = text.readlines()
#tokenize text
clr = []
for i in lines:
if ' ' in i:
clr.append(i)
else:
continue
final_list = []
if len(clr) == 1:
final_list = clr[0].split(' ')
else:
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n return text.split(' ')",
"def word_tokenize(text):\n for (regexp, replacement) in RULES1:\n text = sub(regexp, replacement, text)\n # add extra space to make things easier\n text = \" \" + text + \" \"\n for (regexp, replacement) in RULES2:\n text = sub(regexp, rep... | [
"0.80357236",
"0.78483194",
"0.7841656",
"0.7779024",
"0.77312046",
"0.76928663",
"0.7662095",
"0.7661655",
"0.7650701",
"0.7630462",
"0.7627552",
"0.76248443",
"0.7606103",
"0.7602279",
"0.7587781",
"0.75864506",
"0.7585612",
"0.7584632",
"0.75696945",
"0.7565385",
"0.754833... | 0.73216486 | 53 |
String representation for debugging. | def __repr__(self):
return self.name + ' v' + self.version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug_string(self):\n\n raise NotImplementedError",
"def str(self):\n out = \"{0}:\".format(self.gtype) if self.gtype else \"\"\n out += \"{0}\".format(repr(self.coords))\n out += \"[{0}]\".format(str(self.goalPtr)) if self.goalPtr else \"\"\n return out",
"def __str__(se... | [
"0.8545374",
"0.8019418",
"0.79999775",
"0.7790358",
"0.7776434",
"0.770187",
"0.76717454",
"0.7651955",
"0.75883985",
"0.75883985",
"0.75689715",
"0.75689715",
"0.75689715",
"0.75689715",
"0.75689715",
"0.75689715",
"0.75689715",
"0.75689715",
"0.75689715",
"0.75689715",
"0.... | 0.0 | -1 |
returns the sigmoid value of input 'x' | def sigmoid(self, x):
#logging.debug("sigmoid received %s as input" % (x))
return 1.0 / ( 1.0 + np.exp(-x) ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n\n s = 1 / (1 + np.exp(-x))\n\n return s",
"def sigmoid(x):\n s = 1 / (1 + np.exp(-x))\n return s",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(self, x):\n self.x = x\n output = 1 / (1 + np.exp(-x))\n r... | [
"0.89827466",
"0.8979823",
"0.8962233",
"0.8962233",
"0.89599824",
"0.89466774",
"0.8940268",
"0.89401066",
"0.89257884",
"0.8922805",
"0.89186305",
"0.8917671",
"0.8910522",
"0.8910522",
"0.88749135",
"0.88706017",
"0.88706017",
"0.8870531",
"0.8863822",
"0.8860481",
"0.8857... | 0.90481776 | 0 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(WorldModelInfo, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg.Header()
if self.obstacleinfo is None:
self.obst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77950794",
"0.7720336",
"0.7720336",
"0.7686725",
"0.7626082",
"0.75635314",
"0.7439626",
"0.74171734",
"0.73522437",
"0.7308215",
"0.72808266",
"0.7238561",
"0.7227589",
"0.7224258",
"0.7224258",
"0.7219543",
"0.7211657",
"0.7211657",
"0.7211657",
"0.7211657",
"0.7211657"... | 0.6500962 | 95 |
The ARN of the StandardsSubscription for the account ID, region, and Standard. | def standards_subscription_arn(self) -> Optional[str]:
return pulumi.get(self, "standards_subscription_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return p... | [
"0.62903583",
"0.62903583",
"0.62903583",
"0.62903583",
"0.62903583",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872",
"0.6239872"... | 0.7400405 | 0 |
version a of rational activation function f(x) = p(x) / q(x) = (a_0 + a_1 x + a_2 x^2 + ... + a_n x^n) / (1 + |b_0 x| + | b_1 x^2| + ... + | b_m x^{m+1}|) | def _version_a(in_tensor, numerator_weights, denominator_weights, training):
xps = _get_xps(in_tensor, numerator_weights, denominator_weights)
numerator = 0
for i in range(numerator_weights.shape[0]):
w_n = numerator_weights[i]
numerator = numerator + w_n * xps[i]
denominator = 1.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __act_f(self, p):\n # linear activation if no function is given\n if self.activation is None:\n return p\n # tanh\n if self.activation == \"tanh\":\n return np.tanh(p)\n # sigmoid\n if self.activation == \"sigmoid\":\n return 1 / (1 + n... | [
"0.6371953",
"0.62939656",
"0.614038",
"0.6082801",
"0.60287863",
"0.5944832",
"0.5944491",
"0.59421885",
"0.59407336",
"0.5922325",
"0.5855113",
"0.58235615",
"0.58105165",
"0.5803715",
"0.5803607",
"0.5779129",
"0.5776071",
"0.57723707",
"0.57325375",
"0.57065165",
"0.56897... | 0.59593767 | 5 |
version b of rational activation function f(x) = p(x) / q(x) = (a_0 + a_1 x + a_2 x^2 + ... + a_n x^n) / (1 + |b_0 x + b_1 x^2 + ... + b_m x^{m + 1}|) | def _version_b(in_tensor, numerator_weights, denominator_weights, training):
xps = _get_xps(in_tensor, numerator_weights, denominator_weights)
numerator = 0
for i in range(numerator_weights.shape[0]):
w_n = numerator_weights[i]
numerator = numerator + w_n * xps[i]
denominator = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bdq1(f, x, h=1e-5):\n return (f(x)-f(x-h))/h\n raise NotImplementedError(\"Problem 2 Incomplete\")",
"def __act_f(self, p):\n # linear activation if no function is given\n if self.activation is None:\n return p\n # tanh\n if self.activation == \"tanh\":\n ... | [
"0.63450533",
"0.62205654",
"0.61987466",
"0.6155108",
"0.6125568",
"0.6049572",
"0.60286134",
"0.59429556",
"0.5925009",
"0.59127694",
"0.58870304",
"0.5871198",
"0.5814823",
"0.5793511",
"0.5788324",
"0.5774047",
"0.577375",
"0.5757327",
"0.57562846",
"0.5749017",
"0.571683... | 0.6304958 | 1 |
version c of rational activation function f(x) = p(x) / q(x) = (a_0 + a_1 x + a_2 x^2 + ... + a_n x^n) / (0.1 + |b_0 + b_1 x + b_2 x^2 + ... + b_m x^m|) | def _version_c(in_tensor, numerator_weights, denominator_weights, training):
xps = _get_xps(in_tensor, numerator_weights, denominator_weights)
numerator = 0
for i in range(numerator_weights.shape[0]):
w_n = numerator_weights[i]
numerator = numerator + w_n * xps[i]
denominator = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fv(self):\n return self.beta * (self.x ** self.c)",
"def d_act_f(self, p):\n if self.activation is None:\n return p\n if self.activation == \"tanh\":\n return 1 - np.tanh(p)**2\n if self.activation == \"sigmoid\":\n return (1 / (1 + np.exp(-p))) * (1 ... | [
"0.6379273",
"0.63459",
"0.63392687",
"0.6263221",
"0.62343293",
"0.6225727",
"0.6174099",
"0.60232425",
"0.59941196",
"0.595646",
"0.5947453",
"0.5935628",
"0.59128577",
"0.5910764",
"0.58841825",
"0.58684343",
"0.58679146",
"0.5860315",
"0.58561546",
"0.58535224",
"0.582994... | 0.5906235 | 14 |
version d of rational activation function f(x) = p(x) / q(x) = (noised(a_0) + noised(a_1) x + noised(a_2) x^2 + ... + noised(a_n) x^n) / (1 + |noised(b_0) x + noised(b_1) x^2 + ... + noised(b_m) X^{m+1}|) Noised parameters have uniform noise to be in range [(1random_deviation)parameter,(1+random_deviation)parameter]. | def _version_d(in_tensor, numerator_weights, denominator_weights, training, random_deviation=0.1):
# if in training mode, apply Function B
if not training:
return _version_b(in_tensor, numerator_weights, denominator_weights, training)
# else: inference mode
# get list of polynomial [1, X, X^2, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def d_act_f(self, p):\n if self.activation is None:\n return p\n if self.activation == \"tanh\":\n return 1 - np.tanh(p)**2\n if self.activation == \"sigmoid\":\n return (1 / (1 + np.exp(-p))) * (1 - (1 / (1 + np.exp(-p))))\n if self.activation == \"relu... | [
"0.63499725",
"0.5738637",
"0.5662622",
"0.5646257",
"0.56231034",
"0.5619707",
"0.56074107",
"0.5605139",
"0.56030995",
"0.5598465",
"0.558142",
"0.55551356",
"0.5533831",
"0.55283403",
"0.55210364",
"0.5502796",
"0.54353",
"0.5432516",
"0.5423383",
"0.53758156",
"0.5355918"... | 0.6005855 | 1 |
Strip comments from line string. | def strip_comment_line_with_symbol(line, start): # pragma: no cover
parts = line.split(start)
counts = [len(re.findall(r'(?:^|[^"\\]|(?:\\\\|\\")+)(")', part))
for part in parts]
total = 0
for nr, count in enumerate(counts):
total += count
if total % 2 == 0:
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _StripCommentFromLine(line):\n\n m = re.match(r'(.*)//', line)\n if m:\n return m.group(1).strip() + '\\n'\n else:\n return line",
"def strip_comments(line):\n if \"#\" in line:\n return line[:line.find(\"#\")]\n else:\n return line",
"def clean_comment(line):\n if line.star... | [
"0.83832353",
"0.81881326",
"0.7849576",
"0.78008133",
"0.7795312",
"0.77583575",
"0.772848",
"0.7668799",
"0.7446923",
"0.73321223",
"0.73321223",
"0.73223776",
"0.73150617",
"0.72785574",
"0.7276393",
"0.6891992",
"0.6835089",
"0.6831754",
"0.68139434",
"0.6807712",
"0.6789... | 0.65811074 | 29 |
Strip comments from json string. | def strip_comments(string, comment_symbols=frozenset(('#', '//'))): # pragma: no cover
lines = string.splitlines()
for k in range(len(lines)):
for symbol in comment_symbols:
lines[k] = strip_comment_line_with_symbol(lines[k], start=symbol)
return '\n'.join(lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeJsonComment(jsonStr):\n pureJsonStr = jsonStr\n\n # whole line with #\n # # International\n pureJsonStr = re.sub(\"^\\s*#.*$\\n+\", \"\", pureJsonStr, flags=re.M)\n\n # whole line with //\n # // \"mode\": \"SINGLE\",\n pureJsonStr = re.sub(\"^\\s*//.*$\\n+\", \"\"... | [
"0.82140887",
"0.66599596",
"0.66247106",
"0.65715",
"0.6420987",
"0.63912725",
"0.63465995",
"0.6288423",
"0.6243538",
"0.6228745",
"0.61965793",
"0.61772203",
"0.61554486",
"0.61042005",
"0.6027764",
"0.6013321",
"0.59837884",
"0.5975086",
"0.59750265",
"0.59063786",
"0.588... | 0.645063 | 4 |
Return the first part of the string before the separator. | def prefix(value: str, sep: str = ":") -> str:
return split(value, sep)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition(string, delimiter):\r\n sp = string.split(delimiter, 1)\r\n if len(sp) > 1:\r\n return sp[0], sp[1]\r\n else:\r\n return sp[0], \"\"",
"def get_segment_part(segment, index1, index2=None, separator=\"^\"):\n try:\n res = str(segment[index1])\n except IndexError:\n return... | [
"0.6959047",
"0.6892926",
"0.64691687",
"0.6333578",
"0.6198076",
"0.6144836",
"0.607877",
"0.6047009",
"0.60048366",
"0.5963478",
"0.58458185",
"0.58343995",
"0.57936543",
"0.5779412",
"0.5748152",
"0.5742534",
"0.57307386",
"0.57072866",
"0.57007325",
"0.5687308",
"0.566643... | 0.6665679 | 2 |
Capitalize the given string. | def capitalize(value: str, **kwargs: Any) -> str:
return value[0].upper() + value[1:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalcase(string):\n\n string = str(string)\n if not string:\n return string\n return uppercase(string[0]) + string[1:]",
"def capitalize1(s):\n return s[:1].upper() + s[1:]",
"def capify(text):\n return text[0].upper() + text[1:]",
"def cap_case_str(s):\n return re.sub(r'(?:[_... | [
"0.758429",
"0.7518072",
"0.7452916",
"0.7390075",
"0.73708344",
"0.73651093",
"0.73485756",
"0.73304844",
"0.73039335",
"0.7291703",
"0.72634387",
"0.7208596",
"0.7131677",
"0.7121572",
"0.71159446",
"0.7069266",
"0.7028032",
"0.70153975",
"0.69823194",
"0.6925639",
"0.68826... | 0.71495783 | 12 |
Convert the given string to pascal case. | def pascal_case(value: str, **kwargs: Any) -> str:
return "".join(map(str.title, split_words(value))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pascalcase(string):\n\n return capitalcase(camelcase(string))",
"def snake_to_pascal(string):\n return string[0].upper() + re.sub('_([a-z])', lambda match: match.group(1).upper(), string[1:])",
"def pascal_case(st) -> str:\n if st.find('-') != -1 or st.find('_') != -1:\n st = ''.join(a.capi... | [
"0.8409621",
"0.82226545",
"0.79944193",
"0.7626832",
"0.75415635",
"0.7371576",
"0.70412344",
"0.69141173",
"0.6525821",
"0.64699936",
"0.6370107",
"0.63636506",
"0.63510954",
"0.6329885",
"0.6322473",
"0.63156486",
"0.6258856",
"0.6254649",
"0.62174606",
"0.61909884",
"0.61... | 0.7500309 | 5 |
Convert the given string to camel case. | def camel_case(value: str, **kwargs: Any) -> str:
result = "".join(map(str.title, split_words(value)))
return result[0].lower() + result[1:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camel(s):\n return s[0].upper() + s[1:]",
"def snake_to_camel_case(string: str):\n return ''.join(string_component.title() for string_component in string.split('_'))",
"def to_camel(string, capitalize):\n\n ret = string.lower()\n words = re.split(\"[\\s_]\", ret)\n words = list(map(lambd... | [
"0.8220146",
"0.81357133",
"0.80927026",
"0.80006224",
"0.79969144",
"0.7950429",
"0.79465175",
"0.79127616",
"0.7907379",
"0.78773844",
"0.78683233",
"0.7797966",
"0.77975935",
"0.7793548",
"0.76911855",
"0.76050663",
"0.7580896",
"0.7553699",
"0.7530726",
"0.74709886",
"0.7... | 0.7483897 | 19 |
Convert the given string to kebab case. | def kebab_case(value: str, **kwargs: Any) -> str:
return "-".join(split_words(value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kebabize(string):\n kebab = \"\"\n for letter in string:\n if letter.isdigit():\n continue\n elif letter.isupper():\n kebab+=(\"-\" + letter.lower())\n else:\n kebab+=letter\n return kebab if kebab[0] != \"-\" else kebab[1:]",
"def normalize_keba... | [
"0.80977535",
"0.68328226",
"0.6779258",
"0.6693645",
"0.64388907",
"0.63143903",
"0.628711",
"0.6243377",
"0.6176572",
"0.6149897",
"0.6148278",
"0.6148131",
"0.6137959",
"0.6091195",
"0.6083059",
"0.6076837",
"0.60563636",
"0.6018027",
"0.6016949",
"0.6000742",
"0.5982794",... | 0.7642356 | 1 |
Split a string on new capital letters and not alphanumeric characters. | def split_words(value: str) -> List[str]:
words: List[str] = []
buffer: List[str] = []
previous = None
def flush():
if buffer:
words.append("".join(buffer))
buffer.clear()
for char in value:
tp = classify(char)
if tp == StringType.OTHER:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camelCaseSplit(text):\n matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)', text)\n return [m.group(0) for m in matches]",
"def camel_case_split(str_to_split):\r\n if not isinstance(str_to_split, str):\r\n raise ValueError('The value passed is not a string')\r\n\r\n... | [
"0.72629595",
"0.6891686",
"0.6878133",
"0.67183685",
"0.67106986",
"0.6462587",
"0.6448179",
"0.64122885",
"0.63741857",
"0.6360618",
"0.633657",
"0.6259374",
"0.62568694",
"0.6234555",
"0.62029356",
"0.6173295",
"0.6172135",
"0.61187464",
"0.61187464",
"0.6082147",
"0.59962... | 0.0 | -1 |
Return the host name. The host name is defined as the "short" host name. If the hostname as returned by gethostname() includes a domain, the part until the first period ('.') is returned. | def hostname():
hostname = socket.gethostname()
if '.' in hostname:
hostname = hostname.split('.')[0]
return hostname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gethostname():\n if socket.gethostname().find('.') >= 0:\n host = socket.gethostname()\n else:\n host = socket.gethostbyaddr(socket.gethostname())[0]\n return host",
"def shortHostname(self) -> str:\n\t\treturn self.hostname[0]",
"def get_hostname():\n global H... | [
"0.81991875",
"0.791465",
"0.79109764",
"0.78532636",
"0.78345925",
"0.78146464",
"0.7765937",
"0.7704661",
"0.76844823",
"0.76698875",
"0.76321685",
"0.76246077",
"0.758662",
"0.75610816",
"0.7530208",
"0.7527784",
"0.73770976",
"0.7371371",
"0.73558",
"0.73037255",
"0.72928... | 0.814701 | 1 |
Return the report contents as ElementTree. | def __element_tree(self, report_url: str) -> Element:
contents = self._url_read(report_url)
try:
return xml.etree.cElementTree.fromstring(contents)
except xml.etree.cElementTree.ParseError as reason:
logging.error("Couldn't parse report at %s: %s", report_url, reason)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_xml(self):\n with io.StringIO() as string:\n string.write(ET.tostring(self.root, encoding=\"unicode\"))\n return string.getvalue()",
"def xml(self):\n return parse_xml(self, tab=\"\\t\", id=self.id or \"\")",
"def xml(self):\n return lxml.etree.fromstring(self... | [
"0.6773697",
"0.64732915",
"0.6348116",
"0.63022655",
"0.6260556",
"0.61978227",
"0.61978227",
"0.61727035",
"0.61559945",
"0.6117277",
"0.6011919",
"0.5987201",
"0.59206545",
"0.5858192",
"0.58343565",
"0.58212847",
"0.5802223",
"0.5797656",
"0.5732041",
"0.56848794",
"0.568... | 0.70978814 | 0 |
Create a `stock.valuation.layer` from `self`. | def _create_in_svl(self, forced_quantity=None):
svl_vals_list = []
for move in self:
move = move.with_context(force_company=move.company_id.id)
valued_move_lines = move._get_in_move_lines()
valued_quantity = 0
for valued_move_line in valued_move_lines:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_layer(self) -> Layer:\n return layer.from_geom(self)",
"def custom_layer_factory(self):\n raise NotImplementedError(\n '[custom_layer_factory] must be implemented by the subclass.')",
"def newLayer(self):\n self.currentLayerData = Layer.LayerData()\n self.layers.ap... | [
"0.62595296",
"0.5948165",
"0.5462119",
"0.5448931",
"0.54248637",
"0.5413158",
"0.5374302",
"0.53654724",
"0.5250629",
"0.5227816",
"0.5221554",
"0.52160966",
"0.52141804",
"0.51973444",
"0.5193998",
"0.51810867",
"0.51692635",
"0.51156205",
"0.5099271",
"0.50732505",
"0.507... | 0.0 | -1 |
Generates a subquery that can be used to add sector names to a query set as an annotation. | def get_sector_name_subquery(relation_name=None):
outer_ref_prefix = f'{relation_name}__' if relation_name is not None else ''
subquery = Sector._base_manager.annotate(
name=_SectorStringAgg(F('segment'), Value(Sector.PATH_SEPARATOR)),
).filter(
lft__lte=OuterRef(f'{outer_ref_prefix}lft'),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_cases_aliquots_query(offset, limit):\n return f\"\"\"{{ \n paginatedCasesSamplesAliquots(offset:{offset} limit:{limit} acceptDUA: true) {{ \n total \n casesSamplesAliquots {{\n case_id \n case_submitter_id\n days_to_lost_to_follo... | [
"0.52788776",
"0.5023589",
"0.4967601",
"0.4937378",
"0.48389155",
"0.48375782",
"0.47571516",
"0.4740347",
"0.4729269",
"0.4729224",
"0.47248718",
"0.4718062",
"0.46978077",
"0.46886656",
"0.46772355",
"0.4636779",
"0.46142015",
"0.46118546",
"0.46108577",
"0.4608829",
"0.46... | 0.625573 | 0 |
Encode a long or int into a bytearray. | def encode_uvarint(value):
output = bytearray()
if value < 0:
raise EncoderException(
"Error encoding %d as uvarint. Value must be positive" % value
)
try:
encoder._EncodeVarint(_gen_append_bytearray(output), value)
except (struct.error, ValueError) as exc:
si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Encode(chunk: bytes) -> bytes:\n return _UINT64.pack(len(chunk)) + chunk",
"def encode_i64(value: int) -> bytes:\n return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.I64].LENGTH, True)",
"def bencode(data, f):\n\tif isinstance(data, int):\n\t\t_encode_int(data, f)\n\telif isinstance(data, (str... | [
"0.67872787",
"0.6687064",
"0.66125387",
"0.6539887",
"0.6517371",
"0.651584",
"0.63990545",
"0.6383854",
"0.636777",
"0.633729",
"0.63330156",
"0.6301229",
"0.62918305",
"0.62918305",
"0.6271508",
"0.626411",
"0.6215441",
"0.6208903",
"0.61934125",
"0.6184863",
"0.6166674",
... | 0.54413474 | 94 |
Encode a long or int into a bytearray. | def encode_varint(value):
output = bytearray()
if value > (2 ** 63) or value < -(2 ** 63):
raise EncoderException("Value %d above maximum varint size" % value)
try:
encoder._EncodeSignedVarint(_gen_append_bytearray(output), value)
except (struct.error, ValueError) as exc:
six.rai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Encode(chunk: bytes) -> bytes:\n return _UINT64.pack(len(chunk)) + chunk",
"def encode_i64(value: int) -> bytes:\n return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.I64].LENGTH, True)",
"def bencode(data, f):\n\tif isinstance(data, int):\n\t\t_encode_int(data, f)\n\telif isinstance(data, (str... | [
"0.67872787",
"0.6687064",
"0.66125387",
"0.6539887",
"0.6517371",
"0.651584",
"0.63990545",
"0.6383854",
"0.636777",
"0.633729",
"0.63330156",
"0.6301229",
"0.62918305",
"0.62918305",
"0.6271508",
"0.626411",
"0.6215441",
"0.6208903",
"0.61934125",
"0.6184863",
"0.6166674",
... | 0.5857512 | 37 |
Adds word to dictionary and updates corresponding counts. _set name of the set the word belongs to document document the word belongs to label label for the document the word belongs to word word to be added | def add_word(self, _set, document, label, word):
if _set not in self.sets:
self.sets[_set] = {}
if document not in self.sets[_set]:
self.sets[_set][document] = {}
self.sets[_set][document]['label'] = label
self.sets[_set][document]['words'] = set... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __add_to_word_dict__(self, word, tag):\n if self.word_dict.get(word, None) is None:\n self.word_dict[word] = defaultdict(int)\n self.word_dict[word][tag] += 1",
"def add_word(self, word_one, word_two):\n \n # if word_one is in the corpus\n if word_one in self.cor... | [
"0.6871426",
"0.6767486",
"0.67319787",
"0.6648939",
"0.64936787",
"0.6487393",
"0.64869153",
"0.6423674",
"0.6398661",
"0.63929707",
"0.63783914",
"0.6374384",
"0.63697",
"0.634265",
"0.634265",
"0.62944615",
"0.62598985",
"0.6252318",
"0.62278026",
"0.62264305",
"0.6186001"... | 0.8568339 | 0 |
Utility function to parse languages. >>> _parse_languages(None) is None True >>> _parse_languages("en") == frozenset(('en',)) True >>> _parse_languages('') '' >>> _parse_languages("en,es") == frozenset(('en', 'es')) True | def _parse_languages(value):
if value:
value = value.replace(",", " ")
value = frozenset(value.split())
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_languages():\n languages = set()\n with open('students.txt', 'r') as f:\n next(f)\n for line in f.readlines():\n language_list = [language.strip() for language in line.split(':')[1].split(',') if language.islower()]\n for language in language_list:\n ... | [
"0.622882",
"0.5966636",
"0.59618384",
"0.58379585",
"0.58088034",
"0.5746211",
"0.56950754",
"0.5540831",
"0.55310434",
"0.5517887",
"0.5497429",
"0.5490181",
"0.5486934",
"0.54747385",
"0.5393821",
"0.5391561",
"0.5389735",
"0.53133523",
"0.5290742",
"0.5275239",
"0.5258033... | 0.72711325 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.