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 |
|---|---|---|---|---|---|---|
Test setting the away mode off/false. | async def test_set_away_mode_off(opp):
await common.async_set_away_mode(opp, False, ENTITY_WATER_HEATER_CELSIUS)
state = opp.states.get(ENTITY_WATER_HEATER_CELSIUS)
assert state.attributes.get("away_mode") == "off" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_set_away_mode_on(opp):\n await common.async_set_away_mode(opp, True, ENTITY_WATER_HEATER)\n state = opp.states.get(ENTITY_WATER_HEATER)\n assert state.attributes.get(\"away_mode\") == \"on\"",
"def turn_away_mode_off(self):\n self._away = 0\n self._api._awaymode = self.away\... | [
"0.7333799",
"0.721697",
"0.69039184",
"0.67879134",
"0.67871475",
"0.6761423",
"0.67269874",
"0.66250473",
"0.6546024",
"0.6375222",
"0.63553953",
"0.6330588",
"0.62832606",
"0.6265553",
"0.6236148",
"0.6234184",
"0.623073",
"0.62036973",
"0.6197417",
"0.6178961",
"0.6157971... | 0.7992974 | 0 |
Check timeout on all responses. (Internal) | def run(self):
for req, resp in self.servings:
resp.check_timeout() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkTimeout(self):\n if TIMEOUT <= (datetime.now() - self.clockCheckStop).total_seconds():\n print('Didn\\'t received messages for 1 minute - Program ends')\n exit(0)",
"async def check_timeout(self) -> None:\n async with self.lock:\n # Looping through the keys... | [
"0.7058286",
"0.7047105",
"0.6976976",
"0.6956466",
"0.6903624",
"0.6869933",
"0.67265135",
"0.67265135",
"0.66661",
"0.65805197",
"0.6533125",
"0.652901",
"0.6524272",
"0.6524272",
"0.65208507",
"0.6500781",
"0.64605254",
"0.6445319",
"0.64041847",
"0.63812697",
"0.6341507",... | 0.7151977 | 0 |
Mount the given root, start the builtin server (and engine), then block. | def quickstart(root=None, script_name="", config=None):
if config:
_global_conf_alias.update(config)
tree.mount(root, script_name, config)
engine.signals.subscribe()
engine.start()
engine.block() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_cherrypy(server, cp_root_config, host, port):\n LOGGER.debug(\"Starting BibleMunger's CherryPy HTTP server\")\n cherrypy.config.update({\n 'server.socket_host': host,\n 'server.socket_port': port,\n })\n cherrypy.tree.mount(server, '/', cp_root_config)\n cherrypy.engine.signa... | [
"0.62113804",
"0.5996418",
"0.59840506",
"0.58499175",
"0.5848936",
"0.577345",
"0.5736323",
"0.5716487",
"0.56979954",
"0.56430525",
"0.56052136",
"0.5594576",
"0.5594576",
"0.5591513",
"0.55816275",
"0.5576859",
"0.5571833",
"0.5566873",
"0.55232877",
"0.55101705",
"0.54842... | 0.6634261 | 0 |
Log an access message to the app.log or global log as appropriate. | def access(self):
try:
return request.app.log.access()
except AttributeError:
return _cplogging.LogManager.access(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access(self, resp, req, environ, request_time):\n if not (self.cfg.accesslog or self.cfg.logconfig or self.cfg.syslog):\n return\n\n msg = self.make_access_message(resp, req, environ, request_time)\n try:\n self.access_log.info(msg)\n except:\n self.... | [
"0.7185651",
"0.6523197",
"0.64772236",
"0.64573336",
"0.6434097",
"0.6287813",
"0.6273701",
"0.6230247",
"0.60883826",
"0.60856247",
"0.608382",
"0.6074772",
"0.60715365",
"0.60612786",
"0.6053758",
"0.60466224",
"0.6027029",
"0.6008827",
"0.6003419",
"0.5962097",
"0.5894058... | 0.664811 | 1 |
Expose the function, optionally providing an alias or set of aliases. | def expose(func=None, alias=None):
def expose_(func):
func.exposed = True
if alias is not None:
if isinstance(alias, basestring):
parents[alias.replace(".", "_")] = func
else:
for a in alias:
parents[a.replace(".", "_")] = f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expose(func=None, alias=None):\n def expose_(func):\n func.exposed = True\n return func\n\n return expose_",
"def alias(command_name):\n def decorator(func):\n func.alias = command_name\n return func\n return decorator",
"def get_alias_output(function_name: Optional[... | [
"0.7673283",
"0.7128352",
"0.6637989",
"0.6424419",
"0.6424419",
"0.6424419",
"0.6361283",
"0.6340898",
"0.6146636",
"0.6117641",
"0.60302657",
"0.6021969",
"0.60218155",
"0.5970032",
"0.5950877",
"0.5935909",
"0.5916922",
"0.5893474",
"0.5874196",
"0.5868669",
"0.58553696",
... | 0.7323877 | 1 |
Create an absolute URL for the given path. If 'path' starts with a slash ('/'), this will return (base + script_name + path + qs). If it does not start with a slash, this returns (base + script_name [+ request.path_info] + path + qs). If script_name is None, cherrypy.request will be used to find a script_name, if avail... | def url(path="", qs="", script_name=None, base=None, relative=None):
if isinstance(qs, (tuple, list, dict)):
qs = _urlencode(qs)
if qs:
qs = '?' + qs
if request.app:
if not path.startswith("/"):
# Append/remove trailing slash from path_info as needed
# (this ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_uri(relative_path=''):\n base_path = get_app_root()\n if not os.path.exists(base_path):\n raise ValueError('Path %s does not exist' % base_path)\n\n return 'file://%s' % os.path.join(base_path, relative_path)",
"def build_absolute_url(self, path_or_url):\n return urllib.parse.urlj... | [
"0.6238953",
"0.618595",
"0.610934",
"0.6081608",
"0.60263693",
"0.60063034",
"0.59969616",
"0.5966333",
"0.5895924",
"0.58950174",
"0.58721554",
"0.5836391",
"0.58252335",
"0.5688763",
"0.56713015",
"0.5667372",
"0.56341165",
"0.5604614",
"0.5574834",
"0.5554429",
"0.5540535... | 0.7533173 | 0 |
Get the status from the rsync thread and put it in the progress file | def status(self):
status = self.thread.status()
# print_array(status)
message = ["------ RSYNC PROGRESS ------ "]
if self.log_message:
message.append(self.log_message)
message.append("Current file: %s" % status['current_file'])
message.append("\tBytes Copied: %s" % status['bytes_copied'])
message.append... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transfer_progress(self, stats):",
"def invoke_rsync(self):\n completed_process = subprocess.run(self.rsync_command,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n logging.debug(completed_process)\n ... | [
"0.6777564",
"0.6394757",
"0.61871463",
"0.609681",
"0.6096022",
"0.6055591",
"0.60302174",
"0.5995028",
"0.5973515",
"0.59674454",
"0.59263337",
"0.59085476",
"0.59085476",
"0.5875658",
"0.5855492",
"0.58342963",
"0.58338475",
"0.5822388",
"0.58222246",
"0.58195615",
"0.5804... | 0.8530146 | 0 |
Returns true if track labels have already been assigned to a given frame | def labels_exist(self, frame_num):
return self._frame_labels[frame_num] is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_label(self, label):\n return label in self.get_labels()",
"def has_label(self, label):\n\t\treturn label in self.labels",
"def has_label(self, label):\n\t\t\treturn label in self.labels",
"def has_label(self, label):\n return label == self.label",
"def has_label(self, label):\n ret... | [
"0.6462645",
"0.64227855",
"0.6422614",
"0.6338353",
"0.62672585",
"0.61824983",
"0.60186857",
"0.5974276",
"0.5969538",
"0.58716065",
"0.58103716",
"0.57967025",
"0.5790005",
"0.5789058",
"0.5760368",
"0.5760037",
"0.5759478",
"0.5759478",
"0.5738486",
"0.5736193",
"0.571848... | 0.69120014 | 0 |
Returns 3 dicts. The first contains final list of track as a dict with keys being the frame numbers and values being tensors containing the track ID for each foreground pixel. Note that this is just a flattened list of labels and not the final masks. The second dict contains the number of pixels belonging to each track... | def get_track_mask_idxes(self):
instance_id_num_pts = defaultdict(lambda: 0)
instance_id_lifetimes = defaultdict(lambda: [10000, -1])
for frame_num, labels_per_frame in enumerate(self._frame_labels):
for id in labels_per_frame.unique().tolist():
instance_id_num_pts[i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def computeTrackmap(imagelist):\n tracks = {}\n for i in imagelist:\n for t in i._tracks:\n if not tracks.has_key(t):\n tracks[ t ] = []\n tracks[ t ].append(i)\n return tracks",
"def get_cstr_for_video(\n video_name,\n path_info='/sequoia/data2/... | [
"0.6047102",
"0.56389713",
"0.5587176",
"0.53966856",
"0.53693813",
"0.53398895",
"0.5310672",
"0.5262479",
"0.5234222",
"0.52311134",
"0.5161346",
"0.5151894",
"0.5128668",
"0.5123341",
"0.5115165",
"0.51096714",
"0.5103857",
"0.50867206",
"0.5045372",
"0.5042487",
"0.504056... | 0.6396873 | 0 |
Performs clustering within a subsequence | def cluster_subsequence(self, mask_idxes, embeddings, bandwidths, seediness, label_start, return_fg_embeddings):
assert len(mask_idxes) == embeddings.shape[1]
# extract foreground embeddings
embeddings = embeddings.permute(1, 2, 3, 0).unbind(0) # list(T, tensor(H, W, E))
bandwidths = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self,\n seq_fasta_fn,\n subst_matrix_fn,\n cost_gap_open,\n clustering):",
"def test_first_sequence_placed_in_first_cluster(self):\n seq_len = 20\n num_seqs = 20\n bases = list(standard_bases)\n # Function has different behaviour at ... | [
"0.64124066",
"0.6250099",
"0.6202888",
"0.6154626",
"0.5908853",
"0.58887273",
"0.58326495",
"0.5812277",
"0.57981443",
"0.57825345",
"0.5729109",
"0.57207227",
"0.5707352",
"0.569779",
"0.5696792",
"0.5693362",
"0.5686149",
"0.56815404",
"0.567314",
"0.5648872",
"0.5640961"... | 0.6534881 | 0 |
Associates clusters and resolves inconsistencies for a pair of labels for a given frame. | def associate_clusters(self, labels_1, labels_2):
if not torch.is_tensor(labels_1):
labels_1 = torch.cat(labels_1).cuda()
if not torch.is_tensor(labels_2):
labels_2 = torch.cat(labels_2).cuda()
assert labels_1.shape == labels_2.shape, "Shape mismatch: {}, {}".format(lab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_in_strain(labels_first, labels_second):\n count_data = {}\n labels_first = np.asarray(labels_first)\n labels_second = np.asarray(labels_second)\n for label_2 in np.unique(labels_second):\n label_2_index = labels_second == label_2\n label_1_sub = labels_first[label_2_index]\n ... | [
"0.5888262",
"0.5430708",
"0.5366825",
"0.53241193",
"0.5261441",
"0.5216448",
"0.5203264",
"0.5197972",
"0.5193561",
"0.5150947",
"0.5047554",
"0.50402206",
"0.5018021",
"0.50129044",
"0.4987262",
"0.49855828",
"0.4972752",
"0.49726838",
"0.49714983",
"0.4958701",
"0.4948464... | 0.6399165 | 0 |
Convert MariaDB dynamic columns data in a byte string into a dict | def unpack(buf: bytes) -> dict[str, Any]:
flags: int
column_count: int
len_names: int
flags, column_count, len_names = struct_unpack_from("<BHH", buf)
data_offset_code, coldata_size, data_offset_mask = decode_data_size(flags)
if (flags & 0xFC) != 4:
raise DynColValueError("Unknown dynami... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mmtf_bytes_to_mmtf_dict(bytestring):\n\n raw = msgpack.unpackb(bytestring)\n return decode_dict(raw)",
"def rawtodictonary(rawstring):\n\n if is_python3():\n rawstring = bytes(rawstring).decode('utf-8') \n \n raw = rawstring.split(NULL)[:-2]\n\n data = {}\n for i in range(0,len(r... | [
"0.6225917",
"0.60612905",
"0.5960494",
"0.59214944",
"0.5856121",
"0.57844216",
"0.57782954",
"0.571592",
"0.5661566",
"0.5632245",
"0.55446476",
"0.551958",
"0.5484435",
"0.54693854",
"0.54421115",
"0.5412926",
"0.5399616",
"0.53867096",
"0.5329256",
"0.52692723",
"0.525615... | 0.65447694 | 0 |
Creates name/player num/batting averages lists for an example team. | def build_player_data():
names = ["Gunther O'Brian",
'Workman Gloom',
'Esme Ramsey',
'Cornelius Games',
'Kline Greenlemon',
'Hotbox Sato',
'Famous Owens',
'Jenkins Good']
nums = [77, 31, 37, 6, 14, 53, 7, 64]
avgs = [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStats(population, masterList):\n for team in population:\n for i in range(13): #13 are the number of roster spots?\n team.totHr += masterList[team.roster[i]].hr\n team.totAvg += masterList[team.roster[i]].avg\n team.totRuns += masterList[team.roster[i]].runs\n ... | [
"0.6307435",
"0.61158663",
"0.5994403",
"0.5912429",
"0.5905684",
"0.58455443",
"0.58227724",
"0.57905746",
"0.57655394",
"0.5711466",
"0.5707383",
"0.5696947",
"0.56850535",
"0.56670207",
"0.56519645",
"0.5632154",
"0.56263906",
"0.5602424",
"0.55969036",
"0.55899966",
"0.55... | 0.64472055 | 0 |
prints batting averages for the example team | def print_avg(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PM_averages(self,num):\n self.write(self.headStr('PM')+'AVG %d'%num)",
"def showAverageStats(self) :\n Scenario.messageAverageStats()\n self.showAverageGainWon()\n self.showAverageBetUsed()\n self.showAverageNbAttemptsByLevels()",
"def display_hall_of_fame(self) -> None:\... | [
"0.6329005",
"0.6317431",
"0.6299118",
"0.6253293",
"0.62418795",
"0.6199458",
"0.6118419",
"0.6117253",
"0.6104908",
"0.60712403",
"0.6058508",
"0.6018945",
"0.5972491",
"0.5965435",
"0.5953858",
"0.59346896",
"0.59285134",
"0.5892162",
"0.58633775",
"0.585565",
"0.58317703"... | 0.74231094 | 0 |
Gets the relevant data from the page | def page_data():
return scrape() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(self):",
"def get_data_from_web():\n pass",
"def get_data():\n pass",
"def _get_new_data(self, page_url, soup):\n data = {}\n data['url'] = page_url\n title = soup.find('dd', class_='lemmaWgt-lemmaTitle-title').find('h1')\n data['title'] = title.get_text()\n... | [
"0.6730114",
"0.6618766",
"0.6600513",
"0.6547922",
"0.65046227",
"0.6493531",
"0.6475723",
"0.6469656",
"0.64514273",
"0.6447151",
"0.6422951",
"0.6407426",
"0.6378092",
"0.63685703",
"0.6319855",
"0.63064635",
"0.6302634",
"0.6302634",
"0.62835723",
"0.6277931",
"0.6271495"... | 0.7586842 | 0 |
Display popup dialog box to confirm game exit | def exitConfirm():
confirm = showDialogBox('Exit the game now?', 'question', 'yesno', 'no')
if confirm == 'yes':
raise SystemExit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onExit(self, event):\r\n\t\tdlg = wx.MessageDialog(self, \"Are you sure you wish to exit?\",\r\n\t\t\t\t\t\t\t\"Confirm Exit\", wx.CANCEL|wx.OK|wx.ICON_QUESTION)\r\n\t\tresult = dlg.ShowModal()\r\n\t\tdlg.Destroy()\r\n\t\tif result == wx.ID_OK: sys.exit()",
"def leave(self):\n p = GameOverPopup(self)\... | [
"0.76142627",
"0.7329652",
"0.69724643",
"0.6886522",
"0.68566287",
"0.6802856",
"0.6779717",
"0.67677563",
"0.6766365",
"0.6754058",
"0.67408264",
"0.67349386",
"0.67311794",
"0.67250013",
"0.67158383",
"0.67048454",
"0.66943",
"0.6679825",
"0.6664499",
"0.66626614",
"0.6630... | 0.805535 | 0 |
(Players) > NoneType Update title of the widget to display current player's turn | def updateWidget(self):
if self.frame1.state() == 'normal':
self.frame2.deiconify()
self.frame1.withdraw()
else:
self.frame2.withdraw()
self.frame2.update()
self.frame2.deiconify()
self.frame1.title("%s's turn" % self.usernames[1])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_turn_text(self):\n if self.turn_display_timer > 0:\n self.turn_display_timer -= 1\n if self.turn_display_timer > 0:\n fill(1, 0, 0)\n textSize(self.WINDOW_SIZE//20)\n textAlign(CENTER)\n if self.player_turn is True... | [
"0.7002769",
"0.65161884",
"0.63520014",
"0.6310842",
"0.6283611",
"0.6257139",
"0.6219182",
"0.6207914",
"0.620026",
"0.6124011",
"0.60627913",
"0.60494995",
"0.6037499",
"0.60145146",
"0.6012637",
"0.6004304",
"0.59991753",
"0.5988134",
"0.5971973",
"0.5967771",
"0.59676695... | 0.651695 | 1 |
(Players) > NoneType Switch turns between the two players Switch between widgets belonging to the respective players | def switchTurn(self):
# Widget for player 1
if self.frame1.state() == 'normal':
self.frame2.deiconify()
self.frame1.withdraw()
self.frame1.update()
self.frame2.update()
if self.message[0]:
showDialogBox(self.message[0]) # anno... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switchPlayer(self):\n\n \n tmp = self.current\n self.current = self.other\n self.other = tmp\n\n self.topSelector.toggleActive()\n self.bottomSelector.toggleActive()",
"def switch_player(self):\n if self.playerOne:\n # sets the chip color to blue\n ... | [
"0.7426509",
"0.6998824",
"0.6808672",
"0.6744094",
"0.63660485",
"0.6339389",
"0.62118816",
"0.6183109",
"0.6131109",
"0.6131109",
"0.6129296",
"0.61174875",
"0.60700214",
"0.59835243",
"0.5968046",
"0.59500325",
"0.59343904",
"0.59280646",
"0.5894448",
"0.58891624",
"0.5836... | 0.7315319 | 1 |
(Board) > NoneType Randomly place each ship on the board in 20 attempts Announce failures in placing ships to the user | def placeShips(self):
self.ships = [] # Canvas co-ordinates for the ships
self.shipText = [] # Text to be displayed besides each ship
self.failedAttempts = []
self.names = {2: 'BOAT', 3: 'SUB', 4: 'CRUISER', 5: 'CARRIER'}
items = self.shipList.items()
for k, v in item... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_ships(self):\n # An array that holds the ships to then be looped through\n length_of_ships = [6, 4, 3, 2]\n\n for ship_length in length_of_ships:\n while True:\n if self.user == 'computer':\n orientation = random.choice(['H', 'V'])\n ... | [
"0.77851987",
"0.71791416",
"0.692289",
"0.6760538",
"0.6685494",
"0.6635419",
"0.6634116",
"0.66018915",
"0.6573452",
"0.65290695",
"0.64881796",
"0.64754516",
"0.64248055",
"0.6380921",
"0.63760126",
"0.6361738",
"0.63463557",
"0.6336883",
"0.6308116",
"0.6266603",
"0.62579... | 0.7395961 | 1 |
(Board, event) > NoneType Bomb the location that user clicked on | def fire(self, event):
# Unbind left-click to prevent user from bombing
# multiple locations at once
self.canvas.tag_unbind('square', '<Button-1>')
self.canvas.update()
# Get co-ordinates of the square that was clicked
n = self.canvas.find_closest(event.x, event.y)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bomb(self, index):\n\n coords = self.canvas.coords(self.squares[index])\n x, y = coords[0] + 10, coords[1] + 10\n tag = self.hit[index]\n\n # Count moves for player (used for scoring)\n if self.players.winCondition == 1:\n self.players.moves[self.playerNumber][0] +... | [
"0.6646679",
"0.6438571",
"0.63480586",
"0.6284458",
"0.6263875",
"0.61304384",
"0.609052",
"0.6035234",
"0.60325086",
"0.602507",
"0.6016339",
"0.5970993",
"0.59499353",
"0.59125906",
"0.59030676",
"0.59016794",
"0.5841434",
"0.58179694",
"0.5795095",
"0.5780501",
"0.5770864... | 0.6606424 | 1 |
(Board, int) > NoneType Bomb the square on the board at location index Display visually if the location is a hit, sink or a miss | def bomb(self, index):
coords = self.canvas.coords(self.squares[index])
x, y = coords[0] + 10, coords[1] + 10
tag = self.hit[index]
# Count moves for player (used for scoring)
if self.players.winCondition == 1:
self.players.moves[self.playerNumber][0] += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _board_detail(self, i, j, player=None):\n if self.board[i][j] is not None:\n return self.board[i][j]\n else:\n return ' '",
"def open_tile(self, y, x):\n # Find the letter index and convert into a y-coordinate.\n # Checks if it is a mine\n if [y, x] in... | [
"0.6560357",
"0.6459542",
"0.6036888",
"0.6023518",
"0.59488803",
"0.59221",
"0.58814245",
"0.5858179",
"0.58324164",
"0.5821298",
"0.58056515",
"0.5783976",
"0.57837015",
"0.57567793",
"0.5751314",
"0.57417196",
"0.57401717",
"0.57344073",
"0.57321626",
"0.5721358",
"0.57197... | 0.74928945 | 0 |
Add a signal handler for a given signal | def add_signal_handler(self, signal: str, handler: SignalType) -> None:
self.signals[signal].append(handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_signal_handler():\n signal.signal(signal.SIGUSR1, sig_handler)\n signal.signal(signal.SIGTERM, term_handler)\n #logger.warning(\"Signal handler installed.\")",
"def signal(sig, action): # real signature unknown; restored from __doc__\n pass",
"def add_signal(self, signal_type, signal):\n\n... | [
"0.7463304",
"0.6929054",
"0.68717974",
"0.6861777",
"0.68480754",
"0.6819123",
"0.67900306",
"0.6741492",
"0.67177755",
"0.6694262",
"0.66740245",
"0.66523397",
"0.6566147",
"0.65374196",
"0.65315366",
"0.64460534",
"0.64369327",
"0.64045984",
"0.63855124",
"0.6362513",
"0.6... | 0.82271916 | 0 |
Remove a signal handler for a given signal | def remove_signal_handler(self, signal: str, handler: SignalType) -> None:
self.signals[signal].remove(handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect(signal, handler=None):\n if signal not in REGISTRY:\n return\n if handler:\n REGISTRY[signal].disconnect(handler)\n return\n REGISTRY[signal].registry.clear()\n del REGISTRY[signal]",
"def remove_handler(self, handler):\n pass",
"def unhandle(self, handler... | [
"0.7518128",
"0.73878825",
"0.733965",
"0.7093696",
"0.7082112",
"0.7016719",
"0.6983593",
"0.6968562",
"0.69220537",
"0.67706484",
"0.677042",
"0.6749921",
"0.6749921",
"0.674355",
"0.671034",
"0.66765815",
"0.65682906",
"0.65674055",
"0.65650666",
"0.65581524",
"0.65396845"... | 0.8691496 | 0 |
Trigger the ready signal | def trigger_ready(self) -> None:
self.trigger_signal("ready") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_trigger_ready(self) -> None:\n await self.async_trigger_signal(\"ready\")",
"def _ready(cls):\n sync_call(cls.ready)",
"def signal_ready(self):\n self.logger.debug(\"service is ready\")",
"def set_ready(self, ready):\n\n if ready != self.ready:\n self.re... | [
"0.8025426",
"0.7645126",
"0.7626614",
"0.74764514",
"0.729565",
"0.7278469",
"0.7272239",
"0.71919453",
"0.7183721",
"0.71314156",
"0.7097618",
"0.7070732",
"0.7034649",
"0.7022209",
"0.7019923",
"0.70172924",
"0.70098567",
"0.7004107",
"0.69810987",
"0.6939787",
"0.69081724... | 0.906193 | 0 |
Trigger the reloading signal | def trigger_reloading(self) -> None:
self.trigger_signal("reloading") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload(self):",
"def reload(self):",
"async def async_trigger_reloading(self) -> None:\n await self.async_trigger_signal(\"reloading\")",
"def reload(self):\n\n pass",
"def handleReload(self, confInfo=None):",
"def reloadfile(self, ):\n self.loadfile()",
"def onReload(self, eve... | [
"0.7571994",
"0.7571994",
"0.7530184",
"0.7265492",
"0.7066332",
"0.6972975",
"0.69430655",
"0.6931121",
"0.6902578",
"0.6864657",
"0.68005574",
"0.6678387",
"0.66441363",
"0.6629255",
"0.65927565",
"0.65846795",
"0.65178376",
"0.649942",
"0.6400243",
"0.6395761",
"0.63782394... | 0.8661393 | 0 |
Trigger the stopping signal | def trigger_stopping(self) -> None:
self.trigger_signal("stopping") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trigger_stop(self):\n self.terminate = True\n self.stop_event.set()",
"def stop(self):\n self._stop_event.set()",
"def stop(self):\n self._stop_signal = True",
"async def async_trigger_stopping(self) -> None:\n await self.async_trigger_signal(\"stopping\")",
"def stop(sel... | [
"0.83172107",
"0.7786065",
"0.77781236",
"0.7761774",
"0.76054394",
"0.76054394",
"0.7582804",
"0.7582804",
"0.7535837",
"0.7515825",
"0.7493608",
"0.74792635",
"0.7423843",
"0.7423843",
"0.7423843",
"0.7423843",
"0.73963726",
"0.73890865",
"0.73866063",
"0.73866063",
"0.7358... | 0.8796747 | 0 |
Asynchronously trigger a signal | async def async_trigger_signal(self, signal: str, call_non_async: bool = True) -> None:
logger.debug("Triggered async Signal %s", signal)
for handler in self.signals[signal]:
if iscoroutinefunction(handler):
await handler(self, signal)
elif call_non_async:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_trigger_ready(self) -> None:\n await self.async_trigger_signal(\"ready\")",
"def signal(self):\n pass",
"def signal(self):\n self.mainloop().signal()",
"def wait(self, signal):\n while True:\n s = self.receive()\n if s == signal:\n ... | [
"0.65525323",
"0.63653135",
"0.62964845",
"0.6249843",
"0.6248277",
"0.609612",
"0.6083517",
"0.5988911",
"0.59010714",
"0.5864339",
"0.5805615",
"0.57938665",
"0.57897955",
"0.5769629",
"0.5765342",
"0.56968933",
"0.5655166",
"0.5621324",
"0.5615974",
"0.56096613",
"0.560776... | 0.7176681 | 0 |
Asynchronously trigger ready signal | async def async_trigger_ready(self) -> None:
await self.async_trigger_signal("ready") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trigger_ready(self) -> None:\n self.trigger_signal(\"ready\")",
"async def wait_until_ready(self):\n await self._ready.wait()",
"def _ready(cls):\n sync_call(cls.ready)",
"async def wait_until_ready(self) -> None:\n await self._ready.wait()",
"def wait_until_ready(self):\n ... | [
"0.7957024",
"0.76273876",
"0.75980026",
"0.7584667",
"0.73376846",
"0.73272824",
"0.71455956",
"0.7090845",
"0.6984995",
"0.6972566",
"0.6957092",
"0.694639",
"0.68779695",
"0.6805574",
"0.6723002",
"0.6695403",
"0.6651755",
"0.66165686",
"0.66163814",
"0.6561962",
"0.655465... | 0.8690879 | 0 |
Asynchronously trigger reloading signal | async def async_trigger_reloading(self) -> None:
await self.async_trigger_signal("reloading") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trigger_reloading(self) -> None:\n self.trigger_signal(\"reloading\")",
"def __work__(self):\n while not self.is_done:\n self.refreshSignal.emit()\n time.sleep(0.05)",
"def receive_reload_request(self, _: EmptyMsg):\n self.update()",
"async def on_reload(name: s... | [
"0.77258253",
"0.68277395",
"0.65592974",
"0.6540588",
"0.6480827",
"0.6469871",
"0.64691025",
"0.64691025",
"0.63705677",
"0.6348815",
"0.6345243",
"0.6345243",
"0.6331519",
"0.6307918",
"0.62133044",
"0.61762387",
"0.6157899",
"0.61375374",
"0.61370605",
"0.6109216",
"0.608... | 0.8389388 | 0 |
Asynchronously trigger stopping signal | async def async_trigger_stopping(self) -> None:
await self.async_trigger_signal("stopping") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def stop(self):",
"async def stop_signal():\n global user_exit\n user_exit = True\n await cancel_async_tasks()",
"async def _stop(self) -> None:\n self._stopped.set()",
"async def _stop(self):\n return",
"async def stop(self):\n self._stopped.set()",
"def _async_stop(s... | [
"0.7618304",
"0.7535549",
"0.7479075",
"0.7390178",
"0.73786783",
"0.7311615",
"0.72304475",
"0.7133008",
"0.7077584",
"0.70226985",
"0.69951266",
"0.6995009",
"0.6995009",
"0.69884837",
"0.6905019",
"0.6893961",
"0.6875865",
"0.68426615",
"0.6798531",
"0.6798531",
"0.6798531... | 0.8404765 | 0 |
Return a subconfig This is used if a unit wants to spawns multiple processes, or turns over the execution into an async event loop | def subconfig(self) -> "Config":
config = Config()
config.func = self.func
config.targets = self.targets.copy()
config.blacklisted_targets = self.blacklisted_targets.copy()
config.variables = self.variables.copy()
config.unit_iterator = self.unit_iterator.copy()
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subconfig(self, subsection):\n if config.is_config(self.config):\n raise PluginFeatureError(\"subconfig() incompatible with plugin.Config, \"\n \"use config.option_map()\")\n section = self.plugin_name() + '/' + subsection\n if section not in ... | [
"0.60988027",
"0.60472995",
"0.59924436",
"0.5848383",
"0.5754003",
"0.5652345",
"0.56391656",
"0.561206",
"0.5585556",
"0.55465674",
"0.5543928",
"0.55178064",
"0.5506117",
"0.5506117",
"0.55029464",
"0.54643583",
"0.5461314",
"0.5458342",
"0.5458342",
"0.5458342",
"0.545834... | 0.7124728 | 0 |
Add a couple of targets | def add_targets(self, targets: List["ConfigUnit"]) -> None:
for target in targets:
self.add_target(target) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_for_targets(self, targets, products):\n # FIXME: This is a temporary helper for use until the classpath has been split.\n for target in targets:\n self.add_for_target(target, products)",
"def addTargets(self, **kwargs):\n self.targets.update(kwargs)\n for key, val in kwargs.items():\n ... | [
"0.75258464",
"0.74412984",
"0.67919725",
"0.67026454",
"0.66502565",
"0.64302343",
"0.63414145",
"0.620095",
"0.59678",
"0.5941169",
"0.5926424",
"0.5833991",
"0.5790687",
"0.5789335",
"0.5789186",
"0.5767488",
"0.57362753",
"0.57196784",
"0.57172567",
"0.5712924",
"0.570663... | 0.7605349 | 0 |
Get a config object with a preset of values from a module | def get_from_module(cls, module: ModuleType) -> "Config":
config = Config()
config.load_from_module(module)
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_module_config(name):\n return _CONFIGS[name]",
"def get_config(\n config_module: str, config_name: str, overrides: List[str] = []\n) -> PipelineConfig:\n _ensure_hydra_initialized(config_module)\n config = compose(config_name=config_name, overrides=overrides)\n return config # type: ignor... | [
"0.6761987",
"0.64763343",
"0.6444306",
"0.6280169",
"0.6217964",
"0.60760456",
"0.6073496",
"0.60730475",
"0.6055335",
"0.6041652",
"0.6026207",
"0.60070944",
"0.6006351",
"0.6006167",
"0.5896163",
"0.5896163",
"0.58649266",
"0.5849656",
"0.5849656",
"0.58370876",
"0.5822898... | 0.68166244 | 0 |
Sets the current config variable | def set_config(config: Config):
CurrentConfig.set(config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setConfig(self,config):\n if config:\n self.config = config\n else:\n from layman import config\n self.config = config",
"def set(name):\n set_config(name)",
"def config(self, config):\n self._config = config",
"def set_config(self, attr, value):... | [
"0.73220515",
"0.717356",
"0.70822525",
"0.70399904",
"0.70399904",
"0.7011923",
"0.67849416",
"0.66773766",
"0.6659831",
"0.65874934",
"0.65869415",
"0.65798306",
"0.652901",
"0.6460033",
"0.6352335",
"0.63502425",
"0.632236",
"0.63159484",
"0.62957823",
"0.62849516",
"0.623... | 0.74602777 | 0 |
Returns a list of items If param is a list returns param, if param is None returns empty list otherwise return a list containing param. | def _param_to_list(param: OptionalConfigUnitList) -> List["ConfigUnit"]:
if param is None:
return []
if isinstance(param, list):
return param.copy()
return [param] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_helper(self, param):\n if param.name == 'list':\n address = param.address\n else:\n address = self.get_value(\n param.address, param.type_, param.is_global)\n return self.list_table[address]",
"def get_subparams_list(param_name = None):\n ... | [
"0.66779256",
"0.6531761",
"0.6481148",
"0.6286537",
"0.6194483",
"0.61740565",
"0.6156124",
"0.6154225",
"0.6076655",
"0.6076655",
"0.6016638",
"0.60031086",
"0.59561324",
"0.59488076",
"0.5926385",
"0.59183264",
"0.5917936",
"0.5917832",
"0.59167904",
"0.5913159",
"0.591087... | 0.7490679 | 0 |
Add a config unit to the global list of config units | def add_unit(cls, unit: "ConfigUnit", path: str) -> None:
if path in cls.units:
raise Exception("Can't overwrite config unit {}".format(path))
cls.units[path] = unit
for listener in cls.listener:
listener.add_target(unit, force=False)
for container in unit.belon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_unit(number_of_units=1):\n zaza.model.add_unit(\n \"ovn-central\",\n count=number_of_units,\n wait_appear=True\n )\n zaza.model.wait_for_application_states()",
"def addconfiguration(self, name, q, unit='rad'):\n v = getvector(q, self.n)\n ... | [
"0.62909514",
"0.62766176",
"0.5906996",
"0.580822",
"0.5765161",
"0.57047325",
"0.56498396",
"0.56426114",
"0.5507572",
"0.54749453",
"0.54564583",
"0.54489315",
"0.53271854",
"0.52905995",
"0.5268504",
"0.52679884",
"0.5252192",
"0.52068555",
"0.5104467",
"0.5103326",
"0.50... | 0.7123583 | 0 |
Add a listener to track for new config units This is used in case an import leads to new units. If you initiated a config than this config will add a listener here. Because the listeneres `add_target` method will be called with `force=False`. Units will just be added if they are already implicitly selected. | def add_listener(cls, listener: ConfigUnitListener) -> None:
cls.listener.append(listener) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_target(self, target: \"ConfigUnit\", force: bool = True) -> None:\n raise NotImplementedError()",
"def added(self, configuration):\n log.debug('ConfigListener: configuration %s added' % configuration)",
"def pre_configure_target(name):\n ListenerManager.call(_target_pre_configure_m... | [
"0.62391466",
"0.5685482",
"0.56807923",
"0.563405",
"0.55722517",
"0.5544438",
"0.5483096",
"0.54174834",
"0.5350144",
"0.53082293",
"0.5286893",
"0.5259616",
"0.51942605",
"0.51904094",
"0.51435626",
"0.51106787",
"0.505528",
"0.5054847",
"0.5011461",
"0.49943042",
"0.49943... | 0.6901531 | 0 |
Asynchronously initializes all targets This function will not run aynthing like `async_run` but rather, as a context manager, enable the user to execute whatever she wants. | async def async_init(
config: Optional[Config] = None,
targets: Optional[List[ConfigUnit]] = None
) -> AsyncGenerator[Config, None]:
# pylint: disable=import-outside-toplevel
from .units import ASYNC_UNIT
if config is None:
assert targets is not None
config = Config(targets=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_setup(self):\n pass",
"async def initialize(self):",
"async def async_init(self) -> Optional[FinalTargetType]:\n for unit in self.unit_iterator:\n logger.debug(\"Run Config Unit %s\", unit)\n if unit in self.ran_units:\n logger.debug(\"Unit alr... | [
"0.6919155",
"0.6721145",
"0.6462371",
"0.6447364",
"0.6447364",
"0.6354801",
"0.63443065",
"0.63086605",
"0.63086605",
"0.62547606",
"0.62547606",
"0.62547606",
"0.62547606",
"0.6208426",
"0.6191402",
"0.6144838",
"0.6113137",
"0.6084455",
"0.6014905",
"0.59837544",
"0.59801... | 0.69338 | 0 |
Importing customers from csv | def import_customers(ctx):
load_csv(ctx, 'data/sample/customers.csv', 'res.partner') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ingest_customer_csv(csv_path):\n # Create a CSV import generator (next yields one db row)\n import_generator = import_csv_gen(csv_path)\n # Skip over the title row\n next(import_generator)\n # Iterate over all other rows\n while True:\n try:\n data = next(import_generator)\n... | [
"0.7907247",
"0.7341674",
"0.7154953",
"0.70078534",
"0.700205",
"0.692045",
"0.69052356",
"0.68793905",
"0.68598324",
"0.6829377",
"0.6810357",
"0.6772564",
"0.67216235",
"0.66662025",
"0.6599912",
"0.6596026",
"0.6590651",
"0.6519543",
"0.64981043",
"0.6441509",
"0.64220226... | 0.8267799 | 0 |
This is a copy of CharField.prepare_template, except that it adds a fake request to the context, which is mainly needed to render CMS placeholders | def _prepare_template(self, obj, needs_request=False):
if self.instance_name is None and self.template_name is None:
raise SearchFieldError("This field requires either its instance_name variable to be populated or an explicit template_name in order to load the correct template.")
if sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_template(self, obj):\n if self.instance_name is None and self.template_name is None:\n raise SearchFieldError(\n \"This field requires either its instance_name variable to be populated or an explicit template_name in order to load the correct template.\"\n )\... | [
"0.6153747",
"0.60101753",
"0.5881539",
"0.5870305",
"0.58173484",
"0.57768446",
"0.57493883",
"0.5698434",
"0.56751007",
"0.5672635",
"0.5669253",
"0.5664703",
"0.5644459",
"0.5637024",
"0.5635972",
"0.5587371",
"0.5558491",
"0.5539983",
"0.55088854",
"0.549886",
"0.54948735... | 0.6982965 | 0 |
gets the translated value of field name. If `FALLBACK`evaluates to `True` and the field has no translation for the current language, it tries to find a fallback value, using the languages defined in `settings.LANGUAGES`. | def get_value(self, context, obj, field_name):
try:
language = get_language()
value = self.get_translated_value(obj, field_name, language)
if value:
return value
if self.FALLBACK:
for lang, lang_name in settings.LANGUAGES:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_localised_field_value(instance, field_name, use_get=False):\n try:\n current_language = get_language()\n default_language = settings.LANGUAGES[0][0]\n\n current_field_name = '%s_%s' % (field_name, current_language)\n default_field_name = '%s_%s' % (field_name, default_languag... | [
"0.72564465",
"0.6232545",
"0.6061771",
"0.6037152",
"0.59930974",
"0.58454067",
"0.5741291",
"0.5723845",
"0.5710129",
"0.5498982",
"0.5490709",
"0.54545844",
"0.54410774",
"0.54275036",
"0.5411096",
"0.53789973",
"0.5334559",
"0.53225064",
"0.5306349",
"0.5301584",
"0.52906... | 0.7574892 | 0 |
Replaces spectral traces with their SVD transformed equivalents truncating at the nth component | def apply_svd(self, n):
## should really handle svd sensibly if we have multiple traces
## fitting multiple traces simultaneously requires they all have the
## same basis. Could pick the first trace to define the basis
#svd_trace, s, self.rs_vectors = np.linalg.svd(self.traces[0], f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_smoothing():\n spec = IGRINSSpectrum(file=file)\n new_spec = spec.remove_outliers(threshold=3)\n\n assert len(new_spec.flux) > 0\n assert new_spec.shape[0] <= spec.shape[0]\n assert new_spec.shape[0] > 0\n assert new_spec.mask is not None",
"def normalize(traces):\n\n start = time()... | [
"0.5761264",
"0.5749155",
"0.5724773",
"0.5530607",
"0.5521944",
"0.5486506",
"0.54782325",
"0.5366299",
"0.5365444",
"0.53456056",
"0.5317082",
"0.5311268",
"0.53095454",
"0.5274362",
"0.5255685",
"0.52273995",
"0.5148688",
"0.5129812",
"0.51054215",
"0.5089043",
"0.5089043"... | 0.68789 | 0 |
Extraction of predicted spectra given concentration traces and spectral_traces | def get_spectra(self, conc_traces,spectral_trace):
# linear fit of the fitted_concs to the spectra CANNOT fit intercept here!
self.regressor.fit(conc_traces,spectral_trace)
fitted_spectra = self.regressor.coef_
return fitted_spectra | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_traces(self, conc_traces, spectra):\n # linear fit of the fitted_concs to the spectra CANNOT fit intercept here!\n #self.regressor.fit(conc_traces,spectral_trace)\n #fitted_spectral_traces = self.regressor.predict(conc_traces)\n fitted_spectral_traces = spectra.dot(conc_traces.T... | [
"0.73953843",
"0.59392315",
"0.58455896",
"0.5840992",
"0.56691813",
"0.56298405",
"0.56196576",
"0.56067437",
"0.5575594",
"0.5565665",
"0.55577856",
"0.5539701",
"0.55241483",
"0.5521413",
"0.54929256",
"0.54926497",
"0.5449172",
"0.5448283",
"0.5431577",
"0.54244214",
"0.5... | 0.72131884 | 1 |
Extraction of fitted spectral traces given concentration traces and spectral traces | def get_traces(self, conc_traces, spectra):
# linear fit of the fitted_concs to the spectra CANNOT fit intercept here!
#self.regressor.fit(conc_traces,spectral_trace)
#fitted_spectral_traces = self.regressor.predict(conc_traces)
fitted_spectral_traces = spectra.dot(conc_traces.T) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_spectra(self, conc_traces,spectral_trace):\n # linear fit of the fitted_concs to the spectra CANNOT fit intercept here!\n self.regressor.fit(conc_traces,spectral_trace)\n fitted_spectra = self.regressor.coef_\n return fitted_spectra",
"def signal_spectral(signal, FS):\n # c... | [
"0.7544013",
"0.6135971",
"0.61327654",
"0.60406107",
"0.6037455",
"0.60138136",
"0.5927169",
"0.5919424",
"0.5919397",
"0.58779633",
"0.58650166",
"0.5854092",
"0.5844608",
"0.58175015",
"0.5817054",
"0.5798176",
"0.57689226",
"0.5761942",
"0.5754797",
"0.5746217",
"0.573928... | 0.747247 | 1 |
Concentration function returns concentrations at the times given in t Uses odeint to integrate dc/dt using rate constants k over times t at initial concentrations c0 Implicitly uses self.dc_dt | def C(self,t,K,c0):
#ode(self.dc_dt,c0,t,args=(k,)).set_integrator('lsoda')
#ode(self.dc_dt,c0,t,args=(k,)).set_integrator('vode', method='bdf', order=15)
# if we have any negative times we assume they occur before the
# reaction starts hence all negative times are assigned con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dc_dt(self,C,t,K):\n \n # dc/dt built up by separately computing the positive and negative contributions.\n # In our example positive_dcdt = [0, k1[A], k2[B]] and negative_dcdt = [-k1[A],-k2[B],0]\n reaction_matrix = np.array(self.reaction_matrix,dtype=np.int)\n C = np.array... | [
"0.6939089",
"0.6678995",
"0.6678481",
"0.64412683",
"0.6246044",
"0.623071",
"0.60813147",
"0.5940947",
"0.59370506",
"0.59000605",
"0.5868189",
"0.5811064",
"0.57907593",
"0.5774607",
"0.5751241",
"0.57507056",
"0.5726319",
"0.57118165",
"0.5708015",
"0.5692963",
"0.5673289... | 0.8079857 | 0 |
Master error function Computes residuals for a given rate function, rate constants and initial concentrations by linearly fitting the integrated concentrations to the provided spectra. As we wish to simultaneously fit multiple data sets T and S contain multiple arrays of times and spectral traces respectively. params a... | def errfunc(self, params):
K = self._get_K(params)
T0 = self._get_T0(params)
C0 = self._get_C0(params)
OD_offset = self._get_OD_offset(params)
offset_times = [t-t0 for t,t0 in zip(self.times,T0)]
offset_traces = [st - od for st,od in zip(self.traces,OD_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fitRateSpectrum(Times, Data, Rates, w, Lnorm='ridge', standardizeData=True, CalcNdof=False, rho=0.5):\n\n \n if Lnorm == 'lasso':\n # Use L1-norm Lasso regression\n try:\n from scikits.learn.linear_model import Lasso \n except:\n print 'Error: could NOT import L... | [
"0.6031641",
"0.60028064",
"0.5769116",
"0.56840014",
"0.5682552",
"0.5609652",
"0.5597647",
"0.55745053",
"0.54805255",
"0.5466741",
"0.5466002",
"0.5461182",
"0.5457156",
"0.54216826",
"0.53635955",
"0.53407264",
"0.5331584",
"0.52818257",
"0.52758473",
"0.5265389",
"0.5227... | 0.6964196 | 0 |
If only a single set of parameters has been provided then we expand the parameters by constructing a set for each dataset | def expand_params(self):
no_datasets = len(self.traces)
no_species = self.reaction_matrix.shape[0]
t0_keys = [key for key in self.input_params.keys() if 't0' in key]
od_keys = [key for key in self.input_params.keys() if 'OD' in key]
k_keys = [key for key in self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_dataset_param(self, dataset):\n if dataset is None and self.dataset is None:\n return []\n if dataset is 'all':\n dataset = ''\n if dataset is None and self.dataset is not None:\n dataset = self.dataset\n return dataset",
"def expand_meta_p... | [
"0.6278451",
"0.61863405",
"0.61345685",
"0.60741186",
"0.58544976",
"0.5854048",
"0.5829348",
"0.58233947",
"0.58083564",
"0.57842964",
"0.5757557",
"0.5747619",
"0.5726513",
"0.5703662",
"0.57034504",
"0.5681105",
"0.56639737",
"0.5641781",
"0.56325614",
"0.561404",
"0.5589... | 0.6242219 | 1 |
Utility function to fit assuming a sequential reaction model Sets the reaction matrix up for a sequential model then calls the master fit() method | def fit_sequential(self, no_species, debug=False):
self.init_sequential(no_species)
self.fit(debug) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit():\n pass",
"def fitted_model(model_data, sequential_model):\n x_train, y_train, x_val, y_val, x_test, _ = model_data\n compile_model(sequential_model)\n fitted_model = fit_model(sequential_model, 64, 1, False, x_train, y_train, x_val, y_val, x_test)\n return fitted_model",
"def fit_... | [
"0.64742583",
"0.6445856",
"0.63966495",
"0.6344927",
"0.62193805",
"0.6152714",
"0.6093543",
"0.6078134",
"0.6075871",
"0.60507065",
"0.6024773",
"0.60206896",
"0.5976558",
"0.5969459",
"0.5966335",
"0.59576577",
"0.59506774",
"0.59072554",
"0.5899322",
"0.5877998",
"0.58676... | 0.6447086 | 1 |
Utility function to fit assuming a parallel reaction model Sets the reaction matrix up for a parallel model then calls the master fit() method | def fit_parallel(self, no_species,debug=False):
self.init_parallel(no_species)
self.fit(debug) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fit(self, X, _transform=False):\n\n n_cols = X.shape[1]\n\n data = DistributedDataHandler.create(data=X, client=self.client)\n self.datatype = data.datatype\n\n if \"svd_solver\" in self.kwargs and self.kwargs[\"svd_solver\"] == \"tsqr\":\n comms = Comms(comms_p2p=True)\... | [
"0.6496851",
"0.64436406",
"0.63440764",
"0.62476355",
"0.6204807",
"0.6138343",
"0.6115907",
"0.6078986",
"0.60787815",
"0.60163367",
"0.59925085",
"0.5985123",
"0.59803116",
"0.59718335",
"0.5964751",
"0.59567624",
"0.59344",
"0.59056485",
"0.589933",
"0.58992696",
"0.58986... | 0.6665549 | 0 |
Returns a Latex representation of the current reaction scheme | def tex_reaction_scheme(self):
if self.reaction_matrix is None or self.input_params is None:
return 'undefined'
species = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
eqn = []
reactants, products = self.reaction_matrix.nonzero()
for r,p,k in zip(reactan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reaction_str(self):\n\n def format(number):\n return str(number).rstrip(\".0\") + \" \"\n\n reactant_bits = []\n product_bits = []\n for met in sorted(self._metabolites, key=attrgetter(\"id\")):\n coefficient = self._metabolites[met]\n if coefficient... | [
"0.6516189",
"0.61752766",
"0.6117226",
"0.6117226",
"0.61046225",
"0.60964334",
"0.60246444",
"0.5972512",
"0.5943637",
"0.5936047",
"0.5920423",
"0.5911163",
"0.58398604",
"0.58012223",
"0.57974076",
"0.57868797",
"0.5786228",
"0.577146",
"0.57446593",
"0.5738029",
"0.57333... | 0.7731967 | 0 |
Test creation of set in db | def test_create_set(self):
obj1 = Set.objects.first()
obj2 = Set.objects.last()
self.assertEqual(str(obj1), obj1.id)
self.assertEqual(str(obj2), obj2.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_io_success(self):\r\n m1 = TestSetModel.create(int_set={1, 2}, text_set={'kai', 'andreas'})\r\n m2 = TestSetModel.get(partition=m1.partition)\r\n\r\n assert isinstance(m2.int_set, set)\r\n assert isinstance(m2.text_set, set)\r\n\r\n assert 1 in m2.int_set\r\n asse... | [
"0.69416434",
"0.68995917",
"0.6744727",
"0.66820097",
"0.66440153",
"0.66096723",
"0.6553905",
"0.64886695",
"0.6466538",
"0.64500856",
"0.64318264",
"0.63216364",
"0.6292189",
"0.6287698",
"0.6272713",
"0.62361026",
"0.6229549",
"0.6219275",
"0.621327",
"0.6202346",
"0.6197... | 0.75687176 | 0 |
Try to detect the presence of the kcc tool. | def _detect(env):
try:
return env['KCC']
except KeyError:
pass
kcc = env.WhereIs('kcc', env['KCC_DIR'])
if kcc:
return kcc
raise SCons.Errors.StopError(
KccNotFound,
"Could not find Kalimba C compiler (kcc.exe)") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_nvcc_available():\r\n def set_version():\r\n p_out = output_subprocess_Popen([nvcc_path, '--version'])\r\n ver_line = decode(p_out[0]).strip().split('\\n')[-1]\r\n build, version = ver_line.split(',')[1].strip().split()\r\n\r\n assert build == 'release'\r\n global nvcc_... | [
"0.6018184",
"0.5991554",
"0.58086854",
"0.58063084",
"0.5731486",
"0.57303655",
"0.5663401",
"0.5663401",
"0.55095214",
"0.5506362",
"0.55029947",
"0.54678726",
"0.54535484",
"0.54263836",
"0.5421077",
"0.54184335",
"0.5403426",
"0.53653455",
"0.5360666",
"0.5358234",
"0.535... | 0.7571903 | 0 |
load default config and update it with arguments if provided | def setup_config(args):
# Set the default configuration file
f = pkgutil.get_data(__package__, 'dnstap.conf')
cfg = load_yaml(f)
# Overwrites then with the external file ?
if args.c:
cfg_ext = load_yaml(open(args.c, 'r'))
merge_cfg(u=cfg_ext,o=cfg)
# Or searches for a file ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_default_user_configs(args):\n # Skip any imported keys from future\n import __future__ as ff\n future_keys = dir(ff)\n # Load default settings\n import pythiaplotter.default_config as dc\n default_settings = {k: getattr(dc, k) for k in dir(dc)\n if k not in future_... | [
"0.7204939",
"0.7133817",
"0.7069775",
"0.6954889",
"0.69438267",
"0.69321847",
"0.69108415",
"0.6866273",
"0.6854772",
"0.68134815",
"0.6661569",
"0.66395104",
"0.6524558",
"0.65017855",
"0.6491883",
"0.648499",
"0.647498",
"0.64722943",
"0.64687335",
"0.64638644",
"0.645244... | 0.7182467 | 1 |
Provide a hashed lfn from an lfn. | def getHashLfn(lfn):
return hashlib.sha224(lfn).hexdigest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _s_hash(fn, data: str):\n\n return fn(_b(data)).hexdigest()",
"def generate_function_key(fn):\n return hashlib.md5(fn.func_code.co_code).hexdigest()",
"def get_hash(hash_function, x: str):\n hash_function.update(x.encode())\n return int.from_bytes(hash_function.digest(), byteorder=\"big\")",
... | [
"0.6238101",
"0.6153464",
"0.6071181",
"0.6069656",
"0.6035795",
"0.5960966",
"0.59406644",
"0.5940355",
"0.58954185",
"0.5881548",
"0.58747935",
"0.5853849",
"0.5838578",
"0.5833709",
"0.58259416",
"0.5795485",
"0.5772984",
"0.57470024",
"0.5737209",
"0.5716741",
"0.57127243... | 0.7909504 | 0 |
Formats the logs according to the specified format in the config yaml | def formatLogs(logs,format):
formattedLogs=[]
if(format.__eq__("json")):
for log in logs:
formattedLogs.append(json.dumps(dict(log)))
return formattedLogs
elif(format.__eq__("xml")):
for log in logs:
formattedLogs.append(dict2xml.dict2xml(dict(log)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format(self, record: logging.LogRecord = None) -> str:\n # s = super().format(record)\n s = None\n e = {}\n e['id'] = uuid.uuid4().hex\n e['message'] = record.getMessage()\n # log.warning('record.message: %r', record.getMessage())\n # log.warning('record.args: %... | [
"0.6359971",
"0.63122666",
"0.6309027",
"0.6017584",
"0.60169244",
"0.596097",
"0.5888444",
"0.58323663",
"0.5759873",
"0.5745515",
"0.5734548",
"0.5720412",
"0.5708935",
"0.5696282",
"0.56763834",
"0.55640334",
"0.5556745",
"0.5511905",
"0.55033696",
"0.5491028",
"0.54729235... | 0.69405305 | 0 |
Set the figure size for matplotlib. | def set_figsize(figsize=(3.5, 2.5)):
use_svg_display()
plt.rcParams['figure.figsize'] = figsize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_figsize(figsize=(3.5, 2.5)): #@save\n use_svg_display()\n d2l.plt.rcParams['figure.figsize'] = figsize",
"def set_figure_size(self):\n lims, _ = self.set_lims()\n size_fac = 50\n paperSizeFac = 0.65\n one_dec = 1.6\n xdecs = np.log10(lims(1)) - np.log10(lims(0))\... | [
"0.78508115",
"0.70364225",
"0.6904956",
"0.68747413",
"0.6740527",
"0.66900957",
"0.66710436",
"0.6648599",
"0.6556224",
"0.65500504",
"0.64922696",
"0.6473836",
"0.6463363",
"0.646269",
"0.64610773",
"0.6458102",
"0.6423973",
"0.6417006",
"0.6400636",
"0.6392053",
"0.638390... | 0.79740876 | 1 |
Set the axes for matplotlib. | def set_axes(axes, xlabel, ylabel, xlim, ylim, xscale, yscale, legend):
axes.set_xlabel(xlabel)
axes.set_ylabel(ylabel)
axes.set_xscale(xscale)
axes.set_yscale(yscale)
axes.set_xlim(xlim)
axes.set_ylim(ylim)
if legend:
axes.legend(legend)
axes.grid() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_axes(self, a):\r\n self.axes = a",
"def _InitAxes( self ):\n self.ax = self.fig.add_subplot( 111 )",
"def setAxes(self, ax):\n self.ax = ax\n ax.grid()\n yStr = self.ylabel\n if self.yunit:\n yStr += ' [' + self.yunit + ']'\n ax.set_ylabel(yStr)\n... | [
"0.7821627",
"0.76623124",
"0.74066865",
"0.7335988",
"0.72890466",
"0.723273",
"0.7213896",
"0.69110376",
"0.6894962",
"0.6696438",
"0.6584788",
"0.6532761",
"0.6482387",
"0.6465752",
"0.6464336",
"0.6435061",
"0.64285314",
"0.62969166",
"0.62893236",
"0.6268436",
"0.6264467... | 0.7960503 | 1 |
Return token indices and the vocabulary of the time machine dataset. | def load_corpus_time_machine(max_tokens=-1):
lines = read_time_machine()
tokens = tokenize(lines, 'char')
vocab = Vocab(tokens)
# Since each text line in the time machine dataset is not necessarily a
# sentence or a paragraph, flatten all the text lines into a single list
corpus = [vocab[token] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize_dataset(self, data):\n token_pt = tfds.deprecated.text.SubwordTextEncoder.build_from_corpus(\n (pt.numpy() for pt, _ in data), target_vocab_size=2**15)\n token_en = tfds.deprecated.text.SubwordTextEncoder.build_from_corpus(\n (en.numpy() for _, en in data), target_v... | [
"0.6068157",
"0.6040147",
"0.6004017",
"0.5997151",
"0.59268683",
"0.59231883",
"0.5921531",
"0.5907424",
"0.59062046",
"0.58765256",
"0.5871494",
"0.58630276",
"0.58408225",
"0.5837843",
"0.5832458",
"0.5793951",
"0.57792675",
"0.5772422",
"0.57481855",
"0.5747621",
"0.57457... | 0.63158065 | 0 |
Load the time machine dataset into a list of text lines. | def read_time_machine():
with open(download('time_machine'), 'r') as f:
lines = f.readlines()
return [re.sub('[^A-Za-z]+', ' ', line).strip().lower() for line in lines] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data():\n with open('../data/dataset.txt', 'r') as data_file:\n return data_file.read().split('\\n')",
"def load_timestamps(data_path):\n timestamp_file = os.path.join(data_path, 'oxts', 'timestamps.txt')\n\n # Read and parse the timestamps\n timestamps = []\n with ... | [
"0.6615895",
"0.6404806",
"0.6191352",
"0.61405325",
"0.61029655",
"0.6073385",
"0.60627526",
"0.60588497",
"0.6038774",
"0.58766353",
"0.5872229",
"0.58710784",
"0.5862341",
"0.58029455",
"0.5802697",
"0.5782409",
"0.5737791",
"0.57256633",
"0.5698695",
"0.5684962",
"0.56405... | 0.6859016 | 0 |
Show the trace of 2D variables during optimization. | def show_trace_2d(f, results): #@save
set_figsize()
plt.plot(*zip(*results), '-o', color='#ff7f0e')
x1, x2 = torch.meshgrid(torch.arange(-5.5, 1.0, 0.1),torch.arange(-3.0, 1.0, 0.1))
plt.contour(x1, x2, f(x1, x2), colors='#1f77b4')
plt.xlabel('x1') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(self,verbose=0):\n print 'inferenceArgs',self.ws.inferenceArgs\n print 'inferenceExpr',theano.pp(self.ws.inferenceExpr)\n if verbose>=1:\n print 'debugprint inferenceExpr:'\n theano.printing.debugprint(self.ws.inferenceExpr)\n if self.ws.dataLossExpr:\n print 'dataLossArgs',... | [
"0.62626696",
"0.6006373",
"0.57875335",
"0.5762216",
"0.5757944",
"0.57540536",
"0.574416",
"0.5707666",
"0.5659824",
"0.5619692",
"0.55768055",
"0.55019",
"0.5486955",
"0.5468893",
"0.542694",
"0.5422578",
"0.5377899",
"0.53736806",
"0.5372507",
"0.53692776",
"0.536704",
... | 0.62007415 | 1 |
get_player_sum returns an int | def test_get_player_sum(self):
self.assertIsInstance(network.get_player_sum(), int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_score(player_cards):\n score = sum(player_cards)\n return score",
"async def get_player_total(user_id):\n return ex.first_result(await ex.conn.fetchrow(\"SELECT total FROM blackjack.currentstatus WHERE userid = $1\", user_id))",
"def determineAmountToCall(self, player):\n\t\treturn s... | [
"0.7370785",
"0.70759094",
"0.6778255",
"0.65896446",
"0.65821964",
"0.6551155",
"0.64373845",
"0.6431769",
"0.63957685",
"0.62656343",
"0.6204107",
"0.6148466",
"0.61299497",
"0.6116737",
"0.60755056",
"0.606602",
"0.60486996",
"0.6046093",
"0.60406727",
"0.5975451",
"0.5975... | 0.7653584 | 0 |
Search for a repetitive allele in the reference, until there are no more. Then return the start/stop coordinates associated with the updated 3' position. | def find_rpt_coords(self) -> (int, int):
start_size = self.size
end_size = self.size + len(self.allele)
coord = self.coord
fasta_alt = self.fasta_alt
while self.allele == fasta_alt:
coord += len(self.allele)
start_size += len(self.allele)
end_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_position(self, e):\n walk = self._data.first()\n while walk is not None and walk.element()._value != e:\n walk = self._data.after(walk)\n \n return walk",
"def _find_states(self, lookup, alignment, reference):\n # Get the reference allele, given our conti... | [
"0.5607255",
"0.5489305",
"0.54088825",
"0.5405536",
"0.50670695",
"0.5052634",
"0.5051449",
"0.50445276",
"0.5033622",
"0.4967559",
"0.49665543",
"0.49522686",
"0.49390197",
"0.49328735",
"0.49193752",
"0.49173978",
"0.4914808",
"0.4909151",
"0.49074334",
"0.4898974",
"0.489... | 0.6008213 | 0 |
Test autoloaded lookup handlers. | def test_autoloaded_lookup_handlers(mocker: MockerFixture) -> None:
mocker.patch.dict(CFNGIN_LOOKUP_HANDLERS, {})
handlers = [
"ami",
"awslambda",
"awslambda.Code",
"awslambda.CodeSha256",
"awslambda.CompatibleArchitectures",
"awslambda.CompatibleRuntimes",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_register_lookup_handler_str(mocker: MockerFixture) -> None:\n mocker.patch.dict(CFNGIN_LOOKUP_HANDLERS, {})\n register_lookup_handler(\n \"test\", \"runway.cfngin.lookups.handlers.default.DefaultLookup\"\n )\n assert \"test\" in CFNGIN_LOOKUP_HANDLERS\n assert CFNGIN_LOOKUP_HANDLERS[... | [
"0.7028987",
"0.66624916",
"0.6524028",
"0.65138626",
"0.62585324",
"0.6225807",
"0.6182978",
"0.586599",
"0.5839276",
"0.5836783",
"0.5735428",
"0.5720263",
"0.57087195",
"0.5682903",
"0.5669771",
"0.5642421",
"0.56408334",
"0.562706",
"0.5615401",
"0.5566726",
"0.55578625",... | 0.78962594 | 0 |
Test register_lookup_handler no subclass. | def test_register_lookup_handler_not_subclass() -> None:
class FakeLookup:
"""Fake lookup."""
with pytest.raises(TypeError):
register_lookup_handler("test", FakeLookup) # type: ignore | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_register_lookup_handler_str(mocker: MockerFixture) -> None:\n mocker.patch.dict(CFNGIN_LOOKUP_HANDLERS, {})\n register_lookup_handler(\n \"test\", \"runway.cfngin.lookups.handlers.default.DefaultLookup\"\n )\n assert \"test\" in CFNGIN_LOOKUP_HANDLERS\n assert CFNGIN_LOOKUP_HANDLERS[... | [
"0.77697766",
"0.68155754",
"0.67613983",
"0.6516736",
"0.64058006",
"0.6284836",
"0.6086164",
"0.60600495",
"0.6003532",
"0.59994555",
"0.59856564",
"0.59579164",
"0.59579164",
"0.59143126",
"0.58516574",
"0.5844376",
"0.5815227",
"0.58099604",
"0.5752378",
"0.57349396",
"0.... | 0.819721 | 0 |
Test register_lookup_handler from string. | def test_register_lookup_handler_str(mocker: MockerFixture) -> None:
mocker.patch.dict(CFNGIN_LOOKUP_HANDLERS, {})
register_lookup_handler(
"test", "runway.cfngin.lookups.handlers.default.DefaultLookup"
)
assert "test" in CFNGIN_LOOKUP_HANDLERS
assert CFNGIN_LOOKUP_HANDLERS["test"] == Defaul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_register_lookup_handler_not_subclass() -> None:\n\n class FakeLookup:\n \"\"\"Fake lookup.\"\"\"\n\n with pytest.raises(TypeError):\n register_lookup_handler(\"test\", FakeLookup) # type: ignore",
"def test_autoloaded_lookup_handlers(mocker: MockerFixture) -> None:\n mocker.patch... | [
"0.6491469",
"0.62127",
"0.5973767",
"0.594004",
"0.5752023",
"0.57111067",
"0.57111067",
"0.568894",
"0.5546321",
"0.5527395",
"0.5519219",
"0.5513894",
"0.5504457",
"0.5500056",
"0.54894114",
"0.5448521",
"0.5445007",
"0.5364488",
"0.52665246",
"0.52348346",
"0.5234424",
... | 0.8179712 | 0 |
Return the top 5 tickers starting with the string `ticker_start` from the list of valid ticker symbols. | async def get_tickers(ticker_start: str):
# TODO: This. It's low priority.
return {"message" : "dummy return message"} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def five_min_ticker(*args):\n markets = fetch_markets()\n map(populate_five_min_data, markets)\n return",
"def get_best_five(self):\n return sorted(self.speakers.iteritems(),\n key=lambda (key, val): (val, key),\n reverse=True)[:5]",
"def get_top_five_c... | [
"0.6028439",
"0.5386634",
"0.528898",
"0.51805276",
"0.51279986",
"0.5071716",
"0.50292003",
"0.50277686",
"0.501954",
"0.5001384",
"0.49733034",
"0.49714798",
"0.49527708",
"0.49457914",
"0.49385273",
"0.48923478",
"0.48641166",
"0.4850651",
"0.4846627",
"0.48374152",
"0.483... | 0.5778998 | 1 |
Create a doc in the Search Index. | async def create_doc(self, *args, **kwargs):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_add(index_name, doc_type, doc, doc_id=None):\n resp = es.index(index=index_name, doc_type=doc_type, body=doc, id=doc_id)\n print(resp)",
"def create_document(obj):\n index = obj.get_index_name()\n doc_type = obj.get_document_type()\n body = obj.get_document_body()\n exists = ES.exi... | [
"0.7268289",
"0.72263414",
"0.71898484",
"0.6992766",
"0.6892436",
"0.6792396",
"0.6747379",
"0.67075866",
"0.67029434",
"0.6697542",
"0.6651314",
"0.66347575",
"0.6598456",
"0.6594917",
"0.6569574",
"0.65341103",
"0.6468941",
"0.64314777",
"0.6429818",
"0.6427337",
"0.640422... | 0.7585452 | 0 |
Remove a doc in the Search Index. | async def remove_doc(self, *args, **kwargs):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_document_from_index(self, doc_name):\n\t\tif not doc_name:\n\t\t\treturn\n\n\t\tix = self.get_index()\n\t\twith ix.searcher():\n\t\t\twriter = AsyncWriter(ix)\n\t\t\twriter.delete_by_term(self.id, doc_name)\n\t\t\twriter.commit(optimize=True)",
"def delete_document(self, index: str, doc_id: str):\n ... | [
"0.82766545",
"0.7518166",
"0.72692305",
"0.7221789",
"0.71012115",
"0.69175696",
"0.68284357",
"0.6793826",
"0.67908835",
"0.6757231",
"0.6734349",
"0.6657543",
"0.6607274",
"0.6585242",
"0.65722555",
"0.6567174",
"0.65492606",
"0.642772",
"0.63854206",
"0.63825154",
"0.6370... | 0.81784636 | 1 |
Returns the call/put price corresponding the implied vol at strike K | def option_price(self, K, payoff='Call'):
return self.IV.price_from_vol(self.smile_func(K), self.f, K, self.T_expiry, payoff=payoff) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_from_vol( self, vol ):\n if self._vol_type == \"LogNormal\":\n S = self._deal_terms[ \"underlyer\" ].spot_value\n K = self._deal_terms[ \"payoff\" ].payoff_terms[ \"strike\" ]\n time_to_mat = self._deal_terms[ \"maturity\" ] - self._pricing_date... | [
"0.74730724",
"0.72675455",
"0.70773613",
"0.70316756",
"0.6866724",
"0.6865428",
"0.67700785",
"0.6473597",
"0.64252746",
"0.63514227",
"0.634056",
"0.6305643",
"0.63045806",
"0.6284474",
"0.61870676",
"0.6160804",
"0.6160804",
"0.6160804",
"0.61449486",
"0.6058198",
"0.6036... | 0.7444923 | 1 |
Returns a dictionary strike > option price | def option_price_curve(self, payoff='Call'):
return dict(zip(self.strike_grid, list(map(lambda K: self.option_price(K, payoff=payoff), self.strike_grid)))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prices(self):\n pass",
"def option_price(self, K, payoff='Call'):\n return self.IV.price_from_vol(self.smile_func(K), self.f, K, self.T_expiry, payoff=payoff)",
"def get_option_strikes(self, symbol: str, expiration: date) -> List[float]:\n url =... | [
"0.6321658",
"0.6184237",
"0.61564404",
"0.6082121",
"0.60253316",
"0.5881576",
"0.5880924",
"0.58474046",
"0.5830259",
"0.5773858",
"0.5711766",
"0.5702026",
"0.5700022",
"0.5699233",
"0.5640838",
"0.5625982",
"0.56258357",
"0.5616689",
"0.5598313",
"0.55965245",
"0.5590727"... | 0.7708653 | 0 |
Returns a dictionary strike > probability density function of the terminal distribution of the underlyer | def pdf_curve(self):
return dict(zip(self.strike_grid, list(map(lambda K: self.pdf(K), self.strike_grid)))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability_density(dic):\n\n var = dic['var']\n par = dic['par']\n y1 = dic['y']\n y = y1.conjugate() * y\n return dic_result(var,par,y)",
"def gc_prob_density(r):\n return np.exp(_interp_ln_dens(r))",
"def density_ch(tensor):\n return 1 - sparsity_ch(tensor)",
"def densi... | [
"0.6591659",
"0.60822266",
"0.60120857",
"0.5929537",
"0.5885551",
"0.58809704",
"0.58587855",
"0.5833516",
"0.582754",
"0.5756616",
"0.5750407",
"0.5721838",
"0.5720068",
"0.5718098",
"0.571279",
"0.57115805",
"0.5678578",
"0.56736284",
"0.5665384",
"0.5656114",
"0.56461424"... | 0.6241185 | 1 |
check what is the latest version of the python sdk and report in case there is a newer version | def checkVersion(self):
try:
respInfo = self._reqSession.get(self._host + "/static/pythonSDKVersion.txt")
if respInfo.status_code != 200 or len(respInfo.text) > 20:
return
latestVersion = respInfo.text.strip()
import eventregistry._version as _vers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_updates():\n last_version = str(request.urlopen(__source__).read().decode(\"utf8\"))\n if str(open(__file__).read()) != last_version:\n log.warning(\"Theres new Version available!, Update from \" + __source__)\n else:\n log.info(\"No new updates!,You have the lastest version of... | [
"0.7302678",
"0.70730126",
"0.7005278",
"0.6894811",
"0.67887616",
"0.67020005",
"0.6671456",
"0.6653263",
"0.6598624",
"0.6585028",
"0.6583392",
"0.65347326",
"0.6532097",
"0.6465128",
"0.6416083",
"0.64116913",
"0.6397081",
"0.63903785",
"0.63445276",
"0.6332754",
"0.631875... | 0.8087034 | 0 |
return the last exception | def getLastException(self):
return self._lastException | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_exception(self):\r\n \r\n return self._exception",
"def last_exception():\n exc_type, exc_value, exc_traceback = sys.exc_info()\n return ''.join(traceback.format_exception(exc_type, exc_value,\n exc_traceback))",
"def GetLastExceptionStr... | [
"0.75733626",
"0.7377325",
"0.72208196",
"0.71323705",
"0.70439875",
"0.7019781",
"0.681785",
"0.67563045",
"0.6682987",
"0.6662121",
"0.65182114",
"0.64950377",
"0.6491702",
"0.6485551",
"0.64727026",
"0.64006877",
"0.6381573",
"0.63463336",
"0.6341862",
"0.6328694",
"0.6214... | 0.84810376 | 0 |
print some statistics about the last executed request | def printLastReqStats(self):
print("Tokens used by the request: " + str(self.getLastHeader("req-tokens")))
print("Performed action: " + str(self.getLastHeader("req-action")))
print("Was archive used for the query: " + (self.getLastHeader("req-archive") == "1" and "Yes" or "No")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _last_request():\n return httpretty.httpretty.last_request",
"def get_stats(self, current_time, last_print):\n logs_for_stats = self.database.loc[\n (current_time >= self.database[\"date\"]) & (self.database[\"date\"] > last_print)\n ]\n if len(logs_for_stats):\n ... | [
"0.6650085",
"0.62377346",
"0.62252164",
"0.62195563",
"0.6044054",
"0.60019636",
"0.59563315",
"0.5945934",
"0.5944727",
"0.5881183",
"0.58766323",
"0.58630186",
"0.5848277",
"0.5829016",
"0.5821796",
"0.5796692",
"0.57771313",
"0.57528746",
"0.57433945",
"0.57153016",
"0.57... | 0.75956744 | 0 |
return True or False depending on whether the last request used the archive or not | def getLastReqArchiveUse(self):
return self.getLastHeader("req-archive", "0") == "1" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_archive(self):\n\t\t# refresh the archive pool searches\n\t\tself.pool_search(refresh=True)\n\t\tif self.status == 'archived':\n\t\t\treturn True\n\t\treturn False",
"def _is_downloaded(self):\n return self._system.file_exists(self._tar_name)",
"def _is_archive(local_path: str) -> bool:\n ... | [
"0.6869388",
"0.63293815",
"0.6328624",
"0.629294",
"0.62679875",
"0.62628776",
"0.6115898",
"0.60808235",
"0.60806364",
"0.603922",
"0.5940659",
"0.58642906",
"0.58642775",
"0.58522505",
"0.5848016",
"0.5847946",
"0.58310467",
"0.58162844",
"0.58130246",
"0.58006656",
"0.580... | 0.8248378 | 0 |
return a list of news sources that match the prefix | def suggestNewsSources(self, prefix: str, dataType: Union[str, list] = ["news", "pr", "blog"], page: int = 1, count: int = 20, **kwargs):
assert page > 0, "page parameter should be above 0"
params = {"prefix": prefix, "dataType": dataType, "page": page, "count": count}
params.update(kwargs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listsources():\n\tmain_url = \" https://newsapi.org/v2/sources?apiKey=5f81b593f35d42a8980313250c03d7e7\"\n\n\t# fetching data in json format \n\topen_source = requests.get(main_url).json() \n\n\t# getting all articles in a string sources\n\tsource = open_source[\"sources\"] \n\n\t# empty list which will \n\t# ... | [
"0.62707055",
"0.6084322",
"0.6078376",
"0.6037707",
"0.6009768",
"0.5960838",
"0.59466416",
"0.594522",
"0.59372747",
"0.5871036",
"0.579802",
"0.5768899",
"0.5733959",
"0.5702365",
"0.56964064",
"0.5685058",
"0.568116",
"0.5660605",
"0.56461525",
"0.55997753",
"0.5596747",
... | 0.6308919 | 0 |
return a list of news source groups that match the prefix | def suggestSourceGroups(self, prefix: str, page: int = 1, count: int = 20, **kwargs):
assert page > 0, "page parameter should be above 0"
params = { "prefix": prefix, "page": page, "count": count }
params.update(kwargs)
return self.jsonRequest("/api/v1/suggestSourceGroups", params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSourceGroups(self):\n ret = self.jsonRequest(\"/api/v1/sourceGroup/getSourceGroups\", {})\n return ret",
"def _groupNamesToList(settings):\n return [getattr(GroupName, val) for val in settings.dhGroups]",
"def source_list(self):\n return list(self._client.group.streams_by_nam... | [
"0.6081402",
"0.59167695",
"0.59045476",
"0.5903306",
"0.5868237",
"0.5850195",
"0.58375734",
"0.58148956",
"0.56765896",
"0.5635335",
"0.5631688",
"0.5598677",
"0.55861235",
"0.5540542",
"0.55310994",
"0.5514977",
"0.5493764",
"0.54888964",
"0.5457038",
"0.5433079",
"0.54262... | 0.6120901 | 0 |
return a list of event types that match the prefix | def suggestEventTypes(self, prefix: str, page: int = 1, count: int = 20, **kwargs):
assert page > 0, "page parameter should be above 0"
params = {"prefix": prefix, "page": page, "count": count}
params.update(kwargs)
return self.jsonRequest("/api/v1/eventType/suggestEventTypes", params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all(self):\r\n return list(pecan.request.storage_conn.get_event_types())",
"def get_triggers_by_prefix(uuid: UUID, prefix: str | Tuple) -> Optional[List['Trigger']]:\n scenario = store.get_scenario(uuid)\n if scenario:\n return [trigger for trigger in scenario.trigger_manager.triggers... | [
"0.63858974",
"0.6202084",
"0.5924098",
"0.5862218",
"0.5741972",
"0.566967",
"0.562749",
"0.5544773",
"0.5511223",
"0.5464088",
"0.54471403",
"0.54358304",
"0.54006886",
"0.53771496",
"0.537508",
"0.537111",
"0.5363539",
"0.53595304",
"0.5346293",
"0.5343913",
"0.53282255",
... | 0.64759165 | 0 |
return a concept uri that is the best match for the given concept label if there are multiple matches for the given conceptLabel, they are sorted based on their frequency of occurence in news (most to least frequent) | def getConceptUri(self, conceptLabel: str, lang: str = "eng", sources: Union[str, List[str]] = ["concepts"]):
matches = self.suggestConcepts(conceptLabel, lang = lang, sources = sources)
if matches != None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]:
return mat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCategoryUri(self, categoryLabel: str):\n matches = self.suggestCategories(categoryLabel)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n return matches[0][\"uri\"]\n return None",
"def uri_sort_key(uri):\n if uri.start... | [
"0.5373891",
"0.5326923",
"0.5324317",
"0.5230062",
"0.5156094",
"0.51187223",
"0.49526542",
"0.49000037",
"0.4895589",
"0.48791897",
"0.48177102",
"0.46961698",
"0.4668031",
"0.46295252",
"0.46246976",
"0.46214887",
"0.46188977",
"0.46140313",
"0.4609746",
"0.45985618",
"0.4... | 0.6000219 | 0 |
return a location uri that is the best match for the given location label | def getLocationUri(self, locationLabel: str, lang: str = "eng", sources: Union[str, List[str]] = ["place", "country"], countryUri: Union[str, None] = None, sortByDistanceTo: Union[List, Tuple, None] = None):
matches = self.suggestLocations(locationLabel, sources = sources, lang = lang, countryUri = countryUri, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_family_location(family_label):\n\n search_dirs = [\"/hps/nobackup/production/xfam/rfam/RELEASES/14.3/miRNA_relabelled/batch1_chunk1_searches\",\n \"/hps/nobackup/production/xfam/rfam/RELEASES/14.3/miRNA_relabelled/batch1_chunk2_searches\",\n \"/hps/nobackup/production... | [
"0.6586528",
"0.62700546",
"0.60183",
"0.5761023",
"0.5684978",
"0.56574464",
"0.5643387",
"0.5624193",
"0.5612762",
"0.5518236",
"0.5503416",
"0.5490034",
"0.54579645",
"0.5414388",
"0.54064244",
"0.53824854",
"0.534134",
"0.53146106",
"0.5304863",
"0.5296975",
"0.5288527",
... | 0.6828578 | 0 |
return a category uri that is the best match for the given label | def getCategoryUri(self, categoryLabel: str):
matches = self.suggestCategories(categoryLabel)
if matches != None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]:
return matches[0]["uri"]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_category_label(label: str) -> str:\n return number_first_regex.sub(\n '_',\n space_regex.sub(\n '_',\n label.strip().lower().replace('*', '').replace('(', '').replace(\n ')', '').replace('.', '')))",
"def get_label_name(label):\n\tindex = np.argmax(... | [
"0.5820102",
"0.57796377",
"0.57189244",
"0.568857",
"0.56706095",
"0.5670265",
"0.5614227",
"0.55840105",
"0.547457",
"0.544891",
"0.5384078",
"0.5384078",
"0.537984",
"0.537984",
"0.5355162",
"0.53501034",
"0.534399",
"0.5342672",
"0.53198165",
"0.5298704",
"0.5283161",
"... | 0.7599166 | 0 |
alternative (shorter) name for the method getNewsSourceUri() | def getSourceUri(self, sourceName: str, dataType: Union[str, List[str]] = ["news", "pr", "blog"]):
return self.getNewsSourceUri(sourceName, dataType) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNewsSourceUri(self, sourceName: str, dataType: Union[str, List[str]] = [\"news\", \"pr\", \"blog\"]):\n matches = self.suggestNewsSources(sourceName, dataType = dataType)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n return matc... | [
"0.76972795",
"0.68226814",
"0.6523007",
"0.6433535",
"0.64236754",
"0.63689995",
"0.6365982",
"0.63083386",
"0.63083386",
"0.6300353",
"0.628872",
"0.6269325",
"0.626673",
"0.6256632",
"0.6249758",
"0.6189944",
"0.61506224",
"0.61473215",
"0.61441106",
"0.606726",
"0.6057817... | 0.7801554 | 0 |
return the URI of the source group that best matches the name | def getSourceGroupUri(self, sourceGroupName: str):
matches = self.suggestSourceGroups(sourceGroupName)
if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]:
return matches[0]["uri"]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getURI(self, *args):\n return _libsbml.GroupsExtension_getURI(self, *args)",
"def _source(self, namespace):\n if not namespace:\n source = self._default_source\n else:\n source = self._sources.get(namespace)\n if not source:\n raise GroupResolverSo... | [
"0.62811434",
"0.6188032",
"0.6106267",
"0.5954231",
"0.58817136",
"0.58752364",
"0.5858591",
"0.580521",
"0.57376444",
"0.56671643",
"0.56523913",
"0.56210285",
"0.55978084",
"0.55902463",
"0.55665797",
"0.5522302",
"0.55100167",
"0.54542893",
"0.54542893",
"0.54542893",
"0.... | 0.7802163 | 0 |
return a uri of the concept class that is the best match for the given label | def getConceptClassUri(self, classLabel: str, lang: str = "eng"):
matches = self.suggestConceptClasses(classLabel, lang = lang)
if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]:
return matches[0]["uri"]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getConceptUri(self, conceptLabel: str, lang: str = \"eng\", sources: Union[str, List[str]] = [\"concepts\"]):\n matches = self.suggestConcepts(conceptLabel, lang = lang, sources = sources)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n ... | [
"0.6339133",
"0.60691535",
"0.6041036",
"0.59156215",
"0.5846136",
"0.575784",
"0.56709063",
"0.5510237",
"0.54722863",
"0.5397338",
"0.5382017",
"0.5376677",
"0.53355074",
"0.53352785",
"0.53339684",
"0.5312528",
"0.5297552",
"0.5296992",
"0.52870166",
"0.5281717",
"0.527981... | 0.74872255 | 0 |
return detailed information about a particular concept | def getConceptInfo(self, conceptUri: str,
returnInfo: ReturnInfo = ReturnInfo(conceptInfo = ConceptInfoFlags(synonyms = True, image = True, description = True))):
params = returnInfo.getParams()
params.update({"uri": conceptUri })
return self.jsonRequest("/api/v1/concept/g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concept_details(\n self,\n concept_id: str,\n params: Optional[Dict] = None,\n headers: Optional[Dict] = None,\n ) -> ConceptDetails:\n method = self._get_method(\"concept_details\")\n method = method.format(**{\"id\": concept_id})\n\n return self.call_api_ge... | [
"0.7382096",
"0.6283711",
"0.62482786",
"0.61796254",
"0.5913981",
"0.58909845",
"0.58331335",
"0.5800988",
"0.5798764",
"0.571371",
"0.56614435",
"0.5658186",
"0.5639102",
"0.56273085",
"0.56273085",
"0.5625537",
"0.56052315",
"0.55974036",
"0.5594931",
"0.55901265",
"0.5580... | 0.6814808 | 1 |
return author uri that is the best match for the given author name (and potentially source url) if there are multiple matches for the given author name, they are sorted based on the number of articles they have written (from most to least frequent) | def getAuthorUri(self, authorName: str):
matches = self.suggestAuthors(authorName)
if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]:
return matches[0]["uri"]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_author_name_urls(dept_name, dept_url):\n\t# Change to \"School of Humanities\" to match the name used in Enlighten\n\t# Done because the string obtained from http://www.gla.ac.uk/schools/ contains the Gaelic name as well\n\tif \"Humanities\" in dept_name:\n\t\tdept_name = \"School of Humanities\"\n\n\t# ge... | [
"0.65008885",
"0.6420538",
"0.6307418",
"0.6182964",
"0.5921297",
"0.5848237",
"0.57895356",
"0.57528603",
"0.56621397",
"0.5610987",
"0.556793",
"0.5543805",
"0.55181277",
"0.55117804",
"0.5501808",
"0.5497998",
"0.547425",
"0.54675233",
"0.5461011",
"0.5434933",
"0.5433778"... | 0.6498803 | 1 |
return event type uri that is the best match for the given label | def getEventTypeUri(self, eventTypeLabel: str):
matches = self.suggestEventTypes(eventTypeLabel)
if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]:
return matches[0]["uri"]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCategoryUri(self, categoryLabel: str):\n matches = self.suggestCategories(categoryLabel)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n return matches[0][\"uri\"]\n return None",
"def get_type_label(type_url):\n retur... | [
"0.5890905",
"0.5888158",
"0.5736647",
"0.57230157",
"0.57189935",
"0.56664103",
"0.5650868",
"0.5550143",
"0.5519739",
"0.54728514",
"0.5453214",
"0.5382518",
"0.53772074",
"0.533073",
"0.5309743",
"0.52296954",
"0.51811314",
"0.5180448",
"0.5166474",
"0.51578933",
"0.514757... | 0.7921001 | 0 |
if you have article urls and you want to query them in ER you first have to obtain their uris in the ER. articleUrls a single article url or a list of article urls returns dict where key is article url and value is either None if no match found or a string with article URI. | def getArticleUris(self, articleUrls: Union[str, List[str]]):
assert isinstance(articleUrls, (six.string_types, list)), "Expected a single article url or a list of urls"
return self.jsonRequest("/api/v1/articleMapper", { "articleUrl": articleUrls }) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_article_dictionary(url):\n articles = {\"title\": get_article_title(url), \"content\": get_article_body(url)}\n return articles",
"async def get_article_links(self):\n urls = []\n for page in range(self._start, self._end+1):\n urls.append(self._searchURL + str(page))\n ... | [
"0.6657474",
"0.6604622",
"0.65535355",
"0.65198207",
"0.6463539",
"0.6353567",
"0.6336571",
"0.61973166",
"0.61275584",
"0.6114767",
"0.6050255",
"0.60251725",
"0.5979369",
"0.58659524",
"0.5813537",
"0.5808789",
"0.57911414",
"0.5790488",
"0.57822967",
"0.5779605",
"0.56730... | 0.68681526 | 0 |
return the list of URIs of all known source groups | def getSourceGroups(self):
ret = self.jsonRequest("/api/v1/sourceGroup/getSourceGroups", {})
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sources(self):\n srcs = GroupResolver.sources(self)\n if srcs:\n srcs.remove(self.default_sourcename)\n srcs.insert(0, self.default_sourcename)\n return srcs",
"def source_list(self):\n return list(self._client.group.streams_by_name().keys())",
"def source_... | [
"0.7338798",
"0.6820434",
"0.6810196",
"0.64609927",
"0.6334199",
"0.62872773",
"0.62260437",
"0.6215513",
"0.61615586",
"0.6148272",
"0.614812",
"0.6053038",
"0.6036904",
"0.6008529",
"0.6004802",
"0.59989154",
"0.5949554",
"0.5941072",
"0.5938796",
"0.58946294",
"0.5885352"... | 0.70465386 | 1 |
return info about the source group | def getSourceGroup(self, sourceGroupUri: str):
ret = self.jsonRequest("/api/v1/sourceGroup/getSourceGroupInfo", { "uri": sourceGroupUri })
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_group_id(self):\n return self._source_group_id",
"def getSourceGroups(self):\n ret = self.jsonRequest(\"/api/v1/sourceGroup/getSourceGroups\", {})\n return ret",
"def getGroup(self):\n\t\treturn self.Group",
"def _source(self, namespace):\n if not namespace:\n ... | [
"0.6965876",
"0.63914514",
"0.63097787",
"0.6098065",
"0.6034737",
"0.6034737",
"0.6034737",
"0.6034737",
"0.6034737",
"0.6034737",
"0.5995682",
"0.5991559",
"0.59797585",
"0.5949926",
"0.594139",
"0.59092706",
"0.58857083",
"0.5862467",
"0.5850348",
"0.5844907",
"0.58210206"... | 0.65173215 | 1 |
Given a 10x BAM entry as a pysam.AlignedSegment, extract the barcode, UMI, and sequence. | def extract_10x(alignment):
barcode = alignment.get_tag('CR')
umi = alignment.get_tag('UR')
# The quality scores for the sequence is returned as an array.array of
# unsigned chars.
sequence = alignment.query_sequence
return ([barcode], [umi], sequence) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_bam():\n global sample_name, header, segmentID, bam\n sys.stderr.write(time.strftime(\"%c\") + \" Busy with parsing bam file...\\n\")\n bam = pysam.AlignmentFile(NanoSV.opts_bam, 'rb')\n if not bam.has_index():\n sys.exit('The bam has no index file')\n header = bam.header\n if 'H... | [
"0.6318754",
"0.5959911",
"0.57797533",
"0.56292635",
"0.5563726",
"0.5562032",
"0.54856086",
"0.53108937",
"0.52643204",
"0.5243333",
"0.5230461",
"0.52059263",
"0.5188892",
"0.51638234",
"0.51475555",
"0.51249605",
"0.5097929",
"0.5083921",
"0.50224",
"0.500398",
"0.4997373... | 0.61430377 | 1 |
Detect what technology was used to generate this BAM. | def detect_technology(self):
logger.warning('Only 10x Genomics BAM files can be detected.')
with pysam.AlignmentFile(self.path, 'rb') as f:
# Check first read of file to see the headers.
for item in f.fetch(until_eof=True):
# This is a 10x BAM
if a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_technology(self, what):\n return self.form.set_value(\"technology\", what)",
"def supported_features(self):\n return SUPPORT_LGSMARTTV",
"def is_supported(self) -> bool:\n if self.builders and self.app.builder.name not in self.builders:\n return False\n if self... | [
"0.53937185",
"0.53510743",
"0.5293819",
"0.52716935",
"0.5255712",
"0.5241225",
"0.5211665",
"0.5197686",
"0.5197202",
"0.5197202",
"0.518907",
"0.51142985",
"0.5114245",
"0.51077163",
"0.5107098",
"0.5107098",
"0.5100026",
"0.509623",
"0.50713795",
"0.5060234",
"0.50579786"... | 0.6483788 | 0 |
Evaluate current holding stocks at Today and update cur stock attribute | def evaluate_cur_stocks(self):
today = datetime.today()
close_val = PRICE_DF.iloc[PRICE_DF.index.get_loc(today, method="ffill")]
close_val = close_val[self.cur_stocks.index]
close_val = pd.DataFrame({"PRICE_CURRENT" : close_val.values}, index=self.cur_stocks.index)
evaluated_stoc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(stock):\n fetch_data_yahoo(stock) \n if stock['Cap'] != None:\n calc_class(stock)",
"async def daily(self, ctx):\r\n # TODO: Asssess whether this can be cleaned up. \r\n # As it stands, very similar to inv()\r\n author = ctx.author\r\n with DB() as db:\r\n ... | [
"0.7198389",
"0.67817557",
"0.6673082",
"0.6595928",
"0.6560851",
"0.6535039",
"0.6521472",
"0.6423094",
"0.6384765",
"0.63523483",
"0.6341521",
"0.63283294",
"0.62257564",
"0.6195676",
"0.60492074",
"0.6039613",
"0.6026212",
"0.6016211",
"0.59771603",
"0.59657294",
"0.591991... | 0.7214952 | 0 |
Generates the stable link and returns it. If the link could not be generated because the source file was not found ``None`` is returned. Call ``close`` to delete the link. | def link(self):
self.__enter__()
return self.stable_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __enter__(self):\n if self.stable_path:\n return self.stable_path\n \n _, file_name = os.path.split(self._source_path)\n stable_dir = tempfile.mkdtemp(prefix=\"%s-\" % file_name)\n assert self._source_path.startswith(\"/\")\n stable_path = os.path.join(stabl... | [
"0.5937122",
"0.58447796",
"0.5743967",
"0.56529963",
"0.5629153",
"0.5612357",
"0.55422425",
"0.5530858",
"0.54267585",
"0.53902197",
"0.52353996",
"0.5191223",
"0.51137",
"0.5081782",
"0.5077057",
"0.5065889",
"0.50577205",
"0.5030819",
"0.5026374",
"0.50132394",
"0.5006848... | 0.61671346 | 0 |
Enters the context and returns self if the link could be created. If the link could not be created because the source path did not exist ``None`` is returned. | def __enter__(self):
if self.stable_path:
return self.stable_path
_, file_name = os.path.split(self._source_path)
stable_dir = tempfile.mkdtemp(prefix="%s-" % file_name)
assert self._source_path.startswith("/")
stable_path = os.path.join(stable_dir, self._sou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link(self):\n\n if self.path_source is not None:\n full_source_path = os.path.join(\n os.path.expandvars(self.path_source), self.name\n )\n full_destination_path = os.path.join(\n os.path.expandvars(self.path_destination), self.name\n ... | [
"0.57441884",
"0.5403153",
"0.52979624",
"0.5242806",
"0.5223527",
"0.5191228",
"0.5150666",
"0.51408464",
"0.51333934",
"0.51022995",
"0.50961906",
"0.5043649",
"0.5019827",
"0.5007971",
"0.4994224",
"0.4989699",
"0.49889046",
"0.49748132",
"0.4961593",
"0.49501863",
"0.4932... | 0.6574273 | 0 |
Return a list of all pypet trajectory names in a a given hdf5 file. | def getTrajectorynamesInFile(filename):
assert pathlib.Path(filename).exists(), f"{filename} does not exist!"
hdf = h5py.File(filename, "r")
all_traj_names = list(hdf.keys())
hdf.close()
return all_traj_names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def labels(self):\n with self._h5file('r') as h5file:\n return list(h5file.keys())",
"def list_h5(walk_dir):\n\n file_list = []\n for root, subdirs, files in os.walk(walk_dir):\n\n for filename in files:\n file_path = os.path.join(root, filename)\n if file_pat... | [
"0.5963088",
"0.59348214",
"0.5826333",
"0.58148545",
"0.5610662",
"0.56103677",
"0.55904347",
"0.5585358",
"0.5580575",
"0.5579591",
"0.5578491",
"0.5534216",
"0.54983604",
"0.5476016",
"0.54249066",
"0.5373145",
"0.5356421",
"0.53518355",
"0.53175646",
"0.5283302",
"0.52732... | 0.8125475 | 0 |
Function uses itertools.combinations to generate possible permutations of minterms and xterms | def get_pairs(terms):
return itertools.combinations(terms, 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permutations(xs):\n if not xs:\n yield []\n else:\n for x, xs in selections(xs):\n for ys in permutations(xs):\n yield [x] + ys",
"def get_combinations(self):\n all_steps = self.do_steps()\n self.option = [k for k, v in all_steps.items()]\n r... | [
"0.63869417",
"0.62922204",
"0.6280528",
"0.60896415",
"0.60720867",
"0.6060668",
"0.6060022",
"0.6006552",
"0.5943192",
"0.59218216",
"0.59115046",
"0.5862979",
"0.586069",
"0.58377963",
"0.5827487",
"0.5826101",
"0.5818908",
"0.57880336",
"0.57866234",
"0.576338",
"0.575172... | 0.6309878 | 1 |
Function takes an input of possible pairs and returns a set of reduced pairs | def reduce_pairs(pairs):
return set(map(reduce_bits, filter(differ_by_one, pairs))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pair_combos(iterable):\n pairs = set()\n for a in iterable:\n for b in iterable:\n pairs.add(a + b)\n return list(pairs)",
"def all_pairs(elements):\n if len(elements) < 2:\n return []\n elif len(elements) == 2:\n return [(elements[0], elements[1])]\n else:\n... | [
"0.6682539",
"0.6649223",
"0.658668",
"0.6501677",
"0.6372383",
"0.63125974",
"0.62352455",
"0.615719",
"0.6116768",
"0.6116768",
"0.61058265",
"0.6084855",
"0.6050953",
"0.60320103",
"0.6000207",
"0.59864324",
"0.5941454",
"0.59207493",
"0.59112364",
"0.58852816",
"0.5879278... | 0.8235042 | 0 |
Function returns list of essential prime implicants. If any term in m_terms is covered by only one primeimplicant, that primeimplicant is considered to be essential. | def terms_covered_once(prime_implicants, m_terms):
covered = []
for prime_implicant in prime_implicants:
for covered_term in prime_implicant.get_covered_terms():
covered.append(covered_term)
return [i for i in covered if covered.count(i) == 1 and i in m_terms] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_term_max_coverage(prime_implicants, m_terms):\n term_max_coverage = max(prime_implicants, key=lambda prime_implicant: len(\n [i for i in prime_implicant.get_covered_terms() if i in m_terms]))\n\n return term_max_coverage",
"def getInterim(self):\n return [x for x in self.xeps if x.int... | [
"0.51042086",
"0.50913125",
"0.50038147",
"0.49761307",
"0.4944465",
"0.49364462",
"0.4881296",
"0.48746046",
"0.48463184",
"0.48211226",
"0.48175967",
"0.48172054",
"0.4810883",
"0.48001704",
"0.4791628",
"0.47870997",
"0.47426683",
"0.46842042",
"0.46507025",
"0.46479034",
... | 0.700567 | 0 |
Function returns the prime implicant that covers the most m_terms | def get_term_max_coverage(prime_implicants, m_terms):
term_max_coverage = max(prime_implicants, key=lambda prime_implicant: len(
[i for i in prime_implicant.get_covered_terms() if i in m_terms]))
return term_max_coverage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def problem41():\n for i in range(len(PANDIGITAL), 1, -1):\n cur_max = 0\n for p in itertools.permutations(PANDIGITAL[:i]):\n n = int(\"\".join(p))\n if pelib.is_prime(n) and n > cur_max:\n cur_max = n\n\n if cur_max > 0:\n return cur_max",
... | [
"0.6628919",
"0.6173766",
"0.6173766",
"0.6153234",
"0.60713315",
"0.5992777",
"0.59897196",
"0.5982625",
"0.59818715",
"0.59119636",
"0.58534485",
"0.58469534",
"0.5822166",
"0.58060354",
"0.57984334",
"0.57881075",
"0.57745135",
"0.5755864",
"0.5747243",
"0.57214177",
"0.56... | 0.7448263 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.