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 |
|---|---|---|---|---|---|---|
This tests the commentarylist view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for this view. | def test_commentary_view_list(self):
test_response = self.client.get('/papers/commentaries')
self.assertEqual(test_response.status_code, 200)
self.assertTrue('commentary_list' in test_response.context)
self.assertTemplateUsed(test_response, 'base.html')
self.asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_commentary_view(self):\n test_response = self.client.get('/papers/commentary/1')\n self.assertEqual(test_response.status_code, 200)\n self.assertTrue('commentary' in test_response.context) \n self.assertTemplateUsed(test_response, 'commentary-detail.html')\n self.... | [
"0.6995162",
"0.67945224",
"0.6661858",
"0.665188",
"0.65656775",
"0.65432876",
"0.6319565",
"0.6162861",
"0.6144577",
"0.6141237",
"0.6118269",
"0.6117653",
"0.6109369",
"0.6105392",
"0.6102034",
"0.6058892",
"0.6050288",
"0.60439247",
"0.60389704",
"0.60058194",
"0.6004947"... | 0.78076106 | 0 |
This tests the jclist view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for this view. | def test_jc_view_list(self):
test_response = self.client.get('/journal-club')
self.assertEqual(test_response.status_code, 200)
self.assertTrue('journal_club_list' in test_response.context)
self.assertTemplateUsed(test_response, 'base.html')
self.assertTemplateUse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testviewlist(self):\n rv = self.app.get('/viewcategory')\n self.assertEqual(rv.status_code, 302, \"viewlist page should not load unless signed in\")",
"def test_get_with_user(self):\n response = TempLanguageListView.as_view()(self.request)\n self.assertEqual(response.status_code, ... | [
"0.68689126",
"0.6572278",
"0.6550239",
"0.64747584",
"0.64244735",
"0.64096004",
"0.64024365",
"0.63962084",
"0.63934314",
"0.6390168",
"0.63770026",
"0.6361745",
"0.6326139",
"0.6250595",
"0.62116224",
"0.6175842",
"0.605871",
"0.60534877",
"0.6006303",
"0.60029066",
"0.600... | 0.7534962 | 0 |
Convert of p value to a color code using a diverging color map, meaning two opposite poles are distinguished from the middle and from each other. higher=True if the observed mean (bar height) is higher than the test mean. | def p_to_color_div(p, higher=False):
cmap = cm.get_cmap('seismic')
# help(cmap)
return cmap(p_to_norm(p, higher)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colortopalette(color, palette):\n for a,b in palette:\n if color >= a and color < b:\n return b",
"def pcolor(self, mode=\"mean\", vmin=None, vmax=None):\n from pylab import clf, xticks, yticks, pcolor, colorbar, flipud, log10\n if mode == \"mean\":\n data = self.get_mean()\n ... | [
"0.6033845",
"0.5929055",
"0.58861625",
"0.5847088",
"0.58045423",
"0.5588033",
"0.5586589",
"0.55774224",
"0.5474697",
"0.54477924",
"0.5420866",
"0.5419459",
"0.5380197",
"0.53801894",
"0.53602606",
"0.5349077",
"0.5343383",
"0.5341518",
"0.5334428",
"0.5313867",
"0.5295791... | 0.7469932 | 0 |
return True if n is a prime number | def is_prime(n):
if n < 2:
return False
if n == 2 | n == 3:
return True
if n % 2 == 0 | n % 3 == 0:
return False
for i in range(2, int(sqrt(n))+1):
if n % i == 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isprime(n):\r\n\treturn is_prime(n)",
"def isprime(n):\n\treturn is_prime(n)",
"def isprime(n):\n if n % 2 == 0:return False\n return all(n % i for i in range(3, int(n**0.5) + 1, 2))",
"def isprime(n: int) -> bool:\r\n if n > 1:\r\n for i in range(2, int(n / 2) + 1):\r\n if (n ... | [
"0.8848491",
"0.8838163",
"0.8630065",
"0.86087567",
"0.860345",
"0.8588974",
"0.8586852",
"0.85864645",
"0.8582361",
"0.85803086",
"0.8576298",
"0.8530761",
"0.8525803",
"0.84985477",
"0.849435",
"0.849369",
"0.8492627",
"0.8485174",
"0.8478475",
"0.8467156",
"0.84513164",
... | 0.8309483 | 41 |
Strip the leading 'f' from the 'funderline' and 'foverstrike' dict D keys. Returns a new dict. Prepares a new dict with standard font attribute keys that can be used to create or modify a Tkinter font. | def convert_ttoptions_dict_to_font_dict(d):
return {
(k[1:] if k in (funderline_s, foverstrike_s) else k): v
for k, v in d.items()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_font_dict_to_ttoptions_dict(d):\n return {\n (\"f\" + k if k in (underline_s, overstrike_s) else k): v\n for k, v in d.items()\n }",
"def split_dict_into_options_fontattrs_and_case(d):\n c_d = {\n case_s: (v if k == case_s else k)\n for k, v in d.items()\n ... | [
"0.70298797",
"0.63934696",
"0.5784403",
"0.5700632",
"0.561567",
"0.55499864",
"0.54290736",
"0.53962106",
"0.53393847",
"0.5336261",
"0.53199905",
"0.53116393",
"0.5281415",
"0.5261497",
"0.52454764",
"0.5211536",
"0.51234704",
"0.5099443",
"0.5096136",
"0.5094325",
"0.5062... | 0.7088782 | 0 |
Return a dict of font attributes for font F. | def get_font_dict(f):
return tk_font.Font(font=f).actual() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_font_dict(*a, **kw):\n return get_font_dict(*a, **kw)",
"def _get_font_descriptor(self) -> dict:\n self._base_font = self.font['name'].names[6].toStr()\n head = self.font[\"head\"]\n self.units_per_em = head.unitsPerEm\n scale = 1000 / self.units_per_em\n xMax = ... | [
"0.74730724",
"0.69602007",
"0.6700861",
"0.6700861",
"0.6700861",
"0.65566766",
"0.6475081",
"0.6448031",
"0.6367565",
"0.63474965",
"0.6328355",
"0.6328355",
"0.6276222",
"0.6271578",
"0.6190036",
"0.61846054",
"0.6170288",
"0.6078483",
"0.60327715",
"0.60177344",
"0.587516... | 0.8171498 | 0 |
Get config option info from the internal widget used to keep state. | def _widget_cget(self, option, **kwargs):
cook_b = kwargs.get("cook", True)
default_b = kwargs.get(default_s, False)
if default_b:
value = self.widget.config(option)[-2]
return value
try: # if True: #
value = self.widget.cget(option)
except tk... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _opt_config(self):\n return self._opt_method.config",
"def get_opt(self, widget):\r\n opt = dict()\r\n opt[\"state\"] = widget[\"state\"]\r\n opt[\"fg\"] = widget[\"fg\"]\r\n opt[\"bg\"] = widget[\"bg\"]\r\n return opt",
"def get_option(self, n):\n opts = se... | [
"0.730024",
"0.70098037",
"0.6630041",
"0.66143924",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
"0.66057783",
... | 0.0 | -1 |
Bind to all widgets at an event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value. | def bind_all(self, sequence=None, func=None, add=None):
return super().bind_all(sequence, func, add) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind(self, sequence=None, func=None, add=None):\n return self._widget_bind(sequence, func, add, internal=False)",
"def _widget_bind(self, sequence=None, func=None, add=None, **kw):\n debug_b = kw.get(\"debug\", self.default_debug)\n if debug_b:\n self._print(\n ... | [
"0.7693165",
"0.7222266",
"0.645661",
"0.6357454",
"0.6174125",
"0.6122644",
"0.5983554",
"0.5814096",
"0.58034766",
"0.57443905",
"0.56805885",
"0.56678206",
"0.5640299",
"0.56379724",
"0.5591991",
"0.55774534",
"0.5511707",
"0.55109316",
"0.5502429",
"0.54826534",
"0.542643... | 0.6885231 | 2 |
See help on module method convert_font_dict_to_ttoptions_dict() for more info. | def convert_font_dict_to_ttoptions_dict(*a, **kw):
return convert_font_dict_to_ttoptions_dict(*a, **kw) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_ttoptions_dict_to_font_dict(*a, **kw):\n return convert_ttoptions_dict_to_font_dict(*a, **kw)",
"def convert_font_dict_to_ttoptions_dict(d):\n return {\n (\"f\" + k if k in (underline_s, overstrike_s) else k): v\n for k, v in d.items()\n }",
"def convert_ttoptions_dict_to... | [
"0.85870737",
"0.8015302",
"0.7890632",
"0.66027755",
"0.64634246",
"0.637451",
"0.6002357",
"0.58082384",
"0.56775844",
"0.5582303",
"0.54864246",
"0.54647195",
"0.54149157",
"0.5291586",
"0.5229343",
"0.52052104",
"0.51397294",
"0.5136468",
"0.5106122",
"0.50967175",
"0.505... | 0.8966815 | 0 |
See help on module method convert_ttoptions_dict_to_font_dict() for more info. | def convert_ttoptions_dict_to_font_dict(*a, **kw):
return convert_ttoptions_dict_to_font_dict(*a, **kw) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_font_dict_to_ttoptions_dict(*a, **kw):\n return convert_font_dict_to_ttoptions_dict(*a, **kw)",
"def convert_ttoptions_dict_to_font_dict(d):\n return {\n (k[1:] if k in (funderline_s, foverstrike_s) else k): v\n for k, v in d.items()\n }",
"def convert_font_dict_to_ttopti... | [
"0.8870512",
"0.80991346",
"0.7984105",
"0.68638766",
"0.68179125",
"0.6558356",
"0.60517687",
"0.60045576",
"0.5751478",
"0.56992775",
"0.5575399",
"0.55026853",
"0.5495594",
"0.5452329",
"0.5431746",
"0.5417478",
"0.5397275",
"0.5392449",
"0.53916657",
"0.535098",
"0.532333... | 0.8861002 | 1 |
See help on module method split_dict_into_options_fontattrs_and_case() for more info | def split_dict_into_options_fontattrs_and_case(*a, **kw):
return split_dict_into_options_fontattrs_and_case(*a, **kw) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_dict_into_options_fontattrs_and_case(d):\n c_d = {\n case_s: (v if k == case_s else k)\n for k, v in d.items()\n if k in case_dict_keys\n }\n f_d = {\n (k[1:] if k in (funderline_s, foverstrike_s) else k): v\n for k, v in d.items()\n if k in ttfont_dict_... | [
"0.8158567",
"0.6146297",
"0.6146184",
"0.612431",
"0.60964656",
"0.56719506",
"0.5402258",
"0.53158045",
"0.5224621",
"0.520008",
"0.5196009",
"0.5192469",
"0.5191934",
"0.51555294",
"0.5132841",
"0.5121578",
"0.50395375",
"0.5033344",
"0.4930688",
"0.48783988",
"0.4848216",... | 0.8819805 | 0 |
Test when a mat is present in both systems that the closest is chosen | def test_closest_common_mats(self):
m = mats.Materials("mats_test.json", NoneVisited())
self.assertEqual( '164 G. Canis Majoris', m.closest([0, 0, 0], ['Iron'])[1]['system'])
self.assertEqual( '2MASS J10433563-5945136', m.closest([8000, 0, 3000], ['Iron'])[1]['system']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_closest_multiple_mats(self):\n m = mats.Materials(\"mats_test.json\", NoneVisited())\n self.assertEqual( '164 G. Canis Majoris', m.closest([0, 0, 0], ['Tungsten', 'Germanium'])[1]['system'])\n self.assertEqual( '2MASS J10433563-5945136', m.closest([8000, 0, 3000], ['Tungsten', 'German... | [
"0.70502865",
"0.68170565",
"0.6539207",
"0.6474658",
"0.60842615",
"0.59941274",
"0.58957547",
"0.5809887",
"0.57292074",
"0.5712595",
"0.5706446",
"0.5617678",
"0.5616232",
"0.5613859",
"0.55955845",
"0.5579897",
"0.55496943",
"0.55332154",
"0.55323607",
"0.5526193",
"0.549... | 0.69867074 | 1 |
Convert quantiles to parameter distribution samples | def _generate_distribution_samples(self, set_count, parameter_count):
self._samples = numpy.zeros((set_count, parameter_count))
for i, distribution in enumerate(self.parameter_distributions.values()):
self._samples[:, i] = distribution.ppf(self._quantiles[:, i]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantile_transform(X, *, axis=..., n_quantiles=..., output_distribution=..., ignore_implicit_zeros=..., subsample=..., random_state=..., copy=...):\n ...",
"def _process_quantiles(x, dim):\r\n x = np.asarray(x, dtype=float)\r\n\r\n if x.ndim == 0:\r\n x = x[np.newaxis]\r\n elif x.ndim == 1... | [
"0.68211794",
"0.6415406",
"0.64061975",
"0.6368863",
"0.6360626",
"0.6310223",
"0.63034046",
"0.63015264",
"0.63015264",
"0.63015264",
"0.6219652",
"0.61983705",
"0.61857074",
"0.61848336",
"0.6183454",
"0.6149637",
"0.614597",
"0.614434",
"0.614434",
"0.6136265",
"0.6131276... | 0.6143542 | 19 |
Returns the matching end bracket of a start bracket | def bracket_match(bracket):
if bracket == '(':
return ')'
if bracket == '[':
return ']'
if bracket == '{':
return '}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_bracket_group(input_string, start):\n return find_closure_group(input_string, start, group=[\"{\", \"}\"])",
"def bracket_start(self):\n c = self.call\n while c.next is not None:\n c = c.next\n return c.name.end_pos",
"def MatchEndParen(self, string):\n if not sel... | [
"0.7235852",
"0.6754336",
"0.6661549",
"0.6645004",
"0.6581832",
"0.64741564",
"0.6465799",
"0.6454053",
"0.63443047",
"0.625815",
"0.6226062",
"0.61927885",
"0.6087954",
"0.6085719",
"0.6070282",
"0.6045832",
"0.5983436",
"0.59363747",
"0.59363747",
"0.59363747",
"0.59055185... | 0.63158673 | 9 |
Moves the right motor backward upon a button press. The motor moves at a speed in degrees per second | def right_backward(self, state, speed):
if state:
self.right_motor.run_forever(speed_sp=-speed)
ev3.Leds.set_color(ev3.Leds.RIGHT, ev3.Leds.RED)
else:
self.right_motor.stop()
ev3.Leds.set_color(ev3.Leds.RIGHT, ev3.Leds.BLACK) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_backward(self):\n self.right_motor.run_forever(speed_sp=-self.MAX_SPEED)",
"def reverse_button(self, left_speed, right_speed):\n self.left_motor.run_forever(speed_sp=-int(left_speed))\n self.right_motor.run_forever(speed_sp=-int(right_speed))",
"def move_down(self):\n self... | [
"0.81504446",
"0.81332487",
"0.79073024",
"0.7753975",
"0.7736763",
"0.7614222",
"0.76010567",
"0.7574628",
"0.7548701",
"0.7487201",
"0.7446322",
"0.73603594",
"0.7341898",
"0.7309033",
"0.7309033",
"0.72994953",
"0.7273443",
"0.7273166",
"0.72636706",
"0.72190654",
"0.71785... | 0.8011508 | 2 |
Moves the left motor forward upon a button press. The motor moves at a speed in degrees per second. | def left_forward(self, state, speed):
if state:
self.left_motor.run_forever(speed_sp=speed)
ev3.Leds.set_color(ev3.Leds.LEFT, ev3.Leds.GREEN)
else:
self.left_motor.stop()
ev3.Leds.set_color(ev3.Leds.LEFT, ev3.Leds.BLACK) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_button(self, left_speed, right_speed):\n self.left_motor.run_forever(speed_sp=int(left_speed))\n self.right_motor.run_forever(speed_sp=int(right_speed))",
"def left_button(self, left_speed, right_speed):\n self.right_motor.run_forever(speed_sp=int(right_speed))",
"def left(self... | [
"0.8180152",
"0.8072951",
"0.79563665",
"0.79242516",
"0.76426995",
"0.7510501",
"0.743861",
"0.72708344",
"0.7261254",
"0.72529185",
"0.72219086",
"0.7221309",
"0.7179941",
"0.7176807",
"0.71635216",
"0.7163195",
"0.7162422",
"0.71594447",
"0.71523064",
"0.7139756",
"0.71342... | 0.77653205 | 4 |
Moves the left motor backward upon a button press. The motor moves at a speed in degrees per second. | def left_backward(self, state, speed):
if state:
self.left_motor.run_forever(speed_sp=-speed)
ev3.Leds.set_color(ev3.Leds.LEFT, ev3.Leds.RED)
else:
self.left_motor.stop()
ev3.Leds.set_color(ev3.Leds.LEFT, ev3.Leds.BLACK) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_button(self, left_speed, right_speed):\n self.left_motor.run_forever(speed_sp=-int(left_speed))\n self.right_motor.run_forever(speed_sp=-int(right_speed))",
"def left_backward(self):\n self.left_motor.run_forever(speed_sp=-self.MAX_SPEED)",
"def move_down(self):\n self.p... | [
"0.79304874",
"0.7911803",
"0.7817998",
"0.7593929",
"0.75321615",
"0.7413286",
"0.73599225",
"0.7350439",
"0.73449975",
"0.7308199",
"0.7263581",
"0.713369",
"0.7118184",
"0.7115466",
"0.71105486",
"0.70657635",
"0.70229584",
"0.7020933",
"0.69893116",
"0.69810027",
"0.69655... | 0.7629859 | 3 |
Combine embedding across the episode temporal dimension. | def reduce_temporal_embeddings(
temporal_embedding,
output_size,
scope,
reuse=tf.AUTO_REUSE,
conv1d_layers = (64,),
fc_hidden_layers = (100,),
combine_mode = 'temporal_conv'):
if len(temporal_embedding.shape) == 5:
temporal_embedding = tf.reduce_mean(temporal_embedding, axis=[2, 3])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _embed(self):\n with tf.variable_scope('word_embedding'):\n self.word_embeddings = tf.get_variable(\n 'word_embeddings',\n shape=(self.term_vocab.size(), self.term_vocab.embed_dim),\n initializer=tf.constant_initializer(self.term_vocab.embeddings),... | [
"0.64200747",
"0.6326184",
"0.6267721",
"0.6249737",
"0.61867166",
"0.6164913",
"0.6011324",
"0.6011175",
"0.5934129",
"0.59319943",
"0.58960605",
"0.5863642",
"0.5856913",
"0.5833061",
"0.58082265",
"0.5761189",
"0.57435846",
"0.57144356",
"0.5711894",
"0.57084066",
"0.57015... | 0.6678748 | 0 |
Numpy function for softmax | def softmax(x):
shape = x.shape
probs = np.exp(x - np.max(x, axis=len(shape) - 1, keepdims=True))
probs /= np.sum(probs, axis=len(shape) - 1, keepdims=True)
return probs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x): \n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x):\n return np.exp(x)/np.sum(np.exp(x),axis=0)",
"def softmax(x):\n return np.exp(x)/np.su... | [
"0.86270744",
"0.86158144",
"0.8584062",
"0.8584062",
"0.8571627",
"0.8568542",
"0.8537994",
"0.8537994",
"0.8537994",
"0.8537994",
"0.8537994",
"0.8537994",
"0.8537994",
"0.8537994",
"0.853401",
"0.8531851",
"0.8524876",
"0.85204613",
"0.8517792",
"0.85159737",
"0.84623146",... | 0.8353117 | 30 |
Method to retrieve the definition for this configuration. This will trigger a refresh of the definition from the PyFiguration object and clean any empty keys from it. | def get_definition(self) -> dict:
# Refresh the definition from the PyFiguration object
self._set_definition(self.pyfiguration.definition)
# Return the cleaned definition
return {
key: (
self.definition.get(key, None)
if not isinstance(value, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_definition(self):\n return self.definition",
"def get_dict(self):\n\n return self._definition",
"def definition(self):\n return self._definition",
"def definition_yaml(self):\n\n if self._definition:\n return dump_calculationset_yaml(self._definition)\n r... | [
"0.7015458",
"0.6883142",
"0.6698901",
"0.6642334",
"0.6635337",
"0.6635337",
"0.65403134",
"0.64501756",
"0.622594",
"0.61618227",
"0.6159994",
"0.6070069",
"0.6052024",
"0.6051887",
"0.6040782",
"0.57456213",
"0.5742419",
"0.5742021",
"0.5717445",
"0.57154304",
"0.5694363",... | 0.81133777 | 0 |
Returns the appropriate InputKind constant from an ``inspect.Parameter`` object. | def infer_kind_from_parameter(param: Parameter, has_units: bool = False) -> InputKind:
if (
param.annotation in [DataArray, Union[DataArray, str]]
and param.default is not None
):
return InputKind.VARIABLE
if Optional[param.annotation] in [
Optional[DataArray],
Optio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def param_kind(self) -> Optional['outputs.ParamKind']:\n return pulumi.get(self, \"param_kind\")",
"def param_kind(self) -> Optional['outputs.ParamKindPatch']:\n return pulumi.get(self, \"param_kind\")",
"def test_kind():\n value = 11\n num_a = param.Integer(value=value)\n\n ... | [
"0.62266386",
"0.6068737",
"0.5857749",
"0.57730204",
"0.57138574",
"0.56005263",
"0.55768615",
"0.54822344",
"0.54724395",
"0.54724395",
"0.54724395",
"0.54565644",
"0.5385306",
"0.5363856",
"0.53320456",
"0.53102803",
"0.5280218",
"0.52761555",
"0.5202848",
"0.5170891",
"0.... | 0.68978894 | 0 |
This method generates the content of the overlay presenting OnlineHelp. In case both section and subsection are missing, we'll open main OnlineHelp page. | def showOnlineHelp(self, section=None, subsection=None, **data):
template_specification = self.fill_overlay_attributes(None, "TVB", "Online-Help", "help/online_help", "help")
# Add URL of the help page
template_specification["helpURL"] = self.config.get_help_url(section, subsection)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _helpmenu_about():\n self.helpindex = Toplevel(self.master)\n self.helpindex.title(\"About\")\n self.helpindex.geometry(\"500x300\")\n self.helpindex.label()",
"def on_about(self):\n render_about_window()",
"def advanced_help(self, master, helpText):\r\n ... | [
"0.5949303",
"0.5661682",
"0.5626375",
"0.5579263",
"0.5571765",
"0.55493313",
"0.5491596",
"0.5457224",
"0.54476744",
"0.5438522",
"0.54367846",
"0.54181486",
"0.54152334",
"0.5382418",
"0.538217",
"0.5373193",
"0.5362131",
"0.5341298",
"0.5334435",
"0.5333858",
"0.53327006"... | 0.7249005 | 0 |
Overloading of the equality method | def __eq__(self,other):
if isinstance(other, self.__class__):
return self.mac == other.mac
else: return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pas... | [
"0.85453904",
"0.85453904",
"0.85453904",
"0.85453904",
"0.85453904",
"0.85453904",
"0.85453904",
"0.85453904",
"0.85453904",
"0.85453904",
"0.85453904",
"0.85067266",
"0.85067266",
"0.85067266",
"0.85067266",
"0.85067266",
"0.85067266",
"0.85067266",
"0.85067266",
"0.85067266"... | 0.0 | -1 |
Compute the mean and variance of the `posterior` of NNGP and NTK. Note that this method is equivalent to `gradient_descent_mse_gp` at infinite | def gp_inference(kernel_fn,
x_train,
y_train,
x_test,
get,
diag_reg=0.,
compute_cov=False):
if get is None:
get = ('nngp', 'ntk')
kdd, ktd, ktt = _get_matrices(kernel_fn, x_train, x_test, get, compute_cov)
gp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_posterior(g: to.Tensor, lpj: to.Tensor) -> to.Tensor:\n if tvo.get_device().type == \"cpu\":\n means = _mean_post_einsum(g, lpj)\n else:\n means = _mean_post_mul(g, lpj)\n\n assert means.shape == (g.shape[0], *g.shape[2:])\n assert not to.isnan(means).any() and not to.isinf(means... | [
"0.6821062",
"0.634901",
"0.6108903",
"0.5793908",
"0.57890546",
"0.5678156",
"0.56511575",
"0.55245835",
"0.5481837",
"0.5460603",
"0.54288447",
"0.5391452",
"0.5336825",
"0.5321799",
"0.53201544",
"0.5288015",
"0.5281915",
"0.5274995",
"0.52628106",
"0.5254729",
"0.52215147... | 0.0 | -1 |
Calculates negative auto correlation of samples xs. This uses the usual window estimators for auto correlation and sums these to get an estimate of autocorrelation time (i.e., Monte Carlo error). However, note this is not even a consistent estimator of autocorrelation time. (See Geyer (1992)) Because we use this as a r... | def auto_correlation_naive(target_distribution, x0, xs, accepteds, max_lag=None):
n = len(xs)
if max_lag is None:
max_lag = n - 1
if max_lag < 1:
raise ValueError("max_lag needs to be greater than 0.")
ac = 0.0
seq = xs - np.mean(xs)
var = np.var(seq)
if np.isclose(var, 0.0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_correlation(x, lags):\n\tn = len(x)\n\tx = np.array(x)\n\tresult = []\n\tfor i in range(1, lags + 1):\n\t\ty = abs(np.correlate(x[i:] - x[i:].mean(), x[:n - i] - x[:n - i].mean())[0])\n\t\td = (x[i:].std() * x[:n - i].std() * (n - i))\n\t\tresult.append(y / d)\n\treturn result",
"def autocorrelation(x):... | [
"0.6973235",
"0.69557774",
"0.69557774",
"0.6942276",
"0.6906297",
"0.67576116",
"0.67576116",
"0.6709613",
"0.6635032",
"0.6602292",
"0.65536845",
"0.6510047",
"0.64248836",
"0.6423801",
"0.64084697",
"0.6330132",
"0.6288052",
"0.62572426",
"0.6225367",
"0.6192353",
"0.61847... | 0.6718385 | 7 |
Reward the previous action with reward. | def reward(self, history_id, reward):
reward_action = self._historystorage.unrewarded_histories[history_id].action
reward_action_idx = self._actions.index(reward_action)
context = self._historystorage.unrewarded_histories[history_id].context[reward_action_idx]
context = np.matrix(context... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _action_rewards(self, context) -> ActionRewards:\n pass",
"def reward(self, history_id, reward):\n pass",
"def _reward(self, action):\n raise NotImplementedError",
"def get_reward(self, state, action, next_state, absorbing):\n raise NotImplementedError",
"def _reward(self, a... | [
"0.73942286",
"0.730866",
"0.72596717",
"0.72183096",
"0.71373534",
"0.70769584",
"0.7075508",
"0.69718593",
"0.6958205",
"0.6942918",
"0.69239765",
"0.6892974",
"0.6892642",
"0.6838727",
"0.68366915",
"0.6809473",
"0.68087393",
"0.68080866",
"0.6806997",
"0.6735299",
"0.6689... | 0.6421402 | 50 |
Besteffort of sanitizing an untrusted string that will be used to create a file on the user's local filesystem. untrustedFilename filename string with possibly bad / hostile characters or sequences. sanitized filename | def getSafeFilename(untrustedFilename: unicode) -> unicode:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_filename(filename):\n sanitized_filename = re.sub(r'[/\\\\:*?\"<>|]', '-', filename)\n sanitized_filename = sanitized_filename.replace('&', 'and')\n sanitized_filename = sanitized_filename.replace('\"', '')\n sanitized_filename = sanitized_filename.replace(\"'\", '')\n sanitized_filenam... | [
"0.76141167",
"0.7589279",
"0.7583239",
"0.7583239",
"0.7568847",
"0.7568013",
"0.74044746",
"0.7367551",
"0.72991896",
"0.72416437",
"0.72291976",
"0.71116453",
"0.7109258",
"0.70507437",
"0.7026937",
"0.698266",
"0.6959216",
"0.69557416",
"0.69411516",
"0.692763",
"0.683257... | 0.8151417 | 0 |
Creates a new Resource Manager. This is the supplier for all resource creation calls. | def __init__(self, domain: str = 'minecraft', resource_dir: Sequence[str] = ('src', 'main', 'resources'), indent: int = 2, ensure_ascii: bool = False, default_language: str = 'en_us', on_error: Callable[[str, Exception], Any] = None):
self.resource_dir = utils.str_path(resource_dir)
self.domain = domain... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, context, data, is_auto_import=False):\n db_session_event = 'create-resource_mgr'\n db_session = self.db_api.get_transactional_session(\n db_session_event)\n state_map = {eon_const.RESOURCE_MGR_STATE_KEY:\n eon_const.EON_RESOURCE_MANAGER_STATE_... | [
"0.6851695",
"0.6713712",
"0.6389448",
"0.610204",
"0.5957527",
"0.59392047",
"0.5828924",
"0.57964164",
"0.57455796",
"0.5712935",
"0.5695316",
"0.56430745",
"0.56219834",
"0.5576493",
"0.5545291",
"0.55416983",
"0.5518348",
"0.5513336",
"0.5472368",
"0.5451935",
"0.5429594"... | 0.0 | -1 |
Creates a loot table for a block | def block_loot(self, name_parts: ResourceIdentifier, *loot_pools: Json) -> BlockContext:
res = self.loot(name_parts, *loot_pools, path='blocks', loot_type='minecraft:block')
return BlockContext(self, res) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_blockchain_table(self):\n cmd = \"\"\" CREATE TABLE IF NOT EXISTS %s (\n %s integer PRIMARY KEY AUTOINCREMENT,\n %s text,\n %s integer,\n %s real,\n %s text,\n %s text);\"\"\" %(TAB... | [
"0.63324046",
"0.5871776",
"0.58042663",
"0.57642454",
"0.5742061",
"0.5738972",
"0.5712546",
"0.5661574",
"0.56419104",
"0.55933917",
"0.55933917",
"0.5591138",
"0.55905056",
"0.55779237",
"0.5572",
"0.55483365",
"0.55483365",
"0.55442643",
"0.554193",
"0.55252165",
"0.55087... | 0.5383651 | 38 |
This returns a simple distance function in interval [0,1] between 2 defects. | def custom_distance_fun(defect1, defect2):
distance = 1
# first check if they are within 30 days of each other
delta_days = abs(defect2[0] - defect1[0]) / 24
if delta_days <= 30: # 30 days for our example
delta_chapter = 0 if defect1[1] == defect2[1] else 1
distance = 0.3 * (delta_days... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetDist(feature_1, feature_2):\n return np.linalg.norm(feature_1 - feature_2)",
"def distance(x1, y1, x2, y2):\n return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5",
"def distance(x1, y1, x2, y2):\n dist = ((x1-x2)**2 + (y1-y2)**2)**0.5\n return dist",
"def get_distance(x1, y1, x2, y2):\n ret... | [
"0.72660995",
"0.7037052",
"0.6957593",
"0.69535524",
"0.691113",
"0.69090927",
"0.688562",
"0.6865793",
"0.68565273",
"0.68522716",
"0.68291134",
"0.68224895",
"0.6820436",
"0.67833143",
"0.6781289",
"0.67671955",
"0.67505133",
"0.6744825",
"0.67392284",
"0.673723",
"0.67296... | 0.76450396 | 0 |
Tests that a listener is added to the underlying client, after being wrapped in such a way that it would be executed in the reactor thread. | def test_add_listener(self):
self.wrapper.add_listener(self._assert_in_reactor_thread)
event = object()
internal_listener, = self.client.listeners
internal_listener(event)
self.assertIdentical(self.received_event, event) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subscribe_one_listener(self):\n def listener():\n pass\n EVENT_MANAGER.subscribe('test_listener', listener)\n self.assertIn(listener, EVENT_MANAGER._listeners['test_listener'])",
"def test_remove_listener(self):\n listener = lambda state: state\n self.wrappe... | [
"0.69329417",
"0.68686044",
"0.6679982",
"0.6588854",
"0.6491933",
"0.64301765",
"0.64275664",
"0.60705894",
"0.60204434",
"0.6015809",
"0.59902453",
"0.59442145",
"0.59395874",
"0.59093046",
"0.5886746",
"0.58820283",
"0.5850155",
"0.5834565",
"0.5828874",
"0.58169866",
"0.5... | 0.8787536 | 0 |
This method returns all cache blocks. Returns A list of dictionaries with all cache blocks information. | def get_mem(self) -> list:
return self.__mem | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_block_dict(self) -> dict:\n return self.blocks",
"def getBlocks(self) -> List[ghidra.program.model.mem.MemoryBlock]:\n ...",
"def get_blocks(self):\n cmd = \"\"\" SELECT * FROM %s; \"\"\" %(TABLE_BLOCKCHAIN)\n\n self.__dbcursor.execute(cmd)\n return self.__dbcursor.f... | [
"0.7125327",
"0.7070081",
"0.70094293",
"0.65782726",
"0.6538208",
"0.6474031",
"0.6422362",
"0.6313308",
"0.6279374",
"0.62622875",
"0.62430704",
"0.6112625",
"0.60894114",
"0.6081727",
"0.6073321",
"0.6060935",
"0.60378546",
"0.59768677",
"0.59563947",
"0.59398735",
"0.5886... | 0.0 | -1 |
Constructor for Featurizer class | def __init__(self, proj_num,
base_data_dir = '/home/server/server2/data/SVR166219/',
base_setup_dir = '/home/server/server2/projects/Gromacs/'):
self.proj_num = proj_num
self.base_data_dir = base_data_dir
self.dataframe_path = os.path.join(base_dir,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, **kwargs):\n super(FeatherMatrix8x16, self).__init__(**kwargs)",
"def __init__(self, atom_types=0, fuzz_increment=0.3, min_path=1,\n max_path=15, n_jobs=1, verbose=True):\n\n super(ErGFeaturizer, self).__init__(n_jobs=n_jobs, verbose=verbose)\n self.atom_ty... | [
"0.6500379",
"0.64959556",
"0.6455273",
"0.64541894",
"0.6440447",
"0.6437264",
"0.6403186",
"0.6393175",
"0.63061374",
"0.62930197",
"0.625",
"0.62428296",
"0.62397194",
"0.61983615",
"0.61846805",
"0.6179621",
"0.6176057",
"0.617425",
"0.61732495",
"0.61695814",
"0.61669487... | 0.0 | -1 |
Create an empty DataFrame for this project. | def create_dataframe(self):
df = pd.DataFrame({'date': [],
'RUN': [],
'CLONE': [],
'GEN': pd.Series(0, index=[], dtype='int'),
'frame': pd.Series([], index=[], dtype='int'),
't... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_frame_creator(self):\n\n return pd.DataFrame()",
"def _make_blank(cls) -> pd.DataFrame:\n spec = list(zip(cls._required_columns, cls._required_dtypes))\n try:\n arr = np.zeros(0, dtype=spec)\n return pd.DataFrame(arr)\n except TypeError as exc:\n ... | [
"0.7723491",
"0.70627886",
"0.6873515",
"0.682038",
"0.6787119",
"0.67716914",
"0.67471194",
"0.6731752",
"0.67029136",
"0.6631718",
"0.6576077",
"0.6564954",
"0.655227",
"0.65334797",
"0.6475534",
"0.64730036",
"0.64184165",
"0.64145875",
"0.6413942",
"0.6403204",
"0.6402589... | 0.7061941 | 2 |
Initialize the TestModel class. | def __init__(self, opt):
assert(not opt.isTrain)
BaseModel.__init__(self, opt)
# specify the training losses you want to print out.
self.loss_names = []
# specify the images you want to save/display.
self.visual_names = ['real_A', 'fake_B']
# specify the models y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_model(self):\n pass",
"def initialize(self, model):\n pass",
"def init_model(self):\n pass",
"def setUpClass(self):\n\n base_model = BaseModel()",
"def test_model_initialization():\n MyModel(\"model\", SkillContext())",
"def setUpClass(cls) -> None:\n ... | [
"0.7904024",
"0.7741662",
"0.7725355",
"0.7593264",
"0.7423927",
"0.73066896",
"0.7193625",
"0.71935016",
"0.71538514",
"0.7059315",
"0.70272547",
"0.7017552",
"0.6943066",
"0.6941206",
"0.6924282",
"0.69038963",
"0.69038963",
"0.69038963",
"0.69038963",
"0.6898596",
"0.68887... | 0.0 | -1 |
Opens the web browser and the openEO web editor with the currently connected backend. | def web_view(self):
try:
webbrowser.open("https://editor.openeo.org/?server={}".format(self.backend.url))
except:
pass
# QWebEngineView, QWebView... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_in_web(self):\n self._client_api._open_in_web(url=self.platform_url)",
"def open_in_browser(self):\n webbrowser.open(self.url)",
"def browse( self ):\n webbrowser.open(self.url())",
"def open_editor(event):\n event.current_buffer.open_in_editor(event.cli)",
"def open_in... | [
"0.7481132",
"0.7377785",
"0.6997551",
"0.6635567",
"0.66273844",
"0.65531313",
"0.65294063",
"0.65204966",
"0.6444651",
"0.64436615",
"0.64406693",
"0.6440161",
"0.64144015",
"0.63915634",
"0.6381181",
"0.63800144",
"0.63578606",
"0.6345542",
"0.633933",
"0.6310409",
"0.6253... | 0.8344945 | 0 |
Opens the web browser and the openEO web editor with the currently connected backend. | def web_view_close(self):
self.webWindow.close()
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def web_view(self):\n try:\n webbrowser.open(\"https://editor.openeo.org/?server={}\".format(self.backend.url))\n except:\n pass\n # QWebEngineView, QWebView...",
"def open_in_web(self):\n self._client_api._open_in_web(url=self.platform_url)",
"def open_in_brow... | [
"0.8345564",
"0.748172",
"0.737889",
"0.6998054",
"0.66360885",
"0.6628433",
"0.6553087",
"0.6530007",
"0.65210116",
"0.64452475",
"0.6445135",
"0.6442146",
"0.64409137",
"0.6414483",
"0.6391573",
"0.63821244",
"0.6380862",
"0.63583416",
"0.63462824",
"0.6340097",
"0.6311658"... | 0.0 | -1 |
Replace last pronoun in sentence with [MASK] | def replace_last_pronoun(schema, pronoun):
pronouns = [
"eles",
"ela",
"ele",
"os",
"dela",
"it",
"o",
"la",
"lo",
"a",
"la",
"las",
"deles",
"delas",
"dele",
"sua",
"seu",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pronoun_fix(self, section):\n return re.sub(reg_abbrev, repl, section)",
"def profanity_word_handler(word):\n return word[0] + ''.join([settings.CENSOR_PROFANITY_REPLACEMENT_CHARACTER for I in range(len(word)-2)]) + word [-1]",
"def replace(self, text, mask):\n p = self.d\n i = 0\n ... | [
"0.62197584",
"0.6168616",
"0.5933409",
"0.5781912",
"0.5771165",
"0.57635194",
"0.57377964",
"0.56737596",
"0.56600326",
"0.5568031",
"0.5551167",
"0.5548511",
"0.5495571",
"0.5491943",
"0.54779506",
"0.547635",
"0.5463883",
"0.5458453",
"0.5445313",
"0.54325855",
"0.5418504... | 0.69771785 | 0 |
Move an RA/Dec offset. | async def set_offsets_radec(self, dra: float, ddec: float, **kwargs: Any) -> None:
log.info("Moving offset dra=%.5f, ddec=%.5f", dra, ddec)
await self.comm.send_event(OffsetsRaDecEvent(ra=dra, dec=ddec))
self._telescope.set_offsets(dra, ddec) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shiftRADec(ra1, dec1, deltaRA, deltaDec):\n\n d2r = math.pi/180.\n as2r = math.pi/648000.\n\n # Convert everything to radians\n #rara1 = ra1*d2r\n dcrad1 = dec1*d2r\n shiftRArad = deltaRA*as2r\n shiftDCrad = deltaDec*as2r\n\n # Shift!\n #deldec2 = 0.0\n sindis = math.sin(shiftRAra... | [
"0.66595817",
"0.6006074",
"0.5929881",
"0.5713689",
"0.5630921",
"0.5577712",
"0.5405503",
"0.53487694",
"0.53287065",
"0.53238285",
"0.53156906",
"0.5288385",
"0.5274514",
"0.5260297",
"0.5212244",
"0.5211268",
"0.5190426",
"0.5181402",
"0.51695246",
"0.51426184",
"0.514229... | 0.61812323 | 1 |
Compute 'Scaled Dot Product Attention' | def attention(query, key, value, adj_matrix, mask=None,dropout=None):
# query.shape = (batch, h, max_length, d_e)
# key.shape = (batch, h, max_length, max_length, d_e)
# value.shape = (batch, h, max_length, d_e)
# out_scores.shape = (batch, h, max_length, max_length)
# in_scores.shape = (batch, h, m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scaled_dot_product_attention(q, k, v, mask):\n matmul_qk = tf.matmul(q, k, transpose_b=True) # [..., q_len, kv_len]\n # scale matmul_qk\n dk = tf.cast(tf.shape(k)[-1], tf.float32)\n scaled_attention_logits = matmul_qk / tf.sqrt(dk)\n # print(\"scaled_attention_logits\", tf.nn.top_k(scaled_atten... | [
"0.67412263",
"0.66336447",
"0.6571855",
"0.65150195",
"0.6505148",
"0.6504337",
"0.6503735",
"0.6503735",
"0.64900446",
"0.6464487",
"0.64103204",
"0.6387002",
"0.63768214",
"0.62903184",
"0.61006254",
"0.6056964",
"0.601408",
"0.5984356",
"0.595376",
"0.5942652",
"0.5925456... | 0.0 | -1 |
Gets a collection of `InputExample`s for the train set. | def get_train_examples(self, input_file):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_inputs(self, example):\n return example",
"def get_train_examples(self):\n raise NotImplementedError()",
"def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in enumerate(data):\n guid = \"%s-%s\" % (set_type, i)\n text = elem[... | [
"0.7353409",
"0.7173496",
"0.65607446",
"0.6421442",
"0.640515",
"0.63427144",
"0.62901086",
"0.62796",
"0.6252537",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"0.6247562",
"... | 0.71288145 | 2 |
Gets a collection of `InputExample`s for the dev set. | def get_dev_examples(self, input_file):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_inputs(self, example):\n return example",
"def get_examples(self, env):\n return self.fam.c_get_examples(self, env)",
"def get_dev_examples(self):\n raise NotImplementedError()",
"def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in enume... | [
"0.6587386",
"0.6555576",
"0.6551477",
"0.64263123",
"0.63808954",
"0.6256121",
"0.6192293",
"0.61156076",
"0.60942835",
"0.6054705",
"0.60512304",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767"... | 0.68085253 | 0 |
Serializes this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.8421195",
"0.84043926",
"0.8362277",
"0.83090377",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.8236021",
"0.82179517",
"0.82133806",
"0.82032114",
"0.8181652",
"0.8179579",
"0.81732064",
"0.81534773",
"0.8118078",
"0.8090142",
"0.... | 0.0 | -1 |
Serializes this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.88999254",
"0.8837045",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.87147456",
"0.8637419",
"0.8619328",
"0.8598524",
"0.8572258",
"0.8568808",
"0.8568808",
"0.8446259",
"0.8446259",
"0.8446259",
... | 0.0 | -1 |
Serializes this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.8421625",
"0.8404173",
"0.83615255",
"0.83081526",
"0.82821834",
"0.82821834",
"0.82821834",
"0.82821834",
"0.82821834",
"0.82821834",
"0.823544",
"0.8216961",
"0.8212815",
"0.82025886",
"0.8181318",
"0.8179069",
"0.81732166",
"0.81532955",
"0.8117324",
"0.8089861",
"0.807... | 0.0 | -1 |
Serializes this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.8900063",
"0.8837246",
"0.8804028",
"0.8804028",
"0.8804028",
"0.8804028",
"0.8804028",
"0.8804028",
"0.8804028",
"0.8804028",
"0.8804028",
"0.8714247",
"0.8636599",
"0.8619112",
"0.8598233",
"0.857137",
"0.8567948",
"0.8567948",
"0.84456474",
"0.84456474",
"0.84456474",
... | 0.0 | -1 |
Serializes this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.8421195",
"0.84043926",
"0.8362277",
"0.83090377",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.8236021",
"0.82179517",
"0.82133806",
"0.82032114",
"0.8181652",
"0.8179579",
"0.81732064",
"0.81534773",
"0.8118078",
"0.8090142",
"0.... | 0.0 | -1 |
Serializes this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.88999254",
"0.8837045",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.87147456",
"0.8637419",
"0.8619328",
"0.8598524",
"0.8572258",
"0.8568808",
"0.8568808",
"0.8446259",
"0.8446259",
"0.8446259",
... | 0.0 | -1 |
Converts to OpenCV camera and back exactly. | def test_converts_to_opencv_and_back_exactly() -> None:
cam = Camera(
imgsz=(4288, 2848),
f=(3100, 3200),
c=(5, -4),
k=(0.1, -0.05, 0.02, 0.003, 0.004, 0.005),
p=(0.03, 0.04),
)
xcam = OpenCV.from_camera(cam)
residuals = Converter(xcam, cam).residuals()
np.tes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capture():\n stream = BytesIO()\n cam.capture(stream, 'jpeg')\n data = np.fromstring(stream.getvalue(), dtype=np.uint8)\n # \"Decode\" the image preserving color\n img = cv2.imdecode(data, 1)\n # switch BGR order to RGB order\n img = img[:, :, ::-1]\n\n # resize image to match training ... | [
"0.6674611",
"0.6660657",
"0.6604536",
"0.6486034",
"0.6445145",
"0.6269034",
"0.62239224",
"0.6220102",
"0.6210833",
"0.6185141",
"0.6152201",
"0.6121139",
"0.6104605",
"0.6100494",
"0.6063312",
"0.60058856",
"0.60040694",
"0.6002377",
"0.5998047",
"0.59908324",
"0.59869665"... | 0.7640889 | 0 |
Converts to OpenCV camera and back with optimized parameters. | def test_converts_to_opencv_and_back_by_optimization() -> None:
# Initial conversion is exact
cam = Camera(
imgsz=(4288, 2848),
f=(3100, 3200),
c=(5, -4),
k=(0.1, -0.05, 0.02, 0.003, 0.004, 0.005),
p=(0.03, 0.04),
)
xcam = OpenCV.from_camera(cam)
# s* must be ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capture():\n stream = BytesIO()\n cam.capture(stream, 'jpeg')\n data = np.fromstring(stream.getvalue(), dtype=np.uint8)\n # \"Decode\" the image preserving color\n img = cv2.imdecode(data, 1)\n # switch BGR order to RGB order\n img = img[:, :, ::-1]\n\n # resize image to match training ... | [
"0.65229195",
"0.6356687",
"0.6075868",
"0.6033102",
"0.599067",
"0.5941069",
"0.5913982",
"0.59093237",
"0.5855322",
"0.5850977",
"0.5825967",
"0.58159816",
"0.57715976",
"0.5729508",
"0.57209337",
"0.57144177",
"0.57114017",
"0.5706012",
"0.5705577",
"0.56977916",
"0.569321... | 0.70280343 | 0 |
Construct from a spyview colormap. | def __init__(self, filename):
dir = os.path.dirname(os.path.realpath(__file__))
path = os.path.join(dir, filename)
self.path = path
self.colors = np.loadtxt(path)
self.gamma = 1
self.min, self.max = 0, 1
self.length = self.colors.shape[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_colormap(seg_map):\n\tcolormap = np.zeros((256, 3), dtype=int)\n\tind = np.arange(256, dtype=int)\n\tfor shift in reversed(range(8)):\n\t\tfor channel in range(3):\n\t\t\tcolormap[:, channel] |= ((ind >> channel) & 1) << shift \n\t\tind >>= 3\n\treturn colormap[seg_map]",
"def generate_colormap(scale_... | [
"0.6322929",
"0.6176424",
"0.61403215",
"0.6041539",
"0.5938284",
"0.5926456",
"0.59055984",
"0.5836181",
"0.55492616",
"0.554661",
"0.554661",
"0.554661",
"0.54754937",
"0.54754937",
"0.5468141",
"0.5463574",
"0.54622966",
"0.5453723",
"0.54483914",
"0.5438157",
"0.54032797"... | 0.0 | -1 |
Create a matplotlib colormap object that can be used in the cmap argument of some matplotlib plotting functions. | def get_mpl_colormap(self):
return mpl.colors.ListedColormap(self.get_colors().astype(float) / 255.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cmap(n, name='jet'):\n return plt.cm.get_cmap(name, n)",
"def create_label_colormap():\n colormap = np.array([\n [128, 64, 128],\n [244, 35, 232],\n [ 70, 70, 70],\n [102, 102, 156],\n [190, 153, 153],\n [153, 153, 153],\n [250, 170, 30],\n ... | [
"0.69520676",
"0.6926641",
"0.6904607",
"0.68217474",
"0.68167293",
"0.6804701",
"0.6722993",
"0.6717997",
"0.66702443",
"0.6637944",
"0.6592603",
"0.6592603",
"0.65426683",
"0.65426683",
"0.65426683",
"0.6498463",
"0.6483466",
"0.64792794",
"0.64792794",
"0.63807136",
"0.635... | 0.68799716 | 3 |
Lists all completed appointments | def completed_appointments(request):
appointments = AppointmentRequests.objects.all().filter(completed=True)
return render(request,"completed_appointments.html",{"appointments":appointments}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appointments(request):\n now = timezone.localtime(timezone.now())\n data = {}\n tables = {}\n rows = []\n seen = Appointment.objects.filter(seen_time__isnull=False).filter(\n checkin_date__iexact=now.date())\n # Today's COMPLETE patients\n complete = seen.filter(finish_time__isnull=... | [
"0.70405823",
"0.69358844",
"0.6691656",
"0.66775256",
"0.6669717",
"0.6491661",
"0.63387835",
"0.6337608",
"0.62747514",
"0.6011038",
"0.5888386",
"0.58656263",
"0.58645207",
"0.57239056",
"0.57122755",
"0.5704981",
"0.5633838",
"0.5601579",
"0.5481789",
"0.54587936",
"0.544... | 0.7818238 | 0 |
Return unique row values. | def unique_rows(self):
return list(set([coord[0] for coord in self.landscape])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_column_values(rows, column_name):\r\n\r\n values = [] #Create an empty list\r\n for row in rows: #Iterate through each row\r\n values.append(row[column_name]) \r\n values = set(values)\r\n return values",
"def unique_vals(rows, col):\n return set([row[col] for row i... | [
"0.7763872",
"0.76682717",
"0.7427329",
"0.7181941",
"0.7151387",
"0.70599794",
"0.70087016",
"0.68221056",
"0.68171996",
"0.67726475",
"0.67377454",
"0.6690328",
"0.6446183",
"0.6429998",
"0.6352167",
"0.6325808",
"0.63168585",
"0.6271823",
"0.6248301",
"0.6242782",
"0.62318... | 0.72621524 | 3 |
Return unique col values. | def unique_cols(self):
return list(set([coord[1] for coord in self.landscape])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unique(self):\n unique_values = len(self.df[self.col_name].unique())\n return unique_values",
"def unique_vals(rows, col):\n return set([row[col] for row in rows])",
"def unique_column_values(rows, column_name):\r\n\r\n values = [] #Create an empty list\r\n for row in rows: #I... | [
"0.8017241",
"0.79388994",
"0.7912871",
"0.78138286",
"0.76319945",
"0.75911283",
"0.74789625",
"0.73798853",
"0.7112682",
"0.702473",
"0.68938774",
"0.68558615",
"0.6763925",
"0.66712695",
"0.6665255",
"0.66252613",
"0.64667904",
"0.63827485",
"0.63588256",
"0.6214178",
"0.6... | 0.6886812 | 11 |
Getter method for LandscapeCell._f_max property of Island instance. | def f_max(cls):
return cls.params["f_max"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max(self):\n return self._max",
"def y_max(self) -> ir.FloatingValue:\n return ops.GeoYMax(self).to_expr()",
"def max(self):\n return self._max_coords",
"def max(self):\n return self.__max",
"def maximum(self):\n return self.properties.get('maximum')",
"def _get... | [
"0.7260386",
"0.72263217",
"0.72230726",
"0.7198294",
"0.7159727",
"0.715061",
"0.7146769",
"0.7146769",
"0.7086542",
"0.70571244",
"0.69791996",
"0.6900343",
"0.68943435",
"0.6879998",
"0.6859924",
"0.6847697",
"0.6814958",
"0.6802613",
"0.67975664",
"0.6780665",
"0.676816",... | 0.75995696 | 0 |
Getter method for LandscapeCell._fodder property. | def fodder(self):
return self._fodder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fights_getter(self):\n pass",
"def f(self):\n\n if self._f is not None:\n return(self._f)\n if self.larmor is None:\n return(None)\n if self._ppm is not None:\n self._f = (self._ppm - self._ppmshift) * self.larmor * 1e-6;\n return(self.... | [
"0.58732045",
"0.5561921",
"0.5469103",
"0.5446388",
"0.5394377",
"0.53059864",
"0.5265515",
"0.52549964",
"0.52517664",
"0.5222427",
"0.5211383",
"0.5142021",
"0.5138665",
"0.5078845",
"0.5078024",
"0.50659364",
"0.50598496",
"0.5051501",
"0.50436074",
"0.50307596",
"0.50288... | 0.7192365 | 0 |
Setter method for LandscapeCell._fodder property. | def fodder(self, new_fodder):
self._fodder = new_fodder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fodder(self):\n return self._fodder",
"def update_fodder(self):\n pass",
"def setF(self):\n if self.parent: self.f = self.setG(self.parent.g) + self.setH()\n else: self.f = self.setG() + self.setH()\n return self.f",
"def set_f(self, f):\n self.f = f\n sel... | [
"0.6226923",
"0.6212696",
"0.5517692",
"0.5320309",
"0.51716024",
"0.51112646",
"0.5079241",
"0.49785167",
"0.49501643",
"0.49382922",
"0.48588383",
"0.48471537",
"0.4788442",
"0.47740567",
"0.4714347",
"0.46752936",
"0.4674817",
"0.46725443",
"0.46531987",
"0.4644119",
"0.46... | 0.6110984 | 2 |
Getter method for LandscapeCell._is_mainland property. | def is_mainland(self):
return self._is_mainland | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_land_cells(self):\n return {loc: cell for loc, cell in self.landscape.items() if cell.is_mainland}",
"def landmark(self):\n return self[self.landmark_columns]",
"def landmark(self):\n return self[self.landmark_columns]",
"def side_wall(self):\n return self.container['side_... | [
"0.62447333",
"0.5531503",
"0.5531503",
"0.54353625",
"0.53049135",
"0.52609074",
"0.5237441",
"0.52285284",
"0.5215378",
"0.5179901",
"0.5174118",
"0.5139008",
"0.51312906",
"0.51131773",
"0.50843114",
"0.5059011",
"0.50320953",
"0.5007997",
"0.5007153",
"0.4964402",
"0.4951... | 0.835515 | 0 |
Sorts all `carnivores` by `fitness` from higher to lower. | def sorted_carnivores(self):
fitness_dict = {carn: carn.fitness for carn in self.carnivores}
sorted_tuples = dict(sorted(fitness_dict.items(), key=lambda x: x[1], reverse=True))
return list(sorted_tuples.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_by_fitness(self):\n self.fauna_list['Herbivore'].sort(key=operator.\n attrgetter('animal_fitness'))\n self.fauna_list['Carnivore'].sort(key=operator.\n attrgetter('animal_fitness'),\n ... | [
"0.77107835",
"0.72214985",
"0.71205306",
"0.7016911",
"0.6791151",
"0.65467834",
"0.64414424",
"0.6319603",
"0.6285522",
"0.6280308",
"0.62016904",
"0.6193156",
"0.6133859",
"0.59983385",
"0.5886053",
"0.5863023",
"0.5784374",
"0.57115126",
"0.5681038",
"0.5665921",
"0.55872... | 0.7415279 | 1 |
This method will check if the author is creating a book with the same title that he has already created. | def is_valid_book(current_author, inputed_name, availale_books):
book_info = []
author_book = {}
for book in availale_books:
author = book.author.username
author_book[author] = book.book_name
book_info.append(author_book)
author_book = {}
for book in book_info:
for author, book_name in book.items():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def book_exist(author, title, edition):\n book = Book.query.filter_by(\n author=author,\n book_title=title,\n edition=edition).first()\n if book:\n return True\n return False",
"def create_book(self, title, isbn):\n isbn_list = [book.get_isb... | [
"0.7084978",
"0.66516525",
"0.6646654",
"0.62203574",
"0.6197589",
"0.59708244",
"0.5946598",
"0.5945097",
"0.59332937",
"0.5931482",
"0.5924121",
"0.5917307",
"0.5889866",
"0.58608824",
"0.58516216",
"0.58496094",
"0.5842271",
"0.58405405",
"0.5839544",
"0.5838867",
"0.57879... | 0.64411306 | 3 |
Float string minimal Inkscape representation (8 sf + D dp). | def fsmn(x, D = 8):
if round(x, D) == 0: return "0"
a = abs(x)
a = round(a, min(D, 8 - max(floor(log10(a)) + 1, 0)))
if a % 1000 == 0: # can use a positive exponent for shortening, e.g. 137000 = 137e3
i = str(int(a))
cf = i.rstrip('0')
res = "{}e{}".format(cf, len(i) - len(cf))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lat2str(x):\n \n deg = u\"\\u00B0\"\n if x<0:\n return f'{abs(x)}{deg}S'\n else:\n return f'{x}{deg}N'",
"def format_float_to_string(x):\r\n return format(x, '.4g')",
"def getFloat(string):\n return (0.0)",
"def form5(x, pos):\n\treturn '%.7f' % x",
"def form5(x, pos):\n\t... | [
"0.61619323",
"0.6044224",
"0.60145175",
"0.60101914",
"0.60101914",
"0.60101914",
"0.5984221",
"0.5903303",
"0.5885753",
"0.5877492",
"0.5810578",
"0.5794507",
"0.57626677",
"0.5711459",
"0.57003593",
"0.5691539",
"0.56853855",
"0.56853855",
"0.56850356",
"0.56705695",
"0.56... | 0.5236897 | 88 |
Style string as input, dictionary of its attributes as output. Multiple and misplaced semicolons are skipped over seamlessly. | def stylecrunch(stystr):
return dict(pair.split(":") for pair in semicolons.findall(stystr)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __createStyleFromString(self, string):\n\n matches = re.findall(r\"([^=]+)=([^;]+)(;|$)\", str(string).lower());\n if not matches :\n return False;\n\n\n style = OutputFormatterStyle();\n for match in matches:\n if ('fg' == match[0]) :\n style.se... | [
"0.704506",
"0.65025985",
"0.647081",
"0.6375655",
"0.5701932",
"0.56727433",
"0.56223893",
"0.5592753",
"0.5531473",
"0.5528155",
"0.552802",
"0.5513635",
"0.54624325",
"0.5455829",
"0.54307246",
"0.54259133",
"0.5425541",
"0.5402203",
"0.53839004",
"0.5370589",
"0.5349517",... | 0.70628744 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def model_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick_marks = np.arange(len(classes))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81940335",
"0.8095006",
"0.80290395",
"0.8019189",
"0.7993875",
"0.7991161",
"0.79809004",
"0.7975263",
"0.7961412",
"0.7956938",
"0.7937461",
"0.7934524",
"0.7934342",
"0.7931134",
"0.7926225",
"0.79244965",
"0.792367",
"0.79231006",
"0.7922885",
"0.792215",
"0.7917699",
... | 0.0 | -1 |
Checks that all currencies have exchange rate with non negative values. | def valid_exchange_rate(cur, conn, v=False):
logs = []
print("Checking that all currencies have a valid exchange rate...")
t = 'currencies'
c = 'to_dollars'
query = f"""
SELECT COUNT(*) FROM {t}
WHERE {c} <= 0
OR {c} IS NULL
"""
try:
cur.execute(qu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_exchange_rates_exist(self):\n\t\tcompany_currency = frappe.db.get_value(\"Company\", self.company, \"default_currency\")\n\t\tif not company_currency:\n\t\t\tmsgprint(_(\"Please specify currency in Company\") + \": \" + self.company,\n\t\t\t\traise_exception=ShoppingCartSetupError)\n\n\t\tprice_list_c... | [
"0.69747007",
"0.62878335",
"0.62022275",
"0.61810416",
"0.6147035",
"0.6143961",
"0.59718674",
"0.59453756",
"0.5879294",
"0.5876464",
"0.5789517",
"0.5780246",
"0.57712007",
"0.5750224",
"0.5750019",
"0.56792",
"0.5651312",
"0.56410223",
"0.5634037",
"0.5615107",
"0.5610797... | 0.65103465 | 1 |
Check that all descriptions in `industries` are filled. | def descriptions_filled(cur, conn, v=False):
logs = []
print("Checking that all descriptions in `industries` are filled...")
t = 'industries'
c = 'description'
query = f"SELECT COUNT(*) FROM {t} WHERE {c} IS NULL"
try:
cur.execute(query)
conn.commit()
row = cur.fetchone()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_get_openings_result(self, result):\n\n\n requiredFields = {'company', 'title', 'url', 'locations'}\n #optionalFields = {'department', 'description'}\n\n for r in result:\n if not requiredFields.issubset(set(result.keys())):\n return False\n\n return True",
"def test_com... | [
"0.5525462",
"0.5483162",
"0.53835434",
"0.5309033",
"0.52606326",
"0.5252952",
"0.52517116",
"0.5250915",
"0.5241845",
"0.52271897",
"0.5223953",
"0.5220568",
"0.5216686",
"0.5211856",
"0.51563776",
"0.5142321",
"0.51061594",
"0.50775707",
"0.50756884",
"0.50648504",
"0.5052... | 0.6680115 | 0 |
Return a proper string representation of None, if None is given, otherwise the given string. | def xStr(s):
return s or 'N/A' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_or_none(val):\n return str(val) if val is not None else None",
"def noneToString(text):\n if text in (None, \"\"):\n return \"None\"\n else:\n return str(text)",
"def get_nonempty_str(arg: Any) -> Optional[str]:\n if isinstance(arg, str):\n if len(arg) > 0:\n ... | [
"0.7977171",
"0.7779768",
"0.7402333",
"0.7094692",
"0.70528096",
"0.6903888",
"0.685519",
"0.68194133",
"0.67747205",
"0.674232",
"0.6625076",
"0.6612874",
"0.6593355",
"0.648822",
"0.64873934",
"0.6461257",
"0.6445033",
"0.6443308",
"0.641366",
"0.640577",
"0.6349751",
"0... | 0.0 | -1 |
Run an input x through the model using the new convolutional weights | def run_through_model(self, x):
for idx, (W, b) in enumerate(zip(self._conv_weights, self._conv_biases)):
curr_n = self.n_values[idx]
curr_k = self.k_values[idx]
x = self.conv_layer_as_matrix_op(W, b, x, curr_n, curr_k)
x = x.flatten()
end_conv_n = self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x = self.conv1(x)\n if self.use_bn:\n x = self.batchnorm(x)\n if self.use_dropout:\n x = self.dropout(x)\n x = self.activation(x)\n x = self.conv2(x)\n if self.use_bn:\n x = self.batchnorm(x)\n if self.use_dro... | [
"0.7162154",
"0.7108813",
"0.70773566",
"0.7060195",
"0.6966304",
"0.69613385",
"0.69249135",
"0.6915375",
"0.6887616",
"0.6875819",
"0.6838874",
"0.6838874",
"0.68166244",
"0.6804043",
"0.6804043",
"0.67920786",
"0.67825353",
"0.67816883",
"0.67723924",
"0.67609173",
"0.6747... | 0.76002765 | 0 |
Send message to slack API | def notify(self, **kwargs):
return self.send(kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_slack(self, message):\n self.slack_client.api_call('chat.postMessage', channel=self.slack_channel, text=message, username=self.username, icon_emoji=self.slack_icon_emoji)\n print(\"Slack Notification sent\")",
"def slack(message):\n slack_hook = 'https://hooks.slack.com/services/T0ATXM9... | [
"0.79324365",
"0.7868449",
"0.77771735",
"0.7640284",
"0.75129026",
"0.7455066",
"0.7357417",
"0.72468823",
"0.72201645",
"0.72018766",
"0.71612376",
"0.71433437",
"0.7133963",
"0.70241785",
"0.70194995",
"0.6994208",
"0.69905776",
"0.6862392",
"0.68473846",
"0.6832329",
"0.6... | 0.0 | -1 |
Write dataframe to csv file | def write_csv(path: str, df_players: pd.DataFrame) -> None:
df_players.to_csv(path, index=False, header=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_tocsv(file_name, dataframe) :\n print(\"\\nSaved result to {}\\n\".format(file_name))\n dataframe.to_csv(file_name, mode='a', header=False,index=False)",
"def save_df(data_frame, file_path):\r\n data_frame.to_csv(file_path)\r\n return None",
"def write_csv(self):\n self.tableView.d... | [
"0.8174892",
"0.8029842",
"0.79994154",
"0.798863",
"0.7965025",
"0.79148513",
"0.7852765",
"0.7796952",
"0.7765033",
"0.7741142",
"0.7736012",
"0.7733297",
"0.7683811",
"0.7671546",
"0.76610994",
"0.7660079",
"0.7572742",
"0.7568689",
"0.74769837",
"0.74458474",
"0.73920983"... | 0.78190386 | 7 |
Get all of the file paths in the directory specified by suffix. | def _package_files(directory: str, suffix: str) -> list:
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
if filename.endswith(suffix):
paths.append(os.path.join('..', path, filename))
return paths | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filepaths(directory, suffix='.tsv'):\n for dir_ in Path(directory).glob('**'):\n if dir_.is_dir():\n yield [str(f) for f in dir_.glob('*') if f.is_file() and f.suffix == suffix]",
"def find_files(suffix, path):\n returnList = []\n find_file_recursive(suffix, path, returnList)\n... | [
"0.77649754",
"0.7681777",
"0.7636498",
"0.7592939",
"0.758829",
"0.75638276",
"0.7513167",
"0.75071305",
"0.7506748",
"0.7427239",
"0.7419402",
"0.73902535",
"0.73786026",
"0.7304414",
"0.71981364",
"0.71593034",
"0.7145902",
"0.7085814",
"0.7085814",
"0.70154583",
"0.701545... | 0.75887126 | 4 |
Set up the main window | def finish_initializing(self, builder): # pylint: disable=E1002
super(PraiaTestWindow, self).finish_initializing(builder)
self.AboutDialog = AboutPraiaTestDialog
self.PreferencesDialog = PreferencesPraiaTestDialog
# Code for other initialization actions should be added here. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\tself.menu_window.playButton.focus_set()",
"def main... | [
"0.80549276",
"0.77803993",
"0.76101744",
"0.76079625",
"0.76058704",
"0.75583404",
"0.75058156",
"0.7500768",
"0.7449036",
"0.74340516",
"0.7430231",
"0.73911846",
"0.73764753",
"0.730698",
"0.7291845",
"0.7287895",
"0.72417337",
"0.72298133",
"0.72146386",
"0.7190348",
"0.7... | 0.0 | -1 |
Derive the next owner group sequence number from the number of existing groups. | def get_owner_group_count(base_reg) -> int:
count: int = len(base_reg.owner_groups)
for reg in base_reg.change_registrations:
if reg.owner_groups:
count += len(reg.owner_groups)
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_group_id(self):\n if not hasattr(self.space, '_group_ctr'):\n self.space._group_ctr = 999\n self.space._group_ctr += 1\n return self.space._group_ctr",
"def _getNextGroupId(self):\n groupId = self._nextGroupId\n self._nextGroupId += 1\n return str... | [
"0.7268382",
"0.6964213",
"0.6463295",
"0.6186053",
"0.6181634",
"0.6181634",
"0.6117854",
"0.6030557",
"0.5942088",
"0.5916832",
"0.58382547",
"0.5800748",
"0.5789288",
"0.5776522",
"0.57567704",
"0.57567704",
"0.57415366",
"0.57354325",
"0.57249",
"0.5715812",
"0.5714009",
... | 0.54254884 | 40 |
Return if the registration type is a type of Transfer Due to Death. | def is_transfer_due_to_death(reg_type: str) -> bool:
return reg_type and reg_type in (MhrRegistrationTypes.TRANS_ADMIN,
MhrRegistrationTypes.TRANS_AFFIDAVIT,
MhrRegistrationTypes.TRANS_WILL,
MhrRegistratio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_transfer_due_to_death_staff(reg_type: str) -> bool:\n return reg_type and reg_type in (MhrRegistrationTypes.TRANS_ADMIN,\n MhrRegistrationTypes.TRANS_AFFIDAVIT,\n MhrRegistrationTypes.TRANS_WILL)",
"def is_dead(self):\n if s... | [
"0.7528021",
"0.6433941",
"0.63929725",
"0.6266077",
"0.5769359",
"0.5665921",
"0.56475866",
"0.56209517",
"0.55984294",
"0.55876935",
"0.549508",
"0.5452859",
"0.54245985",
"0.5410927",
"0.53696936",
"0.5331413",
"0.53019303",
"0.52880794",
"0.52818245",
"0.52271557",
"0.521... | 0.80803174 | 0 |
Return if the registration type is a type of Transfer Due to Death. | def is_transfer_due_to_death_staff(reg_type: str) -> bool:
return reg_type and reg_type in (MhrRegistrationTypes.TRANS_ADMIN,
MhrRegistrationTypes.TRANS_AFFIDAVIT,
MhrRegistrationTypes.TRANS_WILL) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_transfer_due_to_death(reg_type: str) -> bool:\n return reg_type and reg_type in (MhrRegistrationTypes.TRANS_ADMIN,\n MhrRegistrationTypes.TRANS_AFFIDAVIT,\n MhrRegistrationTypes.TRANS_WILL,\n MhrRe... | [
"0.80799603",
"0.6434263",
"0.6391993",
"0.6267138",
"0.5769441",
"0.56659275",
"0.5648029",
"0.5621463",
"0.5599219",
"0.55878174",
"0.5496133",
"0.5453963",
"0.5426138",
"0.54113925",
"0.53712",
"0.53318685",
"0.5302389",
"0.52904683",
"0.52796453",
"0.5227657",
"0.52216655... | 0.75272846 | 1 |
a utf8 intermediate byte starts with the bits 10xxxxxx | def utf8_lead_byte(b):
return (ord(b) & 0xC0) != 0x80 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utf8(num):\n # code de la prof louche\n if num < 8:\n return 1\n else:\n return num//6+1\n\n return binary",
"def binary_to_utf8():\n added, binary_seq, seq, file = binary_conversion()\n \n comp_seq = \"\"\n for bit in range(0, len(binary_seq), 8):\n #cut the sequ... | [
"0.71861124",
"0.6619024",
"0.63067967",
"0.6262105",
"0.6221675",
"0.6198041",
"0.6138288",
"0.607559",
"0.602441",
"0.5991305",
"0.59599704",
"0.59136045",
"0.59116125",
"0.5905374",
"0.58948386",
"0.58777654",
"0.58720964",
"0.58706033",
"0.5865396",
"0.58437234",
"0.58192... | 0.67118126 | 1 |
Flattens JSON from a given file. | def flatten(data):
articles = []
common_info = {
"cop_edition": data["cop_edition"],
"collection_start": data["collection_start"],
"collection_end": data["collection_end"],
}
for article in data['articles']:
new_article = {
"newspaper": article["newspaper"],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def JSONtoObject(fileName):\n # TODO: ensure file exists first!!\n \n with open(fileName) as json_data:\n d = json.load(json_data)\n \n return d\n #return json.loads(d, object_hook=_json_object_hook)",
"def load_json(self, file):\n with open(file, 'r', encoding=\"utf8\... | [
"0.63672173",
"0.6293192",
"0.6266026",
"0.6148497",
"0.6120157",
"0.6117946",
"0.60921836",
"0.6092075",
"0.60511994",
"0.60437727",
"0.6011525",
"0.6011525",
"0.5995071",
"0.5968212",
"0.5940287",
"0.5922406",
"0.59110177",
"0.59110177",
"0.5893223",
"0.5887829",
"0.5879024... | 0.0 | -1 |
Validate the user's password, return false if validation fail. | def verify_password(self, password):
user = self.get()
if user:
return bcrypt.verify(password, user['password'])
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_password(self, password):\r\n # the password might be null as in the case of morpace employees\r\n # logging in via ldap. We check for that here and return them as an\r\n # incorrect login\r\n if self.password:\r\n salt = self.password[:29]\r\n return ... | [
"0.8052305",
"0.80473125",
"0.7996386",
"0.7989366",
"0.797277",
"0.7935312",
"0.7905915",
"0.7876357",
"0.785416",
"0.7822384",
"0.7815065",
"0.77942777",
"0.7784426",
"0.7784426",
"0.7760864",
"0.77542955",
"0.77422935",
"0.7705802",
"0.76797736",
"0.7646487",
"0.7630888",
... | 0.7849507 | 9 |
Return a list of Usergroup objects in which the User is a member. | def get_groups(self):
user_node = self.get()
grouplist = []
if user_node:
for rel in graph.match(start_node=user_node, rel_type='in'):
grouplist.append(Usergroup(id=rel.end_node()['id']))
return grouplist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def member_groups(self, user):\n \n if not hasattr(user, '_group_member_groups'):\n # be sure to use \"slow\" version of is_member to prevent it recursing back\n user._group_member_groups = [self[group] for group in self.root.keys() \\\n if self[group].is_member(u... | [
"0.8238182",
"0.78426594",
"0.78377885",
"0.7591925",
"0.75571036",
"0.749305",
"0.7366647",
"0.731246",
"0.7309097",
"0.72647095",
"0.7212025",
"0.71888405",
"0.7164496",
"0.71636564",
"0.7042197",
"0.70325667",
"0.7019271",
"0.70115685",
"0.69961643",
"0.69479555",
"0.69389... | 0.8087502 | 1 |
This function returns the examples in the raw (text) form. | def _generate_examples(self, filepath):
logger.info("generating examples from = %s", filepath)
with open(filepath, encoding="utf-8") as f:
qasper = json.load(f)
for id_ in qasper:
qasper[id_]["id"] = id_
yield id_, qasper[id_] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_examples():\n # Get the tjson test cases from a url.\n examples = urlopen(TJSON_EXAMPLES_URL).read()\n\n # Strip comments from the lines.\n examples = re.sub(r\"^#.*\\n?\", \"\", examples.decode(), flags=re.MULTILINE)\n\n # Split a group of examples.\n delimiter = re.escape(EXAMPLES_DELIM... | [
"0.6475851",
"0.64643687",
"0.6314795",
"0.6241491",
"0.61601883",
"0.5979994",
"0.59604007",
"0.59122866",
"0.5801395",
"0.57639563",
"0.5722876",
"0.57057697",
"0.5699199",
"0.56715703",
"0.56442004",
"0.56433356",
"0.56305236",
"0.56274277",
"0.56175506",
"0.5615394",
"0.5... | 0.0 | -1 |
Return a sorted QuerySet of outputs produced by this Transformation. | def sorted_outputs(self):
return self.outputs.order_by("dataset_idx") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_sorted(self):\n self.sort_and_reduce()\n return self.data",
"def queryset(self, request):\n qs = self.model.all_objects.get_query_set()\n ordering = self.ordering or ()\n if ordering:\n qs = qs.order_by(*ordering)\n return qs",
"def sorted_inputs... | [
"0.6856667",
"0.661067",
"0.64141405",
"0.62931794",
"0.62715125",
"0.6265818",
"0.62118936",
"0.61536956",
"0.6153121",
"0.604664",
"0.6042609",
"0.5998332",
"0.59798694",
"0.5909811",
"0.59077233",
"0.590417",
"0.58883536",
"0.5855151",
"0.58533245",
"0.58482444",
"0.584824... | 0.74931604 | 0 |
Create a TransformationXput for this Transformation. Decides whether the created TransformationXput should have a structure or not based on the parameters given. If compounddatatype os None but row limits are provided, then a ValueError is raised. PARAMETERS dataset_name name for new xput dataset_idx index for new outp... | def create_xput(self,
dataset_name,
dataset_idx=None,
compounddatatype=None,
row_limits=None,
coords=None,
input=True,
clean=True):
min_row, max_row = (None, None) if not r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_input(self, dataset_name, dataset_idx=None, compounddatatype=None,\n min_row=None, max_row=None, x=0, y=0, clean=True):\n return self.create_xput(dataset_name, dataset_idx, compounddatatype, (min_row, max_row), (x, y), True,\n clean=clean)",
"d... | [
"0.72575265",
"0.7146922",
"0.66140723",
"0.5251067",
"0.47382745",
"0.4657938",
"0.46224844",
"0.4591457",
"0.45721754",
"0.45600256",
"0.45527235",
"0.45186523",
"0.43970025",
"0.43879244",
"0.438423",
"0.43647593",
"0.43591645",
"0.43418604",
"0.4321488",
"0.42868546",
"0.... | 0.7988054 | 0 |
Accessor that returns min_row for this xput (and None if it is raw). | def get_min_row(self):
return (None if self.is_raw() else self.structure.min_row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min(self):\n min_value= self.df[self.col_name].min()\n return min_value",
"def excel_min_row(self, sheet_name):\n return self.wb[sheet_name].min_row",
"def min(self):\n return self.get_first()",
"def find_min(self):\n return self.min",
"def find_min(self):\n return... | [
"0.73047584",
"0.7183337",
"0.6936744",
"0.6934594",
"0.6934594",
"0.69166476",
"0.6890434",
"0.68705785",
"0.68061024",
"0.678977",
"0.678977",
"0.67767787",
"0.67233044",
"0.6701944",
"0.6698056",
"0.6680635",
"0.66586375",
"0.66574216",
"0.6656859",
"0.66483414",
"0.664834... | 0.89773214 | 0 |
Accessor that returns max_row for this xput (and None if it is raw). | def get_max_row(self):
return (None if self.is_raw() else self.structure.max_row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def excel_max_row(self, sheet_name):\n return self.wb[sheet_name].max_row",
"def getMaxValue(self):\n if self.right is None:\n return self.data\n return self.right.getMaxValue()",
"def get_min_row(self):\n return (None if self.is_raw() else self.structure.min_row)",
"de... | [
"0.6603825",
"0.6575399",
"0.65357685",
"0.65208274",
"0.65103996",
"0.6506023",
"0.64990634",
"0.6469231",
"0.64600104",
"0.6414351",
"0.63631517",
"0.63476604",
"0.63452995",
"0.62628424",
"0.625559",
"0.62500894",
"0.62500894",
"0.6236911",
"0.61934155",
"0.6173751",
"0.61... | 0.8889727 | 0 |
InstallRequirement should strip the fragment, but not the query. | def test_url_with_query(self):
url = 'http://foo.com/?p=bar.git;a=snapshot;h=v0.1;sf=tgz'
fragment = '#egg=bar'
req = InstallRequirement.from_line(url + fragment)
assert req.link.url == url + fragment, req.link | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_url_preserved_line_req(self):\n url = 'git+http://foo.com@ref#egg=foo'\n req = InstallRequirement.from_line(url)\n assert req.link.url == url",
"def strip_marker(req):\n import pkg_resources # Delay import to avoid unnecessary side-effects\n\n # create a copy to avoid mutatin... | [
"0.58563876",
"0.58517206",
"0.57542473",
"0.53614986",
"0.51657397",
"0.5049659",
"0.50453866",
"0.5038694",
"0.50075597",
"0.49775535",
"0.49354988",
"0.49292803",
"0.49132296",
"0.48771584",
"0.4872287",
"0.48662725",
"0.47926253",
"0.47857955",
"0.47644773",
"0.47614238",
... | 0.64154553 | 0 |
Confirm the url is preserved in a noneditable requirement | def test_url_preserved_line_req(self):
url = 'git+http://foo.com@ref#egg=foo'
req = InstallRequirement.from_line(url)
assert req.link.url == url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_url(self):\n pass",
"def check_url_invalidity(self) -> bool:\n validate = URLValidator()\n try:\n validate(self.args.url)\n return False\n except ValidationError:\n return True",
"def test_url_preserved_editable_req(self):\n url =... | [
"0.6791629",
"0.6630487",
"0.6622125",
"0.6376516",
"0.6347378",
"0.63120294",
"0.6310208",
"0.62562466",
"0.61690724",
"0.6154701",
"0.6074883",
"0.6030364",
"0.6028999",
"0.6012266",
"0.6001498",
"0.59947854",
"0.5988226",
"0.59794486",
"0.5937128",
"0.59371084",
"0.5930754... | 0.0 | -1 |
a functiob that create an object from a JSON file | def load_from_json_file(filename):
with open(filename, encoding="utf-8") as round:
return json.load(round) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_json_to_object(file_content):\n object = json.loads(file_content)\n print(object)\n return object",
"def from_json(cls, fname):\n d = read_json(fname)\n return cls.from_dict(d)",
"def from_JSON(cls, filename):\n with open(os.path.expanduser(filename), encoding='utf-8')... | [
"0.7876436",
"0.75865996",
"0.7458397",
"0.7367503",
"0.7363153",
"0.73537076",
"0.72816974",
"0.72788084",
"0.7260943",
"0.7225283",
"0.7211591",
"0.71972865",
"0.71593183",
"0.7146577",
"0.71331924",
"0.7130283",
"0.71249133",
"0.7108719",
"0.71063197",
"0.70940083",
"0.709... | 0.6522976 | 81 |
Constructs a Dummy application window. Do not call directly, use create_application_window. | def __init__(self, app, *_):
super(DummyApplicationWindow, self).__init__(app, None)
self.group_windows=[AbstractGroupWindow(app)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_application_window(app):\n config = app.config()\n gui = str(config.gui())\n if gui.upper() == \"NONE\":\n if str(config[\"enable-splash\"]).upper() != \"FALSE\":\n TextSplashScreen(app)\n return DummyApplicationWindow(app)\n elif gui.upper() == \"TK\":\n impo... | [
"0.7326208",
"0.716374",
"0.7110603",
"0.6991344",
"0.62828904",
"0.6254757",
"0.624171",
"0.62128186",
"0.62024164",
"0.61657685",
"0.61042386",
"0.61020046",
"0.6101551",
"0.5991275",
"0.5977518",
"0.59647137",
"0.5955362",
"0.5941144",
"0.5934068",
"0.5930566",
"0.592169",... | 0.67147046 | 4 |
REmove the BOM marker except at the beginning of the string | def treat_bom(sHtml):
# Check if it is in the beginning
bStartsWithBom = sHtml.startswith(u'\ufeff')
# Remove everywhere
sHtml = sHtml.replace(u'\ufeff', '')
# Return what we have
return sHtml | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_BOM(text):\n if codecs.BOM_UTF8.decode(\"utf-8\") in text:\n return text.replace(codecs.BOM_UTF8.decode(\"utf-8\"), '')\n if codecs.BOM.decode(\"utf-16\") in text:\n return text.replace(codecs.BOM.decode(\"utf-16\"), '')\n if codecs.BOM_BE.decode(\"utf-16-be\") in text:\n r... | [
"0.71555895",
"0.69615155",
"0.6829834",
"0.6778082",
"0.67234707",
"0.6324943",
"0.6160414",
"0.60492104",
"0.5918648",
"0.5853201",
"0.58167225",
"0.58117616",
"0.58061695",
"0.5790491",
"0.5770036",
"0.56134284",
"0.5604382",
"0.5546739",
"0.5528419",
"0.55246675",
"0.5503... | 0.7256657 | 0 |
Renders the home page. | def home(request):
assert isinstance(request, HttpRequest)
# Specify the template
template_name = 'index.html'
# Define the initial context
context = {'title':'RU-Cesar','year':datetime.now().year,
'is_longdale_user': user_is_ingroup(request, 'longdale_user'),
'pfx... | {
"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.0 | -1 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'about.html',
{ 'is_longdale_user': user_is_ingroup(request, 'longdale_user'),
'title':'About',
'message':'Radboud University CESAR utility.',
'year':datetime.now().y... | {
"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.82680845",... | 0.7464537 | 85 |
String for representing the Model object (in Admin site etc.) | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str_... | [
"0.7801624",
"0.77112937",
"0.767426",
"0.767426",
"0.7524702",
"0.74020135",
"0.7398639",
"0.7378346",
"0.7328583",
"0.7270028",
"0.7244434",
"0.7233179",
"0.7205981",
"0.7174358",
"0.7165676",
"0.7108926",
"0.70379156",
"0.70379156",
"0.7012156",
"0.69865996",
"0.6968002",
... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Creates a string for the Genre. This is required to display genre in Admin. | def display_genre(self):
return ', '.join([ genre.name for genre in self.genre.all()[:3] ]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_genre(self):\n \n # Get first 3 genres and join to a string.\n return ', '.join([ genre.name for genre in self.genre.all()[:3] ])",
"def add_genre(request):\n\tif request.method == \"POST\":\n\t\tform = GenreForm(request.POST)\n\t\tif form.is_valid():\n\t\t\tgenre = form.save(co... | [
"0.68910015",
"0.68397367",
"0.6693303",
"0.6687025",
"0.6640322",
"0.6590145",
"0.6582849",
"0.65675485",
"0.6550318",
"0.64924973",
"0.6377207",
"0.63439673",
"0.6292244",
"0.6282142",
"0.6138984",
"0.6097099",
"0.6084374",
"0.6041633",
"0.59845865",
"0.5961023",
"0.5876851... | 0.65876687 | 6 |
String for representing the Model object | def __str__(self):
#return '%s (%s)' % (self.id, self.book.title)
return '{0} ({1})'.format(self.id, self.book.title)
#return '{0}'.format(self.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.8219232",
"0.8020793",
"0.77580154",
"0.7699273",
"0.7683828",
"0.7678613",
"0.7568337",
"0.7568337",
"0.75642484",
"0.75642484",
"0.75589746",
"0.75219977",
"0.75219977",
"0.7509915",
"0.75078505",
"0.7363909",
"0.73598325",
"0.7340365",
"0.73359716",
"0.73188025",
"0.731... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
#return '%s, %s' % (self.last_name, self.first_name)
return '{0}, {1}'.format(self.last_name, self.first_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.8236334",
"0.7989569",
"0.7848069",
"0.7846481",
"0.77509546",
"0.7624108",
"0.7624108",
"0.7623108",
"0.7623108",
"0.75479686",
"0.75224715",
"0.7470156",
"0.74694866",
"0.7446042",
"0.7446042",
"0.7430364",
"0.7427066",
"0.73897326",
"0.7349858",
"0.7340906",
"0.7322887"... | 0.0 | -1 |
When a DescribeCoverage request is made without version, the server returns service exception. | def test_missing_version(self):
params_82 = {'ReQuEsT': "DescribeCoverage", 'SeRvIcE': "WCS", "BOGUS": "SSS"}
response = self.query_server(params_82)
soup = BeautifulSoup(response.text, 'xml')
self.assertTrue(
soup.find('ServiceExceptionReport'),
msg="The server ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_coverage(self):\n\n params_82 = {\n 'ReQuEsT': \"DescribeCoverage\",\n 'SeRvIcE': \"WCS\",\n \"BOGUS\": \"SSS\",\n 'Version': \"1.0.0\",\n \"COVERAGE\": \"asdfasfasdf\"\n }\n response = self.query_server(params_82)\n ... | [
"0.688448",
"0.68293554",
"0.65183294",
"0.6488871",
"0.5555915",
"0.5380862",
"0.5362322",
"0.5339509",
"0.53340733",
"0.5268422",
"0.5260983",
"0.5207646",
"0.51945555",
"0.51736444",
"0.5159731",
"0.5152983",
"0.51491094",
"0.5137445",
"0.5131629",
"0.5131629",
"0.5112142"... | 0.70847917 | 0 |
return a specific string in content with regular expression. | def _reg_catch(reg_ex, text, group_id=1):
match = re.search(reg_ex, text)
if match:
return match.group(group_id)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_reg(self, reg_str, content):\n reg_find = re.findall(reg_str, content)\n assert reg_find is not None, \"ERROR: Could not extract any content, check regex string\"\n return reg_find",
"def regexp(self, pattern):\r\n match = pattern.match(self.text, self.cur)\r\n if mat... | [
"0.64388967",
"0.63961595",
"0.639168",
"0.6096121",
"0.6011971",
"0.59810245",
"0.5931503",
"0.57514685",
"0.57335716",
"0.57265383",
"0.57153904",
"0.57100064",
"0.56549627",
"0.56028265",
"0.55915165",
"0.55691165",
"0.5521213",
"0.5516521",
"0.5509329",
"0.546697",
"0.545... | 0.56034416 | 13 |
String representation of TreeClassifier | def __repr__(self, prefixes=None):
if prefixes is None:
prefixes = []
prefix = "groups=%s" % repr(self._groups)
return super(TreeClassifier, self).__repr__([prefix] + prefixes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tree_string(self, node):\n string = \"\"\n for child in sorted(node.children):\n string += node.depth * \"\\t\"\n if node.depth > 0:\n string += \"|\"\n string += node.feature + \"=\" + child\n if node.children[child].is_leaf:\n ... | [
"0.7572435",
"0.7378224",
"0.72319126",
"0.7179676",
"0.71582866",
"0.7060629",
"0.7029264",
"0.7004967",
"0.69716686",
"0.69716686",
"0.6963815",
"0.69107527",
"0.68911713",
"0.68110436",
"0.68033886",
"0.6801687",
"0.6695289",
"0.667665",
"0.66708094",
"0.658718",
"0.655265... | 0.6517791 | 24 |
Predict the labels for a given `dataset` Predicts using binary classifier and spits out list (for each sample) where with either poslabels or neglabels as the "label" for the sample. If there was just a single label within pos or neg labels then it would return not a list but just that single label. | def _predict(self, dataset):
binary_predictions = ProxyClassifier._predict(self, dataset)
self.ca.estimates = binary_predictions
predictions = [ {-1: self.__predictneg,
+1: self.__predictpos}[x] for x in binary_predictions]
self.ca.predictions = predictions
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_predicted_token_labels(self, predictions, label_map, dataset):\n\n num_samples = len(dataset.tensors[0])\n if num_samples != predictions.shape[0]:\n raise ValueError(\n \"Predictions have {0} samples, but got {1} samples in dataset\".format(\n pred... | [
"0.70734084",
"0.7062133",
"0.70552224",
"0.69676894",
"0.6820836",
"0.6775732",
"0.67679846",
"0.66674614",
"0.66395634",
"0.66258883",
"0.66011167",
"0.6538175",
"0.6538175",
"0.6538175",
"0.6532872",
"0.6430003",
"0.6415061",
"0.637324",
"0.6372734",
"0.6366778",
"0.634528... | 0.6112184 | 47 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.