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 |
|---|---|---|---|---|---|---|
Gets the user_id of this ImageIngressRequest. | def user_id(self):
return self._user_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_id(self):\n return self.id_user",
"def user_id(self):\n return self.status.user[\"id\"]",
"def user_id(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"user_id... | [
"0.72919804",
"0.72066116",
"0.720036",
"0.720036",
"0.71657246",
"0.71657246",
"0.7020362",
"0.70126265",
"0.70126265",
"0.6992793",
"0.6992793",
"0.6992793",
"0.6916133",
"0.6912134",
"0.69059247",
"0.6867621",
"0.68169165",
"0.6794983",
"0.6771934",
"0.67634124",
"0.669133... | 0.7364907 | 3 |
Sets the user_id of this ImageIngressRequest. | def user_id(self, user_id):
if user_id is None:
raise ValueError("Invalid value for `user_id`, must not be `None`") # noqa: E501
self._user_id = user_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id(self, user_id):\n\n self._user_id = user_id",
"def user_id(self, user_id):\n\n self._user_id = user_id",
"def user_id(self, user_id):\n\n self._user_id = user_id",
"def user_id(self, user_id):\n\n self._user_id = user_id",
"def user_id(self, user_id):\n\n self... | [
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.72680086",
"0.7210811",
"0.6845807",
"0.6584662",
"0.6505387",
"0.6454998",
"0.6395808",
"0... | 0.66360784 | 17 |
Gets the image_id of this ImageIngressRequest. | def image_id(self):
return self._image_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"image_id\")",
"def image_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"image_id\")",
"def image_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"image_id\")",
"def image_id(self) -> Opti... | [
"0.79333955",
"0.79333955",
"0.7666061",
"0.7666061",
"0.7623866",
"0.7623866",
"0.74060255",
"0.6876385",
"0.6750982",
"0.6749028",
"0.6717628",
"0.6690994",
"0.6667111",
"0.6542276",
"0.6501582",
"0.6413396",
"0.6171363",
"0.6136316",
"0.6091008",
"0.6064405",
"0.6020776",
... | 0.8027814 | 0 |
Sets the fetch_url of this ImageIngressRequest. | def fetch_url(self, fetch_url):
if fetch_url is None:
raise ValueError("Invalid value for `fetch_url`, must not be `None`") # noqa: E501
self._fetch_url = fetch_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url(self, image_url):\n\n self._url = image_url",
"def fetch(self, fetch: Fetch):\n self._fetch = fetch",
"def image_url(self, image_url: str):\n\n self._image_url = image_url",
"def image_url(self, image_url):\n\n self._image_url = image_url",
"def profile_image_url(self, p... | [
"0.6385813",
"0.6317776",
"0.62758493",
"0.6259357",
"0.6014248",
"0.59864223",
"0.58782375",
"0.5822749",
"0.5734965",
"0.5700897",
"0.56913674",
"0.5670132",
"0.5601388",
"0.55978256",
"0.5584024",
"0.5584024",
"0.5584024",
"0.5584024",
"0.5584024",
"0.5584024",
"0.5584024"... | 0.7596943 | 0 |
calculate probabilities using sigmoid | def predict_proba(self, X):
linear_model = X.dot(self.W) + self.b
prob = 1 / (1 + np.exp(-linear_model))
return prob | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\r\n #pred_x = (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))\r\n pred_x = 1.0 / (1.0 + np.exp(-x))\r\n return pred_x\r\n pass",
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
... | [
"0.7717837",
"0.7655938",
"0.7612347",
"0.7612347",
"0.7592803",
"0.7548761",
"0.7544438",
"0.7544438",
"0.7544438",
"0.7544438",
"0.7544438",
"0.7544438",
"0.7541703",
"0.7538108",
"0.7505563",
"0.7498209",
"0.74947983",
"0.74902207",
"0.74823165",
"0.74813074",
"0.7479476",... | 0.0 | -1 |
Get target data generators for training, testing, prediction. | def _get_target_data_generators(self, ephase,
list_iterstore, dict_iterstore):
X1_gen = None
X2_gen = None
if (ephase == NNModelPhase.PRE_TRAIN):
# Iterstore for dbparam1, TR_OUT and VAL_OUT
self.Xt_gen = list_iterstore[0].setd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_target_data_generators(self, ephase, list_iterstore, dict_iterstore):\n X1_gen = None\n X2_gen = None\n if (ephase == NNModelPhase.PREDICT or ephase == NNModelPhase.TEST):\n # Iterstore for dbparam1, TE_OUT\n X1_gen = list_iterstore[0].setdefault(Dataset.TE_OUT, ... | [
"0.7023369",
"0.6909531",
"0.6873213",
"0.66385406",
"0.66075665",
"0.6436247",
"0.63216937",
"0.6316493",
"0.62796324",
"0.62161946",
"0.61224335",
"0.60699147",
"0.60620767",
"0.60111725",
"0.59768015",
"0.59554696",
"0.5953158",
"0.5949151",
"0.59486556",
"0.594607",
"0.59... | 0.70219344 | 1 |
Copy the source location hint (`lineno` and `col_offset`) from the old to the new node if possible and return the new one. | def copy_location(new_node, old_node):
new_attributes = getattr(new_node, '_attributes', ()) or ()
old_attributes = getattr(old_node, '_attributes', ()) or ()
for attr in 'lineno', 'col_offset':
if attr in old_attributes and attr in new_attributes \
and hasattr(old_node, attr):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_missing_locations(node):\r\n def _fix(node, lineno, col_offset):\r\n attrs = getattr(node, '_attributes', ()) or ()\r\n if 'lineno' in attrs:\r\n if not hasattr(node, 'lineno'):\r\n node.lineno = lineno\r\n else:\r\n lineno = node.lineno\... | [
"0.6069932",
"0.55373293",
"0.53147703",
"0.5175728",
"0.514726",
"0.5007688",
"0.48660088",
"0.4853318",
"0.48059896",
"0.48031142",
"0.48007894",
"0.4750536",
"0.47375607",
"0.46948773",
"0.46795332",
"0.46773106",
"0.46692815",
"0.46600556",
"0.46571478",
"0.46545252",
"0.... | 0.70898926 | 0 |
Increment the line numbers of all nodes by `n` if they have line number attributes. This is useful to "move code" to a different location in a file. | def increment_lineno(node, n=1):
if 'lineno' in getattr(node, '_attributes', ()) or ():
node.lineno = getattr(node, 'lineno', 0) + n
for child in walk(node):
child._attributes = getattr(child, '_attributes', ()) or ()
if 'lineno' in getattr(child, '_attributes', ()) or ():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_node_index(self):\n self.node_index += 1",
"def set_lineno(node, children):\n for i, child in enumerate(children):\n child = child[0]\n #if child does not have lineno, add it \n if not hasattr(child, \"lineno\"):\n setattr(child, \"lineno\", node.lineno)\n\... | [
"0.64601266",
"0.6406021",
"0.6296789",
"0.6268839",
"0.6213082",
"0.6208723",
"0.6100943",
"0.5953907",
"0.58705515",
"0.5744056",
"0.5719048",
"0.5698512",
"0.5642049",
"0.56205755",
"0.56098205",
"0.5587294",
"0.5587128",
"0.5556833",
"0.551955",
"0.55012184",
"0.548361",
... | 0.82735175 | 0 |
Like `iter_child_nodes` but returns a list. | def get_child_nodes(node):
return list(iter_child_nodes(node)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_child_nodes(self):\n parts = []\n for child in sorted(self.children, key=lambda c: c.start):\n child_part = (child.start, child.end, child)\n parts.append(child_part)\n return parts",
"def get_children(self):\n return NodeList(self._my_map['childNodes'])"... | [
"0.7759051",
"0.76859593",
"0.75044936",
"0.7251256",
"0.7251256",
"0.7236841",
"0.72335047",
"0.72286314",
"0.7218785",
"0.71713066",
"0.71700215",
"0.7160709",
"0.71347654",
"0.71161556",
"0.7083401",
"0.7079386",
"0.7079386",
"0.7004263",
"0.6996853",
"0.69955",
"0.6987778... | 0.86886746 | 0 |
Creates a temporary directory, removing it and everything in it when the context exits. For files you can use | def tempdir(*args, **kwargs):
d = mkdtemp(*args, **kwargs)
try:
yield d
finally:
rmtree(d) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tmp_dir():\n tmpdir = tempfile.mkdtemp()\n yield tmpdir\n shutil.rmtree(tmpdir)",
"def cleanup_temp_dir(context):\n\n try:\n os.chdir(context.cwd)\n except:\n print(\"Current working file record does not exist\")\n\n try:\n context.tempdir.cleanup()\n except:\n ... | [
"0.8327845",
"0.8242248",
"0.820278",
"0.8189135",
"0.8157923",
"0.8153317",
"0.8145342",
"0.8144999",
"0.8104914",
"0.8057752",
"0.8029384",
"0.7936613",
"0.79235435",
"0.790472",
"0.7889978",
"0.7871442",
"0.7836462",
"0.78137827",
"0.7770494",
"0.767734",
"0.7674889",
"0... | 0.7782289 | 18 |
Test for equality with ``==``. | def __eq__(self, obj):
return assert_(self.obj == obj, '%r != %r' % (self.obj, obj)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_equal(self, a, b):\n return a == b",
"def testEquality(self):\n pass",
"def is_equal(self, a, b):\n return a is b",
"def equals(x, y):\n return x == y",
"def test_eq(self):\n dummy = DummyCryptographicObject()\n self.assertTrue(dummy == dummy)",
"def values_eq... | [
"0.7926635",
"0.78102934",
"0.7647982",
"0.7621915",
"0.7514688",
"0.7442282",
"0.74086034",
"0.7385574",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
"0.7273519",
... | 0.6707902 | 96 |
Test for inequality with ``!=``. | def __ne__(self, obj):
return assert_(self.obj != obj, '%r == %r' % (self.obj, obj)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, rhs):\n return not self.__eq__(rhs)",
"def __ne__(left, right):\n return (not (left == right))",
"def __ne__(self, values):\n self = self.__eq__(values)\n return self.__invert__()",
"def nexact(cls, lhs, rhs):\n return lhs != rhs",
"def not_equal(lhs, rhs... | [
"0.78504074",
"0.7636881",
"0.74306875",
"0.7427986",
"0.7406329",
"0.7328774",
"0.7327627",
"0.72552085",
"0.725391",
"0.7253823",
"0.7253823",
"0.72504973",
"0.72313046",
"0.72305256",
"0.72305256",
"0.72305256",
"0.72305256",
"0.72285306",
"0.72285306",
"0.7217608",
"0.720... | 0.0 | -1 |
Creates a basic unittest test loader using this reporter. This | def test_loader(cls):
return _test_loader_factory(cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createTestSuite():\n import tests.functional.tests as functional\n return unittest.TestLoader().loadTestsFromModule(functional)",
"def setUpClass(cls):\n cls.run_mgr = runner(['start', 'execute'], ['stop'])\n cls.load_mgr = loader(verbose=False, recursive=True)\n cls.load_mgr.set_addon... | [
"0.6788594",
"0.65385556",
"0.64565843",
"0.644332",
"0.64290255",
"0.64290255",
"0.6279315",
"0.6230456",
"0.6225771",
"0.6222871",
"0.6202562",
"0.6198674",
"0.61960477",
"0.6195475",
"0.6167846",
"0.6145564",
"0.6115673",
"0.61139894",
"0.61038935",
"0.60941917",
"0.608361... | 0.7221888 | 0 |
Get the color for rank 1, 2, or 3. Gold, Silver, or Bronze. If higher than rank 3, get a random color. | def get_color(rank):
if rank == 1:
color = int(0xffd700)
elif rank == 2:
color = int(0xc0c0c0)
elif rank == 3:
color = int(0xcd7f32)
else:
color = random.randint(1, 16777215)
return discord.Color(color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_random_color(self):\r\n random_number = random.random()\r\n if random_number <= 1 / 3.0:\r\n return Color.RED\r\n else:\r\n return Color.BLACK",
"def _random_color(self):\n levels = range(0, 256)\n return tuple(random.choice(levels) for _ in range... | [
"0.74847656",
"0.7349744",
"0.70214736",
"0.6981014",
"0.6901432",
"0.6813053",
"0.6770108",
"0.6759539",
"0.67513776",
"0.66745436",
"0.66514397",
"0.65750384",
"0.6574133",
"0.65668786",
"0.6446063",
"0.64443475",
"0.6414915",
"0.63887674",
"0.6373619",
"0.6372905",
"0.6280... | 0.8297967 | 0 |
Returns True if line segments a1b1 and a2b2 intersect. | def intersect(a1, b1, a2, b2):
return ccw(a1, b1, a2) != ccw(a1, b1, b2) and ccw(a2, b2, a1) != ccw(a2, b2, b1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersects_segment(\n self, a: Tuple[float, float], b: Tuple[float, float]\n ) -> bool:\n assert len(a) == 2\n assert len(b) == 2\n return bool(lib.cpBBIntersectsSegment(self, a, b))",
"def is_intersect(line_a, line_b):\n # Find the four orientations needed for general and s... | [
"0.79986954",
"0.7785552",
"0.7738122",
"0.75132155",
"0.7485431",
"0.7475019",
"0.72003686",
"0.71722126",
"0.71539545",
"0.70528436",
"0.6921835",
"0.68022656",
"0.680213",
"0.6783449",
"0.6769245",
"0.67416507",
"0.6681959",
"0.6674011",
"0.66401654",
"0.66297746",
"0.6629... | 0.69172287 | 11 |
Computes the recall @ k. | def compute(self, pred: torch.Tensor, target: torch.Tensor) \
-> torch.Tensor:
# If 2-dimensional, select the highest score in each row
if len(target.size()) == 2:
target = target.argmax(dim=1)
ranked_scores = torch.argsort(pred, dim=1)[:, -self.top_k:]
recalled ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall_at_k(self, positions, k, num_samples):\n return 1.0 * sum(i <= k for i in positions) / num_samples",
"def recall_at(\n ks: torch.Tensor, scores: torch.Tensor, labels: torch.Tensor\n) -> torch.Tensor:\n\n ks, scores, labels = _check_inputs(ks, scores, labels)\n _, _, topk_labels = _extr... | [
"0.76240575",
"0.7199539",
"0.71977645",
"0.71006775",
"0.69767195",
"0.6848916",
"0.6728094",
"0.6631682",
"0.6628342",
"0.64582336",
"0.64439845",
"0.63412124",
"0.6306473",
"0.6300426",
"0.6275905",
"0.6230507",
"0.6208696",
"0.62065095",
"0.6175473",
"0.615985",
"0.615985... | 0.0 | -1 |
Convert file name into a safe string. | def format_filename(fname):
return ''.join(convert_valid(one_char) for one_char in fname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_filename(name):\n if not isinstance(name, str):\n raise ValueError(\"File name is not a string\")\n if not name:\n raise ValueError(\"File name cannot be empty\")\n name = _percent_escapes_re.sub('_', name)\n if '/' in name:\n name = name[name.rindex('/') + 1:]\n if... | [
"0.7655492",
"0.7532049",
"0.7385799",
"0.7300976",
"0.72844356",
"0.7206055",
"0.7159577",
"0.7042953",
"0.7029593",
"0.7006378",
"0.70005983",
"0.6993339",
"0.69737864",
"0.69587135",
"0.6948461",
"0.693894",
"0.693894",
"0.693894",
"0.69384545",
"0.69374907",
"0.693378",
... | 0.6960034 | 13 |
Convert a character into '_' if invalid. | def convert_valid(one_char):
valid_chars = "-_.%s%s" % (string.ascii_letters, string.digits)
if one_char in valid_chars:
return one_char
else:
return '_' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_keeping_underscores(cls, value):\r\n return INVALID_CHARS.sub('_', value)",
"def _with_underscore(cls, key):\n try:\n return key.replace(\"-\", \"_\")\n except AttributeError:\n return key",
"def non_secret_char(c):\n return c",
"def clean(value):\r\n ... | [
"0.70235366",
"0.6770715",
"0.67471325",
"0.6703061",
"0.66813403",
"0.66652775",
"0.65320665",
"0.6442786",
"0.6432533",
"0.64069337",
"0.63889426",
"0.632381",
"0.6281248",
"0.62803006",
"0.62568724",
"0.6252624",
"0.6206783",
"0.61948264",
"0.61459035",
"0.61348164",
"0.61... | 0.7681193 | 0 |
Remove stopwords of a given sentence | def remove_stopwords(text):
text_split=text.split()
text_split=[word for word in text_split if word not in stopwords.words('spanish')]
return text_split | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stopwords_set(sentence: str, stop_words: Collection[str]) ... | [
"0.838035",
"0.8365179",
"0.8348373",
"0.82454425",
"0.8207006",
"0.81841",
"0.8173266",
"0.815947",
"0.8141942",
"0.812814",
"0.8066427",
"0.7976647",
"0.79604775",
"0.79133135",
"0.78851795",
"0.7873118",
"0.78568643",
"0.78416693",
"0.7785133",
"0.7783995",
"0.7763513",
... | 0.80043656 | 11 |
Conv layer followed by batchnorm and possibly Swish activation | def conv_layer(n_in_filters, n_filters, ker_size, stride=1,
depthwise=False, zero_bn=False, act=True) :
bn = nn.BatchNorm2d(n_filters)
nn.init.constant_(bn.weight, 0. if zero_bn else 1.)
conv = nn.Conv2d(n_in_filters, n_filters, ker_size, stride=stride,padding=ker_size//2,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n channels: int,\n kernel_size: int=15,\n activation: nn.Layer=nn.ReLU(),\n norm: str=\"batch_norm\",\n causal: bool=False,\n bias: bool=True,\n adaptive_scale: bool=False,\n ... | [
"0.7071443",
"0.7052393",
"0.69058734",
"0.68121254",
"0.6764757",
"0.6760634",
"0.67577064",
"0.6733552",
"0.67044973",
"0.6679216",
"0.6655468",
"0.6652834",
"0.66267353",
"0.6600876",
"0.65719825",
"0.6558256",
"0.6558124",
"0.6544699",
"0.6533463",
"0.65325254",
"0.652606... | 0.6422909 | 25 |
Tests whether ``put_partial_emoji_inline_data_into`` works as intended for a unicode emoji. | def test__put_partial_emoji_inline_data_into__1():
data = {}
emoji = BUILTIN_EMOJIS['heart']
put_partial_emoji_inline_data_into(emoji, data)
vampytest.assert_in('emoji_name', data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__put_partial_emoji_inline_data_into__2():\n data = {}\n emoji = Emoji.precreate(202209090000, name = 'Eliminator')\n \n put_partial_emoji_inline_data_into(emoji, data)\n \n vampytest.assert_in('emoji_name', data)\n vampytest.assert_in('emoji_id', data)",
"def test__put_partial_emoji... | [
"0.80866784",
"0.78588593",
"0.6798352",
"0.6628056",
"0.62552017",
"0.6205751",
"0.6145855",
"0.5583427",
"0.55749196",
"0.55677676",
"0.5542862",
"0.5537958",
"0.5310084",
"0.52721083",
"0.52474815",
"0.520294",
"0.51878256",
"0.51708084",
"0.51614255",
"0.5127898",
"0.5062... | 0.78640825 | 1 |
Tests whether ``put_partial_emoji_inline_data_into`` works as intended for a unicode emoji. | def test__put_partial_emoji_inline_data_into__2():
data = {}
emoji = Emoji.precreate(202209090000, name = 'Eliminator')
put_partial_emoji_inline_data_into(emoji, data)
vampytest.assert_in('emoji_name', data)
vampytest.assert_in('emoji_id', data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__put_partial_emoji_inline_data_into__1():\n data = {}\n emoji = BUILTIN_EMOJIS['heart']\n \n put_partial_emoji_inline_data_into(emoji, data)\n \n vampytest.assert_in('emoji_name', data)",
"def test__put_partial_emoji_inline_data_into__0():\n data = {}\n \n put_partial_emoji_in... | [
"0.786478",
"0.78588694",
"0.67995495",
"0.6628189",
"0.62551105",
"0.6208521",
"0.61467546",
"0.55858576",
"0.5577098",
"0.55662906",
"0.55449116",
"0.5539255",
"0.5310914",
"0.5274821",
"0.5247798",
"0.5204306",
"0.5187999",
"0.51732767",
"0.51634437",
"0.51296836",
"0.5065... | 0.8086661 | 0 |
The flow detail name this storage unit is associated with. | def flow_name(self):
# This never changes (so no read locking needed).
return self._flowdetail.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self.device.device_data[self.device_id]['name']",
"def name(self):\n return f\"{get_device_name(self._data, 0, self._name)}\"",
"def name(self):\n if self.metadata and \"name\" in self.metadata:\n return self.metadata[\"name\"]\n else:\n ... | [
"0.66332996",
"0.66266453",
"0.66241026",
"0.6561359",
"0.655795",
"0.6552185",
"0.6524531",
"0.6524531",
"0.65157664",
"0.65157664",
"0.65084565",
"0.65080136",
"0.6505031",
"0.64976925",
"0.64917374",
"0.6483603",
"0.64810526",
"0.64749646",
"0.64729816",
"0.64708287",
"0.6... | 0.7923541 | 0 |
Sets the intention of an atom given an atoms name. | def set_atom_intention(self, atom_name, intention):
source, clone = self._atomdetail_by_name(atom_name, clone=True)
if source.intention != intention:
clone.intention = intention
self._with_connection(self._save_atom_detail, source, clone) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setName(self, name):\n self.name = str(name)",
"def setName(self, name): \n\n self._name = name",
"def setName(self, *args):\n return _libsbml.Reaction_setName(self, *args)",
"def setName(self, name):\n self._name = name",
"def setName(self, name):\n self._name... | [
"0.61079407",
"0.5993148",
"0.59366035",
"0.59321064",
"0.59321064",
"0.59172493",
"0.59172493",
"0.59172493",
"0.59172493",
"0.588289",
"0.58752716",
"0.58752716",
"0.5801094",
"0.5795953",
"0.57899904",
"0.57539606",
"0.5684719",
"0.56466454",
"0.5640301",
"0.56213015",
"0.... | 0.80562615 | 0 |
Get dataset instances from the recipe. | def get_datasets(recipe):
# "datasets"
return {dataset: get_instance(**par) for dataset, par in recipe.items()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_dataset(self):\n dataset = []\n for i in range(self._num_instances):\n dataset.append(self._generate_instance())\n description = {\"num_instances\": self._num_instances,\n \"num_curves\": self._num_curves,\n \"num_eval_points\... | [
"0.6571686",
"0.65596515",
"0.64495486",
"0.6333112",
"0.63033646",
"0.6302469",
"0.6296662",
"0.62876457",
"0.6273768",
"0.6235459",
"0.62130463",
"0.61623687",
"0.61354667",
"0.60952777",
"0.60874087",
"0.60664535",
"0.605857",
"0.60456413",
"0.6021397",
"0.6018103",
"0.601... | 0.83624476 | 0 |
Approximate conversion of wavelength to RGB value | def wavelength_to_rgb(w: float, gamma: float = 1.) -> ndarray:
if w <= BLU:
c = (BLU - w) / 90, 0., 1. # violet - blue
elif w <= CYA:
c = 0., (w - BLU) / BC, 1. # blue - cyan
elif w <= GRN:
c = 0., 1., (GRN - w) / CG # cyan - green
elif w <= YEL:
c = (w - GRN) / GY, 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelength_to_rgb(wavelength, gamma=0.8, float_values=False):\n wavelength *= 10. ** 9.\n if 380. <= wavelength < 440.:\n attenuation = 0.3 + 0.7 * (wavelength - 380.) / (440. - 380.)\n r = ((-(wavelength - 440.) / (440. - 380.)) * attenuation) ** gamma\n g = 0.0\... | [
"0.74345064",
"0.7338989",
"0.7334512",
"0.7255724",
"0.678338",
"0.6542148",
"0.65303266",
"0.6474545",
"0.6416113",
"0.6371208",
"0.6307654",
"0.6303548",
"0.6283774",
"0.62701786",
"0.62700117",
"0.6214549",
"0.61889523",
"0.6178339",
"0.6173803",
"0.6127458",
"0.60953075"... | 0.78364927 | 0 |
Transform linear RGB values to nonlinear RGB values. Rec. 709 is ITUR Recommendation BT. 709 (1990) ``Basic Parameter Values for the HDTV Standard for the Studio and for International Programme Exchange'', | def gamma_correct(self, rgb) -> ndarray:
if self.value.gamma == GAMMA_REC709:
# Rec.709 gamma correction
small = rgb < GAMMA_REC709_CC
rgb[small] *= GAMMA_REC709_FACTOR
rgb[~small] = (1.099 * np.power(rgb[~small], 0.45)) - 0.099
else:
# Nonline... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sRGB_to_sRGB_linear(rgb):\n return np.where(rgb <= 0.03928, rgb / 12.92, np.power((rgb + 0.055) / 1.055, 2.4))",
"def linearFromsRGB(c):\n if c <= 0.04045:\n return c / 12.92\n return math.pow((0.055 + c) / 1.055, 2.4)",
"def sRGB_linear_to_sRGB(rgb_linear):\n\n \"\"\"sRGB standard for gamma inv... | [
"0.78113",
"0.7259781",
"0.7250231",
"0.7224572",
"0.6975645",
"0.6861211",
"0.6766095",
"0.67328876",
"0.6724876",
"0.6666742",
"0.6643549",
"0.660579",
"0.65431714",
"0.65370923",
"0.6351555",
"0.6328644",
"0.6316394",
"0.6259769",
"0.62544197",
"0.62523633",
"0.62266505",
... | 0.0 | -1 |
Transform linear RGB values to nonlinear RGB values. Rec. 709 is ITUR Recommendation BT. 709 (1990) ``Basic Parameter Values for the HDTV Standard for the Studio and for International Programme Exchange'', | def norm_rgb(rgb: ndarray) -> ndarray:
greatest = max(rgb)
if greatest > 0:
rgb /= greatest
return rgb | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sRGB_to_sRGB_linear(rgb):\n return np.where(rgb <= 0.03928, rgb / 12.92, np.power((rgb + 0.055) / 1.055, 2.4))",
"def linearFromsRGB(c):\n if c <= 0.04045:\n return c / 12.92\n return math.pow((0.055 + c) / 1.055, 2.4)",
"def sRGB_linear_to_sRGB(rgb_linear):\n\n \"\"\"sRGB standard for gamma inv... | [
"0.78113",
"0.7259781",
"0.7250231",
"0.7224572",
"0.6975645",
"0.6861211",
"0.6766095",
"0.67328876",
"0.6724876",
"0.6666742",
"0.6643549",
"0.660579",
"0.65431714",
"0.65370923",
"0.6351555",
"0.6328644",
"0.6316394",
"0.6259769",
"0.62544197",
"0.62523633",
"0.62266505",
... | 0.0 | -1 |
Derivative of the sigmoid function | def sigmoid_prime(x):
return sigmoid(x) * (1 - sigmoid(x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_derivative(x):\n return x * (1-x)",
"def sigmoid_derivative(x):\n return x * (1.0 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))",
"def sigmoid_der... | [
"0.8781602",
"0.87376416",
"0.8657338",
"0.8657338",
"0.8633599",
"0.84655267",
"0.82481176",
"0.8147116",
"0.7888459",
"0.78799254",
"0.7833955",
"0.78258616",
"0.77695525",
"0.7659375",
"0.76251775",
"0.76158744",
"0.76124257",
"0.7545348",
"0.7468798",
"0.74397403",
"0.740... | 0.0 | -1 |
Test the correct number of columns is read. | def test_header_file_col_len(suffix: str) -> None:
path = rsc / col_len_file
df = read_ods(path.with_suffix(suffix), 1)
assert isinstance(df, pd.DataFrame)
assert len(df) == 10
assert len(df.columns) == 5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_column_count(cls, line):\n\n # MAGIC n_cols = n_delim + 1 (no trailing delimiter)\n cols = line.count(cls.DELIMITER) + 1\n expected = 7 # MAGIC USAA convention, not all are populated though\n return cols == expected",
"def test_num_columns(self):\n pass",
"def test... | [
"0.7548459",
"0.7510521",
"0.7230019",
"0.6842968",
"0.6755895",
"0.6747935",
"0.67173964",
"0.6654135",
"0.651943",
"0.65001696",
"0.6424232",
"0.63808113",
"0.6362551",
"0.6346241",
"0.61240244",
"0.6113952",
"0.61134326",
"0.60778135",
"0.6052639",
"0.60307294",
"0.6027679... | 0.6021572 | 22 |
Verify referencing a nonexistent sheet raises an error. | def test_non_existent_sheet(suffix: str) -> None:
path = rsc / header_file
sheet_name = "No_Sheet"
with pytest.raises(KeyError) as e_info:
read_ods(path.with_suffix(suffix), sheet_name)
assert e_info.match(f"There is no sheet named {sheet_name}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_sheet(path, sheet): \n xl = pd.ExcelFile(path)\n if sheet not in xl.sheet_names:\n raise ValueError(\"Invalid sheet name \\'\" + sheet +\"\\'\")",
"def test_load_google_spreadsheet_invalid_input(self):\r\n # Bad worksheet name.\r\n self.assertRaises(GoogleSpreadsheetError... | [
"0.7511785",
"0.6662586",
"0.6643164",
"0.63484144",
"0.62883484",
"0.61039853",
"0.5673613",
"0.56441784",
"0.5633385",
"0.55662477",
"0.5559478",
"0.55555546",
"0.5548872",
"0.5499348",
"0.54844403",
"0.54834586",
"0.54558265",
"0.54556406",
"0.54284805",
"0.54255193",
"0.5... | 0.7008097 | 1 |
Verify skipping rows works correctly. | def test_skiprows(suffix: str) -> None:
path = rsc / skiprows_file
df = read_ods(path.with_suffix(suffix), skiprows=2)
assert isinstance(df, pd.DataFrame)
assert len(df) == 8
assert len(df.columns) == 5
assert df.columns.tolist() == ["a", "b", "c", "d", "e"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _skip_row(self, row):\n return False",
"def verify_skip(self, d_stmt, table): \n pass",
"def test_csv_skipped_status_report(self):\n skipped_rows = [row for row in csv_reader\n if row['Status'] == STATUS_SKIPPED and\n row['AVI Object'] == '... | [
"0.78820574",
"0.77395386",
"0.72424877",
"0.67497396",
"0.64111507",
"0.6337518",
"0.62545246",
"0.61462045",
"0.61319643",
"0.6096391",
"0.6084752",
"0.6058193",
"0.60555863",
"0.6041144",
"0.6038415",
"0.6032903",
"0.6030748",
"0.60189646",
"0.60109675",
"0.59978294",
"0.5... | 0.0 | -1 |
get rewards of a given (observations, actions) pair | def get_reward(self, observations, actions):
#initialize and reshape as needed, for batch mode
self.reward_dict = {}
if len(observations.shape)==1:
observations = np.expand_dims(observations, axis = 0)
actions = np.expand_dims(actions, axis = 0)
batch_mode = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_reward(self, observations, actions):\n\n #initialize and reshape as needed, for batch mode\n self.reward_dict = {}\n if(len(observations.shape)==1):\n observations = np.expand_dims(observations, axis = 0)\n actions = np.expand_dims(actions, axis = 0)\n ... | [
"0.71153605",
"0.69725466",
"0.68954384",
"0.6867219",
"0.6484484",
"0.64706373",
"0.6452535",
"0.64430445",
"0.64283854",
"0.62590873",
"0.62259674",
"0.6159445",
"0.61560625",
"0.6150899",
"0.6133165",
"0.60717803",
"0.6011946",
"0.6005865",
"0.6001529",
"0.5990368",
"0.597... | 0.715451 | 0 |
Test that an empty directory has no contents. | def test_GetFilesInDirectory_empty_dir(tempdir: pathlib.Path):
assert not dpack.GetFilesInDirectory(tempdir, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty(self):\n self.assertFalse(os.path.exists('/'))",
"def dir_empty(dir: str) -> bool:\n if dir_exists(dir) and len(list_files_recursively(dir)) > 0:\n return False\n return True",
"def empty_dir(value):\n return not os.listdir(value)",
"def is_directory_empty(directory: Pat... | [
"0.8070695",
"0.7889722",
"0.78633535",
"0.77820647",
"0.77367455",
"0.76245844",
"0.7536993",
"0.7437309",
"0.73705584",
"0.73276424",
"0.723362",
"0.7222807",
"0.72155523",
"0.7202357",
"0.70689946",
"0.7038981",
"0.70136565",
"0.69649816",
"0.6948838",
"0.6948838",
"0.6927... | 0.7773604 | 4 |
Parse ROI information from JSON file into a DataFrame. | def get_roi_information(storage_directory):
exp_path_head = storage_directory
# reformat path for mac with local access
# TODO: might need to adapt this when data is shared via DropBox
temp = exp_path_head.split('/')
temp[1] = 'Volumes'
exp_path_head = '/'.join(temp)
# Find experiment dir ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data(params):\n data_path = params['path']\n interaction_path = os.path.join(data_path,\n params['interactions'])\n get_logger().debug(f'Read {params[\"name\"]} data from {interaction_path}')\n # read interaction data from json file and convert to dataframe\n... | [
"0.6530276",
"0.6404767",
"0.6310999",
"0.6280475",
"0.622082",
"0.6167192",
"0.616662",
"0.61611384",
"0.61324733",
"0.60718936",
"0.60162157",
"0.58918583",
"0.5849082",
"0.58365905",
"0.58346003",
"0.58039165",
"0.56493443",
"0.5648803",
"0.56127465",
"0.55999476",
"0.5594... | 0.51819503 | 57 |
Draw a filled ellipse. | def fill_ellipse(self, x0, y0, a, b, color):
a2 = a * a
b2 = b * b
twoa2 = a2 + a2
twob2 = b2 + b2
x = 0
y = b
px = 0
py = twoa2 * y
# Plot initial points
self.line(x0, y0 - y, x0, y0 + y, color)
# Region 1
p = round(b2 - (a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ellipse(self, arg, fill='', outline=''):\n pass",
"def render_ellipse_filled(shape, center_x, center_y, color, angle=0):\n # Set color\n if len(color) == 4:\n GL.glColor4ub(shape.color[0], shape.color[1], shape.color[2],\n shape.color[3])\n GL.glEnable(GL.GL_BL... | [
"0.790591",
"0.76988083",
"0.7651773",
"0.75840515",
"0.74857664",
"0.74806356",
"0.74699205",
"0.73700464",
"0.7353409",
"0.7340359",
"0.7206906",
"0.7194186",
"0.7190864",
"0.71835893",
"0.71316063",
"0.71035326",
"0.7037746",
"0.69425845",
"0.6936651",
"0.69103634",
"0.690... | 0.6966443 | 17 |
Test the UpdateCommand with document updates. | def test_update(self):
u = stellr.UpdateCommand(TEST_HTTP, commit_within=60000)
self.assertEqual(u.host, 'http://localhost:8983')
self.assertEqual(u._handler, ('/solr/update/json?'
'wt=json&commitWithin=60000'))
a = SimpleObject(DOCUMENTS[0][0], DOC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update_list(self):\n u = stellr.UpdateCommand(TEST_HTTP)\n docs = [{'a': 1}, {'b': 2}]\n u.add_documents(docs)\n self.assertEqual(2, len(u._commands))\n... | [
"0.7484829",
"0.7484829",
"0.7484829",
"0.73511684",
"0.7146475",
"0.7081617",
"0.6998961",
"0.6998518",
"0.69678175",
"0.6921215",
"0.6908419",
"0.6876692",
"0.68547446",
"0.682291",
"0.6794872",
"0.67808986",
"0.6764714",
"0.67617047",
"0.6682451",
"0.66526103",
"0.66376",
... | 0.7977845 | 0 |
Test the UpdateCommand with a document boost. | def test_update_with_document_boost(self):
u = stellr.UpdateCommand(TEST_HTTP)
u.add_documents({'a': 1}, boost=2.0)
self.assertEqual(u.body, '{"add": {"doc": {"a": 1}, "boost": 2.0}}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update(self):\n u = stellr.UpdateCommand(TEST_HTTP, commit_within=60000)\n self.assertEqual(u.host, 'http://localhost:8983')\n self.assertEqual(u._handler, ('/solr/update/json?'\n 'wt=json&commitWithin=60000'))\n\n a = SimpleObject(DOCUMENTS... | [
"0.7547341",
"0.7468933",
"0.71595484",
"0.71595484",
"0.71595484",
"0.6930854",
"0.69129115",
"0.6868889",
"0.68014556",
"0.67611605",
"0.6699331",
"0.66745955",
"0.6582789",
"0.6579156",
"0.65679616",
"0.6551599",
"0.6549169",
"0.653828",
"0.6489231",
"0.6479501",
"0.646386... | 0.7962098 | 0 |
Test the UpdateCommand with a document containing a field boost. | def test_update_with_field_boost(self):
u = stellr.UpdateCommand(TEST_HTTP)
u.add_documents({'a': { 'value': 'f', 'boost': 2.0}})
self.assertEqual(u.body, ('{"add": {"doc": {"a": '
'{"boost": 2.0, "value": "f"}}}}')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_with_document_boost(self):\n u = stellr.UpdateCommand(TEST_HTTP)\n u.add_documents({'a': 1}, boost=2.0)\n self.assertEqual(u.body, '{\"add\": {\"doc\": {\"a\": 1}, \"boost\": 2.0}}')",
"def test_update(self):\n doc_fields = document_fields.DocumentFields({\n ... | [
"0.7730811",
"0.7377141",
"0.6674046",
"0.64579296",
"0.63746595",
"0.6338417",
"0.6287914",
"0.62726045",
"0.626155",
"0.6224084",
"0.6224084",
"0.6224084",
"0.60669535",
"0.59751767",
"0.594101",
"0.59196365",
"0.59026986",
"0.58855736",
"0.58724934",
"0.58679897",
"0.58388... | 0.82783 | 0 |
Test the UpdateCommand with deletes. | def test_delete(self):
u = stellr.UpdateCommand(TEST_HTTP)
u.add_delete_by_id(0)
u.add_delete_by_id([1, 2])
self.assertTrue(len(u._commands), 3)
for i, delete in enumerate(u._commands):
self.assertEquals(delete, ('delete', {'id': str(i)}))
self.assertEqual(u.b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_run(self):\n pass",
"def test_delete(self):\n pass",
"def test_an_extra_delete_is_not_sent(self):\n partition = uuid4()\n cluster = 1\n\n TestQueryUpdateModel.objects.create(\n partition=partition, cluster=cluster)\n\n obj = TestQueryUpdateMo... | [
"0.72760856",
"0.71389437",
"0.7051313",
"0.7049892",
"0.6945619",
"0.686101",
"0.66928357",
"0.6651046",
"0.6611115",
"0.65386665",
"0.6507041",
"0.64788806",
"0.64573306",
"0.6439544",
"0.6439544",
"0.6439544",
"0.641003",
"0.6391396",
"0.6388633",
"0.63683367",
"0.6359489"... | 0.79426324 | 0 |
Sets the data of this PacketProtocolCustom. | def data(self, data):
self._data = data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setData(self, data):\n self.data = struct.pack(\"!I\",data)",
"def setData(self,data):\n self.data = struct.pack(\"!I\",data)",
"def setData(self,data):\n self.data = struct.pack(\"!Q\",data)",
"def setData(self,data):\n self.data = struct.pack(\"!Q\",data)",
"def setData(se... | [
"0.7701528",
"0.7631352",
"0.75758517",
"0.75758517",
"0.7501037",
"0.74370784",
"0.74298215",
"0.73219013",
"0.7301521",
"0.7301521",
"0.7301521",
"0.7297043",
"0.72495896",
"0.7222252",
"0.72127455",
"0.72127455",
"0.7176347",
"0.71428376",
"0.71428376",
"0.71428376",
"0.71... | 0.72417575 | 14 |
Sets the layer of this PacketProtocolCustom. | def layer(self, layer):
self._layer = layer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetLayer(self, *args):\n return _XCAFDoc.XCAFDoc_LayerTool_SetLayer(self, *args)",
"def setLayer( self, layer ):\n if ( layer == self._layer ):\n return False\n \n self._layer = layer\n self.syncLayerData()\n \n return True",
"def Layer(self, ... | [
"0.7249842",
"0.62691164",
"0.61705804",
"0.60661596",
"0.60137343",
"0.5948118",
"0.5897421",
"0.58466697",
"0.58110607",
"0.579545",
"0.5744106",
"0.5734302",
"0.57172185",
"0.56752324",
"0.56675243",
"0.5549862",
"0.55450284",
"0.54290193",
"0.5406521",
"0.5395042",
"0.539... | 0.71172506 | 1 |
Sets the protocol_id of this PacketProtocolCustom. | def protocol_id(self, protocol_id):
self._protocol_id = protocol_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protocol_id(self, protocol_id):\n\n self._protocol_id = protocol_id",
"def protocol(self, protocol):\n\n self._protocol = protocol",
"def protocol(self, protocol):\n\n self._protocol = protocol",
"def protocol(self, protocol):\n\n self._protocol = protocol",
"def protocol(se... | [
"0.8205056",
"0.64274067",
"0.64274067",
"0.64274067",
"0.64274067",
"0.5843362",
"0.5821283",
"0.57265466",
"0.5715602",
"0.5714486",
"0.5685512",
"0.54577667",
"0.5388335",
"0.53577137",
"0.52775705",
"0.52542603",
"0.5133635",
"0.51073205",
"0.5089922",
"0.5065602",
"0.506... | 0.8175949 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PacketProtocolCustom):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80885184",
"0.80885184",
"0.805514",
"0.7983044",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Prepare app client for testing | def client():
gcomics_scrape.APP.config['TESTING'] = True
test_client = gcomics_scrape.APP.test_client()
yield test_client | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.app = app\n self.client = self.app.test_client",
"def setUp(self):\n self.app = create_app()\n self.client = self.app.test_client",
"def set_up_client():\n #creating new flask app and a test client\n app = create_app('test')\n client = app.test_clien... | [
"0.7755218",
"0.7698346",
"0.7594606",
"0.75915396",
"0.7507117",
"0.7507117",
"0.74293315",
"0.74293315",
"0.74293315",
"0.74293315",
"0.74293315",
"0.74293315",
"0.74293315",
"0.74293315",
"0.74293315",
"0.74250424",
"0.74239826",
"0.7410211",
"0.74010044",
"0.736623",
"0.7... | 0.0 | -1 |
Given a list of `` tags, return a mapping of option value to label. Empty options or options with value of "0" are excluded. | def _get_options_map(options: List[bs4.element.Tag]) -> OrderedDict:
mapping = OrderedDict()
for option in options:
value, label = option["value"], option.string
if not value or value == "0" or not label:
continue
mapping[value] = label
return mapping | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tag_options(label_matches):\r\n\ttag_options = []\r\n\tfor key in label_matches.keys():\r\n\t\tif key[1] not in tag_options:\r\n\t\t\ttag_options.append(key[1])\r\n\treturn tag_options",
"def _get_labels(self, label_vector):\n return () if label_vector is None else \\\n list(OrderedDict... | [
"0.67864126",
"0.5671242",
"0.55979216",
"0.55271745",
"0.5457819",
"0.5426272",
"0.53949904",
"0.53090864",
"0.5267378",
"0.5231554",
"0.5147757",
"0.5147757",
"0.5147757",
"0.5147757",
"0.5147757",
"0.5147757",
"0.5147757",
"0.5147757",
"0.5147757",
"0.5147757",
"0.5147757"... | 0.75031984 | 0 |
Closes a handler previously opened by _setup_file_logger() and removes the file handler from self.logger. This should be called when the file logger is done with to avoid leaking file handles typically this should be called from stopping(). | def _close_file_logger(self):
if self._file_log_handler is not None:
self._file_log_handler.flush()
self._file_log_handler.close()
self.logger.removeHandler(self._file_log_handler)
self._file_log_handler = None
self.logger.propagate = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_logger(self):\n \n if self.log is not None:\n self.log(\"Terminating logger...\")\n \n if self.echo:\n self.logger.removeHandler(self.con_hdl)\n \n if self.save:\n self.logger.removeHandler(self.file_hdl)",
"def close(self):\n ... | [
"0.7947553",
"0.7593944",
"0.7487987",
"0.74408555",
"0.72905463",
"0.72905463",
"0.72028244",
"0.7122077",
"0.69937766",
"0.698249",
"0.69302964",
"0.6845436",
"0.6771457",
"0.6722495",
"0.6677456",
"0.66305304",
"0.65722775",
"0.653553",
"0.6532525",
"0.6522841",
"0.6508202... | 0.8713955 | 0 |
Returns a model properties as a dict. This works even when 'value of dict' is 'list of models'. | def to_dict(model):
result = {}
for attr, _ in six.iteritems(model.swagger_types):
value = getattr(model, attr)
result[attr] = to_dict_value(value)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n result = {}\n\n for attr, _ in six.iteritems(self.swagger_types):\n value = getattr(self, attr)\n if isinstance(value, list):\n result[attr] = list(map(\n lambda x: x.to_dict() if hasattr(x, \"to_dict\") else x,\n ... | [
"0.65872693",
"0.655609",
"0.65345556",
"0.6409219",
"0.6356288",
"0.63508886",
"0.6344984",
"0.62736106",
"0.6225622",
"0.62240905",
"0.62239456",
"0.6171471",
"0.61280864",
"0.6112911",
"0.6094268",
"0.60897684",
"0.60897684",
"0.60854423",
"0.6072491",
"0.6053045",
"0.6050... | 0.6335338 | 7 |
Create superuser from using create_user function | def create_superuser(self, username, email, password=None):
if password is None:
raise ValueError('Password should not be none')
# Creating user instance and saving it to database
user = self.create_user(username, email, password)
# Assigning current user as superuser
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_superuser(self, username, email, password):\n print(\"creating super user....\")\n user = self.create_user(\n\n username=username,\n password=password,\n email = email,\n commit=False,\n )\n user.is_staff = True\n user.is_sup... | [
"0.802735",
"0.78833205",
"0.7882388",
"0.78682846",
"0.78518456",
"0.78380865",
"0.78359604",
"0.7834033",
"0.7829922",
"0.78272134",
"0.7801801",
"0.7777548",
"0.7776447",
"0.77545094",
"0.7752551",
"0.77426577",
"0.77347606",
"0.770648",
"0.7688568",
"0.76863813",
"0.76822... | 0.7456637 | 70 |
R"""Return the current vector's location. | def _get_pos(self):
return self._pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pos(self) -> WAVector:\n pass",
"def getPos(self):\n return self.__current_pos",
"def vector(self):\n return self.__vector",
"def v(self):\n return Vector2(self.position)",
"def getOriginVector(self):\n return self.dest - self.orig",
"def __call__(self):\n ... | [
"0.7284569",
"0.7140243",
"0.70194733",
"0.69774306",
"0.6846687",
"0.68167144",
"0.68099767",
"0.6779207",
"0.67299855",
"0.67299855",
"0.67162836",
"0.67160624",
"0.6697706",
"0.6690905",
"0.6664221",
"0.66459155",
"0.6620341",
"0.660673",
"0.65663815",
"0.65663815",
"0.654... | 0.66898906 | 14 |
Initialize the app and its test client and our test database | def setUp(self):
self.app = create_app(config_name="testing")
self.client = self.app.test_client
self.bucketlist = {'name': 'Go to Grand canyon for camping'}
# binds the app to the current context
with self.app.app_context():
# create all tables
db.sessio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.app = app.test_client()\n db.init_db()",
"def setUp(self):\n self.db_fd, app.app.config['DATABASE'] = tempfile.mkstemp()\n app.app.config['TESTING'] = True\n self.app = app.app.test_client()\n app.init_db()",
"def setUp(self):\n self.app ... | [
"0.85438246",
"0.8506064",
"0.83208156",
"0.83074",
"0.8216861",
"0.8214716",
"0.82047653",
"0.81558657",
"0.81520504",
"0.8151072",
"0.81019485",
"0.8092824",
"0.8078673",
"0.8074432",
"0.8058185",
"0.805813",
"0.8049317",
"0.8035526",
"0.8026509",
"0.80195194",
"0.80178994"... | 0.80824775 | 12 |
Check if hash of given password equal to hash of password in database | def check_password(self, password: str) -> bool:
hash_of_given_password = hashlib.new('md5', bytes(password, encoding='utf8'))
return hash_of_given_password.hexdigest() == self.hashed_password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_hash(self, password):\n return bcrypt.check_password_hash(self.password, password)",
"def verify_password(self, password):\n return check_password_hash(self.password_hash, password)",
"def check_password(self, username, password): # tested\r\n conn = self.get_db()\r\n with con... | [
"0.79005927",
"0.7732805",
"0.77067125",
"0.7677182",
"0.76729864",
"0.7659678",
"0.76483893",
"0.763098",
"0.76299393",
"0.76072484",
"0.75598925",
"0.7517769",
"0.75168246",
"0.74923635",
"0.74923635",
"0.7491314",
"0.74741554",
"0.7461201",
"0.74411345",
"0.7440085",
"0.74... | 0.7322207 | 35 |
Returns the signature of this string. Signature is a string that contains all of the letters in order. | def signature(s):
# TODO: rewrite using sorted()
t = list(s)
f=[]
i,j=0
for i in range(len(s)):
for j in range (len(s)-1):
if i!=j:
t[i],t[j]=t[j],t[i]
z=''.join(t)
f.append(z)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_signature(self):\n text = self._get_menu_item_text('Edit->Key Signature')\n return re.search(r'\\[([A-G].?)\\]$', text).group(1)",
"def get_signature(self):\n return \" \".join(self.segments[-1].unixtext.replace(\n u\"\\n\", \" \").strip().split())",
"def get_signed(self... | [
"0.73466843",
"0.7298716",
"0.7100843",
"0.6921928",
"0.6882215",
"0.68380034",
"0.68380034",
"0.68380034",
"0.67676044",
"0.6638596",
"0.64747393",
"0.64411926",
"0.6437717",
"0.6435406",
"0.6415247",
"0.64067405",
"0.64067405",
"0.63900995",
"0.63824594",
"0.6318848",
"0.62... | 0.6213675 | 22 |
Post a message in the queue that a running job be stopped. | def cancel_job(self, job_id):
self.send(JobCommands.CANCEL_JOB, CancelJobPayload(job_id)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(instance):\n if instance.state == STOPPED:\n return\n\n Queue.objects.add(function=\"terminate\", instance=instance)",
"def stopJob(self):\n if len(self.__jobQueue) > 0:\n _JobThread.stopJobThreadInstance(\n self.caller, self.__jobQueue[0].stopRun)",
"def ... | [
"0.7123397",
"0.66809046",
"0.63596714",
"0.6344955",
"0.6309239",
"0.62416476",
"0.62355953",
"0.61057854",
"0.61022836",
"0.6088004",
"0.60868293",
"0.6073603",
"0.6000272",
"0.5996334",
"0.59604996",
"0.5932531",
"0.59168714",
"0.58964777",
"0.5895674",
"0.58899647",
"0.58... | 0.0 | -1 |
Returns True if Stack is empty, False otherwise | def isEmpty(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self) -> bool:\n if len(self.stack)==0:\n return True\n else:\n return False",
"def empty(self):\r\n return len(self.stack) == 0",
... | [
"0.9228193",
"0.91457397",
"0.914495",
"0.90911335",
"0.90871376",
"0.90709865",
"0.90709865",
"0.9068022",
"0.90559614",
"0.89804876",
"0.8931659",
"0.8923932",
"0.8890956",
"0.8882842",
"0.88611394",
"0.88598084",
"0.8855795",
"0.8855795",
"0.88425356",
"0.88246936",
"0.876... | 0.0 | -1 |
Adds an item to the top of stack | def push(self, item):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, item):\r\n self.stack.insert(0, item)",
"def push(self, item):\n self.stack.append(item)",
"def push(self, item):\n self.stack.append(item)",
"def push(self, item):\n # Reassign the link to top of the stack and update the\n self.top = [item] + self.top",
"d... | [
"0.8586365",
"0.8252233",
"0.8252233",
"0.82111686",
"0.8030312",
"0.802139",
"0.79880327",
"0.7937661",
"0.787379",
"0.7782695",
"0.77416927",
"0.770514",
"0.76447195",
"0.76184803",
"0.7615128",
"0.758482",
"0.7555666",
"0.74846154",
"0.7455913",
"0.7413334",
"0.73988414",
... | 0.7196093 | 28 |
Removes the item from the top of stack. Returns the removed item | def pop(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n else:\n raise IndexError('Cannot pop item, stack is empty.')\n except IndexError as err:\n print(err)\n ... | [
"0.8351878",
"0.8230783",
"0.8172708",
"0.80849135",
"0.7934138",
"0.78741467",
"0.7828423",
"0.77674854",
"0.77556026",
"0.773075",
"0.77214825",
"0.7717838",
"0.76995176",
"0.7689211",
"0.76874024",
"0.76698285",
"0.7630657",
"0.75891936",
"0.7581609",
"0.7581141",
"0.75511... | 0.0 | -1 |
Returns the top item in the stack, but doesn't remove it | def peek(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(stack):\n item = top(stack)\n stack.top = stack.top.next\n stack.size = stack.size - 1\n return item",
"def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n else:\n ... | [
"0.8242329",
"0.8210143",
"0.8179077",
"0.80861723",
"0.80703646",
"0.7991938",
"0.791445",
"0.77863723",
"0.77537775",
"0.7731241",
"0.76857805",
"0.76725554",
"0.76701343",
"0.76437575",
"0.76392555",
"0.76314986",
"0.76280785",
"0.7625138",
"0.7615717",
"0.7612027",
"0.760... | 0.0 | -1 |
Reaction rate used in the ODE solver. _Parameters | def rate(self, t, y):
k = self._calc_k(y[1])
# return k * (1 - y - self.parameters['y0'])
dy = self.parameters.y0 - y[0]
return [k * dy if dy > 1e-6 else 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reaction_rate (self):\n raise NotImplementedError('Subclass must implement this method')",
"def x_rate(self):\n values = self._interpolate_table(\"x\", derivative_order=1)\n # values += self._corrections(('ortho_eop', iers.ortho_eop, 0, 1e-6),\n # ('pmsd... | [
"0.63901",
"0.6104154",
"0.60939217",
"0.59073734",
"0.58363235",
"0.5816048",
"0.58015335",
"0.57757795",
"0.57664496",
"0.576328",
"0.57556295",
"0.57331765",
"0.5725727",
"0.5704105",
"0.5691218",
"0.5672164",
"0.5665127",
"0.5629107",
"0.56183726",
"0.56106555",
"0.560060... | 0.0 | -1 |
Reaction rate used in ODE solver. | def rate(self, t, y):
k1, k2 = self._k(y[-1])
if y[1] > 1e-6:
dydt = [(self.parameters.y1 * k1 + self.parameters.y2 * k2) * y[1],
-(k1 + k2) * y[1]]
else:
dydt = [0, 0]
return dydt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reaction_rate (self):\n raise NotImplementedError('Subclass must implement this method')",
"def _calculate_r0(net):\n\n r0 = 0\n for reaction in net.reactions:\n t = reaction.rate(net.species)\n r0 += t\n\n return r0",
"def getRate(self) -> int:\n if... | [
"0.72591424",
"0.6518196",
"0.6314829",
"0.62603986",
"0.6247805",
"0.62314045",
"0.6211295",
"0.6148923",
"0.60537946",
"0.6022725",
"0.60090417",
"0.5988731",
"0.5929019",
"0.5919248",
"0.5853174",
"0.58269024",
"0.57911855",
"0.5787843",
"0.57872707",
"0.5778521",
"0.57536... | 0.0 | -1 |
Calculate activation energies for the quadrature points. | def _calc_Em(self):
return (self.parameters.E0 +
self.x * sqrt2 * self.parameters.sigma * self.mt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_activation(self):\r\n\r\n x=0\r\n edges=self.in_edges\r\n for edge in edges:\r\n x+= edge.source.activation*edge.weight\r\n self.activation=1/(1+exp(-x))",
"def calculateElementCoefficients(self):\n #\n #get u,grad(u), and grad(u)Xgrad(w) at the qu... | [
"0.63615316",
"0.59211767",
"0.58977365",
"0.57974905",
"0.5753166",
"0.5704527",
"0.56983346",
"0.5637251",
"0.56114376",
"0.5597304",
"0.559378",
"0.5584039",
"0.5583005",
"0.548597",
"0.54798394",
"0.54694116",
"0.54605067",
"0.54565823",
"0.54556644",
"0.54495233",
"0.544... | 0.0 | -1 |
Convert a MsgSpec object model to canonical string form, parse that to make a clone, and verify that the two are equal. | def round_trip_poto_spec_via_string(self, match):
canonical_spec = str(match.__repr__())
# DEBUG
print("\n### roundTrip: SPEC IN CANONICAL FORM:\n" + canonical_spec)
print("### END SPEC IN CANONICAL FORM #######")
# END
ppp = StringProtoSpecParser(StringIO(canonical_spec)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_messagepack_serialization(self, molecule):\n serialized = molecule.to_messagepack()\n molecule_copy = Molecule.from_messagepack(serialized)\n assert molecule == molecule_copy\n assert molecule_copy.n_conformers == molecule.n_conformers\n assert np.allclose(molecule_copy.... | [
"0.6049694",
"0.58952343",
"0.57759994",
"0.5662845",
"0.5632205",
"0.56114113",
"0.5601377",
"0.5583637",
"0.55373234",
"0.55373234",
"0.54913116",
"0.54425114",
"0.54251564",
"0.5418353",
"0.54155433",
"0.54023933",
"0.5300142",
"0.52732176",
"0.5242905",
"0.52406794",
"0.5... | 0.71208006 | 0 |
Returns Type of Event. | def getEventType(event):
match = reEventType.search(event)
if match:
return match.group(0).split(" ")[1].rstrip("\r")
else:
return None
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type(self):\n return self.event_type",
"def _get_event_type(event):\n return event.type()",
"def _get_event_type(event):\n return event.type()",
"def event_type(self) -> int:\n return self.data[\"args\"][\"eventType\"]",
"def type(self) -> str:\n return self._even... | [
"0.9127099",
"0.8854654",
"0.8854654",
"0.85936844",
"0.83761233",
"0.81655216",
"0.80587494",
"0.7974002",
"0.7809638",
"0.7705801",
"0.7584661",
"0.74313736",
"0.7268725",
"0.69929963",
"0.6920035",
"0.6919956",
"0.6908614",
"0.68834376",
"0.68823326",
"0.6785379",
"0.67504... | 0.7201132 | 13 |
Return a string timestamp. | def timestamp():
return datetime.now().strftime('%Y-%m-%d_%H-%M-%S') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_timestamp():\n return str(int(time.time()))",
"def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")",
"def get_timestamp():\n return time.strftime('%Y-%m-%d %H:%M:%S')",
"def _timestamp():\n moment = time.time()\n moment_us = repr(moment).split(\".\")[1]\n ... | [
"0.86054283",
"0.85580486",
"0.852054",
"0.8364073",
"0.83260745",
"0.8289571",
"0.8282118",
"0.8281473",
"0.8239429",
"0.8191319",
"0.81818944",
"0.8102944",
"0.8100112",
"0.8100112",
"0.8080835",
"0.80527234",
"0.8046272",
"0.80205953",
"0.79885036",
"0.79444164",
"0.793979... | 0.80653024 | 15 |
Load parameters from yaml file and return as dictionary. | def load_params_file(filename):
with open(filename, 'r') as f:
params = yaml.safe_load(f)
return params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_parameters(self):\n with open(INTERNAL_DATA_DIR / self.name_default_params, 'r') as f:\n return yaml.load(f, Loader=yaml.FullLoader)",
"def read_params(config_path):\n with open(config_path) as yaml_file:\n config = yaml.safe_load(yaml_file)\n return config",
"def _load_... | [
"0.7596178",
"0.7330409",
"0.73257834",
"0.7303586",
"0.71755385",
"0.71752834",
"0.7158803",
"0.6984106",
"0.6980693",
"0.6978515",
"0.6975",
"0.6964064",
"0.69475436",
"0.6925834",
"0.6919343",
"0.69125134",
"0.69010776",
"0.6888063",
"0.685124",
"0.6842379",
"0.68278265",
... | 0.79300314 | 0 |
The set of arguments for constructing a VpcIpamPool resource. | def __init__(__self__, *,
address_family: pulumi.Input[str],
ipam_scope_id: pulumi.Input[str],
allocation_default_netmask_length: Optional[pulumi.Input[int]] = None,
allocation_max_netmask_length: Optional[pulumi.Input[int]] = None,
al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: VpcIpamPoolArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n ... | [
"0.80700225",
"0.64764947",
"0.6298883",
"0.6237702",
"0.6171007",
"0.6054522",
"0.60104066",
"0.59792495",
"0.5948947",
"0.5940898",
"0.5932286",
"0.59278244",
"0.59104854",
"0.5905403",
"0.58604604",
"0.58576417",
"0.58528435",
"0.5822844",
"0.5816407",
"0.5778437",
"0.5777... | 0.62087315 | 4 |
Tags that are required for resources that use CIDRs from this IPAM pool. Resources that do not have these tags will not be allowed to allocate space from the pool. If the resources have their tags changed after they have allocated space or if the allocation tagging requirements are changed on the pool, the resource may... | def allocation_resource_tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "allocation_resource_tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allocation_resource_tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:\n return pulumi.get(self, \"allocation_resource_tags\")",
"def tag_resource(ResourceArn=None, Tags=None):\n pass",
"def tag_resource(ResourceArn=None, Tags=None):\n pass",
"def tag_resource(ResourceArn=None, Tags=N... | [
"0.66053426",
"0.57529235",
"0.57529235",
"0.57529235",
"0.567334",
"0.56282586",
"0.5413539",
"0.5404851",
"0.5402001",
"0.5298596",
"0.52662206",
"0.5255876",
"0.5244761",
"0.52363896",
"0.5194843",
"0.5182637",
"0.51411676",
"0.5125815",
"0.50702894",
"0.5055361",
"0.50513... | 0.68771523 | 1 |
A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the providerlevel. | def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.64152515",
"0.64152515",
"0.64115673",
"0.64115673",
"0.64115673",
"0.64115673",
"0.62744796",
"0.6199352",
"0.61412764",
"0.60976297",
"0.60839856",
"0.60669816",
"0.5974499",
"0.5956728",
"0.58630633",
"0.5843171",
"0.5843171",
"0.5843171",
"0.5843171",
"0.5843171",
"0.5... | 0.56854844 | 60 |
Input properties used for looking up and filtering VpcIpamPool resources. | def __init__(__self__, *,
address_family: Optional[pulumi.Input[str]] = None,
allocation_default_netmask_length: Optional[pulumi.Input[int]] = None,
allocation_max_netmask_length: Optional[pulumi.Input[int]] = None,
allocation_min_netmask_length: Optio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: VpcIpamPoolArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def vip_pool(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['VirtualNetworksPropertiesVipPoolArgs']]]]:\n return pul... | [
"0.6695027",
"0.6543157",
"0.6374796",
"0.63023096",
"0.5693747",
"0.5622314",
"0.5589084",
"0.5557529",
"0.5505401",
"0.54906684",
"0.5475523",
"0.54518855",
"0.54329747",
"0.531895",
"0.530619",
"0.52431965",
"0.5194702",
"0.51772577",
"0.51683724",
"0.5160584",
"0.515227",... | 0.55612576 | 7 |
Tags that are required for resources that use CIDRs from this IPAM pool. Resources that do not have these tags will not be allowed to allocate space from the pool. If the resources have their tags changed after they have allocated space or if the allocation tagging requirements are changed on the pool, the resource may... | def allocation_resource_tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "allocation_resource_tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allocation_resource_tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:\n return pulumi.get(self, \"allocation_resource_tags\")",
"def tag_resource(ResourceArn=None, Tags=None):\n pass",
"def tag_resource(ResourceArn=None, Tags=None):\n pass",
"def tag_resource(ResourceArn=None, Tags=N... | [
"0.66053426",
"0.57529235",
"0.57529235",
"0.57529235",
"0.567334",
"0.56282586",
"0.5413539",
"0.5404851",
"0.5402001",
"0.5298596",
"0.52662206",
"0.5255876",
"0.5244761",
"0.52363896",
"0.5194843",
"0.5182637",
"0.51411676",
"0.5125815",
"0.50702894",
"0.5055361",
"0.50513... | 0.68771523 | 0 |
Amazon Resource Name (ARN) of IPAM | def arn(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def ar... | [
"0.6671946",
"0.66577",
"0.66577",
"0.66577",
"0.66577",
"0.66577",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585",
"0.66473585"... | 0.6278986 | 50 |
A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the providerlevel. | def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.64176613",
"0.64176613",
"0.6413839",
"0.6413839",
"0.6413839",
"0.6413839",
"0.627648",
"0.62006116",
"0.6143012",
"0.60981286",
"0.6086032",
"0.60680825",
"0.5972209",
"0.5959422",
"0.5864515",
"0.58448154",
"0.58448154",
"0.58448154",
"0.58448154",
"0.58448154",
"0.5844... | 0.5687071 | 59 |
A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block. | def tags_all(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "tags_all") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.7443474",
"0.7443474",
"0.7437703",
"0.7437703",
"0.7437703",
"0.7437703",
"0.71596783",
"0.7096959",
"0.7082072",
"0.70575476",
"0.693102",
"0.69174385",
"0.68244475",
"0.6797153",
"0.6753355",
"0.67019445",
"0.66311526",
"0.66311526",
"0.66311526",
"0.66311526",
"0.66311... | 0.0 | -1 |
Tags that are required for resources that use CIDRs from this IPAM pool. Resources that do not have these tags will not be allowed to allocate space from the pool. If the resources have their tags changed after they have allocated space or if the allocation tagging requirements are changed on the pool, the resource may... | def allocation_resource_tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
return pulumi.get(self, "allocation_resource_tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allocation_resource_tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:\n return pulumi.get(self, \"allocation_resource_tags\")",
"def allocation_resource_tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:\n return pulumi.get(self, \"allocation_resource_ta... | [
"0.68767494",
"0.68767494",
"0.5753419",
"0.5753419",
"0.5753419",
"0.56738746",
"0.56279933",
"0.54142255",
"0.5405834",
"0.54023194",
"0.5298011",
"0.52674806",
"0.5255175",
"0.5244331",
"0.5236745",
"0.51947594",
"0.51832217",
"0.51416737",
"0.51262635",
"0.507009",
"0.505... | 0.660529 | 2 |
Amazon Resource Name (ARN) of IPAM | def arn(self) -> pulumi.Output[str]:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def ar... | [
"0.6671946",
"0.66577",
"0.66577",
"0.66577",
"0.66577",
"0.66577",
"0.66356164",
"0.6609515",
"0.65203404",
"0.65203404",
"0.65203404",
"0.65203404",
"0.65203404",
"0.65203404",
"0.65203404",
"0.64863175",
"0.63056356",
"0.6285993",
"0.6278986",
"0.6278986",
"0.6278986",
"... | 0.66473585 | 20 |
A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the providerlevel. | def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.6416905",
"0.6416905",
"0.64132154",
"0.64132154",
"0.64132154",
"0.64132154",
"0.6275456",
"0.620147",
"0.61419946",
"0.6099122",
"0.6084784",
"0.60679996",
"0.597075",
"0.59575856",
"0.58628005",
"0.58435833",
"0.58435833",
"0.58435833",
"0.58435833",
"0.58435833",
"0.58... | 0.56623465 | 96 |
A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block. | def tags_all(self) -> pulumi.Output[Mapping[str, str]]:
return pulumi.get(self, "tags_all") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.74426216",
"0.74426216",
"0.7436816",
"0.7436816",
"0.7436816",
"0.7436816",
"0.71594876",
"0.70966953",
"0.70821387",
"0.7057521",
"0.6929662",
"0.69160616",
"0.6824671",
"0.6796777",
"0.675311",
"0.67011976",
"0.66300416",
"0.66300416",
"0.66300416",
"0.66300416",
"0.663... | 0.64110595 | 58 |
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`. | def queryset(self, request, queryset):
if self.value() == '106':
return queryset.filter(content_type__app_label='surveys18')
if self.value() == '107':
return queryset.filter(content_type__app_label='surveys19')
else:
return queryset | {
"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.7538617",
"0.74187994",
"0.72438395",
"0.7202868",
"0.7089319",
"0.70471644",
"0.69740576",
"0.6780697",
"0.67602205",
"0.67348963",
"0.6680121",
"0.6654517",
"0.6586603",
"0.6469687",
"0.64143723",
"0.6400605",
"0.63842523",
"0.6370161",
"0.6348957",
"0.63480085",
"0.6275... | 0.6159046 | 32 |
Called when the user specifies an intent for this skill | def on_intent(intent_request, session):
print("on_intent requestId=" + intent_request['requestId'] +
", sessionId=" + session['sessionId'])
intent = intent_request['intent']
intent_name = intent_request['intent']['name']
#print (intent)
try :
intent_name_value = in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ... | [
"0.7143966",
"0.6956116",
"0.6949057",
"0.6905333",
"0.68928874",
"0.67641324",
"0.6754843",
"0.6722764",
"0.6720773",
"0.67161995",
"0.6699252",
"0.6691263",
"0.6670276",
"0.6645522",
"0.6642719",
"0.6638686",
"0.6607724",
"0.6594981",
"0.6575682",
"0.6570076",
"0.65620786",... | 0.65405214 | 25 |
Takes the resulting pixel list and the expected pixel list and finds the cross entropy value associated with the predicted pixel values | def get_cross_entropy(actual, expected):
# use try except to handle overflow in the log
try:
# formula -(y*log(a) + (1-y)log(1-a))
ones = np.ones(actual.shape) # used to subtract array from one
cross_entropy_vec = np.multiply(expected, np.log(actual)) + np.multiply(ones - expected, np.log(ones - actual))
cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_entropy(targets, predictions, epsilon=1e-12):\n\n predictions = np.clip(predictions, epsilon, 1. - epsilon)\n\n N = predictions.shape[0]\n\n ce = -np.sum(np.sum(targets*np.log(predictions+1e-9)))/N\n\n return ce",
"def cross_entropy(y_pred,y):\n \n epsilon = 0.001 # To prevent overflow an... | [
"0.6927927",
"0.6924277",
"0.67886657",
"0.67806786",
"0.6765155",
"0.66533464",
"0.66466117",
"0.65710235",
"0.65694916",
"0.6542023",
"0.6501739",
"0.64664984",
"0.64607155",
"0.6438654",
"0.6428099",
"0.63960516",
"0.63953024",
"0.6336773",
"0.62872654",
"0.6282965",
"0.62... | 0.6720684 | 5 |
Adding a sparse and a dense tensor to produce a sparse tensor. | def simple_sparse_add():
examples = [
benchmark.Example(
inputs=[
tf.SparseTensor(indices=[[0, 0], [0, 1]],
values=[12, 34],
dense_shape=[2, 2]),
[[-3, 0], [-5, 0]],
],
output=tf.SparseTensor(in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bprop_make_sparse_tensor(indices, values, dense_shape, out, dout):\n return zeros_like(indices), F.sparse_tensor_get_values(dout), ()",
"def SimpleSparseTensorFrom(x):\n x_ix = []\n x_val = []\n for batch_i, batch in enumerate(x):\n for time, val in enumerate(batch):\n x_ix.append([batch_i, tim... | [
"0.6609458",
"0.6417273",
"0.6399707",
"0.6384875",
"0.63827693",
"0.63712513",
"0.6335478",
"0.6301753",
"0.6279677",
"0.6105951",
"0.6105803",
"0.61012745",
"0.6037879",
"0.5977531",
"0.59770197",
"0.59647906",
"0.5960904",
"0.5946578",
"0.59345967",
"0.59215313",
"0.59152"... | 0.7832186 | 0 |
Creates the new child of spec1 and spec2 by taking equal amounts of their genes with a 0.1% chance of mutation | def reproduce(spec1, spec2):
a = [1,0]*(total_params//2)
random.shuffle(a)
"""Mutation chance"""
for i in range(len(a)):
if random.random() <= mutation_chance:
if a[i]==0:
a[i] = 1
else:
a[i] = 0
new_kid = []
for i in ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_child(self, parent1, parent2):\n if np.random.random() < self.crossover_prob:\n # crossover\n x, y = np.sort(np.random.randint(len(parent1), size=2))\n return np.vstack((parent1[:x], parent2[x:y], parent1[y:]))\n else:\n # mutation\n ... | [
"0.70659405",
"0.7004005",
"0.6691898",
"0.6479292",
"0.62824047",
"0.6273859",
"0.6265185",
"0.62334424",
"0.62189996",
"0.6143937",
"0.6052051",
"0.6012036",
"0.59055376",
"0.5852286",
"0.5846563",
"0.58412874",
"0.5834489",
"0.5833654",
"0.58213466",
"0.58114856",
"0.57996... | 0.6811404 | 2 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.70900273 | 54 |
Reset ball function, selects randomized velocity, location (near middle line) | def reset_ball(self, paddle_1, paddle_2):
# Reset position and select new speeds
self.x = 100
self.y = np.random.randint(1, self.screen_Height-1)
self.vx = np.random.randint(25, 30)
self.vy = np.random.choice([-1, 1]) * np.random.randint(25, 30)
p1_state, p2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ball_reset(self):\n self.ball.x = (self.window.width - BALL_RADIUS)/2\n self.ball.y = (self.window.height - BALL_RADIUS)/2\n self.__dx = random.randint(1, MAX_X_SPEED)\n if random.random() > 0.5:\n self.__dx = -self.__dx",
"def __set_ball_velocity(self):\n self._... | [
"0.78953934",
"0.75020355",
"0.69904244",
"0.6919897",
"0.6677168",
"0.6615125",
"0.66012466",
"0.65814906",
"0.6563528",
"0.6452176",
"0.6405985",
"0.6398524",
"0.6389545",
"0.6386",
"0.6357651",
"0.63570076",
"0.63241464",
"0.629224",
"0.6282046",
"0.6259028",
"0.6258053",
... | 0.7498759 | 2 |
Rebalance the portfolio based on context.stocks | def rebalance(context, data):
cancel_all_orders(context, data)
sell_stocks_not_in_portfolio(context, data)
LOG.info("rebalancing")
LOG.info(context.stocks)
totals = calculate_totals(context, data)
LOG.info("totals calculated: %s" % totals)
for stock, info in totals.items():
order(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebalance(context, data):\n logger.debug('rebalancing on: %s', algo.get_datetime())\n\n context.trend_filter = False\n\n # new_portfolio = algo.pipeline_output('pipeline').dropna(subset=['overall_rank']).sort_values('momentum', ascending=False)\n\n new_portfolio = algo.pipeline_output('pipeline').d... | [
"0.7364978",
"0.7146371",
"0.6832523",
"0.6610252",
"0.65502185",
"0.6502971",
"0.65022534",
"0.6463449",
"0.6411393",
"0.63420564",
"0.62449145",
"0.61422247",
"0.61070156",
"0.61015534",
"0.60666263",
"0.605883",
"0.6050995",
"0.60085475",
"0.5991271",
"0.59236807",
"0.5890... | 0.7934528 | 0 |
Place the simple GUI objects in the frame. | def place_main_gui(self):
cont = self.container
self.title = ttk.Label(cont, text='Importă o bază de date')
self.title.config(font=tkg.title_font())
self.title.grid(row=0, column=0, sticky='w')
self.path_label = ttk.Label(cont, textvariable=self.path)
self.path_label.config(font=tkg.small_regu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initGUI(self):\n\n\t\t# Set main frame's location \n\t\tself.grid(row=0, column=0, sticky=\"nsew\")\n\n\t\t# Set path entry frame and its location\n\t\tself.entryFrame = Frame(self, relief = RAISED, borderwidth = 1)\n\t\tself.entryFrame.pack(fill = BOTH, expand = False)\n\t\t# Make label\n\t\tif self.message:\... | [
"0.73877174",
"0.7273837",
"0.724822",
"0.712382",
"0.70954245",
"0.7012067",
"0.6964564",
"0.69641393",
"0.6955205",
"0.6951402",
"0.69476676",
"0.6931697",
"0.6914845",
"0.6914669",
"0.68057585",
"0.67949224",
"0.6766486",
"0.6765765",
"0.6749409",
"0.67474115",
"0.673746",... | 0.0 | -1 |
Place the buttonrelated GUI in the frame. | def place_button_gui(self):
cont = self.container
style = ttk.Style()
style.configure('IDS.TButton', font=tkg.button_regular_font_tuple())
self.choose_button = ttk.Button(cont, text='Alege fișierul')
self.choose_button.config(style='IDS.TButton', command=self.choose_click)
self.choose_button.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_frame(self):\n self._exit_button.grid(row=0, column=2, sticky=tk.W)\n self._clear_button.grid(row=0, column=0, sticky=tk.E)\n # self._copy_button.grid(row=0, column=1, sticky=(tk.W, tk.W))\n return None",
"def place_button_gui(self):\n cont = self.container\n\n # This c... | [
"0.7602936",
"0.75186807",
"0.7198896",
"0.7163624",
"0.7132068",
"0.7062062",
"0.6995572",
"0.696357",
"0.69413227",
"0.6934878",
"0.6920921",
"0.6884443",
"0.68796974",
"0.68721724",
"0.6866608",
"0.68623316",
"0.68578357",
"0.6836645",
"0.68279535",
"0.68257105",
"0.680893... | 0.7705946 | 0 |
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal. | def sort_012(input_list):
cnt0=0 # number of 0's in the array
cnt1=0 # number of 1's in the array
cnt2=0 # number of 2's in the array
for num in input_list:
if num==0:
cnt0+=1
elif num==1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(array):\n\n for i in range(0, len(array)):\n for j in range(len(array)-1, i, -1):\n if array[j] < array[j-1]:\n ## Move the lighter bubble up\n _temp = array[j]\n array[j] = array[j-1]\n array[j-1] = _temp\n \n ... | [
"0.6789548",
"0.67583895",
"0.6682644",
"0.66715705",
"0.6659737",
"0.6641573",
"0.6599344",
"0.65873164",
"0.6554439",
"0.6552122",
"0.64992183",
"0.6485857",
"0.6463896",
"0.6443028",
"0.6429256",
"0.64282393",
"0.64207727",
"0.64205426",
"0.6416836",
"0.6406601",
"0.638842... | 0.0 | -1 |
Zero the gradient buffers. | def reset_grad(self):
self.unet.zero_grad() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_grad(self):\n self.grad.zero_()",
"def zero_grad(self):\n self.grad = Tensor(data=np.zeros_like(self.data, dtype=np.float))",
"def zero_grad(self):\n for p, dp in self.params:\n dp.zero_()",
"def grad_zero(self):\r\n for layer in self.layers:\r\n lay... | [
"0.73872775",
"0.7316328",
"0.72141",
"0.7195178",
"0.7190617",
"0.7181733",
"0.71748376",
"0.7154122",
"0.7154122",
"0.7126482",
"0.709635",
"0.6961804",
"0.6947707",
"0.6915103",
"0.6908444",
"0.6891664",
"0.6866808",
"0.6849193",
"0.6722878",
"0.67000455",
"0.66971904",
... | 0.6845781 | 18 |
Get the front element. | def peek(self) -> int:
return self.items[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self) -> bool:
return len(self.items) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.9053733",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462... | 0.0 | -1 |
Test if two tensors are nearly identical | def near(a,b):
return torch.allclose(a,b, rtol=1e-03, atol=1e-05) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_equal(tensor_1, tensor_2):\n return tf.reduce_max(tf.abs(tensor_1 - tensor_2)).numpy() < 1e-6",
"def allclose(tensor1: Tensor, tensor2: Tensor) ->bool:\n if tensor1.dtype != tensor2.dtype:\n tensor2 = tensor2\n return torch.allclose(tensor1, tensor2)",
"def torch_the_same(X, Y, eps=1e... | [
"0.79671884",
"0.77040684",
"0.7418959",
"0.71327984",
"0.6995445",
"0.69370645",
"0.6923374",
"0.68237865",
"0.67867124",
"0.6737922",
"0.6726358",
"0.67057705",
"0.6691644",
"0.66223776",
"0.66144526",
"0.66142946",
"0.66142774",
"0.6586026",
"0.65736735",
"0.65018594",
"0.... | 0.70005924 | 4 |
Returns the activation layer corresponding to the input activation name. | def activation_factory(name):
if name == 'relu':
return nn.ReLU(inplace=True)
if name == 'leaky_relu':
return nn.LeakyReLU(0.2, inplace=True)
if name == 'elu':
return nn.ELU(inplace=True)
if name == 'sigmoid':
return nn.Sigmoid()
if name == 'tanh':
return nn.T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_activation_by_name(activation_name, activation_id=None):\n import bigdl.dllib.nn.layer as BLayer\n activation = None\n activation_name = activation_name.lower()\n if activation_name == \"tanh\":\n activation = BLayer.Tanh()\n elif activation_name == \"sigmoid\":\n activation = ... | [
"0.7601923",
"0.75102884",
"0.7389526",
"0.7359516",
"0.6840024",
"0.6797463",
"0.6736014",
"0.66799164",
"0.6635552",
"0.6635159",
"0.6632002",
"0.6576473",
"0.6556553",
"0.6556013",
"0.6552924",
"0.6542772",
"0.65092725",
"0.64772713",
"0.64272285",
"0.6365736",
"0.6363103"... | 0.6434719 | 18 |
Renders the home page. | def home():
return render_template('index.html', title='Home Page',
year=datetime.now().year) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.81803685 | 24 |
Renders the about page. | def about():
return render_template('about.html', title='About',
year=datetime.now().year,
message='Your application description page.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.8243358",
... | 0.82680845 | 19 |
Get max force acting on atoms from a calculation document. | def _get_max_force(calc_doc: Calculation) -> Optional[float]:
forces = calc_doc.output.ionic_steps[-1].get("forces")
structure = calc_doc.output.structure
if forces:
forces = np.array(forces)
sdyn = structure.site_properties.get("selective_dynamics")
if sdyn:
forces[np.lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_c_max(\n T, E_ion, E_atom, angles_ion, angles_atom,\n ion_flux, atom_flux, full_export=False, isotope=\"H\"):\n # Diffusion coefficient Fernandez et al Acta Materialia (2015)\n # https://doi.org/10.1016/j.actamat.2015.04.052\n D_0_W = 1.9e-7\n E_D_W = 0.2\n k_B = 8.617e-5\n... | [
"0.60202175",
"0.57835275",
"0.56919444",
"0.56892014",
"0.5686194",
"0.56520456",
"0.56134903",
"0.5605147",
"0.5552555",
"0.5480237",
"0.53515524",
"0.5328387",
"0.5324713",
"0.5320625",
"0.53187954",
"0.5280536",
"0.52729774",
"0.5263932",
"0.5239988",
"0.5228085",
"0.5222... | 0.7630507 | 0 |
Sets up the test fixture before exercising it. | def setUp(self):
# params
self.result = None
self.wait_for_result = None
# publishers
self.event_out = rospy.Publisher(
'~event_out', std_msgs.msg.String, latch=True, queue_size=1
)
self.pub_current_joints = rospy.Publisher(
'~current_join... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fixture_setup(self):\n pass",
"def setUpFixture(self):\n pass",
"def setUp(self):\n self.app = load_app(self.application_under_test)\n\n try:\n teardown_db()\n except Exception as e:\n print('-> err ({})'.format(e.__str__()))\n\n setup_app(se... | [
"0.84950584",
"0.8327538",
"0.785511",
"0.7598032",
"0.7563656",
"0.7563656",
"0.7544914",
"0.7525454",
"0.7508481",
"0.74509245",
"0.7367585",
"0.7355439",
"0.73454165",
"0.7332968",
"0.7320497",
"0.73200977",
"0.73181677",
"0.7312806",
"0.7289844",
"0.7287715",
"0.7287715",... | 0.0 | -1 |
Computes the free energy \mathcal{F}({\bf v}) = \log \sum_{\bf h} e^{E({\bf v},{\bf h})}. | def free_energy(self, v):
return - T.dot(v, self._b) \
- T.log(1. + T.exp(T.dot(v, self._W) + self._c)).sum(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def free_energy_function(self, x):\n \n wx_b = T.dot(x, self.W) + self.bhid\n \n return -T.sum(T.log(1 + T.exp(wx_b)), axis=1) -T.dot(x, self.b)",
"def f0(E, fermi, T):\n return 1. / (1. + np.exp((E - fermi) / (k_B * T)))",
"def bethe_free_energy(self, potential):\n xn, xe... | [
"0.7025948",
"0.6679579",
"0.66672623",
"0.6640644",
"0.6486068",
"0.6409317",
"0.63664955",
"0.631139",
"0.63051414",
"0.62414086",
"0.6212336",
"0.6170881",
"0.6169674",
"0.6156047",
"0.61559224",
"0.6142679",
"0.61094135",
"0.6067248",
"0.6050417",
"0.60194695",
"0.5991574... | 0.740989 | 0 |
Test the == and != operators. | def test_graphid_operator_eq_and_neq():
for xstr, ystr in itertools.product(["g1", "g2", "y7", "z123"], repeat=2):
x = _ir.GraphId(xstr)
y = _ir.GraphId(ystr)
if xstr == ystr:
assert x == y
assert not (x != y)
else:
assert not (x == y)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testEquality(self):\n pass",
"def exact(cls, lhs, rhs):\n return lhs == rhs",
"def test_boolean_logic(self):\n\n self.assertTrue(True, \"True should be equal to True.\")\n self.assertFalse(False, \"False should not be equal to True.\")\n self.assertNotEqual(True, False, \... | [
"0.70257527",
"0.6813076",
"0.6716191",
"0.66282046",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
"0.6585776",
... | 0.60887265 | 97 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.