query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Shorthand for 'assert a == b, "%r != %r" % (a, b) | def eq_(a, b, msg=None):
assert a == b, msg or "%r != %r" % (a, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_eq(a, b, msg=None):\n assert a == b, msg or __safe_error(\"!=\", a, b)",
"def assert_not_equal(self, first, second, msg=\"\"):\r\n assert first != second",
"def assert_equal(self, first, second, msg=\"\"):\r\n assert first == second",
"def eq_(a, b, msg=None):\n if not a == b:\n ... | [
"0.7919268",
"0.76702833",
"0.7663287",
"0.755728",
"0.75565225",
"0.74563134",
"0.7409361",
"0.7374887",
"0.7365077",
"0.7247822",
"0.7191047",
"0.71092767",
"0.7099789",
"0.7056035",
"0.70557606",
"0.7050082",
"0.6990683",
"0.6850763",
"0.683336",
"0.6829528",
"0.6792178",
... | 0.79193425 | 1 |
Call pdb.set_trace in the calling frame, first restoring sys.stdout to the real output stream. Note that sys.stdout is NOT reset to whatever it was before the call once pdb is done! | def set_trace():
import pdb
import sys
stdout = sys.stdout
sys.stdout = sys.__stdout__
pdb.Pdb().set_trace(sys._getframe().f_back) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_pdb():\n import sys, pdb\n sys.stdout, sys.stderr = sys.__stdout__, sys.__stderr__\n pdb.set_trace()",
"def set_trace():\r\n # without this in iPython debugger can generate strange characters.\r\n from IPython.core.debugger import Pdb\r\n Pdb().set_trace(sys._getframe().f_back)",
"d... | [
"0.7670003",
"0.74077517",
"0.721627",
"0.69610035",
"0.6654851",
"0.66356456",
"0.6633973",
"0.65646404",
"0.65473956",
"0.65404314",
"0.6526752",
"0.64950544",
"0.648676",
"0.636147",
"0.63333666",
"0.6309031",
"0.62887394",
"0.6286716",
"0.62252885",
"0.6177955",
"0.613135... | 0.88860595 | 0 |
Decorator to mark a function or method as a test | def istest(func):
func.__test__ = True
return func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_decorator(f):\n return f",
"def test_wraps():\n print('func')",
"def test(func):\n register_tests(func, [func.__name__])",
"def before_test(self, func, *args, **kwargs):\n pass",
"def test(self, func):\r\n @wraps(func)\r\n def wrapper():\r\n with nested(self... | [
"0.79373974",
"0.76270324",
"0.73538077",
"0.7125131",
"0.7075397",
"0.6968306",
"0.69447076",
"0.68645555",
"0.6836928",
"0.6589283",
"0.6563842",
"0.6452376",
"0.64318347",
"0.6396296",
"0.6392702",
"0.6379688",
"0.63777244",
"0.6339727",
"0.6303203",
"0.6289341",
"0.625736... | 0.7805866 | 1 |
Decorator to mark a function or method as not a test | def nottest(func):
func.__test__ = False
return func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_test(func):\n def inner(request, *args, **kwargs):\n return func(request, *args, **kwargs)\n inner.__name__ = func.__name__\n inner.__module__ = func.__module__\n inner.__doc__ = func.__doc__\n inner.__dict__ = func.__dict__\n inner.do_not_test = True\n return inner",
"def _can... | [
"0.7401639",
"0.7101079",
"0.70958424",
"0.7052338",
"0.70041937",
"0.6947029",
"0.6888569",
"0.6880268",
"0.684656",
"0.678958",
"0.6739399",
"0.6721696",
"0.6621172",
"0.660578",
"0.6585856",
"0.6567399",
"0.6533759",
"0.6486018",
"0.64856356",
"0.6460799",
"0.63941807",
... | 0.804951 | 0 |
Regex to get what to do. I hate this function. It's personal. I escape the simbols that would break the regex with 'scape'. Checks what action and where. Returns a string 1 if both locations. | def analiza(command):
action, where = None, None
for option in all_actions:
action_found = search(escape(option), command)
if action_found:
action = action_found.group(0)
break
if 'office1' in command and 'office2' in command:
where = '1'
else:
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_rcloc(x, string): # figures out string location\n if x == 'x':\n top = rc.get(f'{string}.top', context=True)\n bottom = rc.get(f'{string}.bottom', context=True)\n if top is None and bottom is None:\n return None\n elif top and bottom:\n return 'both'... | [
"0.5454036",
"0.5262211",
"0.52049845",
"0.5193955",
"0.5068526",
"0.50648695",
"0.50642747",
"0.5058123",
"0.5048213",
"0.5030032",
"0.49808058",
"0.49609584",
"0.49521613",
"0.4943016",
"0.4942679",
"0.4916906",
"0.49111608",
"0.4900656",
"0.48963696",
"0.48899835",
"0.4888... | 0.53220606 | 1 |
Start an after office. YOLO BILINGUAL. | def sale_after(channel, where, ebrios, user):
trampa = ['Office1', 'Office2']
trampa.remove(where)
if not ebrios[where]:
if user in ebrios[trampa[0]]:
return postea(channel, 'Pero si estás en el otro...')
ebrios[where].append(user)
else:
return postea(channel, 'Ya hay... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_after(self):\r\n pass",
"def GroundExcelEnd(builder):\n return End(builder)",
"def EventContentMissionExcelEnd(builder):\n return End(builder)",
"def after(self):\n pass",
"def after(self):\n pass",
"def AttendanceRewardExcelEnd(builder):\n return End(builder)",
"de... | [
"0.570777",
"0.5286147",
"0.52614105",
"0.5247425",
"0.5247425",
"0.5188237",
"0.5187632",
"0.5163226",
"0.51431924",
"0.5123507",
"0.5122529",
"0.5037582",
"0.5037077",
"0.501578",
"0.49875",
"0.49667245",
"0.49666268",
"0.49497688",
"0.49383745",
"0.49225628",
"0.4902968",
... | 0.530746 | 1 |
for a given LS session, get a list of all dates | def get_ls_session_dates(soup):
ls_session_dates = soup.find(
"select", attrs={
"id": "ContentPlaceHolder1_ddlSession"}).find_all("option")
return [ls.text for ls in ls_session_dates] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_dates(product):\n\n if product == 'analysis_assim':\n files = _list_files(product)\n dates = []\n for f in files:\n date = _date_from_filename(f)\n dates.append(date)\n dates = list(set(dates)) # Get unique dates\n else:\n template = (HS_DATA... | [
"0.71067595",
"0.66075104",
"0.65300286",
"0.64697516",
"0.64585555",
"0.63301075",
"0.6178243",
"0.6165584",
"0.61380464",
"0.6130052",
"0.6070558",
"0.6051707",
"0.5998015",
"0.59683144",
"0.58846116",
"0.5866123",
"0.5841599",
"0.58099794",
"0.580895",
"0.57619506",
"0.575... | 0.6708732 | 1 |
Sets the initial state distribution to a specific distribution. If no argument is given, the distribution provided by the environment is used. Can be called to use a specific distribution over initial states. | def update_initial_state_distribution(self, initial_state_distribution=None):
if initial_state_distribution is None:
self.initial_state_distribution = self.env.get_initial_state_distribution()
else:
self.initial_state_distribution = initial_state_distribution | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_state(self, parameters = None):\n if parameters is None:\n parameters = self._get_static_parameters_or_die()\n return Value(\n state=ed.Categorical(logits=parameters.get('initial_dist_logits')))",
"def initial_state(self, parameters = None):\n if parameters is None:\n parame... | [
"0.67260027",
"0.6548642",
"0.64671284",
"0.6418419",
"0.6362264",
"0.6350059",
"0.6299179",
"0.6178709",
"0.61393434",
"0.61277926",
"0.61277705",
"0.6076269",
"0.6063735",
"0.6054076",
"0.60414034",
"0.60016865",
"0.59948117",
"0.59945595",
"0.5985189",
"0.59540826",
"0.592... | 0.8184992 | 0 |
Returns the inverse dynamics model (at time t). The model is seperated into inverse environment dynamics `T_inv_t` and an inverse policy `policy_inv_t`. `T_inv_t` corresponds to $\\tilde{T}_t(s | a, s')$ `policy_inv_t` corresponds to $\\tilde{\\pi}_t(a | s')$ | def _get_inverse_dynamics(self, t):
# Note DL: The computation of the inverse dynamics is not optimized to be
# maximally efficient. At the moment this is fine, because we only use this
# with very small envs. If performance becomes an issue, the following points
# could be changed:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def T_inv(T):\n R, xyz = rigmech.T2Rxyz(T)\n R_inv = R.T\n xyz_inv = -R_inv * xyz\n T_inv = R_inv.row_join(xyz_inv).col_join(sp.Matrix([[0, 0, 0, 1]]))\n return T_inv",
"def inverse_basis(T, dimensions, t):\n B = basis(T, dimensions, t)\n return inv(B.T.dot(B)).dot(B.T)",... | [
"0.6890299",
"0.68392897",
"0.6447749",
"0.6382373",
"0.6357515",
"0.6187746",
"0.6122827",
"0.61122644",
"0.6025718",
"0.6009074",
"0.59437436",
"0.5908627",
"0.59008974",
"0.58827055",
"0.5843355",
"0.5810907",
"0.58002806",
"0.57949626",
"0.5792615",
"0.57874143",
"0.57464... | 0.7967727 | 0 |
Test that invalid/malformed AQL results in an error. | def test_malformed_aql(managed_workspace, managed_user, server):
table_name = "malformed_table"
malformed_aql = "FOR members RETURN member"
malformed_aql_error = "unexpected RETURN declaration"
with conftest.login(managed_user, server):
resp = server.post(
f"/api/workspaces/{managed... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_using_non_query_operators_in_query_args_raises_error(self):\r\n with self.assertRaises(query.QueryException):\r\n TestModel.objects(5)",
"def test_invalid_search_query(aquarius_instance):\n search_query = dict()\n search_query[\"sort\"] = \"foo_sort\"\n with pytest.raises(Valu... | [
"0.6949547",
"0.69344825",
"0.6926431",
"0.69253504",
"0.6872982",
"0.67915213",
"0.67216325",
"0.66571164",
"0.66170233",
"0.6578466",
"0.65429085",
"0.6493422",
"0.6488986",
"0.6461727",
"0.6437705",
"0.6398488",
"0.63433677",
"0.63350695",
"0.6331441",
"0.6324529",
"0.6289... | 0.7799423 | 0 |
Test that creating a node table succeeds. | def test_create_node_table(populated_workspace, managed_user, server):
workspace, _, node_table, edge_table = populated_workspace
aql = f"FOR doc in {node_table} RETURN doc"
new_table_name = "new_table"
with conftest.login(managed_user, server):
resp = server.post(
f"/api/workspace... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_table_successfully (self):\n\n new_table = self.wrapper.create_table(self.table, [self.bob, self.jane])\n self.assertIsNone(new_table)",
"def test_existing_table(populated_workspace, managed_user, server):\n workspace, _, node_table, _ = populated_workspace\n\n aql = f\"FOR th... | [
"0.7422336",
"0.72615063",
"0.7064853",
"0.7049437",
"0.69733405",
"0.6833108",
"0.6781865",
"0.6729462",
"0.6729462",
"0.65667576",
"0.65574324",
"0.65563565",
"0.65247333",
"0.6506",
"0.6442958",
"0.6426147",
"0.6398391",
"0.638667",
"0.63635725",
"0.63272244",
"0.6293278",... | 0.80323935 | 0 |
Test that creating an edge table succeeds. | def test_create_edge_table(populated_workspace, managed_user, server):
workspace, _, node_table, edge_table = populated_workspace
aql = f"FOR doc in {edge_table} RETURN doc"
new_table_name = "new_table"
with conftest.login(managed_user, server):
resp = server.post(
f"/api/workspace... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_node_table(populated_workspace, managed_user, server):\n workspace, _, node_table, edge_table = populated_workspace\n\n aql = f\"FOR doc in {node_table} RETURN doc\"\n new_table_name = \"new_table\"\n\n with conftest.login(managed_user, server):\n resp = server.post(\n ... | [
"0.71406615",
"0.6742009",
"0.6662753",
"0.66114295",
"0.6584163",
"0.6562892",
"0.64749646",
"0.6457786",
"0.6446716",
"0.63280934",
"0.6242969",
"0.6199534",
"0.61590916",
"0.61175025",
"0.61146593",
"0.6104747",
"0.6094407",
"0.6081413",
"0.60717505",
"0.60520136",
"0.6040... | 0.8062909 | 0 |
[0001] is bitsstyle, it should roundtrip | def test_from_binary_bits_style(self):
self.assertResult('[0001]', b4('[0001]')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_from_binary_bits_style(self):\n self.assertResult('[0001 0000]', b8('[0001 0000]'))",
"def test_from_binary_0b_style(self):\n self.assertResult('[0001]', b4('0b0001'))\n with self.assertRaises(OverflowError):\n b4('0b10001')",
"def _get_binary(value, bits):\n\n # http:... | [
"0.77719307",
"0.685811",
"0.6772562",
"0.6692718",
"0.66696775",
"0.6592825",
"0.6515831",
"0.6484435",
"0.6419338",
"0.6412965",
"0.6407757",
"0.63739306",
"0.62971824",
"0.6284069",
"0.627797",
"0.62453234",
"0.6243162",
"0.62304014",
"0.62304014",
"0.62018377",
"0.6198636... | 0.7915555 | 0 |
[0001 0000] is bitsstyle, it should roundtrip | def test_from_binary_bits_style(self):
self.assertResult('[0001 0000]', b8('[0001 0000]')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_from_binary_bits_style(self):\n self.assertResult('[0001]', b4('[0001]'))",
"def _get_binary(value, bits):\n\n # http://www.daniweb.com/code/snippet216539.html\n return ''.join([str((value >> y) & 1) for y in range(bits - 1, -1, -1)])",
"def bitcast(self, typ):",
"def __bytes__(self):\n ... | [
"0.76303726",
"0.6809973",
"0.66890424",
"0.662012",
"0.6607857",
"0.65789133",
"0.64729995",
"0.641714",
"0.64161503",
"0.6397366",
"0.6325137",
"0.631451",
"0.6302356",
"0.6283654",
"0.62800944",
"0.6269392",
"0.6252997",
"0.6251015",
"0.6251015",
"0.62474406",
"0.6245014",... | 0.767706 | 0 |
The main function finds the most costefficient route for all maps using the Astar algorithm. Each map is printed before and after the application of the algorithm and the path is highlighted in green. I did not optimise | def main():
for task in range(1, 6):
# get map object for the current task
map_obj = MapObj(task=task)
# display map
map_obj.show_map()
# find cost optimal path using a-star
node = search(
map_obj=map_obj,
heuristic=euclidian_distance,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def astar_multi(maze):\n heuristic_lookup = {} \n objs = maze.getObjectives()\n corner_list = maze.getObjectives()\n start = maze.getStart()\n path = []\n dim = maze.getDimensions()\n visited = {}\n lookup_table = {}\n p_queue = []\n edgeset = []\n mintree = {}\n start_heuristic... | [
"0.669275",
"0.6664785",
"0.6642125",
"0.6641919",
"0.66359407",
"0.6612437",
"0.6588065",
"0.65579337",
"0.6521824",
"0.6512447",
"0.6506823",
"0.6470073",
"0.64598304",
"0.6435489",
"0.64266604",
"0.6377514",
"0.63723433",
"0.63617516",
"0.63536024",
"0.63367397",
"0.632998... | 0.77388996 | 0 |
Generate an epoch instance with an arbitrary number of timepoints, channels, trials, and conditions | def generate_epoch(n_epochs_cond=5, n_channels=10, n_times=20,
sfreq=1000., n_conditions=2):
n_epochs = n_epochs_cond * n_conditions
data = rng.randn(n_epochs, n_channels, n_times)
conditions = np.repeat(np.arange(n_conditions), n_epochs_cond)
events = np.array([np.arange(n_epochs),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, epochs, **kwargs):\n if epochs == -1:\n self.layer_ls = []\n self.thick_ls = []\n self.max_ret_ls = []\n self.layer_ls = [0] * epochs\n self.thick_ls = [0] * epochs\n self.max_ret_ls = [0] * epochs\n self.kwargs = kwargs\n ... | [
"0.6585803",
"0.6497939",
"0.6350018",
"0.61702263",
"0.6169882",
"0.6169882",
"0.6169882",
"0.6169882",
"0.6153289",
"0.612797",
"0.61062354",
"0.6102775",
"0.6102775",
"0.60968006",
"0.60782653",
"0.60648984",
"0.60266227",
"0.60192686",
"0.59824383",
"0.5977176",
"0.597660... | 0.74305934 | 0 |
Details about the sharing history. Readonly | def sharing_history(self):
return self.properties.get("sharingHistory", ClientValueCollection(SharingDetail)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history():",
"def history(self):\n return self.info['history']",
"def History(self):\n return self.historydict.get('history', [])",
"def history(self):\n return _spacegrant_swig.general_burster_2_sptr_history(self)",
"def get_history(hdr):\n return hdr['HISTORY']",
"de... | [
"0.7002036",
"0.67638147",
"0.66352415",
"0.64690125",
"0.6420365",
"0.6409814",
"0.6408873",
"0.63647664",
"0.6339836",
"0.6307915",
"0.6307915",
"0.6174997",
"0.6151091",
"0.6138903",
"0.6138903",
"0.6138903",
"0.6110066",
"0.60981596",
"0.60939085",
"0.6082211",
"0.6077518... | 0.8075509 | 0 |
getLabelsByString(str) > retval . Gets vector of labels by string. . . The function searches for the labels containing the specified substring in the associated string . info. | def getLabelsByString(self, p_str): # real signature unknown; restored from __doc__
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _FindLabels(self):\n texs = \" \".join(glob.glob(\"*.tex\"))\n cat_process = subprocess.Popen(shlex.split(\"cat %s\" % texs),\n stdout=subprocess.PIPE)\n grep_process = subprocess.Popen(shlex.split(r\"grep \\\\\\\\label\"),\n ... | [
"0.5799045",
"0.5798392",
"0.5570669",
"0.5566561",
"0.55508935",
"0.54917115",
"0.5488357",
"0.547038",
"0.53623724",
"0.5346925",
"0.5306058",
"0.5249909",
"0.52471197",
"0.52200127",
"0.5211774",
"0.5175147",
"0.514519",
"0.5142796",
"0.5121729",
"0.5119788",
"0.5112844",
... | 0.8171051 | 0 |
predict(src) > label, confidence . Predicts a label and associated confidence (e.g. distance) for a given input image. . . src Sample image to get a prediction from. . label The predicted label for the given image. . confidence Associated confidence (e.g. distance) for the predicted label. . . The suffix const means th... | def predict(self, src): # real signature unknown; restored from __doc__
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_label(self, src): # real signature unknown; restored from __doc__\n pass",
"def predict_label(img, net_model, label):\n img1 = cv2.resize(img, (80, 80))\n predict = net_model.predict(img1.reshape(1, 80, 80, 3))\n maxi = predict[0][0]\n curs = 0\n test = 0\n for i, pred in enu... | [
"0.8164713",
"0.70400786",
"0.6692979",
"0.6685521",
"0.6660367",
"0.6634519",
"0.6623298",
"0.6583924",
"0.658039",
"0.656776",
"0.6564082",
"0.65584797",
"0.6534724",
"0.65208113",
"0.6492168",
"0.6481137",
"0.6455593",
"0.6447984",
"0.6446284",
"0.6433222",
"0.6428921",
... | 0.74669254 | 1 |
predict_collect(src, collector) > None . if implemented send all result of prediction to collector that can be used for somehow custom result handling . src Sample image to get a prediction from. . collector Userdefined collector object that accepts all results . . To implement this method u just have to do same intern... | def predict_collect(self, src, collector): # real signature unknown; restored from __doc__
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, src): # real signature unknown; restored from __doc__\n pass",
"def predict(self, images, batch_size):\n pass",
"def predict_label(self, src): # real signature unknown; restored from __doc__\n pass",
"def predict(self, predPoints=None):",
"def predict(self, review):\n ... | [
"0.6678265",
"0.6456735",
"0.6444024",
"0.64272",
"0.62852335",
"0.6193781",
"0.61182845",
"0.61166155",
"0.60987484",
"0.6045902",
"0.6025777",
"0.60107183",
"0.6006741",
"0.5983426",
"0.59809",
"0.5977417",
"0.59308034",
"0.5930007",
"0.59228754",
"0.5922668",
"0.5911312",
... | 0.82745165 | 0 |
predict_label(src) > retval . | def predict_label(self, src): # real signature unknown; restored from __doc__
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_label(img, net_model, label):\n img1 = cv2.resize(img, (80, 80))\n predict = net_model.predict(img1.reshape(1, 80, 80, 3))\n maxi = predict[0][0]\n curs = 0\n test = 0\n for i, pred in enumerate(predict[0]):\n test += pred\n if pred > maxi:\n maxi = pred\n ... | [
"0.7875492",
"0.7659507",
"0.7163415",
"0.70910007",
"0.70910007",
"0.70826364",
"0.69970626",
"0.6970557",
"0.6970557",
"0.6970557",
"0.6965303",
"0.6934622",
"0.69312555",
"0.69295776",
"0.6902493",
"0.68160045",
"0.6803806",
"0.67396677",
"0.6716303",
"0.6715785",
"0.66905... | 0.8846795 | 0 |
setLabelInfo(label, strInfo) > None . Sets string info for the specified model's label. . . The string info is replaced by the provided value if it was set before for the specified label. | def setLabelInfo(self, label, strInfo): # real signature unknown; restored from __doc__
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLabelInfo(self, label): # real signature unknown; restored from __doc__\n pass",
"def _set_label(self, input_label):\n self.label = input_label\n return self.label",
"def set_label(self, value: str = \"nowhere\"):\r\n self._logger.info(log_message_formatter(\r\n \"... | [
"0.62226284",
"0.6176853",
"0.6155416",
"0.6110403",
"0.6080699",
"0.6080699",
"0.6080699",
"0.6004217",
"0.5885236",
"0.58843833",
"0.5862197",
"0.5846477",
"0.5824491",
"0.5824491",
"0.5824491",
"0.5824491",
"0.5824491",
"0.5708887",
"0.570488",
"0.5693118",
"0.56371164",
... | 0.85136807 | 0 |
update(src, labels) > None . Updates a FaceRecognizer with given data and associated labels. . . src The training images, that means the faces you want to learn. The data has to be given . as a vector\. . labels The labels corresponding to the images have to be given either as a vector\ or . a Mat of type CV_32SC1. . .... | def update(self, src, labels): # real signature unknown; restored from __doc__
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_opencv_classifier(training_filenames,\n training_labels,\n classifier = LBPHFaceRecognizer_create(),\n training_path = Config.A2_EXTRACTED_FACES_PATH):\n faces = _open_images(training_filenames, training_path)\n classi... | [
"0.6088109",
"0.58979994",
"0.5852177",
"0.57855684",
"0.57257205",
"0.5668802",
"0.5597713",
"0.5524305",
"0.550944",
"0.5504895",
"0.54383534",
"0.54116833",
"0.5310754",
"0.5257893",
"0.5196307",
"0.51818097",
"0.5167233",
"0.5166448",
"0.5165602",
"0.5157211",
"0.5147018"... | 0.6211231 | 0 |
Pads attention scores to fixed length. This is a hack because raw_rnn requirs a fully defined shape for all outputs. | def _pad_att_scores(self, scores):
# TODO: File a tensorflow bug and get rid of this hack
max_len = self.attention_inputs_max_len
scores = tf.pad(scores, [[0, 0], [0, max_len - tf.shape(scores)[1]]])
scores.set_shape([None, max_len])
return scores | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pad_feature_sequences(sequences, pad=PAD, feature_dims=768):\n lengths = [tf.shape(x)[0] for x in sequences]\n padded_size = tf.reduce_max(lengths)\n padded_sequences = tf.stack([\n tf.pad(x,\n paddings=[[0, padded_size - lengths[i]], [0, 0]],\n mode='CONSTANT',\n c... | [
"0.5921612",
"0.58181566",
"0.5778595",
"0.5759778",
"0.5745317",
"0.5699408",
"0.56947744",
"0.56926167",
"0.56926167",
"0.5650541",
"0.5650541",
"0.5638927",
"0.5627136",
"0.5626704",
"0.56203145",
"0.55972654",
"0.5548791",
"0.55334276",
"0.54725224",
"0.54442996",
"0.5438... | 0.79294074 | 0 |
This builds the reports from the databases | def buildReports(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_report():\n\n # Fetch the top 3 most viewed articles and number of views and print them\n articles_query = get_articles_query()\n popular_articles = execute_query(articles_query)\n print_top_articles(popular_articles)\n\n # Fetch the most popular authors and print them\n authors_quer... | [
"0.7095108",
"0.69534004",
"0.6663159",
"0.64933413",
"0.6295813",
"0.62742084",
"0.620331",
"0.61957186",
"0.6151746",
"0.6091902",
"0.6060622",
"0.6012525",
"0.6002162",
"0.59818983",
"0.59760636",
"0.5960833",
"0.59428686",
"0.591919",
"0.5917849",
"0.5894175",
"0.5886543"... | 0.7372608 | 0 |
Instantiates a barcode compiler from bcompiler.py | def enterBarcodes(self,event):
compiler = bcompiler.Compiler(self, 'Barcode Entry')
compiler.Centre() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, coder):\n self.coder = coder",
"def __init__( self, owner, barcode_height = 1 ):\n\t\tassert isinstance( owner, HpPclDocument ), \"Owner must be an HpPclDocument\"\n\t\tassert isinstance( barcode_height, int ), \"barcode_height must be integer (1 or 2)\"\n\t\t\n\t\tself.owner = owner\n\... | [
"0.6201548",
"0.6039623",
"0.6039615",
"0.5918131",
"0.59013987",
"0.5875737",
"0.5864135",
"0.58467346",
"0.5824401",
"0.5822712",
"0.5805826",
"0.5780322",
"0.5750381",
"0.57478964",
"0.5738285",
"0.5723711",
"0.570708",
"0.5670732",
"0.5668858",
"0.5664277",
"0.5662253",
... | 0.66856456 | 0 |
Simple month number > Name conversion | def monthName(self, num):
monthNames = {
'1': 'January',
'2': 'February',
'3': 'March',
'4': 'April',
'5': 'May',
'6': 'June',
'7': 'July',
'8': 'August',
'9': 'September',
'10': 'Oct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def named_month(pMonthNumber):\n return datetime.date(1900, pMonthNumber, 1).strftime('%B')",
"def named_month(month_number):\n return date(1900, month_number, 1).strftime(\"%B\")",
"def get_month_name(month_of_year):\n return VALID_MONTHS[month_of_year - 1].title()",
"def month_name(month_number):\... | [
"0.81404334",
"0.80535823",
"0.7878824",
"0.7876861",
"0.7692885",
"0.7680382",
"0.76396465",
"0.74839294",
"0.7439894",
"0.7430571",
"0.7197458",
"0.71760815",
"0.7175387",
"0.7119662",
"0.70344055",
"0.7000854",
"0.69850427",
"0.6970787",
"0.69658434",
"0.68975216",
"0.6864... | 0.81763744 | 0 |
Get a Boolean value from this mask for the specified position | def __getitem__(self, pos):
row, column = pos
if row <= self.n_rows-1 and column <= self.n_columns-1:
return self.bits[row][column]
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains ( self, pos ):\n return ones(pos.shape[1], dtype=bool)",
"def getFlag(flagbyte, pos):\n mask = 2**pos\n result = flagbyte & mask\n return (result == mask)",
"def bit_extraction(self, pos: int = 0) -> ShareTensor:\n ring_bits = utils.get_nr_bits(self.ring_size)\n if po... | [
"0.701694",
"0.6592055",
"0.6446894",
"0.638245",
"0.6335866",
"0.6256663",
"0.620722",
"0.60620993",
"0.60448366",
"0.6014288",
"0.59547925",
"0.58999145",
"0.58697",
"0.58697",
"0.58697",
"0.58697",
"0.58566266",
"0.5838707",
"0.5835728",
"0.5831862",
"0.58260113",
"0.582... | 0.69435835 | 1 |
Set a Boolean value in this Mask at specified position | def __setitem__(self, pos, is_on):
row, column = pos
self.bits[row][column] = is_on | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setBit(self,i,boolval):\n self.boolVals[i]=boolval",
"def set_at(self,x,y,set=True):\n\t\tif ( not self._validate(x,y )):\n\t\t\treturn\n\n\t\t# set the bit in the grid\n\t\tif set:\n\t\t\tself.Grid[y] = self.Grid[y] | (1 << x)\n\t\telse:\n\t\t\tself.Grid[y] = self.Grid[y] & ~(1 << x)",
"def setFlag... | [
"0.717619",
"0.6712488",
"0.6485581",
"0.6381309",
"0.6352583",
"0.63373625",
"0.6290797",
"0.6256687",
"0.62365824",
"0.6226003",
"0.62201405",
"0.6169793",
"0.6165585",
"0.61623925",
"0.6134321",
"0.6093073",
"0.60282",
"0.5949461",
"0.59481525",
"0.5947606",
"0.5944865",
... | 0.72077477 | 0 |
Make an optimizer of the given type (opt), for the given model's parameters with the given learning rate (lr) | def make_optimizer(model, lr, opt, weight_decay):
optimizers = {
'adam': optim.Adam,
'adamax': optim.Adamax,
'rmsprop': optim.RMSprop,
}
optimizer = optimizers[opt](model.parameters(), lr=lr,
weight_decay=weight_decay)
return optimizer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_optimizer(params, optimizer_type='SGD', lr=1e-3,\n weight_decay=0, momentum=0, adam_beta1=0.99,\n adam_beta2=0.99, adam_epsilon=1e-8):\n if optimizer_type == 'SGD':\n optimizer = torch.optim.SGD(params, lr=lr, momentum=momentum,\n ... | [
"0.7859061",
"0.76556516",
"0.7374544",
"0.7362451",
"0.7305754",
"0.72603697",
"0.7259685",
"0.7124255",
"0.71060324",
"0.7080416",
"0.7079644",
"0.7030487",
"0.7030487",
"0.6979409",
"0.6970541",
"0.6970541",
"0.6970541",
"0.69675887",
"0.69508475",
"0.693975",
"0.68981093"... | 0.77417475 | 1 |
Test basic cost evaluation | def test_cost(self):
self.assertAlmostEqual(m2.cost(params), 57.629, 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_cost():",
"def get_expected_cost(self):",
"def test_cost(self):\n # Get components for the network\n data = array([[1, 0], [0, 1]])\n cdata = LabeledCData(data, labels=array([0, 1]))\n encoder = BinaryEncoding(cdata)\n ansatz = ProductAnsatz(2)\n measure... | [
"0.85999995",
"0.7776873",
"0.76988167",
"0.73633325",
"0.7108563",
"0.70541847",
"0.70389044",
"0.6996444",
"0.6914956",
"0.67974335",
"0.67964447",
"0.6743375",
"0.6718135",
"0.6683322",
"0.66094106",
"0.6573829",
"0.6555532",
"0.6512226",
"0.6479566",
"0.64324844",
"0.6432... | 0.78449386 | 1 |
Test that JtJ calculation doesn't crash | def test_JtJ(self):
jtj = m2.GetJandJtJInLogParameters(log(params)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unit_clebsch_delta_j(j1, j2):\n for _ in range(10):\n j3 = np.random.choice(np.arange(abs(j1-j2), j1+j2+1))\n j3p = np.random.choice(np.arange(abs(j1-j2), j1+j2+1))\n m3 = np.random.choice(np.arange(-j3, j3+1))\n m3p = np.random.choice(np.arange(-j3p, j3p+1))\n\n sum_... | [
"0.6056597",
"0.5834659",
"0.57789725",
"0.57316846",
"0.5721448",
"0.57211846",
"0.5700673",
"0.56999576",
"0.5690456",
"0.56631064",
"0.5655923",
"0.56354785",
"0.56102514",
"0.5601062",
"0.55643505",
"0.55643016",
"0.55643016",
"0.5550328",
"0.5533619",
"0.5491374",
"0.548... | 0.61966956 | 0 |
Returns integrated EBL intensity in I [nW / m^2 / sr] for redshift z between wavelegth lmin and lmax (micron) | def ebl_int(self,z,lmin = 0.01,lmax=1e3,steps = 50):
logl = np.linspace(np.log10(lmin),np.log10(lmax),steps)
lnl = np.log(np.linspace(lmin,lmax,steps))
ln_Il = np.log(10.) * (self.ebl_array(z,10.**logl)) # note: nuInu = lambda I lambda
result = simps(ln_Il,lnl)
return re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def z_rec_EH(self):\n # Approximation for drag epoch redshift\n om_m = self.omega_m-np.sum(self.omega_nu)\n om_b = self.omega_b\n g1 = 0.0783*om_b**-0.238/(1.+39.5*om_b**0.763)\n g2 = 0.560/(1+21.1*om_b**1.81)\n z_r = 1048*(1+0.00124*om_b**-0.738)*(1+g1*om_m**g2)\n ... | [
"0.58859634",
"0.58347136",
"0.57607436",
"0.5595133",
"0.5546669",
"0.5499739",
"0.54578257",
"0.54389113",
"0.5430184",
"0.5427108",
"0.54221094",
"0.53859085",
"0.5382195",
"0.536338",
"0.5353813",
"0.53246367",
"0.5316632",
"0.531335",
"0.53034097",
"0.5268161",
"0.526801... | 0.61072236 | 0 |
calculates mean free path in Mpc for gammaray energy ETeV at redshift z | def mean_free_path(self,z,ETeV,
steps_e = 50,
LIV_scale = 0., nLIV=1,
egamma_LIV=True):
if np.isscalar(ETeV):
ETeV = np.array([ETeV])
elif type(ETeV) == list or type(ETeV) == tuple:
ETeV = np.array(ETeV)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_free_path(self):\n return self.dynamic_viscosity / self.density * np.sqrt(np.pi * 1e-3*self.molar_mass / (2*gas_constant * self.temperature))",
"def optical_depth(self,z0,ETeV,\n #OmegaM = cosmo.Om0, OmegaL = 1. - cosmo.Om0, \n OmegaM = 0.3, OmegaL = ... | [
"0.6610436",
"0.6173891",
"0.6033993",
"0.59915024",
"0.57060885",
"0.56476825",
"0.5635512",
"0.5604683",
"0.55728316",
"0.5566647",
"0.550075",
"0.54931307",
"0.548568",
"0.5462976",
"0.54446524",
"0.54130024",
"0.54068774",
"0.5393098",
"0.5387546",
"0.53795075",
"0.537664... | 0.64574486 | 1 |
Initialization Store the incoming information. A number of properties will be inherited from the master record object that spawns a detail record object. | def __init__(self, recordObj):
for prop in Details.inheritProps:
setattr(self, prop, getattr(recordObj, prop, None))
self.details = {}
"""*dict* Stores the details of this record.
Keyed by the name of the detail table, values are lists of detail
records in that de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.data = []\n self.record = {}",
"def __init__(self):\n\n self.records = {}\n self.port_obj = None",
"def __init__(self):\n self.info = dict()",
"def setup(self): \n self.suburbs_dict = dict()\n self.raw_proIds_dict = dict()\n ... | [
"0.639232",
"0.63626075",
"0.6287888",
"0.628684",
"0.62714016",
"0.61718035",
"0.6071245",
"0.60564166",
"0.60220796",
"0.5985775",
"0.5981133",
"0.59693754",
"0.59553707",
"0.59136647",
"0.5913385",
"0.59104806",
"0.5909655",
"0.5867571",
"0.5862412",
"0.58459365",
"0.58418... | 0.6965377 | 0 |
Wrap the details of a specific table for this record into HTML. Some of the parameters above will be passed to the initializers of the detail record objects, others to their `wrap` method. | def wrapDetail(
self,
dtable,
withDetails=False,
readonly=False,
bodyMethod=None,
inner=True,
wrapMethod=None,
expanded=False,
withProv=True,
extraCls=None,
filterFunc=None,
combineMethod=None,
withN=True,
sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap(self, readonly=False, showTable=None, showEid=None):\n\n table = self.table\n\n for detailTable in G(DETAILS, table, default=[]):\n self.fetchDetails(detailTable)\n\n details = self.details\n\n return H.join(\n self.wrapDetail(\n detailTable... | [
"0.74048793",
"0.6016774",
"0.5724653",
"0.5614895",
"0.55560035",
"0.5549911",
"0.5545732",
"0.55195165",
"0.5512996",
"0.54582226",
"0.54367775",
"0.5415133",
"0.54078156",
"0.5382487",
"0.5302844",
"0.5284239",
"0.5262095",
"0.5224541",
"0.5220882",
"0.5194215",
"0.5191155... | 0.7190013 | 1 |
Determines the record id specified by `showTable` and `showEid` in `kwargs`. "kwargs" may contain the keys `showTable` and `showEid`. We want the value of `showEid`, but only if the value of `showTable` matches `table`. !!! hint We need this when we have just inserted a detail record and want to navigate to the master ... | def mustShow(table, kwargs):
return G(kwargs, N.showEid) if G(kwargs, N.showTable) == table else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getShowId(show, conn):\n cur = conn.cursor()\n cur.execute(\"SELECT id_show FROM show WHERE name=?\", (show,))\n id_show = cur.fetchone()[0]\n return id_show",
"def get_show_info(self, id, **kwargs):\n kwargs['id'] = id\n return self.get('info/show.json', **kwargs)",
"def show(tes... | [
"0.50562793",
"0.4673139",
"0.45730734",
"0.45034194",
"0.44778624",
"0.44431597",
"0.44299755",
"0.44292748",
"0.4370012",
"0.43550566",
"0.4302196",
"0.4287886",
"0.42611498",
"0.42536113",
"0.4235748",
"0.42272064",
"0.4216847",
"0.42039272",
"0.41761777",
"0.41716072",
"0... | 0.6932175 | 0 |
Generate the `Environment=` row for the service file | def add_to_environment(v):
return "Environment='{}'".format(
"\nEnvironment=".join(
"{}={}".format(k, "".join(map(str, v))) for k, v in iteritems(v)
)
if isinstance(v, dict)
else v
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_environment(self):\n try:\n if self._environment is None:\n self._environment = Environment.fromfilepath(self._environmentName,\n self._configuration.environment_file_path)\n except Exception:\n ... | [
"0.62408334",
"0.62025267",
"0.6103635",
"0.60745347",
"0.6065404",
"0.60588557",
"0.5935273",
"0.59224963",
"0.5909952",
"0.5843454",
"0.58268577",
"0.58259785",
"0.5783211",
"0.57667744",
"0.5734885",
"0.5676795",
"0.567575",
"0.5634579",
"0.56262195",
"0.56262034",
"0.5623... | 0.6312815 | 0 |
Adds a new batch to the dataset | def add_batch(self, batch):
x, e, f = batch
if self.is_empty:
self.x = x
self.e = e
self.f = f
else:
self.x = ch.cat([self.x, x], dim=0)
self.e = ch.cat([self.e, e], dim=0)
self.f = ch.cat([self.f, f], dim=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, batch: Batch):",
"def add(self, datasetName, rows):\r\n\r\n rows = np.vstack(rows)\r\n\r\n\t\t# Add the sample into the buffer\r\n try:\r\n self.datasetBuffer[datasetName].extend(rows)\r\n except:\r\n # Initialize the buffer\r\n self.datasetB... | [
"0.76879364",
"0.6989946",
"0.68998057",
"0.661739",
"0.6585537",
"0.6469785",
"0.63864845",
"0.63252324",
"0.63064003",
"0.6256134",
"0.6253562",
"0.6151694",
"0.60974145",
"0.60922295",
"0.60763055",
"0.6027889",
"0.59819883",
"0.5926093",
"0.58860254",
"0.58841777",
"0.586... | 0.7393912 | 1 |
Return a random groupname. | def groupname():
return jsonify(name=getRandomLine(groupNamesFile)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_name(self):\n return self.groupname",
"def get_group(group, number):\n return '-'.join([get_random_2(number) for i in xrange(group)])",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def group_name(self) -> pulumi.Output[Optional[str]]:\n retu... | [
"0.7487029",
"0.7441565",
"0.738356",
"0.7117439",
"0.7031006",
"0.68817943",
"0.6875971",
"0.6875971",
"0.68434525",
"0.68410903",
"0.6696741",
"0.669556",
"0.66831475",
"0.6659407",
"0.66275847",
"0.66275847",
"0.658835",
"0.6569444",
"0.6569444",
"0.65582913",
"0.65553",
... | 0.7563093 | 0 |
Return a random nickname. | def nickname():
return jsonify(name=getRandomLine(nickNamesFile)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nick(infraction_id: int, member_id: int) -> str:\n rng = random.Random(str(infraction_id) + str(member_id))\n return rng.choice(STAR_NAMES)",
"def random_username():\n return str(uuid.uuid4().hex.upper())",
"def create_random_username() -> str:\n return str(uuid.uuid4())",
"def generate_u... | [
"0.7731821",
"0.7605116",
"0.71987265",
"0.7109871",
"0.7044811",
"0.70312864",
"0.701071",
"0.69502795",
"0.6930679",
"0.69274116",
"0.6888902",
"0.684871",
"0.68305653",
"0.67882365",
"0.678088",
"0.676321",
"0.67560416",
"0.67244273",
"0.6709511",
"0.6670801",
"0.66545403"... | 0.793278 | 0 |
Return a random line from a file. | def getRandomLine(filename):
lines = open(filename).read().splitlines()
return random.choice(lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_line(filename):\n return random.choice(list(open(filename)))",
"def random_line(insult_file=None):\n if insult_file is None:\n insult_file = os.path.join(\n os.path.dirname(os.path.dirname(__file__)), \"data\", \"insult.txt\"\n )\n with open(insult_file) as file_used:... | [
"0.90851754",
"0.8078945",
"0.7128722",
"0.65244347",
"0.64570886",
"0.6451161",
"0.642826",
"0.63926786",
"0.6370725",
"0.6302657",
"0.62390476",
"0.6235747",
"0.6190852",
"0.6190852",
"0.6141415",
"0.609726",
"0.6089984",
"0.6055368",
"0.60491496",
"0.6030685",
"0.6007307",... | 0.89000696 | 1 |
Sets the initial state. | def initial_state(self, initial_state: QuantumCircuit) -> None:
self._invalidate()
self._initial_state = initial_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_initial_state(self):\n pass",
"def initialize(self):\n self.currState = self.startState",
"def set_initial_state(self, initial_states, userdata):\n raise NotImplementedError()",
"def initialize_state(self, state):\n print 'state initialized'\n return state",
"def... | [
"0.8084669",
"0.7947691",
"0.76892877",
"0.7606813",
"0.74890476",
"0.74814117",
"0.7444651",
"0.74338377",
"0.7428735",
"0.74284536",
"0.7420471",
"0.74169594",
"0.735922",
"0.72971404",
"0.7283322",
"0.72217274",
"0.7177605",
"0.7153066",
"0.71174866",
"0.71003413",
"0.7090... | 0.8285448 | 0 |
The operators that are evolved in this circuit. | def operators(self):
return self._operators | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operators(self):\n return self.domain.operators.keys()",
"def operartors(self) -> List[Operator]:\n return list(self.__ops.keys())",
"def target_iops(self):\n return self._target_iops",
"def opschrift(self):\n return self._opschrift.get_waarde()",
"def commutative_operators(... | [
"0.72724944",
"0.7149426",
"0.66538227",
"0.64726526",
"0.63937265",
"0.63606274",
"0.6252834",
"0.62380904",
"0.62157017",
"0.61217785",
"0.61166877",
"0.6110983",
"0.6102505",
"0.6101349",
"0.60718983",
"0.60718983",
"0.60451394",
"0.6039561",
"0.60343015",
"0.60126996",
"0... | 0.7647899 | 0 |
Set the operators to be evolved. | def operators(self, operators=None) -> None:
operators = _validate_operators(operators)
self._invalidate()
self._operators = operators | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_operator(self, op):\n self.operator = op",
"def operators(self, operators):\n if operators is None:\n raise ValueError(\"Invalid value for `operators`, must not be `None`\") # noqa: E501\n\n self._operators = operators",
"def make_operators(self):\n self.relation... | [
"0.606116",
"0.6031933",
"0.5978947",
"0.5958669",
"0.5903525",
"0.5811195",
"0.54755634",
"0.5424017",
"0.53741544",
"0.537248",
"0.5370519",
"0.5367691",
"0.535185",
"0.5344351",
"0.5329274",
"0.5329274",
"0.531702",
"0.5296634",
"0.5288444",
"0.52609754",
"0.5259466",
"0... | 0.67941713 | 0 |
A list of the quantum registers associated with the circuit. | def qregs(self):
if self._data is None:
self._build()
return self._qregs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_list(self):\n num_items = self.MAX_NUM_CPU_REGISTERS\n buf = (ctypes.c_uint32 * num_items)()\n num_regs = self._dll.JLINKARM_GetRegisterList(buf, num_items)\n return buf[:num_regs]",
"def c(self) -> List[RegisterSlot]:\n return self._reg_slots",
"def read_all_reg... | [
"0.72353625",
"0.6982318",
"0.69703597",
"0.67520475",
"0.6496093",
"0.6402607",
"0.6319915",
"0.62845147",
"0.61529905",
"0.6120168",
"0.60789955",
"0.60054946",
"0.5992863",
"0.59664446",
"0.59085006",
"0.5674193",
"0.56505626",
"0.5649483",
"0.559813",
"0.55776286",
"0.557... | 0.70502937 | 1 |
Getter of preferred initial points based on the given initial state. | def preferred_init_points(self):
if self._initial_state is None:
return None
else:
# If an initial state was set by the user, then we want to make sure that the VQE does
# not start from a random point. Thus, we return an all-zero initial point for the
# o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _InitialPoints(self):\n raise NotImplementedError, \"a sampling algorithm was not provided\"",
"def initial_available_points(self):\n goal_counts = np.sum(self.initial_counts, axis=1) # int array, length 8\n # Zero out columns in the point table corresponding to unavailable colors\n ... | [
"0.65241104",
"0.62157947",
"0.6134984",
"0.6091931",
"0.6011487",
"0.5985288",
"0.5925419",
"0.5869456",
"0.5853288",
"0.57893443",
"0.572881",
"0.572881",
"0.5689507",
"0.5677375",
"0.5677368",
"0.56595117",
"0.5646456",
"0.5629645",
"0.5622023",
"0.5608991",
"0.5601939",
... | 0.76517075 | 0 |
Computes a raster surface from the sensors for a given time step. It uses an interpolation method based on kernel regression, where the digital elevation model is also taken into account. | def update(measurements, time):
measurements = np.array(measurements)
data = measurements[:,0:3] # array of [lat, lon, elevation]
targets = measurements[:,3] # array of corresponding temperature values
# Setup the KRLS (Kernel Recursive Least Squares method)
params = dict(adopt_thresh=0.01, dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assemble_hyper_surface(self):\n def get_row_no(k0):\n hdf = pd.HDFStore(self.ewlibpath, 'r')\n hdf0 = hdf.get(k0)\n idx = np.where((np.abs(hdf0.th_wavelength-self.wavelength)<=0.025)\n & (np.abs(hdf0.th_EP - self.ep)<=0.02)\n ... | [
"0.57478726",
"0.56688666",
"0.5558783",
"0.5527691",
"0.55237734",
"0.5487333",
"0.5443716",
"0.5438485",
"0.543733",
"0.54365754",
"0.5421463",
"0.53841406",
"0.5287607",
"0.52655905",
"0.52636653",
"0.5244625",
"0.5223492",
"0.5199888",
"0.5196663",
"0.5163137",
"0.5138299... | 0.63378984 | 0 |
set the environment variables, such that the google tooling is found (including the bundled python2) | def _set_environment_vars(self):
os.environ["PATH"] = os.path.join(self.source_folder, "depot_tools") + os.pathsep + os.environ["PATH"]
os.environ["DEPOT_TOOLS_PATH"] = os.path.join(self.source_folder, "depot_tools")
if tools.os_info.is_windows:
os.environ["DEPOT_TOOLS_WIN_TOOLCHAIN"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpEnvironmentVariables(basedir):\n\tif sys.platform == 'win32':\n\t\toldpath = os.environ[\"PATH\"]\n\t\tcwd = os.getcwd()\n\t\tos.environ[\"PATH\"] = oldpath + ';' + cwd + fileSeperator + basedir + fileSeperator + \"platform-tools\"\n\t\tprint os.environ[\"PATH\"]\n\telse:\n\t\tcwd = os.getcwd()\n\t\toldpa... | [
"0.69727653",
"0.6762943",
"0.6667667",
"0.64813846",
"0.62734365",
"0.62556714",
"0.6216179",
"0.6163621",
"0.61167514",
"0.6113473",
"0.606974",
"0.60209626",
"0.59844047",
"0.5979563",
"0.5979563",
"0.5979563",
"0.5979563",
"0.5979563",
"0.5979563",
"0.5972794",
"0.5951268... | 0.7446639 | 0 |
Return the statistics on the vault. | def get_vault_statistics(self, vault_id):
statistics = dict()
statistics['internal'] = {}
statistics['total-size'] = 0
statistics['block-count'] = 0
path = self._get_vault_path(vault_id)
total_size = 0
object_count = 0
for root, dirs, files in os.walk(p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statistics(self):\n return self.get_statistics()",
"def stats(self):\n url = client.build_url('stats')\n _, res_json = client.get(url, headers=self.headers)\n\n return res_json",
"def get_stats(self):\n return self.stats",
"def stats(self, **kwargs):\n return sel... | [
"0.6779402",
"0.6658791",
"0.66039014",
"0.6595597",
"0.6511061",
"0.6488987",
"0.64880913",
"0.64044243",
"0.6361973",
"0.63501835",
"0.6323141",
"0.62799245",
"0.6276256",
"0.62499607",
"0.62417096",
"0.62329715",
"0.6227262",
"0.6211958",
"0.61963075",
"0.61676866",
"0.616... | 0.79440016 | 0 |
Constructs global mass matrix | def build_global_mass_matrix(self):
number_of_rigid_bodies = len(self.rigid_body_list)
mass_matrix = sym.zeros(number_of_rigid_bodies*12)
for n, rigid_body in enumerate(self.rigid_body_list):
rows = rigid_body.mass_matrix.shape[0]
columns = rigid_body.mass_matrix.shape[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Mass_Matrix(self):\n self.mass_matrix = np.empty((self.N,self.N))\n for n1 in range(self.N):\n for n2 in range(self.N):\n self.mass_matrix[n1,n2] = integrate.quad(lambda x:self.basis[n1](x)*self.basis[n2](x),-1,1)[0]",
"def mass_matrix(self):\n if not self._fr o... | [
"0.73696244",
"0.69049346",
"0.67930025",
"0.6665424",
"0.66567814",
"0.65501755",
"0.6459234",
"0.6390062",
"0.6222223",
"0.6222223",
"0.6220611",
"0.6161287",
"0.61193216",
"0.6114994",
"0.60945964",
"0.6076594",
"0.6066146",
"0.6044834",
"0.602346",
"0.60065585",
"0.600581... | 0.8037953 | 0 |
Generates the gradient of the symbolic constraints. The function takes a RigidBody list, extracts the constraint list (phi) of length "n" and takes the gradient of it by differentiating every element by the variables in list (sym_vars) of length "m". The result is an n by m matrix | def make_sym(self):
phi_list = []
sym_vars = sym.zeros(len(self.rigid_body_list) * 12, 1)
for i, rigid_body in enumerate(self.rigid_body_list): # Global symbolic variable matrix (column vector)
for j, sim_var in enumerate(rigid_body.symbolic_variables):
sym_vars[i ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_symbolic(symfile_path=\"fung_Dsym\",resym=False):\n # Construct the quadratic form as a flat list of independent entries\n q = np.array([sp.symbols('q_{}{}'.format(i,j)) for \n (i,j) in lin.utri_indices(6)])\n\n # We also need its matrix form\n Q = np.empty((6,6),dtype=object)... | [
"0.5647912",
"0.5572266",
"0.5430133",
"0.5325553",
"0.5253732",
"0.51065946",
"0.5088273",
"0.506773",
"0.5049411",
"0.50162876",
"0.50142187",
"0.5005687",
"0.49903697",
"0.49903545",
"0.49705514",
"0.4970129",
"0.49695",
"0.49345443",
"0.49293503",
"0.49056122",
"0.4875236... | 0.6449369 | 0 |
Creates a instance of the class, and initializes to the state of ``factory``. | def create_from(cls, factory):
obj = cls()
obj.classes = copy.copy(factory.classes)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createInstance (self, factory, **kw):\n kw.update(self.__kw)\n return factory(*self.__args, **kw)",
"def build(self, factory, *factory_args, **factory_kw):\n return self._instantiate(\"\", factory, factory_args, factory_kw)",
"def create_factory(cls, *args):\n raise NotImplement... | [
"0.79718953",
"0.7543471",
"0.7095387",
"0.70036685",
"0.6901319",
"0.6901319",
"0.67882156",
"0.6730385",
"0.66555715",
"0.64878696",
"0.64506084",
"0.64506084",
"0.6373436",
"0.6314116",
"0.62899953",
"0.6198925",
"0.6183983",
"0.61658484",
"0.61658484",
"0.6142839",
"0.611... | 0.7794423 | 1 |
Show or manage experiments. If `COMMAND` is omitted, lists experiments. Refer to ``tracker experiments list help`` for more information on the `list` command. | def experiments(ctx, **kw):
if not ctx.invoked_subcommand:
ctx.invoke(list_experiments, **kw)
else:
if _params_specified(kw):
print(
"options cannot be listed before command ('%s')"
% ctx.invoked_subcommand) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(args):\n experiments = sorted(os.listdir('./litmus'))\n print_color(\"Available Litmus Chaos Experiments:\\n\\n\")\n if (f\"{args.platform}\" == \"GKE\"):\n i = 1\n for experiment_file in experiments:\n print_color(f\"\\t{i}. {experiment_file.replace('.yaml', '')}\")\n ... | [
"0.5550416",
"0.54972893",
"0.548261",
"0.53740233",
"0.53727925",
"0.5205789",
"0.5087544",
"0.5083064",
"0.5008612",
"0.49829122",
"0.4963313",
"0.4948618",
"0.49133205",
"0.4912635",
"0.48615542",
"0.4836184",
"0.48322412",
"0.4783423",
"0.47415975",
"0.47331274",
"0.47041... | 0.68585443 | 0 |
Convert sample type to float32. Audio sample type is usually integer or floatpoint. Integers will be scaled to [1, 1] in float32. | def _convert_samples_to_float32(samples):
float32_samples = samples.astype('float32')
if samples.dtype in np.sctypes['int']:
bits = np.iinfo(samples.dtype).bits
float32_samples *= (1. / 2 ** (bits - 1))
elif samples.dtype in np.sctypes['float']:
pass
else:
raise TypeError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_samples_to_float32(samples):\n float32_samples = samples.astype('float32')\n if samples.dtype in np.sctypes['int']:\n bits = np.iinfo(samples.dtype).bits\n float32_samples *= 1.0 / 2 ** (bits - 1)\n elif samples.dtype in np.sctypes['float']:\n pass... | [
"0.8283951",
"0.7093063",
"0.6973607",
"0.6631132",
"0.6566718",
"0.64980143",
"0.6428351",
"0.6348937",
"0.62683785",
"0.62051016",
"0.6118191",
"0.6072721",
"0.60383964",
"0.59404373",
"0.5726471",
"0.57245517",
"0.56885844",
"0.56732315",
"0.56583136",
"0.5654879",
"0.5597... | 0.8191275 | 1 |
Stacks frames together across feature dim, and then subsamples input is batch_size, feature_dim, num_frames output is batch_size, feature_dim stacking, num_frames / subsampling | def stack_subsample_frames(x, stacking=1, subsampling=1):
seq = [x]
for n in range(1, stacking):
tmp = torch.zeros_like(x)
tmp[:, :, :-n] = x[:, :, n:]
seq.append(tmp)
x = torch.cat(seq, dim=1)[:, :, ::subsampling]
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process_frames(dataset_info, example):\n frames = tf.concat(example['frames'], axis=0)\n frames = tf.map_fn(_convert_frame_data, tf.reshape(frames, [-1]), dtype=tf.float32, back_prop=False)\n img_dims = (dataset_info.frame_size, dataset_info.frame_size, 3)\n frames = tf.reshape(frames, (-1, datase... | [
"0.64651203",
"0.6031667",
"0.5993256",
"0.59457266",
"0.5899866",
"0.5887053",
"0.58762443",
"0.5839149",
"0.5750188",
"0.5731775",
"0.5697769",
"0.5681133",
"0.5664947",
"0.56605095",
"0.55500853",
"0.5538209",
"0.5504839",
"0.5427659",
"0.53950876",
"0.5392277",
"0.5389183... | 0.76389587 | 0 |
The core of a testcase, it coordinates an individual test, running Pexpect with the supplied StateMachine. Following unittest convention, each TestCase is named "test", where is StateMachine to test. It should invoke this method with the SM name and a concise description. | def doTestCase(self, testSM, desc="Nondescript TestCase!",
dir=None, smList=[], script=None,
preserveImpl=False, useSimState=False,
testAutocodeFailure=False,
expectFile=None, autocodeOpts=""):
# configure a few optional parameters
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doTestCase(self, testSM, desc=\"Nondescript TestCase!\",\n dir=None, smList=[],\n spinSteps=500,\n preserveImpl=False,\n testAutocodeFailure=False,\n expectFile=None, autocodeOpts=\"\"):\n # configure a few optiona... | [
"0.6815357",
"0.6198991",
"0.5872724",
"0.5832466",
"0.58168024",
"0.5796591",
"0.5774531",
"0.5766275",
"0.5742237",
"0.574126",
"0.5740555",
"0.5732068",
"0.5725276",
"0.56966364",
"0.5675381",
"0.5672046",
"0.5670964",
"0.5668301",
"0.5645139",
"0.56409556",
"0.5633106",
... | 0.63063616 | 1 |
Set color pin to level | def set_color(color, level):
ok = True
if color not in ['r', 'g', 'b']:
ok = False
if len(level) > 3:
ok = False
if level in ['0', '1']:
ok = True
if len(level) == 3 and is_float(level) and float(level) < 1:
ok = True
if ok:
logger.info('set color '+co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setColor(self,value):\n\t\tself.politics = value if(type(value) is int)else int(value[1:],16)\n\t\tself.canvas.itemconfig('node_'+self.identifier,fill=self.toRGB())",
"def light_set(self, pin='D13', value='0'):\n self.bridge.put(str(pin), str(value))",
"def set_color(self, color):\n\t\tpass",
"def... | [
"0.6784165",
"0.6714295",
"0.6534821",
"0.6392559",
"0.63554823",
"0.6350252",
"0.6337442",
"0.62017435",
"0.6153506",
"0.6116179",
"0.61065125",
"0.610241",
"0.61005515",
"0.61003697",
"0.6098637",
"0.60917",
"0.6076725",
"0.60752636",
"0.6062184",
"0.60583264",
"0.6056868",... | 0.73374116 | 0 |
Given the SiteNavigation and config, generate the context which is relevant to app pages. | def get_context(nav, config, page=None):
if nav is None:
return {'page', page}
extra_javascript = utils.create_media_urls(nav, config['extra_javascript'])
extra_css = utils.create_media_urls(nav, config['extra_css'])
# Support SOURCE_DATE_EPOCH environment variable for "reproducible" builds.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_page_context(app, pagename, templatename, context, doctree):\n site = context[\"SITEMAP_BASE_URL\"]\n version = context[\"version\"]\n app.sitemap_links.add(f\"{site}{version}/{pagename}.html\")",
"def get_context(self, request, *args, **kwargs):\n program_page_qset = (\n Prog... | [
"0.64237046",
"0.5941939",
"0.5937197",
"0.576859",
"0.5759713",
"0.5750525",
"0.57030636",
"0.5691361",
"0.5682844",
"0.55573195",
"0.5517698",
"0.5475482",
"0.5452502",
"0.54406327",
"0.5434236",
"0.5425038",
"0.542211",
"0.5401884",
"0.53937006",
"0.5383588",
"0.5339235",
... | 0.6960111 | 0 |
Build error template. Force absolute URLs in the nav of error pages and account for the possability that the docs root might be different than the server root. | def build_error_template(template, env, config, site_navigation):
site_navigation.url_context.force_abs_urls = True
default_base = site_navigation.url_context.base_path
site_navigation.url_context.base_path = utils.urlparse(config['site_url']).path
build_template(template, env, config, site_navigation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error():\n return render_template(\"404.html\")",
"def error():\n return render_template(\"error.html\", **locals())",
"def error_page(e):\n \n return render_template('error-page.html'), 404",
"def render_mainpageerror(errormsg) -> 'html':\n return render_template('mainpage.html',\n ... | [
"0.6378513",
"0.63113934",
"0.62887967",
"0.6114465",
"0.6099821",
"0.6058465",
"0.60497946",
"0.60116094",
"0.60070163",
"0.60021037",
"0.59898597",
"0.5853245",
"0.584596",
"0.5825194",
"0.57990044",
"0.57735413",
"0.5763044",
"0.57584614",
"0.5745072",
"0.57316893",
"0.570... | 0.79008925 | 0 |
Check if the site directory contains stale files from a previous build. | def site_directory_contains_stale_files(site_directory):
return True if os.path.exists(site_directory) and os.listdir(site_directory) else False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assets_are_stale(self, sourcedirectory, cachedirectory):\n comparison = filecmp.dircmp(sourcedirectory, cachedirectory, [], [])\n if comparison.left_only or comparison.right_only:\n # We have files in one directory and not the other\n return True\n if comparison.diff... | [
"0.73036665",
"0.6897631",
"0.6753435",
"0.6666933",
"0.66593444",
"0.6602083",
"0.65377283",
"0.6468902",
"0.64555126",
"0.63005996",
"0.62627804",
"0.6243703",
"0.6235594",
"0.6230908",
"0.6230891",
"0.6163383",
"0.61371064",
"0.61293364",
"0.6111086",
"0.6101928",
"0.60846... | 0.8247749 | 0 |
Returns memory at given postion (or first) | def read(self, memory_index: int = 0):
return self.memory[memory_index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_memory(self, address):\n return self.memory[Vm.filter_mem_address(address)]",
"def getMemory():\n return tracemalloc.take_snapshot()",
"def getMemory():\n return tracemalloc.take_snapshot()",
"def getMemory():\n return tracemalloc.take_snapshot()",
"def getMemory():\n return tra... | [
"0.68211687",
"0.6760047",
"0.6760047",
"0.6760047",
"0.6760047",
"0.6760047",
"0.6760047",
"0.6760047",
"0.6728509",
"0.67121994",
"0.659583",
"0.65721595",
"0.6552528",
"0.6526528",
"0.65026605",
"0.63256115",
"0.6306055",
"0.6306055",
"0.628278",
"0.625401",
"0.6219227",
... | 0.704332 | 0 |
Set the number of threads available to OpenMP. | def setNthreads(self, nthreads=None):
if nthreads is None:
nthreads = 4
lib._omp_set_num_threads(nthreads) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNumThreads(self, num):\r\n self.threads = num",
"def _nthreads_update(self):\n self.inputs.environ[\"OMP_NUM_THREADS\"] = \"%d\" % self.inputs.num_threads",
"def setNumThreads(cls, numThreads: int):\n cls.NUMTHREADS = numThreads",
"def set_omp_threads(self, omp_threads):\n self... | [
"0.8153281",
"0.78580624",
"0.7821545",
"0.780303",
"0.7579933",
"0.755946",
"0.7554526",
"0.75463355",
"0.7321347",
"0.72295845",
"0.7046031",
"0.6898059",
"0.66965824",
"0.66469413",
"0.65147096",
"0.63906753",
"0.6382793",
"0.63627875",
"0.6297557",
"0.6274347",
"0.6223236... | 0.81029433 | 1 |
Invert the frequency ordering of the data and write new data to a new file. | def invertFreq(self, gulp=512, start=0, nsamps=None, filename=None,
back_compatible=True, **kwargs):
if filename is None:
filename = f"{self.header.basename}_inverted.fil"
if nsamps is None:
size = self.header.nsamples - start
else:
size = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse(old, new):\r\n infile = open(old, \"r\")\r\n xs = infile.readlines() # Turn lines of old file into a list\r\n infile.close()\r\n\r\n xs.reverse() # Reverse this list\r\n outfile = open(new, \"w\")\r\n for i in xs:\r\n outfile.write(i) # Write a line-at-a-time at reversed list\r... | [
"0.59383094",
"0.5676988",
"0.56486845",
"0.563409",
"0.56094074",
"0.55190325",
"0.54690236",
"0.54314154",
"0.5381509",
"0.5371342",
"0.5319333",
"0.5317582",
"0.52946216",
"0.5280266",
"0.5279158",
"0.5264256",
"0.52483827",
"0.51210845",
"0.5119559",
"0.5109265",
"0.50949... | 0.59125257 | 1 |
Split the data into component Subbands and write to disk. | def splitToBands(self, chanpersub, chanstart=0, gulp=1024,
back_compatible=True, **kwargs):
nsub = (self.header.nchans - chanstart) // chanpersub
fstart = self.header.fch1 + chanstart * self.header.foff
out_files = [
self.header.prepOutfile(
f"{s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(filepath, nsamples):\n start = np.cumsum([0] + list(nsamples[:-1]))\n if filepath[-10:] == 'analog.brw':\n filename = filepath[:-10]\n analog = read_3brain_analog(filepath)\n for i, (s,n) in enumerate(zip(start, nsamples)):\n name = f\"{filename}_part_{i}_analog.npz\... | [
"0.5985549",
"0.5971308",
"0.587507",
"0.58540344",
"0.5845654",
"0.58155084",
"0.580034",
"0.57559204",
"0.56809855",
"0.5657787",
"0.5650791",
"0.5621833",
"0.5610747",
"0.5605502",
"0.5595287",
"0.5587867",
"0.5562627",
"0.55431837",
"0.55205584",
"0.5485787",
"0.5451865",... | 0.6317587 | 0 |
Remove the bandpass from the data and write new data to a new file. | def removeBandpass(self, gulp=512, filename=None, back_compatible=True, **kwargs):
if self.header.nbits < 8:
raise TypeError(f"{self.header.nbits}-bit filterbank not supported yet!")
if filename is None:
filename = f"{self.header.basename}_bpcorr.fil"
if self.chan_stdevs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_raster_file(self):\n try:\n if self.dataset:\n del self.dataset\n self.dataset = None\n except AttributeError:\n pass",
"def del_sensordata(self):\n\n organisation_id = '5af01e0210bac288dba249ad'\n animal_id = '5b6419ff36b9... | [
"0.5933749",
"0.5901013",
"0.570865",
"0.5658413",
"0.5603462",
"0.5584138",
"0.5413415",
"0.5412506",
"0.5377428",
"0.53714997",
"0.53704345",
"0.5294259",
"0.52744484",
"0.5258257",
"0.52405524",
"0.5235547",
"0.5230835",
"0.5218087",
"0.5205468",
"0.5202733",
"0.51996034",... | 0.61438173 | 0 |
Remove the channelweighted zeroDM from the data and write to disk. | def removeZeroDM(self, gulp=512, filename=None, back_compatible=True, **kwargs):
if filename is None:
filename = f"{self.header.basename}_noZeroDM.fil"
bpass = self.bandpass(gulp=gulp, **kwargs)
chanwts = bpass / bpass.sum()
out_ar = np.empty(
self.header.nsampl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self):\n self.weight = 0",
"def clear(self):\n for i in range(0, len(self.weights)):\n self.weights[i] = 0",
"def remove_data(writer: UFOWriter, filename: str) -> None:\n writer.removeImage(filename)",
"def zero_file(filepath) -> None:\n open(filepath, 'w').close(... | [
"0.5712157",
"0.5613594",
"0.5599467",
"0.5497472",
"0.5395688",
"0.53879404",
"0.5292676",
"0.5254541",
"0.523003",
"0.51881754",
"0.51489764",
"0.5127307",
"0.51157844",
"0.50971276",
"0.50971276",
"0.50944394",
"0.5094192",
"0.50888014",
"0.50849307",
"0.507961",
"0.506595... | 0.64837915 | 0 |
>>> is_unique2("abc") True >>> is_unique2("abca") False | def is_unique2(test_str):
chars = set(test_str)
if len(test_str) == len(chars):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def if_unique_chars_two(s):\n\tpass",
"def is_unique2(a_string):\n\n if len(a_string) is 0:\n print \"String is empty.\"\n return False\n\n for i in range(len(a_string)):\n if a_string[i] in a_string[i+1:]:\n return False\n return True",
"def is_unique(str):\n\n # ch... | [
"0.8055356",
"0.80206674",
"0.78698117",
"0.7816099",
"0.7809377",
"0.77794737",
"0.7721651",
"0.77059877",
"0.7695966",
"0.75797135",
"0.7577004",
"0.7574116",
"0.7429127",
"0.7316069",
"0.72335",
"0.7169959",
"0.7168162",
"0.7020953",
"0.7004606",
"0.6980227",
"0.6978172",
... | 0.8443884 | 0 |
Is every character in a string unique? (No other data structures) >>> ctci_is_unique("abc") True >>> ctci_is_unique("abca") False | def ctci_is_unique(test_str):
checker = 0
for char in test_str:
if checker & (1 << ord(char)):
return False
checker |= (1 << ord(char))
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_unique(str):\n\n # char_count = {}\n\n # for char in str:\n # count = char_count.get(char, 0)\n\n # if count == 1:\n # return False\n\n # else:\n # char_count[char] = 1\n\n # return True\n\n return len(str) == len(set(str))",
"def is_unique(a_string):... | [
"0.84747744",
"0.8140181",
"0.81322134",
"0.8114418",
"0.8107672",
"0.8088259",
"0.8021266",
"0.793905",
"0.7903577",
"0.79001844",
"0.77746737",
"0.7722646",
"0.7675967",
"0.7540307",
"0.75136435",
"0.7489287",
"0.742571",
"0.73753625",
"0.72755927",
"0.7269633",
"0.7260739"... | 0.85859317 | 0 |
Creates the table schema for jping. | def create_schema(self):
schema = '''CREATE TABLE jping (
ip_address text not null,
interface text not null,
hostname text not null,
ping_results integer not null,
UNIQUE(ip_address, hostname)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(self):\n pass",
"def _create_schema(self):\n self._conn.executescript(self._db_schema)",
"def create_tables():\n db.create_all()",
"def create_tables():\n db.create_all()",
"def _create_schema(self): \n q = (\"CREATE TABLE IF NOT EXISTS \" + \\\n ... | [
"0.7370933",
"0.73353314",
"0.71621585",
"0.71621585",
"0.70881975",
"0.7036414",
"0.7035071",
"0.70045376",
"0.6884486",
"0.6884398",
"0.6859097",
"0.68503493",
"0.68248487",
"0.678821",
"0.6767582",
"0.67378175",
"0.67157537",
"0.6701008",
"0.6692936",
"0.6687144",
"0.66760... | 0.83904684 | 0 |
Assign a symmetry to this orientation. Computes equivalent transformations which have the smallest angle of rotation and assigns these inplace. | def set_symmetry(self, symmetry):
return super(Orientation, self).set_symmetry(C1, symmetry) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symmetrize(self):\n if self.is_symmetric:\n return self\n else:\n return self.append(self.reverse()).squash().scale(0.5)",
"def set_symmetry(self):\n if self.symmetry == 'cubic':\n self.c = self.b = self.a\n self.alpha = self.beta = self.gamma ... | [
"0.68379647",
"0.63247406",
"0.62150794",
"0.6033159",
"0.5790186",
"0.5710504",
"0.5692132",
"0.5627491",
"0.55908424",
"0.5588727",
"0.5578908",
"0.55787057",
"0.55684054",
"0.5474449",
"0.54559314",
"0.5397559",
"0.5370231",
"0.53542906",
"0.5333975",
"0.53132725",
"0.5270... | 0.6940527 | 0 |
Plots a pandapower network as simple as possible in plotly. If no geodata is available, artificial geodata is generated. For advanced plotting see the tutorial | def simple_plotly(net, respect_switches=True, use_line_geodata=None, on_map=False,
projection=None, map_style='basic', figsize=1, aspectratio='auto', line_width=1,
bus_size=10, ext_grid_size=20.0, bus_color="blue", line_color='grey',
trafo_color='green', ext_grid_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Map(data):\n lon = [loc[1] for loc in data[\"geo\"]]\n lat = [loc[0] for loc in data[\"geo\"]]\n\n return dcc.Graph(id=\"MapGraph\", figure=dict(\n data=[dict(\n type='scattergeo',\n # mode='markers',\n lon=lon,\n lat=lat,\n text=data[\"nam... | [
"0.6505959",
"0.5767984",
"0.57615566",
"0.5678889",
"0.5660103",
"0.55604595",
"0.55479735",
"0.55429876",
"0.55307907",
"0.5516373",
"0.5513826",
"0.54868585",
"0.5476079",
"0.5463248",
"0.5438006",
"0.5433141",
"0.5427512",
"0.54012054",
"0.5369923",
"0.535564",
"0.5345028... | 0.66807514 | 0 |
Constructor for the VOIEPayStatement class | def __init__(self,
pay_period=None,
billable=None,
asset_id=None,
pay_date=None,
start_date=None,
end_date=None,
net_pay_current=None,
net_pay_ytd=None,
gross... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, id, amount, merchant_account_id, plan_id, recurring, refund, status, transaction_source,\n created_at):\n self.id = id\n self.amount = amount\n self.merchant_account_id = merchant_account_id\n self.plan_id = plan_id\n self.recurring = recurring\... | [
"0.65044194",
"0.6307002",
"0.620769",
"0.6163483",
"0.6141965",
"0.61416954",
"0.6071476",
"0.603084",
"0.60003966",
"0.5983754",
"0.59459877",
"0.5912048",
"0.59101224",
"0.5881059",
"0.5832934",
"0.5828335",
"0.5781907",
"0.57507104",
"0.5735501",
"0.5731837",
"0.5719738",... | 0.637194 | 1 |
takes a json response and an int value as an input and gets the id and title of the recipe which are used to create a recipe object. | def parseIdAndTitle(json_response, value):
value -= 1
recipe_id = json_response[value].get("id")
title = json_response[value].get("title")
chosen_recipe = Recipe(recipe_id, title)
return chosen_recipe | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipe(index):\n try:\n if request.method == 'GET':\n return Response(\n json.dumps(recipebook.recipes[index].to_json_dict()),\n mimetype=\"application/json\")\n elif request.method == 'DELETE':\n del recipebook.recipes[index]\n ... | [
"0.6462986",
"0.64035267",
"0.62267154",
"0.62179077",
"0.61062384",
"0.610319",
"0.6008811",
"0.5932115",
"0.5921812",
"0.58959126",
"0.5851059",
"0.5830453",
"0.5796052",
"0.5793681",
"0.57863414",
"0.57809633",
"0.57797873",
"0.57645226",
"0.57598555",
"0.5718678",
"0.5712... | 0.86446846 | 0 |
takes a json response and a recipe object as an input and gets the the remaining variables to complete the recipe | def parseRemainingVariables(json_response, recipe):
ready_in_minutes = json_response.get("readyInMinutes")
recipe.ready_in_minutes = int(ready_in_minutes)
servings = json_response.get("servings")
recipe.servings = int(servings)
vegetarian = json_response.get("vegetarian")
recipe.vegetarian = b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseIdAndTitle(json_response, value):\n value -= 1\n recipe_id = json_response[value].get(\"id\")\n title = json_response[value].get(\"title\")\n\n chosen_recipe = Recipe(recipe_id, title)\n\n return chosen_recipe",
"def parse(self, response):\r\n recipes = json.loads(response.text)['r... | [
"0.70564234",
"0.66529244",
"0.6566267",
"0.63100326",
"0.6282875",
"0.61790144",
"0.6119851",
"0.60705906",
"0.6067787",
"0.6061985",
"0.60436475",
"0.59552884",
"0.59436643",
"0.5934469",
"0.59291595",
"0.5928495",
"0.58863497",
"0.5856393",
"0.5825364",
"0.5812589",
"0.578... | 0.76964325 | 0 |
Renders link to admin edit page of the instance | def edit_link(instance):
try:
content_type = ContentType.objects.get_for_model(instance.__class__)
except AttributeError:
raise ValueError('Passed value must be registered model instance')
else:
model_admin_change_link = 'admin:{app}_{model}_change'.format(
app=content_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_admin_url(self, instance: BaseModel, name: str = None) -> str:\n url = resolve_url(\n admin_urlname(instance._meta, SafeText(\"change\")), instance.pk\n )\n return format_html('<a href=\"{}\">{}</a>', url, name or str(instance))",
"def show_admin_edit_admins():\n retu... | [
"0.74779993",
"0.71713144",
"0.7034175",
"0.7031935",
"0.687221",
"0.67710173",
"0.6748048",
"0.67283934",
"0.6709886",
"0.6644535",
"0.66391677",
"0.6635271",
"0.66156125",
"0.6559105",
"0.6458785",
"0.64456254",
"0.6369891",
"0.6332825",
"0.63129157",
"0.62749803",
"0.62418... | 0.75063384 | 0 |
Assigns numericalized tokens from a torchtext dataset to given block. The numericalized tokens would be stored in the block as node features with the same name as ``field_name``. The length would be stored as another node feature with name ``field_name + '__len'``. | def assign_textual_node_features(ndata, textset, ntype):
node_ids = ndata[dgl.NID].numpy()
for field_name, field in textset.fields.items():
examples = [getattr(textset[i], field_name) for i in node_ids]
tokens, lengths = field.process(examples)
if not field.batch_first:
to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_tokens(dgraph):\n cnt = 0\n for node in dgraph.subgraphs(exclude_root=True):\n node[WORD] = (cnt, node[WORD])\n cnt += 1\n return dgraph",
"def numberize(\n self, text_row: Optional[List[str]], token_row: Optional[List[List[str]]]\n ):\n raise NotImplementedErro... | [
"0.49899042",
"0.49458674",
"0.4597669",
"0.44813046",
"0.44396284",
"0.43921947",
"0.43901628",
"0.43741897",
"0.437239",
"0.43617868",
"0.4340282",
"0.4332555",
"0.43059653",
"0.42984346",
"0.42948395",
"0.4293449",
"0.42870733",
"0.42821",
"0.42744076",
"0.42413977",
"0.42... | 0.570742 | 0 |
Constructs blockdiagonal matrices from a list of batched 2D tensors. | def block_diagonal(matrices, dtype=tf.float32):
matrices = [tf.convert_to_tensor(matrix, dtype=dtype)
for matrix in matrices]
blocked_rows = tf.Dimension(0)
blocked_cols = tf.Dimension(0)
batch_shape = tf.TensorShape(None)
for matrix in matrices:
full_matrix_shape = matrix.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_diagonal(matrices, dtype=tf.float32):\n matrices = [tf.convert_to_tensor(matrix, dtype=dtype) for matrix in matrices]\n blocked_rows = tf.Dimension(0)\n blocked_cols = tf.Dimension(0)\n batch_shape = tf.TensorShape(None)\n for matrix in matrices:\n full_matrix_shape = matrix.get_sha... | [
"0.6619513",
"0.6613682",
"0.655527",
"0.5562392",
"0.5511607",
"0.5471755",
"0.5449592",
"0.54316026",
"0.54224735",
"0.53800976",
"0.53526396",
"0.53514004",
"0.5349552",
"0.53482145",
"0.53291816",
"0.52584076",
"0.5256403",
"0.52407396",
"0.52090025",
"0.51927626",
"0.518... | 0.6632318 | 0 |
counts total number of tips withen each clade, for each time interval (delta) between startDate and endDate | def countAbudanceFromNames_byWeek(assignment_d, clade_s, startDate, endDate, delta, tipLog_name):
psuodocount = 0.1
abundances_d = {} # key: week; value: dict of key:clade; value: count
weekToDate_d = {}
#assignment_d: key: node name; value: clade
week_l = []
tipLog_open = open(tipLog_name, "w")
outLine = " ".... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_count_figure(start_date, end_date):\n start_time = dt.datetime.now()\n\n start_date = dt.datetime.strptime(start_date.split('T')[0], '%Y-%m-%d') # Convert strings to datetime objects\n end_date = dt.datetime.strptime(end_date.split('T')[0], '%Y-%m-%d')\n\n layout_count = copy.deepcopy(layout)... | [
"0.63646436",
"0.60437846",
"0.5729084",
"0.5528347",
"0.5494922",
"0.5494551",
"0.5457132",
"0.54407156",
"0.54233235",
"0.54187125",
"0.54141986",
"0.54032373",
"0.53941506",
"0.53909934",
"0.53774375",
"0.53718525",
"0.53516877",
"0.53500086",
"0.53485024",
"0.5342512",
"0... | 0.6565103 | 0 |
Return a variable expression. | def var(name, indices=None, namespace=None):
return ExprVariable(name, indices, namespace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __evaluate(self, var_x):\n # pylint: disable=W0612,C0103\n x = var_x\n # pylint: enable=W0612,C0103\n return eval(self.expr)",
"def var(*args, **kwargs):\n return Variable(*args, **kwargs)",
"def var():\n def _var(quoted_name):\n name = quoted_name.subexpres... | [
"0.6765594",
"0.67599285",
"0.6684439",
"0.6677005",
"0.6608736",
"0.64855665",
"0.6425542",
"0.6377694",
"0.63234913",
"0.6245846",
"0.6157124",
"0.6141117",
"0.61130923",
"0.61058295",
"0.61058295",
"0.60471797",
"0.60296386",
"0.60043085",
"0.5952808",
"0.5937447",
"0.5937... | 0.69640934 | 0 |
Alias for Not Or | def Nor(*args):
return Not(Or(*args)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def or_(a, b):",
"def or_(*args, **kwargs):\n ...",
"def _or(cls, arg1, arg2):\n return arg1 or arg2",
"def Nand(*args):\n return Not(And(*args))",
"def __or__(self, other):\n return self.or_(other)",
"def _disjunction_op(spec, *expressions):",
"def logical_not(data):\n return _m... | [
"0.7744504",
"0.7600855",
"0.73388374",
"0.712332",
"0.7107725",
"0.70444447",
"0.69407004",
"0.6908771",
"0.6825725",
"0.6777729",
"0.67709655",
"0.6765871",
"0.67414224",
"0.6728819",
"0.6709352",
"0.66580135",
"0.6656805",
"0.6656805",
"0.66186357",
"0.6613777",
"0.660012"... | 0.79952836 | 0 |
Alias for Not And | def Nand(*args):
return Not(And(*args)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def g3(a, b): \n return not (a and b)",
"def logical_not(data):\n return _make.logical_not(data)",
"def Nor(*args):\n return Not(Or(*args))",
"def and_(a, b):",
"def logical_not(x, f=None):\n return _cur_framework(x, f=f).logical_not(x)",
"def f3(a, b): \n return not a and b",
"def are... | [
"0.7429656",
"0.73743397",
"0.7254128",
"0.72403973",
"0.72128904",
"0.7202583",
"0.7160593",
"0.69574064",
"0.6820052",
"0.67752165",
"0.67490554",
"0.673992",
"0.67366326",
"0.66894037",
"0.66130674",
"0.65995705",
"0.65942705",
"0.65701526",
"0.65526336",
"0.6508646",
"0.6... | 0.8334748 | 0 |
Return factored OR expression. | def f_or(*args):
f = Or(*args).factor()
return f if f in B else f.factor() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __or__(self, other):\n return self.fam.c_binop('or', self, other)",
"def or_filter(self):\n return self.__or",
"def logical_or(lhs, rhs):\n return _make.logical_or(lhs, rhs)",
"def OR(r, s):\n return lambda l, i: r(l, i) or s(l, i)",
"def or_(a, b):",
"def OR(f, g):\n def _or(x... | [
"0.72824216",
"0.72605616",
"0.72244006",
"0.7189983",
"0.7150636",
"0.71503717",
"0.7149849",
"0.71485686",
"0.7084532",
"0.7034951",
"0.7026961",
"0.7015368",
"0.6998646",
"0.6988639",
"0.6953847",
"0.692454",
"0.6911263",
"0.6901217",
"0.6782453",
"0.6745333",
"0.6737616",... | 0.74049526 | 0 |
Return factored AND expression. | def f_and(*args):
f = And(*args).factor()
return f if f in B else f.factor() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AND(f, g):\n def _and(x):\n return f(x) & g(x)\n return _and",
"def __and__(self, other):\n return self.fam.c_binop('and', self, other)",
"def andExpr( ): #DOUBLE CHECK THIS\n\n\ttok = tokens.peek( )\n\tif debug: print(\"andExpr: \", tok)\n\tleft = relationalExpr( ) #does the left side ... | [
"0.7685821",
"0.7567055",
"0.7542148",
"0.7402988",
"0.73984677",
"0.7365032",
"0.7191451",
"0.7181298",
"0.7178305",
"0.71579075",
"0.71424943",
"0.7115908",
"0.70472956",
"0.70092374",
"0.6939504",
"0.6932273",
"0.6930632",
"0.6859645",
"0.6840487",
"0.6839109",
"0.6829706"... | 0.76616824 | 1 |
Return factored NAND expression. | def f_nand(*args):
f = Nand(*args).factor()
return f if f in B else f.factor() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_nand(formula: Formula) -> Formula:\r\n # Task 3.6b\r\n not_in_nand = Formula('-&', Formula('p'), Formula('p'))\r\n and_in_nand_1 = Formula('-&', Formula('p'), Formula('q'))\r\n and_in_nand_2 = Formula('-&', and_in_nand_1, and_in_nand_1)\r\n map_not_and = {'~': not_in_nand, '&': and_in_nand_2}... | [
"0.744132",
"0.6313319",
"0.6303102",
"0.624486",
"0.618966",
"0.6178",
"0.61749196",
"0.6122476",
"0.6084992",
"0.60619164",
"0.6059954",
"0.5967823",
"0.59419394",
"0.59201986",
"0.5912208",
"0.58587086",
"0.58543205",
"0.581285",
"0.5809934",
"0.57927495",
"0.57444936",
... | 0.756205 | 0 |
Return factored XOR expression. | def f_xor(*args):
f = Xor(*args).factor()
return f if f in B else f.factor() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xor(a, b):",
"def logical_xor(lhs, rhs):\n return _make.logical_xor(lhs, rhs)",
"def xor(self, *args):\n return Xor(self, *args)",
"def __xor__(self, other):\r\n return self + other - 2 * self * other",
"def bitwise_xor(lhs, rhs):\n return _make.bitwise_xor(lhs, rhs)",
"def __xor_... | [
"0.7347668",
"0.7320897",
"0.7074059",
"0.705857",
"0.7030184",
"0.70107704",
"0.6983589",
"0.69802547",
"0.6948282",
"0.6938849",
"0.691845",
"0.6918182",
"0.6842644",
"0.6584827",
"0.65149814",
"0.6466459",
"0.64596623",
"0.6454875",
"0.64386135",
"0.6411335",
"0.6386134",
... | 0.7596927 | 0 |
Return factored Equal expression. | def f_equal(*args):
f = Equal(*args).factor()
return f if f in B else f.factor() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not (isNumeric(other) or isinstance(other, Expression)):\n raise excep.biogemeError(\n f'This is not a valid expression: {other}'\n )\n return Equal(self, other)",
"def test_evaluate_eq_expression(self):\n value = self.evalua... | [
"0.64993846",
"0.62977135",
"0.6280569",
"0.6125994",
"0.6052821",
"0.59954417",
"0.5935994",
"0.59330344",
"0.5894095",
"0.5775339",
"0.56533134",
"0.56360894",
"0.5609988",
"0.55999637",
"0.5599588",
"0.5599358",
"0.55491364",
"0.55359566",
"0.54632974",
"0.5438657",
"0.542... | 0.6433425 | 1 |
Return factored Implies expression. | def f_implies(p, q):
f = Implies(p, q).factor()
return f if f in B else f.factor() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __build_implies_claim(p: Union[str, Formula], q: Union[str, Formula]) -> str:\r\n if not isinstance(p, str):\r\n p = str(p)\r\n if not isinstance(q, str):\r\n q = str(q)\r\n return FormulaToken.T_LPAREN.value + p + FormulaToken.T_IMPLIES.value + q + FormulaToken.T_RPAREN.value",
"def c... | [
"0.5503145",
"0.54710484",
"0.5414377",
"0.5181429",
"0.5047608",
"0.5047608",
"0.5047608",
"0.5047608",
"0.50441784",
"0.49751234",
"0.49477363",
"0.49404833",
"0.48677582",
"0.4833539",
"0.4833129",
"0.48093265",
"0.4783783",
"0.4771399",
"0.4755154",
"0.47451997",
"0.47129... | 0.60535204 | 0 |
Return the expression arguments as a set. | def arg_set(self):
return frozenset(self._args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argnames(self):\n if self.get_key is None:\n return set()\n return set(self.get_key.names)",
"def add_sets(*args):\n out = set()\n for arg in args:\n for thing in arg:\n out.add(thing)\n return out",
"def get_inputs(self):\n return set()",
"def gener... | [
"0.6592047",
"0.59467465",
"0.58978856",
"0.5826089",
"0.57832193",
"0.57633984",
"0.576187",
"0.5735104",
"0.57286227",
"0.572601",
"0.57041776",
"0.5674664",
"0.56622905",
"0.5654461",
"0.5624057",
"0.56030184",
"0.5563661",
"0.55584985",
"0.554394",
"0.55349946",
"0.552808... | 0.76516306 | 0 |
Return the minterm indices. | def min_indices(self):
return {term.minterm_index for term in self.iter_minterms()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csm_indices(csm):\r\n return csm_properties(csm)[1]",
"def minterms(self):\n return {term for term in self.iter_minterms()}",
"def indices(self):\n _indices = []\n for h in self.miller.indices():\n _indices.append(self.indices_hkl(*h)[0])\n return _indices",
"def... | [
"0.67521006",
"0.6749728",
"0.6553618",
"0.6467163",
"0.64463216",
"0.6422634",
"0.63756764",
"0.63702714",
"0.6366723",
"0.6292146",
"0.62177294",
"0.60309356",
"0.60134804",
"0.60054165",
"0.5987985",
"0.5980607",
"0.5970725",
"0.59659284",
"0.5937036",
"0.59070975",
"0.589... | 0.8107897 | 0 |
Return the maxterm indices. | def max_indices(self):
return {term.maxterm_index for term in self.iter_maxterms()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxterms(self):\n return {term for term in self.iter_maxterms()}",
"def find_max_row_idx(self) -> int:\n return np.argmax([r.free_spots for r in self.rows])",
"def calcMaxIDX(fls, noct):\n freq_l = fls[-1] / (2.0 ** (1 / (2.0 * noct)))\n max_idx = np.array(abs(fls - freq_l)).argmin()\n ... | [
"0.7510647",
"0.6439072",
"0.6402897",
"0.6388593",
"0.6372091",
"0.6313786",
"0.6313786",
"0.6313786",
"0.6246103",
"0.61829925",
"0.6137347",
"0.60862005",
"0.60851663",
"0.60530096",
"0.60490596",
"0.6045112",
"0.6043904",
"0.6017721",
"0.5998949",
"0.5979813",
"0.59256333... | 0.87908155 | 0 |
Solution to the ODE x'(t) = f(t,x,p) with initial condition x(0) = x0 | def g(t, x0, paras):
x = odeint(f, x0, t, args=(paras,))
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve(self, d, t, x0 = None, **kwargs):\n if x0 == None:\n x0 = np.array([0., d])\n #x0 = np.array([self.Om*self.A0/np.sqrt(self.Q**2*(1-self.Om**2)**2 + self.Om**2), d])\n sol = solve_ivp(self.get_ode(d), (t[0], t[-1]), x0, t_eval = t, vectorized = True, **kwargs)\n\n ... | [
"0.72270614",
"0.680277",
"0.6791222",
"0.6732357",
"0.665617",
"0.64487714",
"0.63547033",
"0.62716657",
"0.61901784",
"0.618311",
"0.6123282",
"0.606181",
"0.60610807",
"0.60454464",
"0.6030709",
"0.5927355",
"0.59010226",
"0.5892585",
"0.58741474",
"0.5866117",
"0.58608145... | 0.712407 | 1 |
Constructs a version of 'fn' that applies to smaller batches. | def batchify(fn, chunk):
if chunk is None:
return fn
def ret(inputs, styles, alpha, feature):
results = []
for i in range(0, inputs.shape[0], chunk):
input_chunk = inputs[i:i + chunk]
style_chunk = styles[i:i + chunk]
alpha_chunk = alpha[i:i + chunk] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minibatched_call(fn, mbsize, *args, **kwargs):\n tensor_list, _ = tree_util.tree_flatten((args, kwargs))\n batchsize = tensor_list[0].shape[0]\n mbs = [\n fn(*tree_slice(args, inds), **tree_slice(kwargs, inds))\n for inds in th.arange(batchsize).split(mbsize)\n ]\n return tree_cat(... | [
"0.68100464",
"0.64958173",
"0.61957973",
"0.607114",
"0.5799871",
"0.5749444",
"0.57317525",
"0.57095826",
"0.5580774",
"0.557718",
"0.55540234",
"0.5553517",
"0.55492264",
"0.5467045",
"0.5456915",
"0.5452786",
"0.54423714",
"0.5421315",
"0.5418292",
"0.5408055",
"0.5398568... | 0.68411267 | 0 |
Prepares inputs and applies network 'fn'. | def run_network(inputs, styles, viewdirs, fn, alpha, feature, embed_fn, embeddirs_fn, netchunk=1024 * 64):
inputs_flat = torch.reshape(inputs, [-1, inputs.shape[-1]])
embedded = embed_fn(inputs_flat)
if viewdirs is not None:
input_dirs = viewdirs[:, None].expand(inputs.shape)
input_dirs_flat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_onnx(self, func):\n\n self.visit(func)\n self._add_output(self._node_dict[self.last_node])\n model = self._mc.make_model()\n return run_onnx_optimizer(model)",
"def input_fn(sources, train, params):\n \n raise NotImplementedError",
"def nn_layer_fn(in_dim, out_d... | [
"0.6114822",
"0.6066764",
"0.6051411",
"0.58879024",
"0.578081",
"0.5764906",
"0.57411844",
"0.56862754",
"0.5493504",
"0.54227525",
"0.5406553",
"0.54007185",
"0.5381922",
"0.5376082",
"0.535788",
"0.5350322",
"0.5327639",
"0.5318534",
"0.5318414",
"0.5298242",
"0.5291845",
... | 0.6075945 | 1 |
Get default embedding configuration. | def get_default_embedding_config():
return EmbeddingConfig() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_config() -> Dict[Text, Any]:\n # please make sure to update the docs when changing a default parameter\n return {\n # ## Architecture of the used neural network\n # Hidden layer sizes for layers before the embedding layers for user message\n # and labe... | [
"0.7179934",
"0.66281974",
"0.6496941",
"0.64729774",
"0.64209044",
"0.63767695",
"0.6296511",
"0.6274945",
"0.62699425",
"0.6251885",
"0.6230376",
"0.6224931",
"0.6210615",
"0.61945677",
"0.6151559",
"0.6142973",
"0.6136437",
"0.61231786",
"0.61219054",
"0.61194086",
"0.6024... | 0.92465454 | 0 |
log_file FileClass object csv_file CsvFileClass object | def __init__(self, log_file, csv_file, data_type):
self.logfile = log_file
self.csvfile = csv_file
self.type = data_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exportCSV(self, log, csvFile):\n return 0",
"def __init__(self, csv_file: str = None) -> None:\n super().__init__(csv_file)",
"def __init__(self, csv_file: str = None) -> None:\n super().__init__(csv_file)",
"def __init__(self, trace, directory):\n #Public attributes\n ... | [
"0.701218",
"0.6839152",
"0.6839152",
"0.663113",
"0.6530626",
"0.6493658",
"0.6452021",
"0.63269067",
"0.61743677",
"0.6166322",
"0.6128192",
"0.60985273",
"0.6040689",
"0.6011828",
"0.5991963",
"0.5935673",
"0.5926908",
"0.59202033",
"0.5918784",
"0.59023845",
"0.58860373",... | 0.7676053 | 0 |
Returns whether or not this function's is zero. | def isZero(self):
return (self.p.isZero() & (self.q.isZero() == False)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self):\n return float(self.coeff.nominator) / self.coeff.denominator == 0.0",
"def _iszero(x):\n return getattr(x, 'is_zero', None)",
"def is_zero(self):\n return self._express.is_zero()",
"def is_zero(self) -> bool:\n return self.field.zero == self",
"def is_zero(self):... | [
"0.7959498",
"0.7948897",
"0.7917833",
"0.78993416",
"0.78755593",
"0.7787352",
"0.7749111",
"0.77026546",
"0.7701648",
"0.7634745",
"0.76274806",
"0.7608437",
"0.7552009",
"0.7447371",
"0.74133384",
"0.73432654",
"0.73386484",
"0.7303627",
"0.7295245",
"0.7283645",
"0.727493... | 0.80330807 | 0 |
Uses the PI camera to take a set of images at a user defined interval | def timelapse(int, n, dir, rotation, iso, shutter, exposure):
camera = PiCamera()
camera.rotation = rotation
camera.iso = iso
camera.shutter_speed = shutter
camera.exposure_compensation = exposure
for i in range(n):
print("Capturing image{0:04d} at {1}".format(i, datetime.datetime.now())... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n camera = picamera.PiCamera()\n camera.resolution = (RESOLUTIONX, RESOLUTIONY)\n camera.iso = 800\n time.sleep(2)\n while True:\n camera.capture('current-image.jpg')\n adapt_steering(navigation.get_xposition('current-image.jpg'))\n time.sleep(0.4)",
"def capture_t... | [
"0.7183913",
"0.7083135",
"0.6747905",
"0.6741476",
"0.6635062",
"0.6630902",
"0.6586208",
"0.6505793",
"0.64411974",
"0.6328073",
"0.621935",
"0.62042236",
"0.61928856",
"0.6175229",
"0.6129245",
"0.6099752",
"0.6064317",
"0.6025888",
"0.59803855",
"0.5976255",
"0.5948611",
... | 0.71534765 | 1 |
main method parses command line arguments and runs the timelapse function. | def main():
parser = argparse.ArgumentParser()
parser.add_argument("--interval", "-t", type=int,
help="length of time in seconds between images",
default=60)
parser.add_argument("--images", "-n", type=int, help="number of images", default=1)
parser.add_arg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n #th = TimingHandler()\n\n #saxparser = make_parser()\n\n #saxparser.setContentHandler(th)\n #saxparser.parse(sys.stdin)\n\n\n parseTiming(sys.argv[1])",
"def main():\n data_file = 'shrec_timer.json'\n\n if len(sys.argv) == 2:\n generate_data(data_file, sys.argv[1])\n\n... | [
"0.6347156",
"0.6338518",
"0.6244848",
"0.6240954",
"0.622727",
"0.61305934",
"0.6101429",
"0.60501397",
"0.5991186",
"0.5987657",
"0.5953188",
"0.5947223",
"0.5901046",
"0.5870938",
"0.5865334",
"0.5851369",
"0.58257043",
"0.5823339",
"0.5771016",
"0.5740938",
"0.57111144",
... | 0.66640913 | 0 |
Get a collection with current mtgjson data. | def build_collection(data_path, include_online_only):
mtgjson.fetch_mtgjson(data_path)
print('Reading mtgjson data.')
mtgjsondata = mtgjson.read_mtgjson(data_path)
return collection.Collection(
mtgjsondata, include_online_only=include_online_only) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_collection(self) -> Any:\n return self.anki.Collection(self.db_location, log=True)",
"def collection(self):\n return self._collection",
"def collection(collection_id):\n\tcollection = models.Collection.query.get(collection_id)\n\tif not collection:\n\t\tabort(404)\n\treturn jsonify(colle... | [
"0.692255",
"0.6764781",
"0.6633865",
"0.66204077",
"0.65857047",
"0.6519674",
"0.6511806",
"0.6480024",
"0.6476107",
"0.6459133",
"0.6335465",
"0.62615633",
"0.6203542",
"0.61701983",
"0.6163128",
"0.6147961",
"0.6126997",
"0.6118164",
"0.60916036",
"0.6081088",
"0.6070931",... | 0.7596141 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.