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 |
|---|---|---|---|---|---|---|
Generates an nbit prime. | def _gen_prime(self, n_bits):
n = gmpy2.mpz(prng.getrandbits(n_bits))
return gmpy2.next_prime(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_possible_prime(n_bits: int = 128) -> int:\n xorshift = XORShift()\n possible_prime = xorshift.getrandbits(n_bits)\n\n # Make sure it is at least of the size n_bits bits\n possible_prime |= (1 << (n_bits - 1))\n\n # Make sure it is odd\n possible_prime |= 1\n\n return possible_pri... | [
"0.76496625",
"0.70351064",
"0.69764924",
"0.6935976",
"0.6927509",
"0.69273657",
"0.6900431",
"0.6892048",
"0.6869236",
"0.68594325",
"0.6854441",
"0.68279946",
"0.6823428",
"0.68212724",
"0.67940694",
"0.67818284",
"0.67702633",
"0.6769174",
"0.67597044",
"0.67560023",
"0.6... | 0.7981432 | 0 |
Runs a forward pass on the embeddings of a transformer inputs is an instance of TransformerInput | def call(self, inputs, **kwargs):
# unpack all the requires model inputs, some might be empty tensors:
[queries, values, queries_mask, values_mask, ids, permutation,
absolute_positions, relative_positions, pointer_labels,
logits_labels, partial_pos, pointer_probs, log_probs,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, inputs):\n raise NotImplementedError",
"def forward(self, *inputs):\n raise NotImplementedError",
"def feed_forward(self, inputs):\n raise NotImplementedError()",
"def forward(self, x):\n\n padding_mask = (x == self.tokenizer.vocab['[PAD]'])\n\n x = x.tran... | [
"0.7118836",
"0.69979274",
"0.6993957",
"0.6929344",
"0.69283456",
"0.684083",
"0.6836636",
"0.6780927",
"0.6780927",
"0.6699587",
"0.669719",
"0.66801965",
"0.6614101",
"0.659447",
"0.65910196",
"0.65812474",
"0.6567654",
"0.6526801",
"0.65019846",
"0.65019506",
"0.6480515",... | 0.0 | -1 |
Helper method to get devicename for a disk message. | def GetDiskDeviceName(disk, name, container_mount_disk):
if (container_mount_disk and filter(
bool, [d.get('name', name) == name for d in container_mount_disk])):
# device-name must be the same as name if it is being mounted to a
# container.
if not disk.get('device-name'):
log.warning(_DEFAUL... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dev_name(self):\n\t\treturn call_sdk_function('PrlSrvCfgHdd_GetDevName', self.handle)",
"def _get_disk_name(disk_type, instance, short=False):\n prefix = '%s_' % (disk_type[0] if short else disk_type)\n base = ('%s_%s' % (instance.name[:8], instance.uuid[:4]) if short\n else ... | [
"0.6959648",
"0.6675731",
"0.64992803",
"0.6462979",
"0.63459396",
"0.63405514",
"0.63324565",
"0.62980556",
"0.6260104",
"0.6211547",
"0.619601",
"0.6178117",
"0.6158191",
"0.6135641",
"0.6083297",
"0.6060151",
"0.6054577",
"0.6053284",
"0.603512",
"0.6030639",
"0.6018254",
... | 0.6454201 | 4 |
Gets labels for the instance message. | def GetLabels(args, client, instance_properties=False):
labels_value = client.messages.Instance.LabelsValue
if instance_properties:
labels_value = client.messages.InstanceProperties.LabelsValue
if args.labels:
return labels_value(additionalProperties=[
labels_value.AdditionalProperty(key=key, valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_labels(self):\n return self.labels",
"def get_labels(self) -> List[str]:\n return self.labels",
"def labels(self):\n return self._labels",
"def labels(self):\n return self._labels",
"def labels(self):\n return self._labels",
"def labels(self):\n return self._... | [
"0.7439988",
"0.7342571",
"0.7308822",
"0.73067605",
"0.73067605",
"0.73067605",
"0.73067605",
"0.73067605",
"0.73067605",
"0.7190166",
"0.7188713",
"0.716992",
"0.71663",
"0.71577185",
"0.71577185",
"0.71577185",
"0.71577185",
"0.71577185",
"0.71577185",
"0.71577185",
"0.715... | 0.7054063 | 47 |
Returns the message of reservation affinity for the instance. | def GetReservationAffinity(args, client):
if args.IsSpecified('reservation_affinity'):
type_msgs = (
client.messages.ReservationAffinity
.ConsumeReservationTypeValueValuesEnum)
reservation_key = None
reservation_values = []
if args.reservation_affinity == 'none':
reservation_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reservation(self):\n return self.request.get('reservation', None)",
"def session_affinity(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"session_affinity\")",
"def reservation(self):\n return self._reservation",
"def reservation_id(self) -> pulumi.Output[Optional[... | [
"0.56318426",
"0.5611059",
"0.5438566",
"0.54317683",
"0.5292865",
"0.52288365",
"0.519662",
"0.519662",
"0.5123067",
"0.5122535",
"0.5082244",
"0.5036739",
"0.49790993",
"0.49545208",
"0.49115857",
"0.48964074",
"0.4877538",
"0.4871858",
"0.4828057",
"0.48028803",
"0.4787754... | 0.7139741 | 0 |
Gets the joint angles saved within arm_cal/ with the physical robot arm data | def get_joint_angles_from_physical_data(self):
print("\nGetting the physical arm joint angles...")
with open(directory + '/final_test/test_data/Matrices/Angles_9.0.csv') as file:
joint_data = csv.reader(file)
idx = 0
for row in joint_data:
for j in row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def joint_angles(self, arm):\n self.main(1, arm.angles)\n # self.distance_service = rospy.Service('distance', Distance, self.distance)\n return Joint_anglesResponse(True)",
"def _joint_angle_control(self):\n\n error = self.target_pos - self.robot_arm_pos\n return self._pd_contr... | [
"0.7593934",
"0.71952444",
"0.71433574",
"0.710774",
"0.6923523",
"0.66831535",
"0.6662158",
"0.6533645",
"0.64866054",
"0.6367499",
"0.634758",
"0.63269603",
"0.62920785",
"0.62724125",
"0.62293535",
"0.6220274",
"0.62182105",
"0.6217899",
"0.6165552",
"0.6158356",
"0.612125... | 0.7684459 | 0 |
Save joint angle values to csv file | def save_new_joint_angles(self,save_file):
with open(directory + save_file, "w") as outfile:
writer = csv.writer(outfile)
writer.writerow(robot.joint_angles.values())
outfile.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_csv(elongation, file_name):\n e = elongation\n\n with open(file_name, 'w') as f:\n f.write(f\"\"\"\\\nBreak Load, {e.break_load()}\nBreak Strength, {e.break_strength()}\nBreak Elongation, {e.break_elongation()}\nYield Load, {e.yield_load()}\nYield Strength, {e.yield_strength()}\nYield Elonga... | [
"0.68784434",
"0.64784217",
"0.62530935",
"0.6227468",
"0.6216056",
"0.61678797",
"0.6122868",
"0.6108017",
"0.61057585",
"0.61050284",
"0.60717154",
"0.60549915",
"0.60008377",
"0.5983506",
"0.5980342",
"0.59396267",
"0.59283924",
"0.5915821",
"0.59127164",
"0.58869755",
"0.... | 0.72760236 | 0 |
Test conversion to a string (bytes in Python 2, unicode in Python 3). | def test_str(self):
self.assertEqual(str(self.bs), str(self.wbs))
self.assertEqual(str(self.be), str(self.be))
# str(us) fails in Python 2
self.assertEqual(str, type(str(self.wus)))
# str(ue) fails in Python 2
self.assertEqual(str, type(str(self.wue))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bytes(self):\n self.assertRaises(\n UnicodeDecodeError,\n lambda: bytes_to_str(\"\\N{SNOWMAN}\".encode(\"utf-8\")),\n )\n decoded = bytes_to_str(b\"hello world\")\n self.assertIsInstance(decoded, str)\n self.assertEqual(decoded, \"hello world\")",
... | [
"0.7925128",
"0.7851373",
"0.7547887",
"0.72509575",
"0.7220252",
"0.7192202",
"0.7186242",
"0.7091968",
"0.70712775",
"0.70700634",
"0.7057976",
"0.70521367",
"0.70431346",
"0.70365196",
"0.70228124",
"0.69987744",
"0.69805384",
"0.69706166",
"0.69312614",
"0.69147164",
"0.6... | 0.0 | -1 |
Test conversion to a string (bytes in Python 2, unicode in Python 3). | def test_str(self):
self.assertEqual(str(self.bioe), str(self.wbioe))
self.assertEqual(str(self.uioe), str(self.wuioe))
self.assertEqual(str(self.bose), str(self.wbose))
self.assertEqual(str(self.uose), str(self.wuose)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bytes(self):\n self.assertRaises(\n UnicodeDecodeError,\n lambda: bytes_to_str(\"\\N{SNOWMAN}\".encode(\"utf-8\")),\n )\n decoded = bytes_to_str(b\"hello world\")\n self.assertIsInstance(decoded, str)\n self.assertEqual(decoded, \"hello world\")",
... | [
"0.7925128",
"0.7851373",
"0.7547887",
"0.72509575",
"0.7220252",
"0.7192202",
"0.7186242",
"0.7091968",
"0.70712775",
"0.70700634",
"0.7057976",
"0.70521367",
"0.70431346",
"0.70365196",
"0.70228124",
"0.69987744",
"0.69805384",
"0.69706166",
"0.69312614",
"0.69147164",
"0.6... | 0.0 | -1 |
Sigmoid activation function Arguments | def activation(x):
return 1 / (1 + torch.exp(-x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))",
"def sigmoid(z):\n \n return 1 / (1 + np.exp(-z))#your code here",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"def ... | [
"0.80501693",
"0.79579645",
"0.7773764",
"0.7771425",
"0.7761971",
"0.7761971",
"0.774402",
"0.7743929",
"0.7727615",
"0.7718519",
"0.77127093",
"0.77118677",
"0.77118677",
"0.77118677",
"0.77118677",
"0.77118677",
"0.77118677",
"0.77029383",
"0.76977247",
"0.7691156",
"0.768... | 0.7080194 | 96 |
Get configuration controller configuration | def get_config() -> Config:
app_config = os.environ.get('APP_CONFIG', 'ProductionConfig')
config_module = importlib.import_module(
'.'.join(
f"magma.fluentd_client.config.{app_config}".split('.')[
:-1
],
),
)
config_class = getattr(config_module, a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_configuration(self) -> dict:\n return self.config",
"def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)",
"def get_config(self):\n return self.config",
"def config(self) -> 'outputs.Dev... | [
"0.7795471",
"0.7655926",
"0.76405966",
"0.762667",
"0.75670826",
"0.7565704",
"0.75247353",
"0.746529",
"0.7411735",
"0.740519",
"0.7381939",
"0.73753506",
"0.73660505",
"0.7344867",
"0.7344867",
"0.7326805",
"0.7326805",
"0.7326805",
"0.7326805",
"0.7326805",
"0.7326805",
... | 0.0 | -1 |
Turn off the LED. (Interrupts flashing.) | def turn_off(self):
self._interrupt_flash()
if self.on:
GPIO.output(self.pin, GPIO.LOW)
self.on = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light",
"def turn_off(self):\n print(\"Turning the lights off\")\n self.led.all_off()\n self.client.publish(STATE_TOPIC, OFF) #publish",
"def switch_off(self):\n if threading.current_thread() != self._blinking_th... | [
"0.85458714",
"0.8278278",
"0.8204422",
"0.8153099",
"0.80230445",
"0.7939081",
"0.7923542",
"0.78094435",
"0.7805423",
"0.7771822",
"0.7770804",
"0.77553195",
"0.77535605",
"0.7707029",
"0.76903665",
"0.76870775",
"0.7635206",
"0.76170915",
"0.7612361",
"0.76120013",
"0.7602... | 0.86891115 | 0 |
Given a reward from the game normalises it zero mean and unit variance. | def normalise_reward(reward, prev_lives, curr_lives):
# Check if we've lost a life and set the reward accordingly
if prev_lives != curr_lives:
reward = -305
return (reward - reward_mean) / reward_stdev | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self, reward):\n return float(np.sign(reward))",
"def em_var(self) -> float:\n if self.__total_pulls == 0:\n raise Exception('Number of pulls is 0. No empirical variance.')\n return (self.__sum_of_square_reward -\n self.__total_rewards**2 / self.__total_pulls) / self.__tot... | [
"0.646132",
"0.64279145",
"0.63724375",
"0.63270456",
"0.631331",
"0.631331",
"0.631331",
"0.631331",
"0.631331",
"0.6134376",
"0.5980681",
"0.5948727",
"0.5926468",
"0.59160405",
"0.5904424",
"0.58087987",
"0.57905304",
"0.5784683",
"0.57786095",
"0.57495064",
"0.5742598",
... | 0.6705976 | 0 |
Get the learning rate for gradient descent. | def get_learning_rate():
return 0.00001 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def __learning_rate(self, lr0, epoch):\n \n \"\"\"\n Dan's Methos\n \"\"\"\n lrs = lr0 * 0.001\n c = np.power((lrs/lr0), 1.0/self.__maxEpoch)\n \n return lr... | [
"0.8053638",
"0.7815953",
"0.7782783",
"0.768594",
"0.7641077",
"0.7641077",
"0.75998056",
"0.73816365",
"0.73109484",
"0.72795993",
"0.72795993",
"0.7202771",
"0.7191542",
"0.7168862",
"0.70190346",
"0.69745064",
"0.6939231",
"0.6884782",
"0.68601567",
"0.68240887",
"0.68173... | 0.790059 | 1 |
Returns a string representation of this BoolectorSolver object. String representation of this BoolectorSolver object. | def __str__(self):
return self.name + "-" + SatSolver.getName(self.satSolver) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_proto(self):\n prototxt = str()\n opts = self.options('solver')\n for opt in opts:\n val = self.get('solver',opt)\n prototxt += opt + ': ' + val + '\\n'\n return prototxt",
"def __str__(self):\n return np.array2string(self.graph.toarray())",
"def ... | [
"0.69683135",
"0.69249827",
"0.68995035",
"0.68752825",
"0.6847918",
"0.6827423",
"0.681375",
"0.6771597",
"0.6691438",
"0.666567",
"0.6647884",
"0.6644545",
"0.6644545",
"0.6644545",
"0.6644545",
"0.6644545",
"0.66380715",
"0.6635287",
"0.66032124",
"0.65613765",
"0.65581477... | 0.6784957 | 7 |
Generates a list of files with extension in the dir structure. | def _get_files(self):
# pylint: disable=unused-variable
for dirpath, __, filenames in os.walk(self.start_location):
for file_ in filenames:
if file_.endswith('.py'):
yield "{0}{1}".format(dirpath, file_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateFileList(args):\n\textensions = (\"jpg\", \"gif\", \"png\", \"bmp\", \"xpm\", \"ico\")\n\n\tfor arg in args:\n\t\tif not os.access(arg, os.R_OK):\n\t\t\tprint >> sys.stderr, \"File not found: %s\" % arg \n\t\t\tcontinue\n\t\tif os.path.isdir(arg):\n\t\t\tfor (root, dirs, files) in os.walk(arg):\n\t\t\t... | [
"0.7657409",
"0.7509316",
"0.72136766",
"0.7166178",
"0.71289724",
"0.707262",
"0.7060423",
"0.7042677",
"0.70380265",
"0.70327353",
"0.7001796",
"0.69956994",
"0.69779444",
"0.6937522",
"0.69339687",
"0.6932267",
"0.6923476",
"0.6920417",
"0.69160354",
"0.6878986",
"0.687806... | 0.7077196 | 5 |
If we have calculated leading whitespace, insert the leading whitespace into the first position of the list | def _insert_leading_whitespace(self, line_list):
if self._leading_whitespace:
line_list[0] = '{0}{1}'.format(
self._leading_whitespace, line_list[0]
)
return line_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reset_leading_whitespace(self):\n self._leading_whitespace = ''",
"def _advanceList(self, list):\n\t\tnewList = [\" \"] * len(list)\n\t\tfor i in range(len(list) - 1):\n\t\t\tnewList[i + 1] = list[i]\n\t\treturn newList",
"def pre_process_data(linelist):\r\n for index in range(len(linelist)):\r\... | [
"0.63360506",
"0.6194572",
"0.5984075",
"0.59210896",
"0.58566105",
"0.5837267",
"0.5801685",
"0.57421136",
"0.56616235",
"0.5637351",
"0.563632",
"0.55919856",
"0.5578196",
"0.55567527",
"0.55411965",
"0.55321133",
"0.55241895",
"0.55104196",
"0.5485656",
"0.54606974",
"0.54... | 0.8051152 | 0 |
Reset leading whitespace to an empty string | def _reset_leading_whitespace(self):
self._leading_whitespace = '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_leading_blanks(self, sentence):\n pass",
"def removeSingleChars(self) -> None:\n self.text = re.sub('\\s[^\\n\\s]\\s', ' ', self.text)",
"def strip_space():\n pass",
"def remove_leading_whitespace_and_empty_lines(text: str) -> str:\n # We call lstrip() twice on the same line. This... | [
"0.7319709",
"0.717422",
"0.68059915",
"0.67550683",
"0.65662074",
"0.64951366",
"0.64855266",
"0.64842486",
"0.6482822",
"0.63899666",
"0.6290314",
"0.62032336",
"0.61713326",
"0.61497635",
"0.61404127",
"0.6126315",
"0.61145175",
"0.61136705",
"0.6111268",
"0.6105448",
"0.6... | 0.8406918 | 0 |
Returns a list of the current nodes set in the config files. | def get_nodes():
nodes_config_file = Settings.CONF_NODES_FILE
current_nodes = load_node_names(nodes_config_file)
return current_nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodes(self):\n with open('node_list.txt', 'r') as file:\n self.nodes = [line.rstrip('\\n') for line in file]",
"def getNodes(self):\n return self.__allNodes",
"def get_node_list(self):\n return self.node_list",
"def nodes(self):\n return list(self.keys())",
"d... | [
"0.68926984",
"0.6829399",
"0.6811819",
"0.68054205",
"0.68054205",
"0.6751895",
"0.67171973",
"0.6658382",
"0.6656555",
"0.6653519",
"0.6566711",
"0.6551818",
"0.6543484",
"0.6534933",
"0.64930457",
"0.6491283",
"0.648216",
"0.6475416",
"0.6464183",
"0.64529616",
"0.64494",
... | 0.7896045 | 0 |
Create a cameraimage plot | def __init__(self, xpix, ypix, size, cmap=None, **kwargs):
super().__init__(**kwargs)
rc = {
"xtick.direction": 'out',
"ytick.direction": 'out',
}
mpl.rcParams.update(rc)
self._image = None
self._mapping = None
self.colorbar = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _plot_camera_view(self):\n fig, axs = plt.subplots()\n fig.show()\n axs.cla()\n axs.axis([-0.003, 0.003, -0.003, 0.003])\n axs.grid()\n axs.plot([0], [0], 'r+')\n for t_step in range(0, int(self._t_sim / self._dt) + 1, 250):\n axs.plot(\n ... | [
"0.7726675",
"0.7168349",
"0.696092",
"0.67199004",
"0.6526006",
"0.6405402",
"0.6365421",
"0.63624465",
"0.62569183",
"0.6251492",
"0.622746",
"0.62114173",
"0.61945605",
"0.618963",
"0.6181302",
"0.61749333",
"0.6172868",
"0.6158118",
"0.61564475",
"0.61529166",
"0.61521983... | 0.0 | -1 |
Create a cameraimage plot using imshow (essentially a 2D histogram, therefore missing module gaps) | def __init__(self, row, col, n_rows, n_cols, **kwargs):
super().__init__(**kwargs)
self._image = None
self._mapping = None
self.colorbar = None
self.autoscale = True
self.row = row
self.col = col
self.n_rows = n_rows
self.n_cols = n_cols
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_img():\n plt.subplot(121)\n plt.imshow(data.data.numpy()[0,].squeeze())\n plt.subplot(122)\n plt.imshow(dec_mean.view(-1,28,28).data.numpy()[0,].squeeze())\n\n plt.show()\n plt.pause(1e-6)\n plt.gcf().clear()\n sample = model.sample_z(data) \n plt.imshow(sample)",
"def im_s... | [
"0.7090252",
"0.7065481",
"0.6908243",
"0.6876816",
"0.6818144",
"0.67968804",
"0.6793367",
"0.6791469",
"0.6783793",
"0.6783793",
"0.6783793",
"0.67668825",
"0.6756246",
"0.6746723",
"0.6726864",
"0.67247105",
"0.6642704",
"0.66406584",
"0.6633492",
"0.6593998",
"0.65844923"... | 0.0 | -1 |
Deletes an existing load balancer service group. | def cli(env, identifier):
mgr = SoftLayer.LoadBalancerManager(env.client)
_, group_id = loadbal.parse_id(identifier)
if env.skip_confirmations or formatting.confirm("This action will cancel "
"a service group. "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_service_group(self, group_id):\r\n svc = self.client['Network_Application_Delivery_Controller_'\r\n 'LoadBalancer_VirtualServer']\r\n\r\n return svc.deleteObject(id=group_id)",
"def _Delete(self):\n cmd = self.cmd_prefix + [\n 'redshift', 'delete-cluste... | [
"0.8037338",
"0.68840265",
"0.68807906",
"0.67657",
"0.67075866",
"0.6662849",
"0.6610307",
"0.6574038",
"0.65581304",
"0.65554225",
"0.6553395",
"0.650906",
"0.6500996",
"0.64721644",
"0.64631516",
"0.6425516",
"0.6391302",
"0.63842916",
"0.6356209",
"0.63453674",
"0.6299887... | 0.7692148 | 1 |
Return agent position as Vector2 instance. | def get_agent_position(agent):
pos = Vector2()
pos.x = agent.pose.pose.position.x
pos.y = agent.pose.pose.position.y
return pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_velocity(agent):\n vel = Vector2()\n vel.x = agent.twist.twist.linear.x\n vel.y = agent.twist.twist.linear.y\n return vel",
"def v(self):\n return Vector2(self.position)",
"def get_pos(self) -> WAVector:\n pass",
"def vector(self) -> Vector:\n return self._norma... | [
"0.7603827",
"0.7458375",
"0.65642893",
"0.6557557",
"0.6540899",
"0.649476",
"0.6391604",
"0.62776494",
"0.61861956",
"0.61706674",
"0.61136395",
"0.61019254",
"0.60933805",
"0.60043144",
"0.5993553",
"0.5949967",
"0.59394747",
"0.59374994",
"0.59348315",
"0.59348315",
"0.59... | 0.8089541 | 0 |
Return obstacle position as Vector2 instance. | def get_obst_position(obst):
pos = Vector2()
pos.x = obst.position.x
pos.y = obst.position.y
return pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v(self):\n return Vector2(self.position)",
"def position(self) -> Point2:\n return Point2((self.proto.pos.x, self.proto.pos.y))",
"def getVector(self):\n return Vector.createFromTwoPoints(self.p1, self.p2)",
"def get_agent_position(agent):\n pos = Vector2()\n pos.x = agent.pose... | [
"0.7097197",
"0.6688148",
"0.63801146",
"0.6271898",
"0.62086916",
"0.60949224",
"0.608759",
"0.6030668",
"0.6011069",
"0.5982183",
"0.5938863",
"0.5893644",
"0.5852353",
"0.5838189",
"0.58177865",
"0.5815798",
"0.5810499",
"0.5789317",
"0.5756227",
"0.5733608",
"0.5721481",
... | 0.6785595 | 1 |
Compute total velocity based on all components. | def compute_velocity(self, my_agent, nearest_agents, avoids):
force = Vector2()
self.velocity = get_agent_velocity(my_agent)
# Compute all the components
alignment = self.compute_alignment(nearest_agents)
cohesion = self.compute_cohesion(nearest_agents)
separation = self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcVelocity(self, iteration):\n self.setIteration(iteration)\n if self.parallelization_mode == \"serial\":\n # calculate and set coordinates\n for this_bin in iteration:\n for this_segment in this_bin:\n self.calcSegmentVelocities(this_segm... | [
"0.68019897",
"0.6791509",
"0.6721381",
"0.6524867",
"0.6395786",
"0.6368563",
"0.631056",
"0.62978995",
"0.6296061",
"0.6260199",
"0.62434727",
"0.62378734",
"0.6212687",
"0.621244",
"0.61956394",
"0.61899245",
"0.6185477",
"0.61673826",
"0.61664444",
"0.61664444",
"0.610558... | 0.5642465 | 72 |
Convert a timestamp (integer microseconds since epoch) to a humanreadable string, using the local timezone for display (e.g. from the TZ env var). | def timestamp_to_human(timestamp: int) -> str:
if timestamp == min_timestamp:
return "(minimum)"
if timestamp == max_timestamp:
return "(maximum)"
dt = datetime.datetime.fromtimestamp(timestamp_to_unix(timestamp))
return dt.strftime("%a, %d %b %Y %H:%M:%S %z") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def epoch2localstr(timestamp=time(), fmat=\"%Y-%m-%d %H:%M:%S\"):\n return strftime(fmat, localtime(timestamp))",
"def epoch2UTCstr(timestamp=time(), fmat=\"%Y-%m-%d %H:%M:%S\"):\n return strftime(fmat, gmtime(timestamp))",
"def timestamp():\n return datetime.utcnow().strftime(\"%F %T\")",
"def _tim... | [
"0.79240173",
"0.76768285",
"0.7200962",
"0.71859604",
"0.7157436",
"0.70873976",
"0.70652544",
"0.7030897",
"0.7030897",
"0.7025387",
"0.7015704",
"0.70048666",
"0.69827145",
"0.6957344",
"0.69570935",
"0.69500625",
"0.6937256",
"0.693307",
"0.6917869",
"0.68773586",
"0.6877... | 0.6910722 | 19 |
Convert a Unix timestamp (floating point seconds since epoch) into a NILM timestamp (integer microseconds since epoch) | def unix_to_timestamp(unix):
return int(round(unix * 1e6)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_to_unix(timestamp):\n return timestamp / 1e6",
"def to_unix_time(timestamp):\n date = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')\n return int(time.mktime(date.timetuple()))*1000",
"def unix_time_nanos(dt):\n return timedelta_to_micros(dt - epoch)",
"def to_unix_milli(self):\n... | [
"0.78923976",
"0.7661996",
"0.7597118",
"0.735602",
"0.7300543",
"0.72853243",
"0.727143",
"0.72053033",
"0.714664",
"0.71329045",
"0.7118739",
"0.71153766",
"0.71015227",
"0.7090832",
"0.7062039",
"0.7041989",
"0.70192975",
"0.7012208",
"0.70073247",
"0.69814116",
"0.6978951... | 0.7627219 | 2 |
Convert a NILM timestamp (integer microseconds since epoch) into a Unix timestamp (floating point seconds since epoch) | def timestamp_to_unix(timestamp):
return timestamp / 1e6 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_unix_time(timestamp):\n date = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')\n return int(time.mktime(date.timetuple()))*1000",
"def unix_to_timestamp(unix):\n return int(round(unix * 1e6))",
"def epoch2datetime(t):\n return datetime.fromtimestamp(t/1000.0)",
"def to_unix(cls, timestam... | [
"0.7693606",
"0.753093",
"0.735114",
"0.73278725",
"0.73242176",
"0.7214598",
"0.7176891",
"0.71321976",
"0.7085821",
"0.7061672",
"0.70609254",
"0.7049853",
"0.70330596",
"0.70321506",
"0.7014287",
"0.69972247",
"0.69893765",
"0.6980199",
"0.6977914",
"0.6924856",
"0.6912029... | 0.8100784 | 0 |
Set require_grad attribute of the activations of this layer to True, such that the gradient will be saved in the activation tensor. | def requires_grad(self):
self._activations.requires_grad = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad",
"def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad",
"def set_feedback_requ... | [
"0.7414841",
"0.7414841",
"0.7162721",
"0.7050536",
"0.68681514",
"0.6537397",
"0.6536761",
"0.65167916",
"0.65075076",
"0.65049225",
"0.6498522",
"0.6498522",
"0.6498522",
"0.6498522",
"0.6488693",
"0.64594144",
"0.6391781",
"0.6391781",
"0.6391781",
"0.63715726",
"0.6295197... | 0.8051192 | 0 |
Same as the forward method, besides that the activations and linear activations are not saved in self. | def dummy_forward(self, x):
h = x.mm(self.weights.t())
if self.bias is not None:
h += self.bias.unsqueeze(0).expand_as(h)
h = self.forward_activationfunction(h)
return h | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n return self.activation_function(self.backbone_model(x))",
"def forward(self, x):\n pass",
"def forward(self, x):\n\t\tx = x.view(-1, self.input_size)\n\t\tout = x\n\t\t\n\t\t# Save the model inputs, which are considered the activations of the 0'th layer.\n\t\tactivations =... | [
"0.7696587",
"0.7636193",
"0.7602142",
"0.75568557",
"0.75488514",
"0.75345045",
"0.7504663",
"0.7484289",
"0.74820065",
"0.74820065",
"0.74500275",
"0.74420303",
"0.74372995",
"0.7434587",
"0.7429219",
"0.7418667",
"0.7417188",
"0.73975044",
"0.73852396",
"0.7337412",
"0.732... | 0.0 | -1 |
Propagate the input of the layer forward to the linear activation of the current layer (so no nonlinearity applied), without saving the linear activations. | def dummy_forward_linear(self, x):
a = x.mm(self.weights.t())
if self.bias is not None:
a += self.bias.unsqueeze(0).expand_as(a)
return a | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n\t\tx = x.view(-1, self.input_size)\n\t\tout = x\n\t\t\n\t\t# Save the model inputs, which are considered the activations of the 0'th layer.\n\t\tactivations = [out]\n\t\tlinearCombs = []\n\n\t\tfor layer in self.hidden_layers:\n\t\t\tlinearComb = layer(out)\n\t\t\tout = self.act(linearComb)... | [
"0.73968726",
"0.7367735",
"0.73378265",
"0.72530997",
"0.7204571",
"0.7072555",
"0.7066929",
"0.7051151",
"0.7049194",
"0.70065236",
"0.6987923",
"0.6955333",
"0.69394904",
"0.69282216",
"0.6917016",
"0.6899713",
"0.6894781",
"0.68933403",
"0.68775415",
"0.6863559",
"0.68487... | 0.67186487 | 31 |
Propagate the activation h backward through the backward mapping function g(h) = t(Qh + d) | def propagate_backward(self, h):
h = h.mm(self.feedbackweights.t())
if self.feedbackbias is not None:
h += self.feedbackbias.unsqueeze(0).expand_as(h)
return self.feedback_activationfunction(h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward_G(self):\n self.loss_G.backward()",
"def linear_activation_backward(dA, cache, activation):\n pass",
"def backward_hidden_activation(self, Y, d):\n # y = tanh(x) ==> dy/dx = (1 - tanh(x)^2) = (1 - y^2)\n return d * (1 - Y ** 2)",
"def sigmoid_backward(a, z, g_z):\r\n ... | [
"0.68786365",
"0.6867864",
"0.6615047",
"0.65797365",
"0.65652436",
"0.65652436",
"0.6551954",
"0.6540747",
"0.65339893",
"0.6449456",
"0.6431897",
"0.6411039",
"0.63963085",
"0.63957036",
"0.6386346",
"0.6366232",
"0.63532126",
"0.63340527",
"0.6333695",
"0.6331842",
"0.6323... | 0.72883886 | 0 |
Adds incomes to the SQLite DB from a JSON blob. | def import_incomes_from_json(json_path):
with open(json_path, "rt") as f:
expenses = json.load(f)
for exp in expenses:
exp_record = far_core.db.IncomeRecord(
date=datetime.datetime.strptime(exp[0], "%Y-%m-%dT%H:%M:%S.%fZ").date(),
amount=exp[1],
category=exp[2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_expenses_from_json(json_path: str):\n with open(json_path, \"rt\") as f:\n expenses = json.load(f)\n for exp in expenses:\n exp_record = far_core.db.ExpenseRecord(\n date=datetime.datetime.strptime(exp[0], \"%Y-%m-%dT%H:%M:%S.%fZ\").date(),\n amount=exp[1],\n ... | [
"0.6438482",
"0.5895376",
"0.58504933",
"0.5833467",
"0.5824965",
"0.5760895",
"0.57036936",
"0.5689061",
"0.5657639",
"0.56370056",
"0.5549808",
"0.55165136",
"0.55008954",
"0.5458344",
"0.54576606",
"0.5424737",
"0.5415092",
"0.53971153",
"0.5356982",
"0.5356726",
"0.533760... | 0.7174711 | 0 |
Sample a random position contained in a sprite. This is useful for handcrafted random agents. Note that this function does not uniformly sample with respect to sprite areas. Instead, it randomly selects a sprite, then selects a random position within that sprite. Consequently, small sprites are represented equally to l... | def sample_contained_position(self):
sprite = self._sprites[np.random.randint(len(self._sprites))]
return sprite.sample_contained_position() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandomPosition(self):\n\n #random.seed(1)#for repeatable results.\n #pos[0] = random.randint(0, self.width-1) # -1 since randint Returns a random integer N such that a <= N <= b.\n #pos[1] = random.randint(0, self.height-1)# -1 since randint Returns a random integer N such that a <= N <... | [
"0.6360241",
"0.6311611",
"0.62038076",
"0.6045359",
"0.6006172",
"0.5995479",
"0.59622943",
"0.59497637",
"0.5944109",
"0.5842172",
"0.57634485",
"0.56751513",
"0.56711155",
"0.5654988",
"0.5644654",
"0.5641509",
"0.5624186",
"0.5607512",
"0.55840975",
"0.5537526",
"0.553752... | 0.78666574 | 0 |
Check if a string is a valid UUID. | def is_valid_uuid_string(uuid_str):
return isinstance(uuid_str, str) and VALID_UUID_REGEX.match(uuid_str) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_uuid(uuid_string):\n try:\n UUID(uuid_string, version=4)\n return True\n except:\n return False",
"def check_uuid(uuid):\n try:\n converted = UUID(uuid, version=4)\n except ValueError:\n return False\n\n return str(converted) == uuid",
"def is_uuid... | [
"0.89210004",
"0.8351139",
"0.82712",
"0.8249813",
"0.79422736",
"0.79241806",
"0.78409225",
"0.7684529",
"0.7656513",
"0.7656513",
"0.7609126",
"0.7479075",
"0.7430325",
"0.74029744",
"0.7372589",
"0.7165484",
"0.69615036",
"0.6798446",
"0.673628",
"0.66985685",
"0.66835564"... | 0.8913077 | 1 |
Return the name of the current user, whether logged in or not. First, we'll try to deduce it solely from cookies, to avoid an unnecessary API query. For the cookiedetection method, see _get_username_from_cookies()'s docs. If our username isn't in cookies, then we're either using OAuth or we're probably not logged in, o... | def _get_username(self):
name = self._get_username_from_cookies()
if name:
return name
if self._oauth and self._login_info[0]:
return self._login_info[0]
return self._get_username_from_api() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_username(self):\n username = self.get_secure_cookie('username')\n if username is None:\n return None\n else:\n return username.decode('utf-8')",
"def get_current_username(self):\n username = self.get_secure_cookie('username')\n if username ... | [
"0.77095276",
"0.77095276",
"0.74957067",
"0.7465287",
"0.74131876",
"0.73816687",
"0.72192925",
"0.7209759",
"0.7183674",
"0.7166811",
"0.7157658",
"0.7118057",
"0.71170485",
"0.69675136",
"0.6952424",
"0.6950646",
"0.6927873",
"0.6920135",
"0.690112",
"0.690112",
"0.690112"... | 0.82763696 | 0 |
The Site's language code, like ``"en"`` or ``"es"``. | def lang(self):
return self._lang | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language_code(self) -> str:\n return pulumi.get(self, \"language_code\")",
"def get_lang(self):\n props = getToolByName(self.context,\n 'portal_properties')\n return props.site_properties.getProperty('default_language') or 'en'",
"def get_language(self) -> ... | [
"0.806508",
"0.80218065",
"0.78310937",
"0.7801867",
"0.77424365",
"0.76973027",
"0.76438516",
"0.7618568",
"0.7567719",
"0.7562287",
"0.75377035",
"0.7412597",
"0.7405118",
"0.73751295",
"0.73751295",
"0.73670673",
"0.73670673",
"0.73122424",
"0.72951007",
"0.729503",
"0.727... | 0.76499903 | 6 |
The UserAgent header sent to the API by the requests session. | def user_agent(self):
return self._session.headers["User-Agent"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UserAgent(self):\n return self._userAgent",
"def view_user_agent():\n\n headers = get_headers()\n\n return jsonify({\"user-agent\": headers[\"user-agent\"]})",
"def user_agent(self) -> str:\n return self.root_hartree.user_agent",
"def _set_agent_header(self):\n self._api_client... | [
"0.79459804",
"0.7529621",
"0.74557334",
"0.7440511",
"0.73630434",
"0.72554636",
"0.7090749",
"0.70216715",
"0.6891309",
"0.68533766",
"0.68533766",
"0.6747359",
"0.6717786",
"0.671194",
"0.66033787",
"0.6573724",
"0.6419079",
"0.6415228",
"0.6396904",
"0.6392646",
"0.635018... | 0.825074 | 0 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0)
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.76427615",
"0.74189496",
"0.7418079",
"0.72710466",
"0.72456723",
"0.72446615",
"0.7237539",
"0.72213703",
"0.7210107",
"0.7058935",
"0.6852219",
"0.6786084",
"0.67836976",
"0.6768417",
"0.67273885",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.... | 0.0 | -1 |
Add a colorbar to the right of an axis. | def _add_colorbar(self, fig, ax, norm, colormap, label=""):
import matplotlib as mpl
pos = ax.get_position()
cpos = [pos.x1 + 0.025, pos.y0 + 0.0125,
0.015, pos.height * 0.8] # this list defines (left, bottom, width, height
cax = fig.add_axes(cpos)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_colorbar(axes, data, label, **kwargs):\n figure = axes.get_figure()\n if 'right' not in kwargs:\n legend = make_axes_locatable(axes)\n padding = kwargs.pop('pad', 0.1)\n cax = legend.append_axes(\"right\", size=\"5%\", pad=padding)\n else:\n ... | [
"0.7418903",
"0.74102116",
"0.7179385",
"0.7166474",
"0.71613485",
"0.71574956",
"0.6979866",
"0.6953447",
"0.6930779",
"0.67889935",
"0.6788904",
"0.6615177",
"0.6534736",
"0.6524789",
"0.65199506",
"0.6450172",
"0.6343112",
"0.62681675",
"0.62551737",
"0.625244",
"0.6166455... | 0.7577057 | 1 |
Add a colorbar to the right of an axis. | def _add_colorbar(self, fig, ax, norm, colormap, label=""):
import matplotlib as mpl
pos = ax.get_position()
cpos = [pos.x1 + 0.025, pos.y0 + 0.0125,
0.015, pos.height * 0.8] # this list defines (left, bottom, width, height
cax = fig.add_axes(cpos)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_colorbar(axes, data, label, **kwargs):\n figure = axes.get_figure()\n if 'right' not in kwargs:\n legend = make_axes_locatable(axes)\n padding = kwargs.pop('pad', 0.1)\n cax = legend.append_axes(\"right\", size=\"5%\", pad=padding)\n else:\n ... | [
"0.7418903",
"0.74102116",
"0.7179385",
"0.7166474",
"0.71613485",
"0.71574956",
"0.6979866",
"0.6953447",
"0.6930779",
"0.67889935",
"0.6788904",
"0.6615177",
"0.6534736",
"0.6524789",
"0.65199506",
"0.6450172",
"0.6343112",
"0.62681675",
"0.62551737",
"0.625244",
"0.6166455... | 0.7577057 | 0 |
Compute the dropout rate for a given dataset. Dropout rate is the percent of rows that is invalid | def dropout_rate(dataset, dataset_level=False):
from core.data.dataset import Dataset
from numpy import isnan
if not isinstance(dataset, Dataset):
raise TypeError("Dataset has to be class core.data.dataset.Dataset")
if dataset_level:
data = dataset.data
drop_row = ((~isnan(data)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dropout_rate(data, sample_period=None):\n if sample_period is None:\n sample_period = get_sample_period(data)\n\n N_SAMPLES = 100\n if len(data) < N_SAMPLES:\n raise TooFewSamplesError\n\n index = _get_index(data)\n assert(index[-1] > index[0])\n duration = index[-1] - index... | [
"0.70734394",
"0.6407013",
"0.6053338",
"0.60318905",
"0.6019802",
"0.5997282",
"0.59813225",
"0.58873934",
"0.5853313",
"0.56782526",
"0.5663235",
"0.5656324",
"0.56531626",
"0.56433153",
"0.5629436",
"0.5511207",
"0.5482371",
"0.5482366",
"0.545724",
"0.5455467",
"0.5443219... | 0.6615234 | 1 |
Set up a specified sensor strategy for a filtered list of sensors. | def set_sampling_strategies(self, namespace, filters,
strategy_and_params, persist_to_redis=False):
req = JSONRPCRequest(
'set_sampling_strategies',
[namespace, filters, strategy_and_params, persist_to_redis]
)
result = yield self._send(req... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_sensors(self, settings):\n\n for sensor in settings.sensors: # for each sensor listed in yaml file\n s = Sensor(sensor, settings.sensors, settings, self.tiny_image,\n self.send_q)\n self.sensors.append(s) # add it to the list of sensors",
"def data_s... | [
"0.6212168",
"0.6047879",
"0.5984111",
"0.5862111",
"0.56338465",
"0.56225127",
"0.5609816",
"0.55850655",
"0.55054116",
"0.54190886",
"0.5383307",
"0.5377089",
"0.5354387",
"0.5349821",
"0.5322056",
"0.528664",
"0.5280848",
"0.5251738",
"0.5243184",
"0.52375025",
"0.52157575... | 0.48311678 | 57 |
Extract and return list of schedule block IDs from a JSON response. | def _extract_schedule_blocks(self, json_text, subarray_number):
data = json.loads(json_text)
results = []
if data['result']:
schedule_blocks = json.loads(data['result'])
for schedule_block in schedule_blocks:
if (schedule_block['sub_nr'] == subarray_number... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sb_ids_by_capture_block(self, capture_block_id):\n url = (yield self.get_sitemap())['capture_blocks'] + '/sb/' + capture_block_id\n response = yield self._http_client.fetch(url)\n response = json.loads(response.body)\n schedule_block_ids = response['result']\n raise tornado.g... | [
"0.6894451",
"0.6024687",
"0.57171553",
"0.53884",
"0.53079563",
"0.5235944",
"0.5219721",
"0.5123098",
"0.5094196",
"0.5088381",
"0.5043245",
"0.5033663",
"0.50309175",
"0.5025719",
"0.5008681",
"0.49947643",
"0.49406612",
"0.493699",
"0.49162883",
"0.48895472",
"0.4873885",... | 0.7273277 | 0 |
Add someone to a group. If the group does not already exist, it is created. Phone number should contain full country code, starting with +. The user must be in the channel to be added to the SMS group. | async def groupadd(bot: fido, channel: str, sender: str, args: List[str]):
if len(args) == 0:
return "Usage: " + IRC.commandPrefix + "groupadd <groupname> <nickname> <phonenumber>"
lines = []
print(f"Args: {args}")
number = ''
nickname = ''
group = ''
for arg in args:
if ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_group(user: User, group: Group) -> Result:\n if user.pw_name in group.gr_mem:\n return Result(State.unchanged)\n command([\"/usr/sbin/addgroup\", user.pw_name, group.gr_name])\n group.gr_mem.append(user.pw_name)\n return Result(State.success)",
"def add_user_to_group(backend, detail... | [
"0.7319026",
"0.70012885",
"0.6975936",
"0.6807812",
"0.67626345",
"0.6608218",
"0.6604799",
"0.6584964",
"0.64897585",
"0.64440286",
"0.643388",
"0.64286697",
"0.64208347",
"0.63954407",
"0.63441056",
"0.63386273",
"0.63230795",
"0.6320489",
"0.630707",
"0.629519",
"0.627943... | 0.72243863 | 1 |
Returns a logger with name set as given, and configured to the level given by the environment variable _LOGGING_LEVEL_ENVAR. | def get_logger(request, name="ot_api"):
# package_dir = os.path.dirname(module_path)
# config_filepath = os.path.join(package_dir, _LOGGING_CONFIG_FILE)
# if os.path.exists(config_filepath):
# try:
# logging.config.fileConfig(config_filepath)
# logger_set = True
# ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logger(name: str, level: typing.Optional[str] = None) -> logging.Logger:\n\n if level is None:\n level = 'INFO'\n\n level = os.environ.get('LOGLEVEL', level)\n\n logger = logging.getLogger(name)\n logger.setLevel(level)\n\n # Initialze the log level of the logger. Other possible value... | [
"0.7054101",
"0.6976178",
"0.69564885",
"0.6857762",
"0.6706148",
"0.6697224",
"0.6684151",
"0.6605958",
"0.6537116",
"0.6535315",
"0.6507628",
"0.64723676",
"0.645156",
"0.63975155",
"0.63804597",
"0.63747877",
"0.63729656",
"0.6353305",
"0.63409024",
"0.63368744",
"0.632537... | 0.6438538 | 13 |
Serialize datetime object to ISO format | def json_serial(obj):
if isinstance(obj, datetime):
serial = obj.isoformat()
return serial
raise TypeError ("Type not serializable") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_datetime(self, obj):\r\n if isinstance(obj, datetime.datetime):\r\n return obj.isoformat()\r\n raise TypeError(\"Type not serializable\")",
"def _serialize_datetime(val):\n return datetime_to_iso8601(val)",
"def convert_datetime_to_iso(datetime_obj):\r\n return ... | [
"0.82276547",
"0.81338626",
"0.7988841",
"0.7720635",
"0.77111363",
"0.76109856",
"0.7569869",
"0.756686",
"0.7540016",
"0.75189203",
"0.74136925",
"0.7394607",
"0.7360123",
"0.72224283",
"0.72161275",
"0.72057235",
"0.71958494",
"0.7195442",
"0.71755505",
"0.716382",
"0.7132... | 0.7167063 | 19 |
E = R(1 ((1 T / S) ^ (1 / F)) | def calculateSaleReturn(S,R,F,T):
if (T > S):
return 0
if F == 100:
return int(R- R*T/S)
return int(R * ( 1.0 - math.pow(float(S-T)/float(S) , (100.0/F)))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Fermi(En,T):\n ev = 1.60218e-19\n kb = 1.380e-23\n return 1/(1+np.exp(En/(kb*T/ev)))",
"def f0(E, fermi, T):\n return 1. / (1. + np.exp((E - fermi) / (k_B * T)))",
"def t(o, r):\n return (r/o)**2",
"def get_S_r(self):\n\n S_r = np.sum((self.eta_model - self.eta_exp) ** 2.)\n\n return... | [
"0.6795593",
"0.66594297",
"0.6638636",
"0.65409285",
"0.64965796",
"0.6493236",
"0.64126164",
"0.63901526",
"0.63594913",
"0.6344598",
"0.6307584",
"0.6305195",
"0.62881887",
"0.62469935",
"0.6245017",
"0.6242335",
"0.62332916",
"0.6226866",
"0.6157747",
"0.61547387",
"0.614... | 0.60779136 | 24 |
This will return a dataframe of mesa adaptive moving average for the given symbol across the given range | def mama(client, symbol, range="6m", col="close", fastlimit=0, slowlimit=0):
df = client.chartDF(symbol, range)
build = {col: df[col].values}
build["mama-{}".format(col)], build["fama-{}".format(col)] = t.MAMA(
df[col].values.astype(float), fastlimit=fastlimit, slowlimit=slowlimit
)
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sma(client, symbol, range=\"6m\", col=\"close\", periods=None):\n if periods is None:\n periods = [30]\n periods = tolist(periods)\n\n df = client.chartDF(symbol, range)\n\n build = {col: df[col].values}\n for per in periods:\n build[\"sma-{}\".format(per)] = t.EMA(df[col].values.a... | [
"0.64383775",
"0.6349082",
"0.62321246",
"0.6192183",
"0.6133744",
"0.6114046",
"0.60660505",
"0.60596275",
"0.60399264",
"0.6012137",
"0.59781194",
"0.5976309",
"0.5968341",
"0.59655726",
"0.5945568",
"0.59419024",
"0.59157807",
"0.59114736",
"0.59101224",
"0.5898787",
"0.58... | 0.6333711 | 2 |
This will return a dataframe of parabolic sar for the given symbol across the given range | def sar(
client,
symbol,
range="6m",
highcol="high",
lowcol="low",
acceleration=0,
maximum=0,
):
df = client.chartDF(symbol, range)
sar = t.SAR(
df[highcol].values.astype(float),
df[lowcol].values.astype(float),
acceleration=acceleration,
maximum=maxim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sarext(\n client,\n symbol,\n range=\"6m\",\n highcol=\"high\",\n lowcol=\"low\",\n startvalue=0,\n offsetonreverse=0,\n accelerationinitlong=0,\n accelerationlong=0,\n accelerationmaxlong=0,\n accelerationinitshort=0,\n accelerationshort=0,\n accelerationmaxshort=0,\n):\... | [
"0.54683787",
"0.52779174",
"0.5243521",
"0.5198385",
"0.50980455",
"0.508012",
"0.50593406",
"0.5048198",
"0.5036455",
"0.50329196",
"0.50227463",
"0.5008056",
"0.49852943",
"0.49674118",
"0.49571982",
"0.49538314",
"0.49523652",
"0.49279118",
"0.48937556",
"0.48650783",
"0.... | 0.6794634 | 0 |
Returns true if image contains black pixels. | def contains_black(image):
extrema = ImageStat.Stat(image).extrema
r = extrema[0][0]
g = extrema[1][0]
b = extrema[2][0]
if r == 0 and g == 0 and b == 0:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_blank( self ):\n for bit in self.pixels:\n if bit:\n return False\n # if we got here, all bits are False\n return True",
"def is_black( self, font_max_width, font_max_height ):\n if (self.width != font_max_width) or (self.height != font_max_height):\n return False\n for bit... | [
"0.7600084",
"0.71576995",
"0.69594336",
"0.69126666",
"0.6889662",
"0.6769178",
"0.67334336",
"0.66606975",
"0.66461545",
"0.65061605",
"0.63814247",
"0.63406545",
"0.62171984",
"0.6208997",
"0.6201711",
"0.61935437",
"0.6187557",
"0.61594856",
"0.61594856",
"0.6146994",
"0.... | 0.823544 | 0 |
Returns true if image contains black pixels. | def only_water_bodies(image):
extrema = ImageStat.Stat(image).extrema
r_l, r_h = extrema[0]
g_l, g_h = extrema[1]
b_l, b_h = extrema[2]
if r_l == g_l == b_l == r_h == g_h == b_h == 127:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_black(image):\n extrema = ImageStat.Stat(image).extrema\n r = extrema[0][0]\n g = extrema[1][0]\n b = extrema[2][0]\n\n if r == 0 and g == 0 and b == 0:\n return True\n\n return False",
"def is_blank( self ):\n for bit in self.pixels:\n if bit:\n return False\... | [
"0.8236099",
"0.7599672",
"0.71560854",
"0.6959882",
"0.6911102",
"0.6888868",
"0.67685765",
"0.6733093",
"0.6658197",
"0.66448003",
"0.65059805",
"0.63805157",
"0.6340955",
"0.6216223",
"0.6208136",
"0.61993134",
"0.6192921",
"0.61873364",
"0.6158511",
"0.6158511",
"0.614801... | 0.0 | -1 |
Convert a PIL.Image to opencv readable image. | def pil_to_opencv(pil_image):
open_cv_image = np.array(pil_image)
# Convert RGB to BGR
open_cv_image = open_cv_image[:, :, ::-1].copy()
return open_cv_image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opencv_to_pil(opencv_image):\n # Convert RGB to BGR\n opencv_image = cv2.cvtColor(opencv_image, cv2.COLOR_BGR2RGB)\n pil_image = Image.fromarray(opencv_image)\n\n return pil_image",
"def convert_imgpil(self, pic):\n curr_pic = cv2.cvtColor(pic, cv2.COLOR_BGR2RGBA)\n return Image.fro... | [
"0.75657105",
"0.69447476",
"0.69349277",
"0.6767946",
"0.6714264",
"0.66768193",
"0.6637803",
"0.66349536",
"0.6593623",
"0.6562439",
"0.65243876",
"0.6503841",
"0.6420061",
"0.64185685",
"0.6381608",
"0.63431305",
"0.63421994",
"0.6332812",
"0.62983567",
"0.62777305",
"0.62... | 0.7250674 | 1 |
Converts a opencv readable image to PIL.Image | def opencv_to_pil(opencv_image):
# Convert RGB to BGR
opencv_image = cv2.cvtColor(opencv_image, cv2.COLOR_BGR2RGB)
pil_image = Image.fromarray(opencv_image)
return pil_image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_imgpil(self, pic):\n curr_pic = cv2.cvtColor(pic, cv2.COLOR_BGR2RGBA)\n return Image.fromarray(curr_pic) # Convert image for PIL",
"def read_img(img_path:str) -> object:\n img = cv2.imread(img_path)\n return img",
"def read_image(image_path: str):\n\treturn cv.imread(image_path... | [
"0.7474325",
"0.72243446",
"0.71202993",
"0.70816153",
"0.70346075",
"0.70159465",
"0.70084906",
"0.6997545",
"0.69896716",
"0.6935454",
"0.6910456",
"0.6879457",
"0.6861066",
"0.68271935",
"0.68192875",
"0.6810771",
"0.6808273",
"0.6800702",
"0.6726575",
"0.67134756",
"0.671... | 0.76816833 | 0 |
Wrapper for tf.matmul to handle a 3D input tensor X. Will perform multiplication along the last dimension. | def matmul3d(X, W):
Xr = tf.reshape(X, [-1, tf.shape(X)[2]])
XWr = tf.matmul(Xr, W)
newshape = [tf.shape(X)[0], tf.shape(X)[1], tf.shape(W)[1]]
return tf.reshape(XWr, newshape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matmul_3d_by_2d(in_tensor, in_matrix, name):\n with tf.name_scope(name, default_name=\"Matmul_3D_by_2D\", values=[in_tensor, in_matrix]):\n tensor_shape = tf.shape(in_tensor)\n matrix_shape = tf.shape(in_matrix)\n return tf.reshape(tf.matmul(\n tf.reshape(in_tensor, [tensor_s... | [
"0.7388232",
"0.70595783",
"0.6666272",
"0.6648486",
"0.66293484",
"0.65410036",
"0.6523533",
"0.64212424",
"0.63774806",
"0.63591254",
"0.63506395",
"0.63181376",
"0.62571365",
"0.6218789",
"0.62185323",
"0.6211721",
"0.61155486",
"0.6047918",
"0.6034888",
"0.6033533",
"0.60... | 0.7767044 | 0 |
SubnetsSubnetPool a model defined in Swagger | def __init__(self):
self.swagger_types = {
'access_zone': 'str',
'aggregation_mode': 'str',
'alloc_method': 'str',
'description': 'str',
'ifaces': 'list[SubnetsSubnetPoolIface]',
'name': 'str',
'ranges': 'list[SubnetsSubnetPoolR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceIdArgs']]]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Inp... | [
"0.7146768",
"0.702516",
"0.69233406",
"0.68750745",
"0.6789589",
"0.66612107",
"0.6629695",
"0.66123956",
"0.64476854",
"0.6438149",
"0.6438149",
"0.6305287",
"0.6230455",
"0.6214354",
"0.61496407",
"0.602596",
"0.6023392",
"0.5999694",
"0.5943222",
"0.59135246",
"0.5911383"... | 0.5968098 | 18 |
Gets the aggregation_mode of this SubnetsSubnetPool. OneFS supports the following NIC aggregation modes. | def aggregation_mode(self):
return self._aggregation_mode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregation_mode(self, aggregation_mode):\n allowed_values = [\"roundrobin\", \"failover\", \"lacp\", \"fec\"]\n if aggregation_mode is not None and aggregation_mode not in allowed_values:\n raise ValueError(\n \"Invalid value for `aggregation_mode`, must be one of {0}\"... | [
"0.7046668",
"0.6042484",
"0.60362566",
"0.60362566",
"0.5865496",
"0.5745859",
"0.5734494",
"0.572302",
"0.53063035",
"0.5284168",
"0.514451",
"0.512114",
"0.5081119",
"0.50785935",
"0.5040278",
"0.50395733",
"0.4992571",
"0.49845603",
"0.49750435",
"0.49648976",
"0.49615124... | 0.77992386 | 0 |
Sets the aggregation_mode of this SubnetsSubnetPool. OneFS supports the following NIC aggregation modes. | def aggregation_mode(self, aggregation_mode):
allowed_values = ["roundrobin", "failover", "lacp", "fec"]
if aggregation_mode is not None and aggregation_mode not in allowed_values:
raise ValueError(
"Invalid value for `aggregation_mode`, must be one of {0}"
.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregation_mode(self):\n return self._aggregation_mode",
"def tag_mode(self, tag_mode):\n allowed_values = [\"all\", \"top\", \"custom\"] # noqa: E501\n if (self._configuration.client_side_validation and\n tag_mode not in allowed_values):\n raise ValueError(\n... | [
"0.6201632",
"0.4829967",
"0.47619343",
"0.47593033",
"0.47533628",
"0.47533628",
"0.46755812",
"0.46252024",
"0.46252024",
"0.4617803",
"0.45948148",
"0.45703322",
"0.45100906",
"0.449665",
"0.4482267",
"0.44757062",
"0.44463238",
"0.44431204",
"0.44327605",
"0.44026256",
"0... | 0.7710118 | 0 |
Gets the description of this SubnetsSubnetPool. A description of the pool. | def description(self):
return self._description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet(self) -> pulumi.Output[Optional['outputs.ResourceIdResponse']]:\n return pulumi.get(self, \"subnet\")",
"def subnets(self) -> pulumi.Output[Sequence[str]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> pulumi.Output[Sequence[str]]:\n return pulumi.get(self, \"su... | [
"0.65410477",
"0.6482354",
"0.6482354",
"0.64789593",
"0.6398242",
"0.6306688",
"0.62765485",
"0.61229205",
"0.6119427",
"0.6100774",
"0.6088884",
"0.60768193",
"0.60532725",
"0.59503126",
"0.5947634",
"0.5890577",
"0.5874006",
"0.58460695",
"0.5815302",
"0.5765604",
"0.57153... | 0.53603315 | 70 |
Sets the description of this SubnetsSubnetPool. A description of the pool. | def description(self, description):
if description is not None and len(description) > 128:
raise ValueError("Invalid value for `description`, length must be less than `128`")
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, sDescription):\n\t\tcall_sdk_function('PrlVirtNet_SetDescription', self.handle, sDescription)",
"def subnets(self, subnets):\n\n self._subnets = subnets",
"def sc_subnet(self, sc_subnet):\n \n self._sc_subnet = sc_subnet",
"def src_subnet(self, src_subnet):\n\n ... | [
"0.6380787",
"0.5776665",
"0.5513259",
"0.5502801",
"0.5491602",
"0.53885",
"0.5378597",
"0.5354776",
"0.53299105",
"0.53263426",
"0.53223777",
"0.5307503",
"0.52544296",
"0.52544296",
"0.5229771",
"0.5216342",
"0.52130693",
"0.5194477",
"0.5128552",
"0.5128552",
"0.5128552",... | 0.50336593 | 65 |
Gets the name of this SubnetsSubnetPool. The name of the pool. It must be unique throughout the given subnet.It's a required field with POST method. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_group_name(self) -> str:\n return pulumi.get(self, \"subnet_group_name\")",
"def subnet_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"subnet_group_name\")",
"def subnet_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"subnet_grou... | [
"0.73497295",
"0.71181536",
"0.7103576",
"0.7103576",
"0.6975695",
"0.68858784",
"0.66850966",
"0.6540356",
"0.6531634",
"0.6531634",
"0.63511825",
"0.63234025",
"0.63234025",
"0.6302717",
"0.6210384",
"0.6203277",
"0.6112852",
"0.61022234",
"0.6100887",
"0.6090951",
"0.60425... | 0.0 | -1 |
Sets the name of this SubnetsSubnetPool. The name of the pool. It must be unique throughout the given subnet.It's a required field with POST method. | def name(self, name):
if name is not None and len(name) > 32:
raise ValueError("Invalid value for `name`, length must be less than `32`")
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_id(self, subnet_id):\n self._subnet_id = subnet_id",
"def subnet_group_name(self) -> str:\n return pulumi.get(self, \"subnet_group_name\")",
"def _set_pool_name(self, pool_name):\n if _CNX_POOL_NAME_REGEX.search(pool_name):\n raise AttributeError(f\"Pool name '{pool_n... | [
"0.6074218",
"0.60503674",
"0.60151356",
"0.5923115",
"0.590467",
"0.590467",
"0.5867237",
"0.5757903",
"0.5745817",
"0.5644494",
"0.564288",
"0.55871063",
"0.5586776",
"0.5585627",
"0.55743086",
"0.54842025",
"0.5482448",
"0.54386467",
"0.54150635",
"0.5399001",
"0.5399001",... | 0.5170114 | 49 |
Sets the ranges of this SubnetsSubnetPool. List of IP address ranges in this pool. | def ranges(self, ranges):
self._ranges = ranges | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self, subnets):\n\n self._subnets = subnets",
"def setRange(self, x_range, y_range):\n pass",
"def subnets(self) -> Sequence[str]:\n return pulumi.get(self, \"subnets\")",
"def ranges(self):\n return self._ranges",
"def subnets(self) -> pulumi.Input[Sequence[pulumi.I... | [
"0.67228794",
"0.59278023",
"0.5787347",
"0.5768242",
"0.5750272",
"0.56791973",
"0.56791973",
"0.56791973",
"0.56791973",
"0.56331146",
"0.56140125",
"0.55526954",
"0.55389863",
"0.5458638",
"0.5458638",
"0.5458638",
"0.5458638",
"0.54410344",
"0.54360497",
"0.5429105",
"0.5... | 0.7128934 | 0 |
Gets the rebalance_policy of this SubnetsSubnetPool. Rebalance policy.. | def rebalance_policy(self):
return self._rebalance_policy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebalance_policy(self, rebalance_policy):\n allowed_values = [\"auto\", \"manual\"]\n if rebalance_policy is not None and rebalance_policy not in allowed_values:\n raise ValueError(\n \"Invalid value for `rebalance_policy`, must be one of {0}\"\n .format(a... | [
"0.65884155",
"0.60569364",
"0.5979603",
"0.56896055",
"0.5443392",
"0.54208374",
"0.54208374",
"0.5378019",
"0.5378019",
"0.53479934",
"0.52900136",
"0.5268837",
"0.5072071",
"0.50693744",
"0.5062869",
"0.50457704",
"0.5039955",
"0.50341755",
"0.50341755",
"0.50341755",
"0.5... | 0.8139084 | 0 |
Gets the sc_failover_policy of this SubnetsSubnetPool. SmartConnect IP failover policy. | def sc_failover_policy(self):
return self._sc_failover_policy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sc_failover_policy(self, sc_failover_policy):\n allowed_values = [\"round_robin\", \"conn_count\", \"throughput\", \"cpu_usage\"]\n if sc_failover_policy is not None and sc_failover_policy not in allowed_values:\n raise ValueError(\n \"Invalid value for `sc_failover_poli... | [
"0.6898092",
"0.63561916",
"0.61526406",
"0.61500436",
"0.6012601",
"0.5823861",
"0.5823861",
"0.5655938",
"0.55789185",
"0.5570546",
"0.555616",
"0.5497216",
"0.5497216",
"0.54784936",
"0.52825147",
"0.51408124",
"0.5047272",
"0.5037962",
"0.5036231",
"0.5036231",
"0.5023863... | 0.8147701 | 0 |
Gets the sc_subnet of this SubnetsSubnetPool. Name of SmartConnect service subnet for this pool. | def sc_subnet(self):
return self._sc_subnet | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_subnet(self) -> str:\n return pulumi.get(self, \"service_subnet\")",
"def service_runtime_subnet_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_runtime_subnet_id\")",
"def cluster_subnet(self) -> str:\n return pulumi.get(self, \"cluster_subnet\")",... | [
"0.7609892",
"0.7027893",
"0.69252676",
"0.6914663",
"0.67790663",
"0.6765147",
"0.67602944",
"0.6726223",
"0.6644179",
"0.6598673",
"0.6598673",
"0.6575017",
"0.6565587",
"0.650544",
"0.650544",
"0.6473729",
"0.6276193",
"0.627563",
"0.6240079",
"0.61633897",
"0.6129372",
... | 0.83138573 | 0 |
Sets the sc_subnet of this SubnetsSubnetPool. Name of SmartConnect service subnet for this pool. | def sc_subnet(self, sc_subnet):
self._sc_subnet = sc_subnet | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def src_subnet(self, src_subnet):\n\n self._src_subnet = src_subnet",
"def sc_subnet(self):\n return self._sc_subnet",
"def subnet_id(self, subnet_id):\n self._subnet_id = subnet_id",
"def dst_subnet(self, dst_subnet):\n\n self._dst_subnet = dst_subnet",
"def service_subnet(self... | [
"0.6747766",
"0.65289974",
"0.60689086",
"0.60044193",
"0.5653991",
"0.5557469",
"0.5398206",
"0.53878",
"0.5285486",
"0.5285486",
"0.5240064",
"0.5216857",
"0.5166137",
"0.513898",
"0.512097",
"0.50805783",
"0.50730646",
"0.4976473",
"0.4976473",
"0.4957406",
"0.49570826",
... | 0.8509438 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 34 |
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 |
compute how many columns values have been changed at the end of the transformation. | def compute_mutation_factor(att_data, newBest):
X2 = pd.DataFrame(index=att_data.index,
columns=xset, data=att_data[xset])
frames = [X2, newBest]
merge = pd.concat(frames)
merge.loc['Diff'] = merge.iloc[0] - merge.iloc[1]
changed_columns[row_index] = merge.loc['Diff'].astype(bo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def columns_count(self):\n if self.value.count != 0:\n return len(self.value[0])\n else:\n return 0",
"def number_of_loc_changes(self) -> int:\n raise NotImplementedError('not implemented')",
"def test_max_num_of_changed_columns(self):\n self._config['Regression th... | [
"0.6526498",
"0.63790566",
"0.61692965",
"0.6138007",
"0.60791665",
"0.60735327",
"0.605364",
"0.60477084",
"0.6038358",
"0.60348517",
"0.6018135",
"0.5999248",
"0.5981664",
"0.5968154",
"0.59143555",
"0.59015596",
"0.58669454",
"0.5848051",
"0.5843882",
"0.5838287",
"0.58281... | 0.53404444 | 85 |
Checks that the server properly generates a 404 status message when requesting a nonexistent URL object. | def run_404_check(http_conn, obj, hostname):
#GET request for the object /loadavg
http_conn.request("GET", obj, headers={"Host":hostname})
#Get the server's response
server_response = http_conn.getresponse()
#Check the response status code
assert server_response.status == httplib.NOT_FOUN... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handleStatus_404(self):\n log.err('HTTP Error 404')",
"def test_not_found(self):\n self._error_test(fitbit_exceptions.HTTPNotFound)",
"def test_not_existing_url(client):\n response = client.get('/not-exists')\n assert response.status_code == 404",
"def check_response_update_nonexisten... | [
"0.764341",
"0.7566126",
"0.75533015",
"0.7485968",
"0.7483502",
"0.74658805",
"0.73571515",
"0.73437613",
"0.73255426",
"0.73090976",
"0.7305266",
"0.7289082",
"0.72777605",
"0.7263893",
"0.7246395",
"0.7211469",
"0.7205335",
"0.7200515",
"0.71816766",
"0.7137802",
"0.711518... | 0.69670063 | 53 |
Check that the unsupported method supplied has either a NOT IMPLEMENTED or METHOD NOT ALLOWED response from the server. | def run_method_check(http_conn, method, hostname):
http_conn.request(method, "/loadavg", headers={"Host":hostname})
server_response = http_conn.getresponse()
assert (server_response.status == httplib.METHOD_NOT_ALLOWED or
server_response.status == httplib.NOT_IMPLEMENTED), \
"Server fai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unsupported_methods(self, app, method, logs):\n self._call(app, method=method, status=405)\n assert logs.entries == []",
"def test_unsupported_request_methods(self):\n unsupported_methods = [\"POST\", \"PUT\", \"PATCH\", \"DELETE\"]\n for method_name in unsupported_methods:\n... | [
"0.76389",
"0.75198126",
"0.7391555",
"0.73317313",
"0.73138714",
"0.716747",
"0.7125154",
"0.7123435",
"0.7100034",
"0.707472",
"0.70310396",
"0.69560313",
"0.6945674",
"0.6942764",
"0.6898435",
"0.6794875",
"0.678581",
"0.6759765",
"0.6758106",
"0.6745458",
"0.6742992",
"... | 0.0 | -1 |
A tool to determine the single observation astrometric precision. This is calculated in a bit of an ad hoc way. We call the overall parallax precision, then multiply by sqrt(N_obs), as this is the number that should have been used to determine | def get_single_obs_pos_err(G=None, V=None, V_IC=None, RA=None, Dec=None, DIST=None,
XGX=None, YGX=None, ZGX=None):
# Ensure inputs are provided
if V_IC is None:
print("You must provide a color index in the form of V_IC.")
return
if G is None and V is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(ground_truth, prediction):\n ground_truth = remove_duplicates(ground_truth)\n prediction = remove_duplicates(prediction)\n precision_score = count_a_in_b_unique(prediction, ground_truth) / float(len(prediction))\n assert 0 <= precision_score <= 1\n return precision_score",
"def preci... | [
"0.66291213",
"0.65281737",
"0.65103024",
"0.6478924",
"0.6458573",
"0.6406385",
"0.63949347",
"0.63949347",
"0.63949347",
"0.63949347",
"0.63949347",
"0.63949347",
"0.63904834",
"0.6380273",
"0.63714486",
"0.63714486",
"0.63714486",
"0.63714486",
"0.63714486",
"0.63714486",
... | 0.0 | -1 |
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`. | def queryset(self, request, queryset):
# Compare the requested value (either '80s' or '90s')
# to decide how to filter the queryset.
if self.value() == 'passed':
return queryset.filter(renewal_date__lt=datetime.datetime.now())
if self.value() == 'today':
return q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queryset(self, request, queryset):\n # Compare the requested value (either '80s' or 'other')\n # to decide how to filter the queryset.\n\n if self.value() is None:\n return queryset.all()\n\n return queryset.filter(firm__pk=self.value())",
"def queryset(self, request, q... | [
"0.7539624",
"0.7419145",
"0.72444373",
"0.7204026",
"0.7088753",
"0.7049072",
"0.69752824",
"0.6782803",
"0.6761786",
"0.6732641",
"0.66813517",
"0.6655251",
"0.6588337",
"0.64702547",
"0.6401302",
"0.6382562",
"0.6367945",
"0.63480246",
"0.6348006",
"0.62765294",
"0.6266501... | 0.64148825 | 14 |
Gets status of current job as string | def get_job_status(self):
if self.worker_thread is None:
return None
else:
return self.worker_thread.get_status() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self) -> str:\n return self._check_job_status()",
"def get_status(self):\n url = \"data_request?id=jobstatus&job=%d&plugin=zwave\" % self.id\n return self.vera.get(url)",
"def _get_job_status(self):\n total_hits = session.query(BoxHit).filter_by(training_job_id=self.id).c... | [
"0.82336414",
"0.77277565",
"0.77177054",
"0.7683568",
"0.765055",
"0.7611976",
"0.75931156",
"0.7571895",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"0.75184166",
"... | 0.7033229 | 85 |
Return the ENDF format string of a floating point number | def write_endf_float(value):
if(abs(value) < 1e-9 or abs(value) > 9.999e9):
raise ValueError("value is too small or too big")
valstring = "{:>13.6e}".format(value).replace('e','').replace('+0','+').replace('-0','-')
# with AMPX written files we use "-0" instead of "+0" for some reason
if( '+0' i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_float(val: float) -> str:\n if val < 0.0001:\n return \"{:.2e}\".format(val)\n else:\n return \"{:.4f}\".format(val)",
"def float_format(self):\n ...",
"def read_endf_float(string):\n if string.strip() == \"\":\n return 0.0\n if \".\" in string:\n strsp... | [
"0.6853804",
"0.6829253",
"0.67047584",
"0.64607596",
"0.6452822",
"0.63223237",
"0.6258043",
"0.62099755",
"0.6206193",
"0.6165801",
"0.6134066",
"0.6126407",
"0.61103994",
"0.605507",
"0.6016943",
"0.6016886",
"0.60008043",
"0.598836",
"0.5963678",
"0.5926003",
"0.5915084",... | 0.79210347 | 0 |
Convert to a dictionary on `keys`. | def dict(self, keys) -> dict:
return {k: self(k) for k in keys} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_to_dict(keys):\n return lambda row: dict(izip(keys, row))",
"def dict_keys(self, keys):\n return _(_dict(keys, self._))",
"def make_dict(keys, values):\n\n return dict(zip(keys, values))",
"def setup_dict(self, keys=None):\n keys = keys or []\n return {key: True for key in ... | [
"0.7378461",
"0.7076432",
"0.66986555",
"0.6534543",
"0.65160644",
"0.64518565",
"0.6331052",
"0.628006",
"0.6267647",
"0.619129",
"0.6179325",
"0.61710954",
"0.616365",
"0.6102621",
"0.60955125",
"0.6047556",
"0.60404044",
"0.6020093",
"0.60104835",
"0.59982044",
"0.59757394... | 0.7469684 | 0 |
View function for home page of site. | def index(request):
# Render the HTML template index.html
return render(
request,
'index.html',
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home_page(request):\r\n return render(request, 'ez_main/home_page.html')",
"def home(request):\r\n return render(request, 'home.html')",
"def homepage(request):\n\treturn render(request, 'core/homepage.html')",
"def homepage(req... | [
"0.8493426",
"0.84268916",
"0.83415145",
"0.83306193",
"0.82976943",
"0.8295291",
"0.8276345",
"0.82545686",
"0.82155704",
"0.8132563",
"0.81246215",
"0.81224865",
"0.8121264",
"0.81049734",
"0.8098485",
"0.80935514",
"0.80935514",
"0.80935514",
"0.80935514",
"0.80935514",
"0... | 0.0 | -1 |
Get ``upload_to`` compliant method which will always return a random filename however will also store the original filename in the model. | def original_random_filename_upload_to(path, filename_field):
g = random_filename_upload_to(path)
def f(instance, filename):
setattr(instance, filename_field, filename)
return g(instance, filename)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_filename_upload_to(path):\n\n def f(instance, filename):\n ext = filename.split('.')[-1]\n filename = '{0}.{1}'.format(uuid.uuid4().hex, ext)\n return os.path.join(path, filename)\n\n return f",
"def item_upload_to(instance, filename):\n import os\n file_root, file_ext... | [
"0.74831945",
"0.6629071",
"0.6584601",
"0.65798",
"0.6561389",
"0.65375376",
"0.6399633",
"0.6395201",
"0.6334883",
"0.62998915",
"0.6263544",
"0.62394667",
"0.62386394",
"0.6228465",
"0.6188894",
"0.6153854",
"0.6061185",
"0.597854",
"0.5954602",
"0.5949434",
"0.59485215",
... | 0.74165535 | 1 |
Wrap each generator invocation with the context manager | def _wrap_generator(self, func):
@functools.wraps(func)
def generator_context(*args, **kwargs):
gen = func(*args, **kwargs)
# Generators are suspended and unsuspended at `yield`, hence we
# make sure the grad mode is properly set every time the execution
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_context(self) -> Generator[None, None, None]:\n try:\n yield\n finally:\n pass",
"def with_iter(contextmanager):\n with contextmanager as iterable:\n for item in iterable:\n yield item",
"async def context(wrapped: AsyncGenerator) -> AsyncGen... | [
"0.734913",
"0.728714",
"0.71597064",
"0.7098914",
"0.705739",
"0.69353694",
"0.69248664",
"0.6832574",
"0.6710036",
"0.6622708",
"0.6599466",
"0.65704554",
"0.6555795",
"0.65336096",
"0.65003043",
"0.64926237",
"0.6468364",
"0.6395617",
"0.62900406",
"0.6287307",
"0.62844425... | 0.72039974 | 2 |
Property that is ``True`` if XSD validator has been fully parsed and built, ``False`` otherwise. For schemas the property is checked on all global components. For XSD components check only the building of local subcomponents. | def built(self) -> bool:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid(self) -> bool:\n are_populated = [bool(getattr(self, fld_nm)) for fld_nm in self.necessary_fields]\n return all(are_populated)",
"def is_valid(self):\n self.logger.debug(\"In is_valid.\")\n\n document = self._get_raw_doc()\n\n session = iHMPSession.get_session()\n ... | [
"0.65819836",
"0.64502954",
"0.64124745",
"0.63751405",
"0.6299663",
"0.6277532",
"0.626997",
"0.6248494",
"0.62199074",
"0.62199074",
"0.6218503",
"0.61914146",
"0.6165104",
"0.6137465",
"0.61175853",
"0.61074924",
"0.61000574",
"0.6086787",
"0.60751176",
"0.6067178",
"0.606... | 0.57019275 | 65 |
Property that returns the validation status of the XSD validator. It can be 'full', 'partial' or 'none'. | def validation_attempted(self) -> str:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_validate(self):\n return self.validate",
"def validate(self):\n return _libsbml.SBMLExternalValidator_validate(self)",
"def status(self) -> Optional['outputs.ValidatingAdmissionPolicyStatus']:\n return pulumi.get(self, \"status\")",
"def validation_required(self):\n return... | [
"0.66547513",
"0.6615809",
"0.660616",
"0.6555182",
"0.6461616",
"0.636392",
"0.63427705",
"0.6189923",
"0.6181256",
"0.6175523",
"0.6175523",
"0.6154305",
"0.61200064",
"0.6100166",
"0.60991067",
"0.6087579",
"0.60874295",
"0.60782105",
"0.6053385",
"0.6031864",
"0.5959862",... | 0.0 | -1 |
The reference element of the schema for the component instance. | def schema_elem(self) -> ElementType:
return self.elem | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReferencedElement(self):\n return _libsbml.SBaseRef_getReferencedElement(self)",
"def getReferencedElement(self):\n return _libsbml.Member_getReferencedElement(self)",
"def reference(self):\n \n return self._reference",
"def reference(self):\n return self._reference"... | [
"0.7293611",
"0.71506554",
"0.71457565",
"0.7132099",
"0.7132099",
"0.70699686",
"0.69538397",
"0.6904921",
"0.68841493",
"0.6641345",
"0.65973806",
"0.6536795",
"0.65191454",
"0.64318717",
"0.642226",
"0.6403344",
"0.63753295",
"0.63378876",
"0.6323613",
"0.6251697",
"0.6225... | 0.7199668 | 1 |
The ``'id'`` attribute of the component tag, ``None`` if missing. | def id(self) -> Optional[str]:
return self.elem.get('id') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self):\n return id(self._component)",
"def id(self) -> \"str\":\n return self._attrs.get(\"id\")",
"def id(self) -> Optional[str]: # noqa: D401\n return self._id",
"def id(self) -> Optional[str]:\n return pulumi.get(self, \"id\")",
"def id(self) -> Optional[str]:\n ... | [
"0.7664326",
"0.735246",
"0.73366094",
"0.73222905",
"0.73222905",
"0.73222905",
"0.73222905",
"0.73222905",
"0.73222905",
"0.7275152",
"0.7239944",
"0.7239944",
"0.72293514",
"0.71449035",
"0.7102151",
"0.70932084",
"0.70932084",
"0.70932084",
"0.70932084",
"0.70932084",
"0.... | 0.7930096 | 0 |
Returns the global XSD component that contains the component instance. | def get_global(self) -> 'XsdComponent':
if self.parent is None:
return self
component = self.parent
while component is not self:
if component.parent is None:
return component
component = component.parent
else: # pragma: no cover
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def component(self):\n return self._component",
"def component(self):\n return self._component",
"def get_datacomponent_of():\n global datacomponent_of\n\n if not datacomponent_of:\n datacomponent_of = stixhelpers.datacomponent_of()\n \n return datacomponent_of",
"def get_xsd... | [
"0.6286199",
"0.6286199",
"0.5958231",
"0.59462523",
"0.5786969",
"0.5684322",
"0.5503915",
"0.5438865",
"0.54345995",
"0.5433707",
"0.5423527",
"0.5423527",
"0.54030484",
"0.53593516",
"0.53278685",
"0.5326421",
"0.5277924",
"0.5210875",
"0.51856184",
"0.5184458",
"0.5184035... | 0.65396667 | 0 |
Property that is `None` for a simpleType. For a complexType is the instance's content if this is a model group or `None` if the instance's content is a simpleType. | def model_group(self) -> Optional['XsdGroup']:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field(self):\n return None",
"def simple_type(self) -> Optional['XsdSimpleType']:\n raise NotImplementedError()",
"def type(cls):\n return 'None'",
"def object(self):\n if not self.initial.get('content_type'):\n return None\n if not self.initial.get('object_i... | [
"0.57888377",
"0.57239676",
"0.56416565",
"0.55236816",
"0.55034775",
"0.54763633",
"0.54243916",
"0.5361706",
"0.5357385",
"0.53298587",
"0.5270638",
"0.52702963",
"0.5241103",
"0.52205056",
"0.5208793",
"0.51863956",
"0.51863956",
"0.5155559",
"0.515461",
"0.51545954",
"0.5... | 0.0 | -1 |
Returns `True` if the instance is a simpleType, `False` otherwise. | def is_simple() -> bool:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_simple(self) -> bool:\n return self.data in ('int', 'bool', 'float', 'str')",
"def _is_simple_type(cls):\n return all([\n AnnotationWrapper(anno).is_simple_in_opt_and_not_opt\n for anno in cls._used_annotations()\n ])",
"def is_simple(self): # -> bool:\n ... | [
"0.7518268",
"0.7465214",
"0.73016876",
"0.7215096",
"0.69040346",
"0.6799015",
"0.66962016",
"0.65748066",
"0.6570434",
"0.65286094",
"0.64456254",
"0.63326734",
"0.6330052",
"0.6305749",
"0.6235231",
"0.62327427",
"0.6174731",
"0.6113703",
"0.60313785",
"0.5956596",
"0.5944... | 0.6993229 | 4 |
Returns `True` if the instance is a complexType, `False` otherwise. | def is_complex() -> bool:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_complex(num):\n try:\n complex(num)\n except Exception:\n return False\n return True",
"def is_noncomplex(obj):\n if type(obj) is time.struct_time:\n return True\n return False",
"def has_complex_content(self) -> bool:\n raise NotImplementedError()",
"def is_... | [
"0.6991629",
"0.69816667",
"0.6833957",
"0.6578932",
"0.6540029",
"0.6409889",
"0.636288",
"0.6264476",
"0.6187651",
"0.6161092",
"0.61596096",
"0.61406785",
"0.61312276",
"0.61312276",
"0.6127211",
"0.6118144",
"0.61157477",
"0.61068714",
"0.605281",
"0.60324097",
"0.6022684... | 0.7926441 | 0 |
Returns `True` if the instance is an atomic simpleType, `False` otherwise. | def is_atomic(self) -> bool:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_simple(self) -> bool:\n return self.data in ('int', 'bool', 'float', 'str')",
"def is_simple(self): # -> bool:\n ...",
"def is_simple() -> bool:\n raise NotImplementedError()",
"def is_simple(self):\n return self.propertyValueType.lower() in ('float', 'double',\n ... | [
"0.6914265",
"0.68693805",
"0.6555886",
"0.6528922",
"0.64907455",
"0.64276314",
"0.6419494",
"0.6274755",
"0.59600633",
"0.5919877",
"0.5916017",
"0.5793506",
"0.57831866",
"0.5748955",
"0.57120603",
"0.5677762",
"0.56652784",
"0.56652784",
"0.56429327",
"0.56262517",
"0.562... | 0.61446124 | 8 |
Returns `True` if the instance is a list simpleType, `False` otherwise. | def is_list(self) -> bool:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_list ( self, s ):\r\n\t\treturn isinstance ( s, type( list () ) )",
"def _is_list(self):\n # TODO\n if self.is_int():\n return self.int() == 0\n else:\n return self.size_words() == 2 and self.tag() == 0 and self.field(1)._is_list()",
"def is_list(s_list):\n return isa(s_list, List)... | [
"0.8060436",
"0.78784156",
"0.7842831",
"0.7836651",
"0.77882046",
"0.7740499",
"0.77369875",
"0.76916593",
"0.76041573",
"0.75871533",
"0.7534671",
"0.7433835",
"0.73666215",
"0.7357901",
"0.7315213",
"0.73009807",
"0.7051911",
"0.7023228",
"0.69761056",
"0.6931018",
"0.6921... | 0.8116657 | 0 |
Returns `True` if the instance is a union simpleType, `False` otherwise. | def is_union(self) -> bool:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_union(typeval: Type) -> bool:\n return get_origin(typeval) is Union",
"def is_union(type_):\n if not is_class(type_):\n return False\n decl = class_traits.get_declaration(type_)\n return decl.class_type == class_declaration.CLASS_TYPES.UNION",
"def is_Union(tp):\n if tp is Union:\... | [
"0.7794229",
"0.7668272",
"0.7333075",
"0.72975063",
"0.71848375",
"0.7168663",
"0.6862358",
"0.6836746",
"0.6821814",
"0.65681845",
"0.6568023",
"0.6547009",
"0.6159125",
"0.58400714",
"0.5830706",
"0.5716111",
"0.57065916",
"0.5680575",
"0.5680575",
"0.5655759",
"0.56489915... | 0.70754385 | 6 |
Returns `True` if the instance is a complexType with mixed or elementonly content, `False` otherwise. | def has_complex_content(self) -> bool:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_complex() -> bool:\n raise NotImplementedError()",
"def has_mixed_content(self) -> bool:\n raise NotImplementedError()",
"def _is_compositional_type(content_type: str) -> bool:\n for valid_compositional_type in (\n SPECIFICATION_COMPOSITIONAL_TYPES + PYTHON_COMPOSITIONAL_TYPES\n ... | [
"0.73011476",
"0.6755603",
"0.6317352",
"0.63057965",
"0.6280332",
"0.62510455",
"0.61269337",
"0.61269337",
"0.61180156",
"0.60020965",
"0.5780087",
"0.5756838",
"0.57503045",
"0.5739632",
"0.5728757",
"0.572271",
"0.57003",
"0.56947136",
"0.5656418",
"0.5653285",
"0.564727"... | 0.7448259 | 0 |
Returns `True` if the instance is a complexType with mixed content, `False` otherwise. | def has_mixed_content(self) -> bool:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_complex_content(self) -> bool:\n raise NotImplementedError()",
"def is_complex() -> bool:\n raise NotImplementedError()",
"def _is_compositional_type(content_type: str) -> bool:\n for valid_compositional_type in (\n SPECIFICATION_COMPOSITIONAL_TYPES + PYTHON_COMPOSITIONAL_TYPES\... | [
"0.78021073",
"0.7548664",
"0.64474976",
"0.64036417",
"0.636686",
"0.6353591",
"0.6174185",
"0.61352396",
"0.59239054",
"0.58688146",
"0.5852847",
"0.58339196",
"0.58145285",
"0.58145285",
"0.58101594",
"0.57247716",
"0.5668973",
"0.56245",
"0.56166047",
"0.5589603",
"0.5577... | 0.70436835 | 2 |
Returns `True` if the instance is a complexType with elementonly content, `False` otherwise. | def is_element_only(self) -> bool:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_complex_content(self) -> bool:\n raise NotImplementedError()",
"def is_complex() -> bool:\n raise NotImplementedError()",
"def isElementOnly(self):\n return _libsbml.SBaseExtensionPoint_isElementOnly(self)",
"def is_structure(self) -> bool:\n return ATTRIBUTE.Structure.val... | [
"0.733595",
"0.7081945",
"0.6312721",
"0.6067637",
"0.6067637",
"0.60672486",
"0.59432083",
"0.591976",
"0.5910551",
"0.58211654",
"0.5772116",
"0.5766335",
"0.57159615",
"0.5702853",
"0.5668826",
"0.55882066",
"0.5545876",
"0.5509464",
"0.5507616",
"0.54215693",
"0.54055274"... | 0.6505828 | 2 |
Generate a new artifact with provided upload data. Data must be a file like object. Returns artifact ID or raises ArtifactsClientError if response checks failed | def generate_artifact(
self,
name="",
description="",
device_types_compatible="",
type="",
args="",
data=None,
):
# prepare upload data for multipart/form-data
files = ArtifactsClient.make_generate_meta(
{
"name": (N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_artifact(\n self, tenant_id, description=\"\", size=0, data=None, artifact_id=None\n ):\n # prepare upload data for multipart/form-data\n files = ArtifactsClient.make_upload_meta(\n {\n \"artifact_id\": artifact_id,\n \"description\": (None, ... | [
"0.7032806",
"0.66699713",
"0.5927136",
"0.5796215",
"0.57826996",
"0.56864136",
"0.5632859",
"0.5349856",
"0.5343114",
"0.5293764",
"0.52279186",
"0.5169445",
"0.51295877",
"0.50673395",
"0.5060113",
"0.4999796",
"0.49880886",
"0.4957866",
"0.49079955",
"0.4869165",
"0.48432... | 0.71066165 | 0 |
Gets the query set from the provided model based on the user's filters. | def get_queryset(self, model, query_str):
query_str = 'model.objects.' + query_str.lstrip('.')
return eval(query_str, dict(model=model)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter(self, _model, **kwargs):\n return _model.objects.filter(**kwargs)",
"def get_queryset(self):\n \n # throw error if no args pass in\n assert self.model or self.queryset, 'No queryset found'\n if self.queryset:\n return self.queryset\n else:\n ... | [
"0.7228663",
"0.6917118",
"0.6848763",
"0.6751418",
"0.67430216",
"0.6717327",
"0.6622515",
"0.6590264",
"0.6575244",
"0.65468127",
"0.65411204",
"0.652278",
"0.64419085",
"0.64040303",
"0.64040303",
"0.63984716",
"0.6395474",
"0.63912994",
"0.63756317",
"0.636691",
"0.634097... | 0.62154794 | 34 |
Get the web service configuration. | def service_config():
global _service_config
if not _service_config:
r = requests.get('https://tech.lds.org/mobile/ldstools/config.json')
r.raise_for_status()
_service_config = r.json()
return _service_config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_configuration(self) -> dict:\n return self.config",
"def get_config(self):\n return self.config",
"def _get_config(self):\n return self._get_from_settings(settings.INTEGRATIONS_PAGER_DUTY_WEBHOOKS, 'service_key')",
"def Get():\n return ServiceConfig() # Singleton decorator en... | [
"0.70686626",
"0.70344067",
"0.6984817",
"0.6951105",
"0.6927025",
"0.6927025",
"0.6903284",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
"0.6873277",
... | 0.6689421 | 82 |
Convert sparse matrix to tuple representation. | def sparse_to_tuple(sparse_mx):
def to_tuple(mx):
if not sp.isspmatrix_coo(mx):
mx = mx.tocoo()
coords = np.vstack((mx.row, mx.col)).transpose()
values = mx.data
shape = mx.shape
return coords, values, shape
if isinstance(sparse_mx, list):
for i in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_to_tuple(sparse_mx):\n def to_tuple(mx):\n if not sp.isspmatrix_coo(mx):\n mx = mx.tocoo()\n coords = np.vstack((mx.row, mx.col)).transpose()\n values = mx.data\n shape = mx.shape\n return coords, values, shape",
"def sparse_to_tuple(sparse_mx):\r\n ... | [
"0.85870504",
"0.82527",
"0.82527",
"0.8091624",
"0.7986327",
"0.602773",
"0.59843755",
"0.5971062",
"0.59706587",
"0.59447116",
"0.59443593",
"0.5910293",
"0.5910293",
"0.5910293",
"0.5910293",
"0.5910293",
"0.58940256",
"0.58499134",
"0.5845008",
"0.577404",
"0.5689886",
... | 0.82655305 | 3 |
Symmetrically normalize adjacency matrix. | def normalize_adj(adj):
adj = sp.coo_matrix(adj)
rowsum = np.array(adj.sum(1)) # D
d_inv_sqrt = np.power(rowsum, -0.5).flatten() # D^-0.5
d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.
d_mat_inv_sqrt = sp.diags(d_inv_sqrt) # D^-0.5
return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).tocoo() # ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)",
"def normalize_adj(adj):\n adj = sp.coo_mat... | [
"0.788518",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7698141",
"0.7691616",
"0.759434",
"0.7566608",
"0.7335597",
"0.72684425",
"0.688461",
"0.68616927",
"0.686005",
"0.6832041",
"0.682895",
"0.6750887",
"0.6... | 0.730491 | 14 |
Split channels (dimension 2) into multiple heads, becomes dimension 1). Must ensure `x.shape[1]` can be deviced by num_heads | def _split_heads(x, num_heads):
shape_lst = bert_utils.get_shape_list(x)
depth = shape_lst[-1]
batch = shape_lst[0]
seq = shape_lst[1]
# print(x.get_shape(), "===splitheads===")
splitted_x = tf.reshape(x, [tf.shape(x)[0], tf.shape(x)[1], \
num_heads, depth // num_heads])
return tf.transpose(splitted_x, [0, 2, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _split_heads(self, x: torch.Tensor) -> torch.Tensor:\n depth = x.size(-1)\n split_x = torch.reshape(x, (\n x.size(0), x.size(1),\n self._hparams.num_heads, depth // self._hparams.num_heads))\n return split_x.permute((0, 2, 1, 3))",
"def split_heads(x, num_heads):\n ... | [
"0.82976234",
"0.8222446",
"0.8079792",
"0.79285574",
"0.77406865",
"0.7666386",
"0.7629393",
"0.7629393",
"0.7629393",
"0.7629393",
"0.7629393",
"0.7629393",
"0.7629393",
"0.7622903",
"0.7601256",
"0.722677",
"0.6768115",
"0.63592714",
"0.63557863",
"0.6236408",
"0.5963263",... | 0.7862194 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.