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
Iterator that returns the bytes of the response body for a given stream ID.
async def _receive_response_body( self, request: Request, stream_id: int ) -> typing.AsyncIterator[bytes]: while True: event = await self._receive_stream_event(request, stream_id) if isinstance(event, h2.events.DataReceived): amount = event.flow_controlled_len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response_content_iterator(self):\n return self.__response.iter_lines()", "def __iter__(self):\n\n # TODO: handle chunked encoding delimited by marker instead\n # of content-length.\n\n while True:\n length = None\n #if line == (self._boundary+\"\\r\\n\")....
[ "0.61358917", "0.6123353", "0.6057051", "0.60289896", "0.5983753", "0.5909031", "0.5810524", "0.5794002", "0.5766743", "0.5695455", "0.56794715", "0.5671418", "0.5658921", "0.5627791", "0.55683047", "0.5547662", "0.55458444", "0.5544601", "0.5536769", "0.552991", "0.55196744"...
0.7502432
0
Return the next available event for a given stream ID. Will read more data from the network if required.
async def _receive_stream_event( self, request: Request, stream_id: int ) -> typing.Union[ h2.events.ResponseReceived, h2.events.DataReceived, h2.events.StreamEnded ]: while not self._events.get(stream_id): await self._receive_events(request, stream_id) event = self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next(self):\r\n ready = select.select([self.filehandle],[ ], [ ], 0)[0]\r\n if ready:\r\n s = os.read(self.filehandle, Format.EventSize)\r\n if s:\r\n event = EventStruct.EventStruct(self)\r\n event.decode(s)\r\n return event\r\n\r\n return None", "async def _receive_e...
[ "0.6233481", "0.5948379", "0.5873502", "0.586125", "0.58496654", "0.5819283", "0.58116215", "0.5764286", "0.5751719", "0.54642206", "0.5444975", "0.54362226", "0.5429541", "0.54216844", "0.54054767", "0.54040897", "0.53794587", "0.5367628", "0.5361919", "0.53495556", "0.53477...
0.6584154
0
Returns the maximum allowable outgoing flow for a given stream. If the allowable flow is zero, then waits on the network until WindowUpdated frames have increased the flow rate.
async def _wait_for_outgoing_flow(self, request: Request, stream_id: int) -> int: local_flow: int = self._h2_state.local_flow_control_window(stream_id) max_frame_size: int = self._h2_state.max_outbound_frame_size flow = min(local_flow, max_frame_size) while flow == 0: await s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_flow(self, source, sink):\n\n max_flow = 0\n\n for i in range(self.V):\n for j in range(self.V):\n self.flow[i, j] = 0\n\n while self.bfs(source, sink):\n increment = maxint\n\n u = sink\n\n while self.pred[u] != -1:\n ...
[ "0.6194889", "0.6043823", "0.5908881", "0.55964226", "0.5325499", "0.53132993", "0.51967525", "0.5127323", "0.4998654", "0.49965987", "0.4975326", "0.49690938", "0.49684918", "0.48983842", "0.48562852", "0.48515046", "0.48479512", "0.48470542", "0.48407075", "0.48086783", "0....
0.7008591
0
`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.
def parse(self, response): links_list = self._get_links(response) location = self._parse_location(response) ids_list = [] start_time = self._parse_time(response) for item in response.css("article p"): start = self._parse_start(item, start_time) if not sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_meetings(self, response):\n response_text = \" \".join(\n response.css(\".page-full-description *::text\").extract()\n )\n self._validate_location(response_text)\n year_str = re.search(\n r\"\\d{4}\", response.css(\"h1.page-heading::text\").extract_first...
[ "0.76047134", "0.748884", "0.725429", "0.72303206", "0.7065225", "0.6969813", "0.67283374", "0.6541739", "0.6381022", "0.6344331", "0.6323085", "0.6306349", "0.61575264", "0.6151112", "0.609193", "0.6073294", "0.606699", "0.604515", "0.6007712", "0.5919449", "0.5883639", "0...
0.7757175
0
Implement bfs on graph from start node.
def bfs(graph, start_node): start_node.distance = 0 start.set_predecessor(None) queue = list() queue.append(start_node) while (len(queue) > 0): current_vertex = queue.pop() current_vertex.setState = "visiting" for vertex in current_vertex.links(): if (vertex.getSt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs_iterative(graph,start):\n\tvisited = set()\n\twatched = set()\n\tnodes_queue = [start] # List that helps as queue\n\twatched.add(start)\n\t\n\twhile nodes_queue:\n\t\tcurrent_node = nodes_queue.pop(0)\n\n\t\tprint(\"visiting\",current_node)\n\t\tvisited.add(current_node)\n\t\t\n\t\tfor adjacent_node in gra...
[ "0.8021", "0.7997895", "0.7961448", "0.78476804", "0.7837276", "0.7739906", "0.7644392", "0.7631997", "0.7578014", "0.7574275", "0.7545059", "0.7529398", "0.75164115", "0.7511431", "0.7448759", "0.73999006", "0.73608285", "0.7345987", "0.73276716", "0.7322407", "0.7304917", ...
0.8236553
0
Creation of new directory with the desired species path_to_aug string with the correct path to the augustus directory species the desired species
def newDirectory(path_to_aug, species): speciesfolder = "{}/config/species/{}".format(path_to_aug, species) print "Create species directory" if os.path.isdir(speciesfolder): print "Directory already exists" pass else: print "Creation of species directory" cmd = "mkdir {}".format(speciesfolder) e = subproc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dir(name_new_path):\n\n try:\n os.mkdir(config_tools.full_dest + name_new_path)\n except OSError:\n print(\"Создать директорию %s не удалось\" % name_new_path)\n else:\n print(\"Успешно создана директория %s \" % name_new_path)", "def Create_my_dir(new_path): #Create path...
[ "0.6143571", "0.5885292", "0.57949185", "0.57169855", "0.56995356", "0.56773305", "0.5616223", "0.55676544", "0.54721105", "0.54696065", "0.54420125", "0.5433205", "0.5414983", "0.54034716", "0.5399662", "0.5398386", "0.5390882", "0.5374036", "0.53519017", "0.53428894", "0.53...
0.80330485
0
Copy generic files to species directory path_to_aug string with the correct path to the augustus directory species the desired species path_to_species path to the desired species
def copyGenericFiles(path_to_aug, species, path_to_species): print "Copy generic files to species folder ..." cmd_copy_files = "cp -a {}/config/species/generic/* {}".format(path_to_aug, path_to_species) if not os.listdir(path_to_species): print "Files are copied" e = subprocess.check_call(cmd_copy_files, shell=T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_map_files(species: list, all_names: list, specific_names: list, point_locations: dict) -> None:\n def copy_file(filename: str) -> None:\n try:\n shutil.copy2(filename, WEBOUT_PATH + \"maps/\")\n except FileNotFoundError:\n report_error(\"Missing file: \" + filename)\...
[ "0.570463", "0.5573707", "0.54315513", "0.54212296", "0.54039174", "0.5377379", "0.5303642", "0.5206441", "0.5163676", "0.51593757", "0.5155531", "0.51527673", "0.51504374", "0.51358163", "0.5097388", "0.5096156", "0.50612074", "0.50554234", "0.50457835", "0.50153804", "0.498...
0.79828143
0
Change file names in species folder speciesfolder path to the species species name species (string)
def changeFilenames(speciesfolder, species): for filename in os.listdir(speciesfolder): if filename.startswith("generic"): newname = filename.replace("generic", species) os.rename(os.path.join(speciesfolder, filename), os.path.join(speciesfolder, newname))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ren_mosaic(mosaic_dir='K:/IID_SaltonSea/Tasks/Soil mapping/PhotoDocumentation/Original/', \r\n file_pattern='*stitch.jpg'): \r\n \r\n \r\n if not os.path.exists(mosaic_dir):\r\n sys.exit('input folder does not exist')\r\n \r\n mosaics = []\r\n for root, dirnames, filena...
[ "0.5825194", "0.5745104", "0.5661004", "0.5641889", "0.5626973", "0.5587708", "0.55794007", "0.55673516", "0.55372524", "0.55338824", "0.5522121", "0.54934716", "0.5491455", "0.54901576", "0.54853535", "0.54637", "0.5458646", "0.54492426", "0.54427385", "0.5432158", "0.542035...
0.74296135
0
Change parameter file based on the species speciesfolder path to the species species name species (string)
def changeParameterFile(speciesfolder, species): with open("{}/{}_parameters.cfg".format(speciesfolder, species), "r+") as inFile: for line in inFile: if "generic" in line: inFile.write(line.replace("generic", species)) else: inFile.write(line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateParameters(self, parameters):\r\n\r\n ##if parameters[0].altered:\r\n ## in_nc_file = parameters[0].valueAsText\r\n ##\r\n ## # Set output workspace and default name\r\n ## workspace = os.path.dirname(in_nc_file)\r\n ## parameters[1].value = os.path.j...
[ "0.59573966", "0.5866064", "0.5679781", "0.5528027", "0.5494092", "0.53728706", "0.53049445", "0.52725124", "0.5258899", "0.5250758", "0.52365535", "0.5221818", "0.5221145", "0.5217603", "0.5206605", "0.51915187", "0.5186459", "0.51603144", "0.50927293", "0.5076365", "0.50761...
0.7661639
0
Appending to index list indexlist indexlist l position
def appendList(indexlist, l): appendedList = [] for i in indexlist: appendedList.append(l[i]) return appendedList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_index(index, keyword, url):\n for entry in index:\n if entry[0] == keyword:\n for link in entry[1]:\n if link[0] == url:\n return\n entry[1].append([url, 0])\n return\n # not found, add new keyword to index\n index.append...
[ "0.63164335", "0.6106782", "0.6098579", "0.5910265", "0.5844025", "0.5824385", "0.58175665", "0.58128893", "0.5767512", "0.5744374", "0.5744374", "0.573304", "0.5712539", "0.5703533", "0.5694374", "0.56741184", "0.5659871", "0.5654996", "0.565198", "0.562455", "0.5623952", ...
0.6954608
0
Split genbank file into training and testset gb genbankfile p percentage in trainingset
def splitGenbankInTrainTest(gb, p): print "Creation of training and test set" entries = list(SeqIO.parse(gb, 'genbank')) num_entries = len(entries) percentage = (len(entries) * p) / 100 train = set(random.sample(list(set(range(len(entries)))), percentage)) test = set(range(len(entries))) - train trainingset = ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeGB(path, train, test):\n\tprint \"Creation of output directory\"\n\tif os.path.isdir(\"{}/output\".format(path)):\n print \"Directory already exists\"\n pass\n else:\n cmd = \"mkdir {}/output\".format(path)\n e = subprocess.check_call(cmd,...
[ "0.6320145", "0.6252562", "0.61847085", "0.602433", "0.6019519", "0.59578097", "0.59377843", "0.5936306", "0.5920327", "0.58385766", "0.5822642", "0.58192265", "0.580331", "0.5770471", "0.57699776", "0.5744256", "0.57158554", "0.5714885", "0.57105845", "0.5706856", "0.5703367...
0.78244436
0
Optimising augustus parameters path_to_aug path to augustus species name of species train trainingsfile
def optimiseParameters(path_to_aug, species, path_to_training): training = {} cmd = "{}/scripts/optimize_augustus.pl --species={} --metapars={}/config/species/{}/{}_metapars.cfg --aug_exec_dir={}/bin --AUGUSTUS_CONFIG_PATH={}/config {}/output/trainingSet.gb" \ .format(path_to_aug, species, path_to_aug, species, spe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def etraining(path_to_aug, species, path_to_save):\n\tcmd = \"{}/bin/etraining --species={} --AUGUSTUS_CONFIG_PATH={}/config {}/output/trainingSet.gb\"\\\n\t.format(path_to_aug, species, path_to_aug, path_to_save)\n\te = subprocess.check_call(cmd, shell=True)", "def train(self, trainfile):", "def modelarts_pre...
[ "0.65137494", "0.5510236", "0.5253078", "0.52287245", "0.5184448", "0.5167022", "0.5157434", "0.50859797", "0.5085768", "0.50851536", "0.50744283", "0.50124586", "0.50039375", "0.4999067", "0.4998801", "0.4997238", "0.49764267", "0.49434403", "0.49311203", "0.49129522", "0.48...
0.7516264
0
Perform etraining path_to_aug path to augustus species speciesname path_to_save
def etraining(path_to_aug, species, path_to_save): cmd = "{}/bin/etraining --species={} --AUGUSTUS_CONFIG_PATH={}/config {}/output/trainingSet.gb"\ .format(path_to_aug, species, path_to_aug, path_to_save) e = subprocess.check_call(cmd, shell=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimiseParameters(path_to_aug, species, path_to_training):\n\n\ttraining = {}\n\tcmd = \"{}/scripts/optimize_augustus.pl --species={} --metapars={}/config/species/{}/{}_metapars.cfg --aug_exec_dir={}/bin --AUGUSTUS_CONFIG_PATH={}/config {}/output/trainingSet.gb\" \\\n\t.format(path_to_aug, species, path_to_au...
[ "0.63730925", "0.57556576", "0.5623206", "0.5551136", "0.5501996", "0.5418961", "0.54180324", "0.539632", "0.5393347", "0.5360482", "0.5342039", "0.5302968", "0.5302308", "0.52957207", "0.5288203", "0.5287659", "0.52853554", "0.5269804", "0.526962", "0.52682483", "0.5260086",...
0.75250244
0
Implements mirroring of player. Transports the player to the other of of the screen if he passes the boundry
def mirror(self): screen_width = self.game.screen.get_width() screen_height = self.game.screen.get_height() if self.rect.centerx < 0 and self.vx < 0: self.rect.centerx = screen_width if self.rect.centerx > screen_width: self.rect.centerx = 0 if s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mirror(self):\n self.__mirror = not self.__mirror", "def pass_player(self):\n # pass control to next player by asking game who that is\n self.disable_all_buttons()\n self.game.pass_control_next(self)", "def player_movement(self):", "def _drive_player_position(self) -> None:\n ...
[ "0.6227395", "0.6102733", "0.6100861", "0.6021791", "0.6008425", "0.5997475", "0.5983257", "0.5978844", "0.5970339", "0.5945614", "0.5880202", "0.58734053", "0.58724165", "0.58650136", "0.58636826", "0.58417666", "0.58116984", "0.57864004", "0.57395214", "0.5725141", "0.57104...
0.6891257
0
Computes log(K) = C / epsilon.
def compute_log_K(alpha: torch.FloatTensor, beta: torch.FloatTensor) -> torch.FloatTensor: return mask * (-C + alpha.unsqueeze(dim=-1) + beta.unsqueeze(dim=-2)) / epsilon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_K(alpha: torch.FloatTensor,\n beta: torch.FloatTensor) -> torch.FloatTensor:\n return torch.exp(compute_log_K(alpha, beta))", "def idcg(k):\n res = sum([1.0 / math.log(i + 2, 2) for i in range(k)])\n if not res:\n return 1.0\n else:\n ...
[ "0.6844799", "0.67468244", "0.6571914", "0.65354055", "0.6519161", "0.6514883", "0.65103704", "0.64965874", "0.638118", "0.6381043", "0.63675636", "0.6359294", "0.6356065", "0.6330975", "0.6328366", "0.63213104", "0.63130784", "0.6307222", "0.6289166", "0.6267791", "0.6260960...
0.73483366
0
Computes K = exp(C / epsilon).
def compute_K(alpha: torch.FloatTensor, beta: torch.FloatTensor) -> torch.FloatTensor: return torch.exp(compute_log_K(alpha, beta))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energyK(k):\r\n C1 = 9.7846113e-07\r\n C2 = 12.263868e0 \r\n E = (-1.0 + np.sqrt(1.0 + 4.0 * C1 * C2**2 * k**2))/(2.0 * C1)\r\n return E", "def em_epsilon_cdp(epsilon, delta, k):\n if delta <= 0:\n return epsilon / k\n else:\n log_delta = np.log(1 / delta)\n return max(\n epsilo...
[ "0.68733776", "0.6838605", "0.67226547", "0.6720718", "0.66450894", "0.6602795", "0.6544375", "0.6368502", "0.6362436", "0.6273013", "0.6218804", "0.62136215", "0.61936444", "0.61768174", "0.614871", "0.6137814", "0.61066556", "0.60865957", "0.6072078", "0.60485095", "0.60358...
0.70685536
0
Performs batched sinkhorn or sinkhorn_epsilon_scaling.
def batch_sinkhorn(C_list: List[torch.FloatTensor], a_list: Optional[List[torch.FloatTensor]] = None, b_list: Optional[List[torch.FloatTensor]] = None, alpha_list: Optional[List[torch.FloatTensor]] = None, beta_list: Optional[List[torch.FloatTe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sinkhorn_epsilon_scaling(C: torch.FloatTensor,\n a: Optional[torch.FloatTensor] = None,\n b: Optional[torch.FloatTensor] = None,\n alpha: Optional[torch.FloatTensor] = None,\n beta: Optional[torch.Fl...
[ "0.6512973", "0.57170856", "0.5676052", "0.5310663", "0.5206009", "0.518024", "0.51277035", "0.5094222", "0.50904757", "0.50467855", "0.50214964", "0.50208896", "0.49705562", "0.49700397", "0.49684253", "0.4946798", "0.4945488", "0.49284238", "0.49186075", "0.4913353", "0.486...
0.57490695
1
Attempts to find a vimpress tag containing a URL for a markdown attachment and parses it. post the content of a post a dictionary with the attachment's content and URL
def blog_get_mkd_attachment(post): attach = dict() try: lead = post.rindex("<!-- ") data = re.search(g_data.TAG_RE, post[lead:]) if data is None: raise VimPressFailedGetMkd("Attached markdown not found.") attach.update(data.groupdict()) attach["mkd_rawtext"] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(text):\n md = markdown.Markdown(['codehilite', 'tables', ])\n\n for iref in re.findall(img_ref_re, text):\n img_id = iref[7]\n try:\n image = FlatPageImage.objects.get(pk=int(img_id))\n md.references[img_id] = (image.image_path.url, '')\n except ObjectDoes...
[ "0.5959062", "0.5766919", "0.5712638", "0.5691578", "0.5690094", "0.5644837", "0.5636878", "0.5609033", "0.55889827", "0.5381469", "0.53029937", "0.527546", "0.5231224", "0.5158965", "0.5147675", "0.5121978", "0.51037097", "0.5094495", "0.50256884", "0.5018789", "0.5013733", ...
0.6503844
0
xaxis label and units. Axis labels know about units. We need to do this so that we can detect when axes are not commesurate. Currently this is ignored other than for formatting purposes.
def xaxis(self,label,units): if units != "": label = label + " (" + units + ")" self.xbox.set_text(r"$%s$" % (label)) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xaxis(self,label,units):\n if units != \"\": label = label + \" (\" + units + \")\"\n self.subplot.set_xlabel(label)\n pass", "def set_xunits(self, units, include_brackets):\n if include_brackets:\n plt.xlabel(\n \"x (\" + self.xunits_from_units(units=uni...
[ "0.77864", "0.68611026", "0.6854408", "0.65931517", "0.6455449", "0.64169616", "0.63975906", "0.6340904", "0.6327228", "0.62637603", "0.62549233", "0.62412125", "0.6206764", "0.61634564", "0.6145363", "0.61047965", "0.6085972", "0.60728234", "0.6061254", "0.6040449", "0.60404...
0.7472149
1
yaxis label and units.
def yaxis(self,label,units): if units != "": label = label + " (" + units + ")" self.ybox.set_text(r"$%s$" % (label)) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaxis(self,label,units):\n if units != \"\": label = label + \" (\" + units + \")\"\n self.subplot.set_ylabel(label)\n pass", "def ylabel(ylabel):\n impl.ylabel(**locals())", "def labels_y(y_unit, latex = True, verbose = 0): \n\n if verbose > 1:\n print(\"Spectra...
[ "0.8391478", "0.7328002", "0.7229695", "0.72150916", "0.7116793", "0.70888394", "0.70200956", "0.7003589", "0.6940507", "0.6940507", "0.6785098", "0.67295647", "0.67104685", "0.66930753", "0.6681132", "0.66706085", "0.6655517", "0.6536776", "0.65352345", "0.65045035", "0.6448...
0.83645123
1
Generate an IC object from an arbitrary distribution. `dist` should be a 1 dimensional numpy array which sums to 1. Note that ICArbitrary is a function, not an InitialCondition object, so it cannot be passed directly. It returns an instance of a an InitialCondition object which can be passed. So in place of, e.g. ICUni...
def ICArbitrary(dist): class ICArbitrary(InitialCondition): """Initial condition from an arbitrary distribution""" name = "Arbitrary distribution" required_parameters = [] def get_IC(self, x, _prevdist=dist, *args, **kwargs): assert len(x) == len(_prevdist) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def functional(cls):\n def intrinsic(dist, rvs=None, crvs=None, rv_mode=None, nhops=None, bound=None):\n opt = cls(dist, rvs, crvs, rv_mode, bound=bound)\n opt.optimize(nhops=nhops)\n return opt.objective(opt._optima)\n\n intrinsic.__doc__ = \\\n \"\"\"\n ...
[ "0.5464289", "0.5242857", "0.50867677", "0.5008406", "0.4976408", "0.4899326", "0.48962682", "0.48933327", "0.47949597", "0.46899083", "0.46655878", "0.4659807", "0.46482962", "0.464026", "0.46331087", "0.46026614", "0.45762175", "0.45641875", "0.45263946", "0.45256034", "0.4...
0.87948656
0
Remove a item from the newspane and the database. Needs the wxID of the Newsitem and the item itself
def removeItem(self, cId, item): # XXX better give more data to deleteitem # remove from db tv.aggregator.db.items.deleteitem(item['guid']) # remove window self.sizer.Remove(self.FindWindowById(cId)) wxCallAfter(self.FindWindowById(cId).Destroy) self.fixlayout()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item_page(request):\n validate(instance=request.body, schema=item_schema_remove)\n body = json.loads(request.body)\n Item.remove_item(body['item_id'])\n return HttpResponse('success')", "def removeItem(*args):", "def removeItem(*args):", "def delete_item(self):\n\n\t\tdb.session.delete...
[ "0.6677025", "0.6658152", "0.6658152", "0.6656285", "0.6550499", "0.6349446", "0.62874526", "0.61035067", "0.61012626", "0.6099826", "0.60991204", "0.6098807", "0.60806286", "0.6074772", "0.6055283", "0.6053414", "0.6047282", "0.60225457", "0.6017202", "0.6017018", "0.6013567...
0.703247
0
This function wraps ```target`` for symbolic tracing. This function wraps ```target``` so that its wrapper produces torch.fx.Proxy in symbolic computation. The returned values are the wrapper and then the original function. Per `_TORCH_METHODS_TO_PATCH`, this function shall receive `torch.arange`, `torch.tensor`, etc. ...
def _wrap_for_symbolic_trace(target: Callable) -> Tuple[Callable, Callable]: @functools.wraps(target) def wrapper(*args, **kwargs): proxy = None def check_has_proxy(v): if isinstance(v, torch.fx.Proxy): nonlocal proxy proxy = v torch.fx.node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target(obj):\n pass", "def get_for_target(self, target):\n return self.get_for_targets([target])", "def translate(self, target) -> Symbol:\n pass", "def the(target: Target) -> \"SwitchTo\":\n return SwitchTo(target)", "def _module_expansion_symbolic_trace(\n root: Union[torch.nn....
[ "0.5747196", "0.5567357", "0.5447606", "0.5443272", "0.53636444", "0.5354897", "0.53466976", "0.5322086", "0.5199569", "0.5158691", "0.5132296", "0.5112975", "0.5112975", "0.5112856", "0.5102122", "0.50624114", "0.5044832", "0.50222284", "0.49999374", "0.49833405", "0.4980673...
0.76548725
0
Make a sequence complement table.
def _makeComplementTable(complementData): table = list(range(256)) for _from, to in complementData.items(): table[ord(_from[0])] = ord(to[0]) return ''.join(map(chr, table))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_reverse_complement(seq):\n \n comp ={\"A\":\"T\", \"T\":\"A\", \"G\":\"C\", \"C\":\"G\", \"a\":\"t\", \"t\":\"a\", \"g\":\"c\", \"c\":\"g\", \"N\":\"N\", \\\n \"R\":\"R\", \"K\":\"K\", \"M\":\"M\", \"B\":\"B\", \"V\":\"V\", \"S\":\"S\", \"W\":\"W\", \"D\":\"D\", \"-\":\"-\",\\\n ...
[ "0.6501026", "0.6488647", "0.640388", "0.6153819", "0.61240596", "0.58666384", "0.58515424", "0.57713187", "0.57382315", "0.57156706", "0.5689411", "0.5679388", "0.567545", "0.5655934", "0.5639121", "0.56217945", "0.5592256", "0.55711305", "0.5533279", "0.55189294", "0.550267...
0.73630214
0
Convert the read to a string format.
def toString(self, format_): if format_ == 'fasta': return '>%s\n%s\n' % (self.id, self.sequence) elif format_ == 'fastq': if self.quality is None: raise ValueError('Read %r has no quality information' % self.id) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readString(self) -> str:\n length = self._unpack('i', 4)\n\n return self._unpack('{:d}s'.format(length), length)", "def _convert_to_str(self, data):\n raise NotImplementedError()", "def read_string(self):\n return self.bits.read('bytes:{0}'.format(self.read_int())).decode(\"utf-...
[ "0.6382687", "0.609507", "0.5894697", "0.57790804", "0.5693771", "0.56932336", "0.5664807", "0.56570023", "0.5553377", "0.5550277", "0.5537743", "0.5533943", "0.5453415", "0.5445564", "0.5429702", "0.5423828", "0.53834105", "0.53597856", "0.5348985", "0.53437597", "0.53399736...
0.6645924
0
What fraction of a read's bases are in lowcomplexity regions? By convention, a region of low complexity is indicated by lowercase base letters.
def lowComplexityFraction(self): length = len(self) if length: lowerCount = len(list(filter(str.islower, self.sequence))) return float(lowerCount) / length else: return 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_base_usage(sequences):\n usage = {\"A\": 0, \"C\": 0, \"G\": 0, \"U\": 0}\n for sequence in sequences:\n for base in usage:\n usage[base] += sequence.count(base)\n return usage", "def base_width(self):\n return self.levels[0].modulo", "def count_umbiguous_bases(sequenc...
[ "0.5814465", "0.5770829", "0.5692989", "0.55663", "0.55663", "0.5555115", "0.55215675", "0.5501957", "0.5496135", "0.54394424", "0.53673625", "0.53662974", "0.5337772", "0.5323738", "0.5300254", "0.5274786", "0.526041", "0.5251321", "0.52420807", "0.5233878", "0.5214491", "...
0.58068293
1
A function which checks whether the sequence in a L{dark.Read} object corresponds to its readClass. For AA reads, more testing is done in dark.Read.AARead.checkAlphabet.
def checkAlphabet(self, count=10): if count is None: readLetters = set(self.sequence.upper()) else: readLetters = set(self.sequence.upper()[:count]) # Check if readLetters is a subset of self.ALPHABET. if self.ALPHABET is None or readLetters.issubset(self.ALPHABET...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CheckRead(read_name, seq, break_line, quality, fastq_fp, line_num):\n if not read_name[0] == \"@\":\n raise Exception(\"Read name does not start with @, line # {}\\n File: {}\".format(\n line_num, fastq_fp))\n for x in seq.upper():\n if x not in [\"A\",\"C\",\"T\",\"G\",\"N\"]:\n...
[ "0.632368", "0.60315424", "0.58719355", "0.57008255", "0.5690734", "0.56746614", "0.54589635", "0.5456177", "0.545491", "0.54282546", "0.540672", "0.53643364", "0.53334075", "0.52928025", "0.5234801", "0.52217376", "0.52216834", "0.5202329", "0.5178834", "0.5153207", "0.51347...
0.61482126
1
Yield all six translations of a nucleotide sequence.
def translations(self): rc = self.reverseComplement().sequence for reverseComplemented in False, True: for frame in 0, 1, 2: seq = rc if reverseComplemented else self.sequence # Get the suffix of the sequence for translation. I.e., # skip 0, 1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def four_reference_text_pipeline(*translations):\n yield translations[0]\n yield translations[1]\n yield translations[2]\n yield translations[3]\n tokens_list = hparams[\"tokenizer\"].encode_as_ids(translations[0])\n yield tokens_list\n tokens_bos = torch.LongTensor...
[ "0.6059625", "0.6018403", "0.57880634", "0.56806105", "0.5570136", "0.546635", "0.53193444", "0.5311218", "0.5291128", "0.5269481", "0.51834804", "0.5138069", "0.50862396", "0.50771385", "0.5071684", "0.50602746", "0.504725", "0.50450003", "0.5029184", "0.50080377", "0.500746...
0.6755874
0
Add a read to this collection of reads.
def add(self, read): self.additionalReads.append(read) self._length += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_read(self, read):\n r = Read(read)\n if read not in self.reads:\n self.reads[read] = r\n else:\n self.reads[read].visit_limit += 1\n self.num_reads += 1", "def add_read(self, new_read): \n if self.sampling:\n self.convert_to_list()\n ...
[ "0.808042", "0.7411734", "0.68958265", "0.68311065", "0.62779593", "0.6246678", "0.60918653", "0.6050086", "0.58991176", "0.58513534", "0.550182", "0.5469112", "0.542135", "0.5347459", "0.5224789", "0.5080593", "0.5008505", "0.49957517", "0.49563736", "0.4949133", "0.49041215...
0.82107294
0
Perform readlinelike operation with timeout.
def timed_readline(self, f, timeout): set_file_nonblock(f) output = [] inactive = 0 while 1: (rlist, dummy_wlist, dummy_xlist) = select.select( [f], [], [], 1.0) if not rlist: inactive += 1 # approx -- py select doesn't return tv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def read_console(self):\n while self.proc is not None and self.proc.poll() is None:\n line = await self.loop.run_in_executor(None, self.proc.stdout.readline) # Async readline\n # Parse the command output and get the time in epoch format\n match = re.match(r'\\[([0-9]{...
[ "0.6026271", "0.59889764", "0.59692883", "0.5956222", "0.5945973", "0.58354115", "0.5794735", "0.5748552", "0.5731926", "0.5697793", "0.5696456", "0.5635814", "0.5579214", "0.5563457", "0.5558049", "0.5558049", "0.5554711", "0.5548686", "0.5533317", "0.5529293", "0.5507688", ...
0.7396864
0
Return the pkginfo toplevel key from a plist file.
def get_pkginfo_template(pkginfo_template_path): pkginfo_template = FoundationPlist.readPlist( os.path.expanduser(pkginfo_template_path)).get("pkginfo") if not pkginfo_template: sys.exit("Pkginfo template format incorrect!. Quitting.") return pkginfo_template
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ParsePkgInfoFile(filename, valid_keys=None, required_keys=None):\n with open(filename) as f:\n return ParsePkgInfo(f.read(), filename, valid_keys, required_keys)", "def get_ploidy(ploidyfile) -> dict:\n print(ColorText('\\nLoading ploidy information ...').bold())\n # have user choose key to dict\n ...
[ "0.5996816", "0.5837237", "0.5746675", "0.57288826", "0.57207835", "0.55407083", "0.54388434", "0.5379934", "0.5370744", "0.5328257", "0.5327059", "0.5318612", "0.52531564", "0.52414703", "0.5228324", "0.5185797", "0.5165715", "0.5163009", "0.5163009", "0.5138028", "0.5135017...
0.6171984
0
Return a list of recipes read from a recipe list.
def get_recipes(recipe_list_path): autopkgr_path = os.path.expanduser( "~/Library/Application Support/AutoPkgr/recipe_list.txt") recipe_list_path = recipe_list_path if recipe_list_path else autopkgr_path if not os.path.exists(recipe_list_path): sys.exit("recipe_list file %s does not exist!" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_list_of_recipes():\n sub_list = []\n with open(args.input_file, 'r') as f:\n lines = [line if line == '\\n' else line.rstrip('\\n') for line in f]\n\n recipes_list = []\n for element in lines:\n if element == '\\n':\n recipes_list.append(sub_list)\n sub...
[ "0.7470539", "0.717811", "0.7038908", "0.7033371", "0.64647275", "0.63799167", "0.6242298", "0.61604017", "0.61157596", "0.60463846", "0.6003851", "0.6000612", "0.59400076", "0.59046197", "0.58528817", "0.58331937", "0.5828307", "0.58243436", "0.57668483", "0.5763964", "0.575...
0.829908
0
Make an override and return its path.
def make_override(recipe, override_dir): print "Making override for %s" % recipe command = ["/usr/local/bin/autopkg", "make-override", recipe] if override_dir: command.insert(2, "--override-dir=%s" % os.path.realpath(override_dir)) # autopkg will offer to search for missin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_override(filename, *args, **kwargs):\n return self.new_file_override()", "def set_override(self, name, override, group=None):\n opt_info = self._get_opt_info(name, group)\n opt_info['override'] = self._get_enforced_type_value(\n opt_info['opt'], override)\n opt...
[ "0.6520226", "0.62095386", "0.573181", "0.56803507", "0.5651182", "0.5482002", "0.5421072", "0.5411501", "0.5387884", "0.537388", "0.53623503", "0.53364706", "0.5333064", "0.5273208", "0.52662563", "0.52376485", "0.52246445", "0.52104706", "0.5176281", "0.5160675", "0.5157786...
0.64365965
1
Force values from pkginfo_template on override's pkginfo.
def apply_pkginfo_template(override, pkginfo_template): # Need to "convert" Objc object to dict. override["Input"]["pkginfo"].update(dict(pkginfo_template)) print "\tApplied pkginfo template."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pkginfo_template(pkginfo_template_path):\n pkginfo_template = FoundationPlist.readPlist(\n os.path.expanduser(pkginfo_template_path)).get(\"pkginfo\")\n if not pkginfo_template:\n sys.exit(\"Pkginfo template format incorrect!. Quitting.\")\n return pkginfo_template", "def __init__(...
[ "0.651707", "0.6157452", "0.59485507", "0.59267056", "0.58984643", "0.58731043", "0.5757216", "0.55956537", "0.5489911", "0.54655373", "0.5460054", "0.5455407", "0.537302", "0.5325744", "0.5272121", "0.5220368", "0.5197567", "0.51900387", "0.5176836", "0.5140331", "0.50660545...
0.8050933
0
Set nonblocking flag on a file object.
def set_file_nonblock(f, non_blocking=True): flags = fcntl.fcntl(f.fileno(), fcntl.F_GETFL) if bool(flags & os.O_NONBLOCK) != non_blocking: flags ^= os.O_NONBLOCK fcntl.fcntl(f.fileno(), fcntl.F_SETFL, flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_nonblocking():\n\n f = tempfile.TemporaryFile()\n flags = fcntl.fcntl(f, fcntl.F_GETFL, os.O_NONBLOCK)\n assert (flags | os.O_NONBLOCK) != flags\n altered_f = prefork.set_nonblocking(f)\n flags = fcntl.fcntl(f, fcntl.F_GETFL, os.O_NONBLOCK)\n assert (flags | os.O_NONBLOCK) == flags\n...
[ "0.80452585", "0.79865307", "0.78769994", "0.78668606", "0.7829774", "0.778213", "0.7100792", "0.64542323", "0.6275431", "0.62455535", "0.569278", "0.5561503", "0.55345726", "0.53661597", "0.5332685", "0.53267896", "0.5315666", "0.52533543", "0.5233728", "0.52281725", "0.5201...
0.845028
0
Ensure terminal colors are normal.
def reset_term_colors(): sys.stdout.write(ENDC)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_color():\n sys.stdout.write(\"\\033[0m\")", "def auto_color(stream=sys.stdin):\n term_name = os.environ.get(\"TERM\", \"\").lower()\n if (stream.isatty()\n and (term_name in KNOWN_TERMINAL_TYPES or \"xterm\" in term_name)):\n return VtColor()\n return NoColor()", "def no_col...
[ "0.7275579", "0.66686815", "0.6584957", "0.6521088", "0.6397339", "0.6316726", "0.6180367", "0.6164479", "0.61055285", "0.6091803", "0.6067145", "0.60187364", "0.59878695", "0.5919879", "0.58935785", "0.5887053", "0.5871885", "0.5869197", "0.5849964", "0.58365643", "0.5833972...
0.7521384
0
Generates all mipmaps for a 3D texture, using a gaussian function
def _generateMipmaps(self, tex): pstats_GenerateMipmaps.start() currentMipmap = 0 computeSize = self.settings.GridResolution self.generateMipmapsNode.setShaderInput("source", tex) self.generateMipmapsNode.setShaderInput( "pixelSize", 1.0 / self.settings.GridResolutio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_proba_map(img):\n method = 'cv2.TM_CCOEFF_NORMED'\n sigmas = [41,31,21,11]\n out = np.zeros(img.shape)\n for sigma in sigmas:\n size=3*sigma\n template = gaussian(size,sigma)\n template/=template.max()\n template*=255\n template = template.astype(np.uint8...
[ "0.5905259", "0.5502456", "0.5490559", "0.5466955", "0.54424596", "0.54394", "0.53396875", "0.53317976", "0.5315601", "0.5230808", "0.51939005", "0.51405245", "0.51367086", "0.5054312", "0.5041904", "0.5040171", "0.5032013", "0.5008445", "0.49599075", "0.4939015", "0.4924666"...
0.58834124
1
Clears a 3D Texture to
def _clear3DTexture(self, tex, clearVal=None): if clearVal is None: clearVal = Vec4(0) self.clearTextureNode.setShaderInput("target", tex, False, True, -1, 0) self.clearTextureNode.setShaderInput( "clearValue", clearVal) self._executeShader( self.cle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_environment_texture(self):\n self.UseImageBasedLightingOff()\n self.SetEnvironmentTexture(None)\n self.Modified()", "def clear_callback(surf, rect):\n surf.blit(SPRITES, (rect.x, rect.y), (*PASSAGE, rect.width, rect.height))", "def clear(self):\r\n if self.groundPath:\...
[ "0.6235203", "0.62056243", "0.6191329", "0.61123496", "0.6004348", "0.5955212", "0.5909611", "0.58804697", "0.5758649", "0.57453144", "0.5732046", "0.5711821", "0.570883", "0.5701665", "0.56351644", "0.5630724", "0.5606466", "0.559564", "0.55940115", "0.55821985", "0.5569273"...
0.8022015
0
Copies texture into texture . The same size is assumed
def _copyTexture(self, src, dest): self.copyTextureNode.setShaderInput("src", src) self.copyTextureNode.setShaderInput("dest", dest) self._executeShader( self.copyTextureNode, (src.getXSize() + 15) / 16, (src.getYSize() + 15) / 16)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_texture(self, texture):\n texture.blit_buffer(self._cbuffer, colorfmt='bgr', bufferfmt='ubyte')", "def __draw_board_texture(self, texture):\n\n textureWidth, textureHeight = texture.size\n\n for x in range(0, self.width, textureWidth):\n for y in range(0, self.height,...
[ "0.7216443", "0.68766034", "0.6644557", "0.65478504", "0.6529141", "0.6472768", "0.63585997", "0.6346054", "0.62756497", "0.61603534", "0.6132107", "0.61011213", "0.60692954", "0.6036011", "0.60248864", "0.59905845", "0.59877455", "0.59877455", "0.5962739", "0.5891247", "0.57...
0.7507176
0
Executes a compute shader, fetching the shader attribute from a NodePath
def _executeShader(self, node, threadsX, threadsY, threadsZ=1): sattr = node.get_attrib(ShaderAttrib) Globals.base.graphicsEngine.dispatch_compute( (threadsX, threadsY, threadsZ), sattr, Globals.base.win.get_gsg())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location( self, shader, mode ):\n return shader.getLocation( mode, self.name, uniform=True )", "def getCompiled(self):\n if self.isCompiled():\n return self.shader\n else:\n raise Exception(\"el shader no ha sido compilado aun\")", "def dataShader(self):\n\t\tretu...
[ "0.5529933", "0.5455402", "0.5451003", "0.53797287", "0.5371496", "0.529932", "0.5226287", "0.52170175", "0.5206947", "0.5142569", "0.50498545", "0.50409245", "0.50264275", "0.50213206", "0.50200623", "0.4992741", "0.49883342", "0.4979414", "0.49767885", "0.49610433", "0.4958...
0.6711757
0
Function to calculate localization of an input set of genes (focal_genes) on a background network (Gint). Option to compute number of edges (method = 'numedges') or largest connected component (method = 'LLC') localization analysis. Calculates by sampling subsections of the focal genes/random set. Percentage to sample ...
def localization(Gint, focal_genes, num_reps = 10, sample_frac = 0.8, method = 'numedges', plot = True, print_counter = False, background_list=None): # Create degree bins to sample from bins = get_degree_binning(Gint, 10) min_degree, max_degree, genes_binned = zip(*bins) bin_df = pd.Dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localization_full(Gint, focal_genes, \n num_reps = 200,\n method = 'LCC', \n print_counter = False,\n label = 'focal genes',\n line_height = 0.1,\n legend_loc = 'upper left'):\n ...
[ "0.73266137", "0.5150185", "0.4992663", "0.4929083", "0.48764333", "0.47241652", "0.4713457", "0.468856", "0.4640513", "0.46259436", "0.46197578", "0.46130657", "0.45749927", "0.45307437", "0.45262876", "0.44685346", "0.44592845", "0.44434673", "0.44209215", "0.44146302", "0....
0.839314
0
Function to calculate localization of an input set of genes (focal_genes) on a background network (Gint). Option to compute number of edges (method = 'numedges') or largest connected component (method = 'LLC') localization analysis. DOes no subsampling. Plots the distribution of random gene localizaiton, and marks the ...
def localization_full(Gint, focal_genes, num_reps = 200, method = 'LCC', print_counter = False, label = 'focal genes', line_height = 0.1, legend_loc = 'upper left'): numed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localization(Gint, focal_genes, num_reps = 10, sample_frac = 0.8, method = 'numedges', plot = True, print_counter = False,\n background_list=None):\n\n # Create degree bins to sample from\n bins = get_degree_binning(Gint, 10)\n min_degree, max_degree, genes_binned = zip(*bins)\n bin_...
[ "0.80217075", "0.4923748", "0.48691314", "0.48593155", "0.4840417", "0.48288253", "0.47790307", "0.47593933", "0.47222963", "0.46872154", "0.4660511", "0.4631559", "0.46020266", "0.4599933", "0.45697355", "0.4537713", "0.45257393", "0.45067975", "0.44830728", "0.44763976", "0...
0.75722873
1
Send an email to new user when their account is created (either by themselves or an admin).
async def send_account_created(self, user_id: int, created_by_admin=False): async with self.pg.acquire() as conn: company_id, status, role = await conn.fetchrow( 'SELECT company, status, role FROM users WHERE id=$1', user_id ) ctx = dict(events_link='/dashboard/ev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_create(self, serializer):\n user = serializer.save()\n signals.user_registered.send(\n sender=self.__class__, user=user, request=self.request\n )\n\n context = get_email_context(user)\n to = [get_user_email(user)]\n if djconf.SEND_ACTIVATION_EMAIL:\n...
[ "0.7419731", "0.74011606", "0.7354138", "0.72132695", "0.71912956", "0.7131884", "0.7039993", "0.7025261", "0.69893897", "0.6955536", "0.6890317", "0.6889825", "0.6767554", "0.67515606", "0.6747817", "0.66501725", "0.6649151", "0.6639073", "0.6636345", "0.66226804", "0.661763...
0.77741104
0
Send an email to those on the waiting list about an event
async def send_tickets_available(self, event_id: int) -> str: async with self.pg.acquire() as conn: tickets_remaining = await conn.fetchval( 'SELECT check_tickets_remaining($1, $2)', event_id, self.settings.ticket_ttl ) if tickets_remaining == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_participant_event_waitlist(request, user, event):\n # Send email to the participant to confirm their that their registration request was received\n\n subject = f\"{settings.SITE_NAME} Event Registration\"\n context = {\n 'name': user.get_full_name(),\n 'domain': get_current_site(r...
[ "0.7540672", "0.6911862", "0.67133474", "0.6671251", "0.65517014", "0.6543087", "0.6541028", "0.6527119", "0.6522715", "0.648171", "0.64357334", "0.64307034", "0.6374249", "0.63337445", "0.63330746", "0.62634426", "0.6232664", "0.6207696", "0.6185272", "0.6172837", "0.6171558...
0.7523456
1
Send an email to a user when they get added to the waiting list.
async def waiting_list_add(self, waiting_list_id: int): company_id, event_name, event_link, event_id, user_id = await self.pg.fetchrow( """ select c.company, e.name, event_link(c.slug, e.slug, e.public, $2), e.id, w.us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_participant_event_waitlist(request, user, event):\n # Send email to the participant to confirm their that their registration request was received\n\n subject = f\"{settings.SITE_NAME} Event Registration\"\n context = {\n 'name': user.get_full_name(),\n 'domain': get_current_site(r...
[ "0.7471983", "0.656123", "0.64728487", "0.6455186", "0.6443988", "0.6429257", "0.6380956", "0.63149315", "0.62389636", "0.62307096", "0.6223183", "0.62158877", "0.62158877", "0.61924016", "0.61894155", "0.6159309", "0.61366713", "0.6131788", "0.6111135", "0.6101313", "0.60671...
0.6780388
1
Send emails to guest of an event 24(ish) hours before the event is expected to start.
async def send_event_reminders(self): async with self.pg.acquire() as conn: # get events for which reminders need to be send events = await conn.fetch( """ SELECT e.id, e.name, e.short_description, e.start_ts, e.timezone, e.duration, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_reminder(self):\n message_contents = \"This is a reminder that your event: \" + self.event_title + \" takes place on \" + self.event_date + \" in \" + self.event_location\n subject = \"Event Reminder\"\n attendees = self.gameplanuser_set.all()\n for attendee in attendees:\n ...
[ "0.6310523", "0.6159316", "0.6102179", "0.59807175", "0.5933528", "0.59130555", "0.5907345", "0.58854324", "0.58564115", "0.5836934", "0.58180124", "0.578778", "0.5784182", "0.5775888", "0.57748985", "0.5772186", "0.57648027", "0.5751996", "0.574765", "0.5741708", "0.56983835...
0.6320206
0
Return the Amplification classification type
def classification_type(self) -> ClassificationType: return ClassificationType.AMPLIFICATION
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classification(self) -> 'outputs.CaseClassificationResponse':\n return pulumi.get(self, \"classification\")", "def get_classification(self, idx):\n if idx in self.min_indices:\n return \"minimum\"\n elif idx in self.max_indices:\n return \"maximum\"\n return ...
[ "0.6398277", "0.6360342", "0.63117385", "0.620024", "0.61695665", "0.61695665", "0.6130714", "0.61290425", "0.6121621", "0.60148275", "0.5971787", "0.5961744", "0.5953864", "0.59246045", "0.5922802", "0.58984596", "0.58776414", "0.58510417", "0.58510417", "0.5844566", "0.5833...
0.8403613
0
Return the exact match token type candidates.
def exact_match_candidates(self) -> List[List[TokenType]]: return [ [TokenType.GENE, TokenType.AMPLIFICATION] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _candidates(self, token):", "def _match(self, *token_types):\n for token in token_types:\n if self._check(token):\n self._advance()\n return True\n\n return False", "def _candidates(self, token):\n token_as_list = [...
[ "0.62045497", "0.6090671", "0.5548191", "0.5508384", "0.5386109", "0.53495836", "0.5307139", "0.52862346", "0.52809906", "0.5276883", "0.52505463", "0.5209841", "0.51953876", "0.5179603", "0.5172369", "0.51713663", "0.51703805", "0.5165941", "0.51578367", "0.5148867", "0.5139...
0.74818367
0
r""" Function to generate all ordered system correlations up to a given time using the process tensor.
def generate_system_correlations( self, final_time: float, progress_type: Optional[Text] = None) -> None: dt = self._process_tensor.dt corr_mat_dim = int(np.round(final_time/dt)) current_corr_dim = self._system_correlations.shape[0] times_a = slice(cor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correlation(\n self,\n freq_1: float,\n time_1: float,\n freq_2: Optional[float] = None,\n time_2: Optional[float] = None,\n dw: Optional[tuple] = (1.0, 1.0),\n dagg: Optional[tuple] = (1, 0),\n interaction_picture: Optiona...
[ "0.57548136", "0.55826193", "0.54951274", "0.54824257", "0.5420731", "0.52263725", "0.5218043", "0.51210517", "0.51055217", "0.51013017", "0.5100515", "0.50651205", "0.5063665", "0.50323975", "0.50323147", "0.50157416", "0.50157416", "0.5011648", "0.50064594", "0.5000577", "0...
0.6702211
0
r""" Function to calculate twotime correlation function between two frequency bands of a bath.
def correlation( self, freq_1: float, time_1: float, freq_2: Optional[float] = None, time_2: Optional[float] = None, dw: Optional[tuple] = (1.0, 1.0), dagg: Optional[tuple] = (1, 0), interaction_picture: Optional[bool] = Fal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def periodic_corr(x, y):\r\n return np.fft.ifft(np.fft.fft(x) * np.fft.fft(y).conj()).real", "def xcorr(t, x, y, zeropad=True):\n tau = t\n # sx = len(x)\n # sy = len(y)\n if zeropad is True:\n Xn = np.fft.rfft(x, n=len(x) * 2)\n Yn = np.conj(sp.fft(y, n=len(x) * 2))\n else:\n ...
[ "0.6103006", "0.59695244", "0.59333843", "0.5838994", "0.5829018", "0.5778187", "0.5759637", "0.57155216", "0.5698791", "0.5675944", "0.5665542", "0.56494987", "0.56299394", "0.56088126", "0.55998456", "0.55977404", "0.5585448", "0.5577997", "0.55673987", "0.5557456", "0.5552...
0.6626181
0
Upload the image to google cloud storage
def uploadGCS(self, imageName): imageIndex = self.imageNames.index(imageName) blob = self.gcsBucket.blob('{0}/{1}'.format(self.meta['collectionAsset'],imageName)) blob.upload_from_filename(self.meta['sources'][imageIndex]) blob.make_public() return {'primaryPath': 'gs://...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __upload(self, filename):\n # Save to local path\n save_img = self.__frame.copy()\n\n # Initialize the bucket for after usage\n image_blob = None\n\n # Make the Google Cloud Storage client\n # and set the storage path\n if self.__yaml[\"bucket\"] is not None:\n...
[ "0.8085426", "0.7240558", "0.709116", "0.7058779", "0.6934209", "0.6832432", "0.6662758", "0.66428983", "0.6575392", "0.6573449", "0.65125227", "0.64969903", "0.6485138", "0.64726627", "0.64468306", "0.64200664", "0.6325931", "0.63143784", "0.62736934", "0.6258715", "0.625706...
0.74081856
1
Get the set of all elements at this node.
def get_elements(self): if self._element is not None: return set([self._element]) if self._elements is not None: return set(self._elements) return set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elements(self):\n return set(self._elements)", "def get_nodeset(self):\n return set(self.nodeset) # return the nodeset", "def nodes(self):\n return set(self.values())", "def get_nodes(self):\n return_set = set()\n for value in self._name:\n return_set.add(va...
[ "0.82320505", "0.7906836", "0.7735899", "0.7528263", "0.7377512", "0.7373335", "0.72610563", "0.72091043", "0.71305674", "0.7127224", "0.71241355", "0.7038929", "0.70093393", "0.7001226", "0.6983671", "0.69816947", "0.6978419", "0.6960768", "0.6957326", "0.6893714", "0.686413...
0.8222173
1
Add a child node to this node indexed by the given character.
def add_child(self, char, node): # Since most nodes only have a single child, we cheat and just store # the character and child node locally instead of using a dictionary # since dictionaries are quite large. We only use a dictionary for # children if there is more than one. if s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_child(self, character, child_node):\n # make sure character is uppercase\n character = character.upper()\n # TODO: Should I consider check if char is english letter?\n if not character.isalpha():\n raise ValueError(f'Child can only be English letters!')\n\n if ...
[ "0.86537194", "0.70604044", "0.67750335", "0.6770045", "0.67432934", "0.660338", "0.65603656", "0.65603656", "0.65603656", "0.6528463", "0.651386", "0.64599043", "0.64599043", "0.645352", "0.64116865", "0.64016056", "0.63904804", "0.6366291", "0.635953", "0.63565797", "0.6352...
0.8423471
1
Set the factory to use for individual nodes in the trie and build the root node.
def __init__(self, node_factory): self._node_factory = node_factory self._size = 0 self._root = self._new_node()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.root = self.TrieNode(0)", "def __init__(self):\n self.root = self.TrieNode(None)", "def set_root_factory(self, root_factory):\n self._root_factory = root_factory", "def __init__(self):\n self.root=TrieNode()", "def __init__(self):\n self.root=Tr...
[ "0.66628134", "0.66552347", "0.6592574", "0.64625233", "0.64625233", "0.6397673", "0.6321013", "0.62914175", "0.6234624", "0.6223266", "0.6214316", "0.6214316", "0.6213284", "0.6166737", "0.6166737", "0.6166737", "0.6166737", "0.6166737", "0.6166737", "0.6166737", "0.6166737"...
0.66947967
0
Create a new node and increment the node counter.
def _new_node(self): self._size += 1 return self._node_factory()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_node(\n self,\n name,\n ):\n pass", "def increment_node_index(self):\n self.node_index += 1", "def n(label):\n global id\n node = pydot.Node(name=id, obj_dict=None, label=label)\n id += 1\n graph.add_node(node)\n return node", "def node_create(self, **k...
[ "0.70677865", "0.6970185", "0.6837357", "0.6816349", "0.6805575", "0.66728896", "0.6584537", "0.6543195", "0.6531047", "0.6513726", "0.6500068", "0.6493502", "0.6477791", "0.646723", "0.6448476", "0.64463496", "0.6412165", "0.6374545", "0.63366497", "0.6334611", "0.6302376", ...
0.79598725
0
Add a metadata element to the trie indexed using the given term. The term is expected to be normalized using the same method that will be used for searches against the trie.
def add(self, term, element): self._add(self._root, term, 0, element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, keyword):\n tag = self._find(keyword)\n if tag is None:\n tag = etree.SubElement(self.meta, CN('meta:keyword'))\n tag.text = keyword", "def _add(self, node, term, i, element):\n if i > 0:\n # If this isn't the root node add the element to the\n ...
[ "0.62103677", "0.6180147", "0.6054324", "0.5957556", "0.5853236", "0.5833369", "0.5781625", "0.5752319", "0.5746715", "0.5708584", "0.56974065", "0.56715727", "0.56261414", "0.554233", "0.55368286", "0.5499526", "0.54936785", "0.54917777", "0.54913145", "0.54720026", "0.54708...
0.6324122
0
Recursively search down from the given node for the next node based on the position i being examined in the given term.
def _search(self, node, term, i): if not term: # No search term, no results return set() if i == len(term): # We hit the end of the search term, everything at # the current node is a match for the term return node.get_elements() char ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_by_term(nodes, term):\n return nodes[sum([ord(c) for c in term]) % len(nodes)]", "def _add(self, node, term, i, element):\n if i > 0:\n # If this isn't the root node add the element to the\n # node since it will be considered a match for the\n # current pre...
[ "0.6425727", "0.5986374", "0.5822369", "0.5725982", "0.56938446", "0.56240034", "0.5621033", "0.5544506", "0.5495314", "0.5474157", "0.5463711", "0.54617184", "0.54571563", "0.54106116", "0.5405283", "0.5391641", "0.5387793", "0.53704965", "0.53512686", "0.5351083", "0.534801...
0.6072376
1
Set the backing stores and new search trie factory for searching and use them to build a search index for the music collection. The trie factory is expected to return search tries with the
def __init__(self, album_store, artist_store, genre_store, track_store, trie_factory): self._album_store = album_store self._artist_store = artist_store self._genre_store = genre_store self._track_store = track_store self._trie_factory = trie_factory sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload(self):\n album_search = self._trie_factory()\n artist_search = self._trie_factory()\n genre_search = self._trie_factory()\n track_search = self._trie_factory()\n\n self._add_all_to_tree(self._album_store.get_all(), album_search)\n self._add_all_to_tree(self._art...
[ "0.72312427", "0.6137963", "0.6121258", "0.6121258", "0.6121258", "0.6121258", "0.6069405", "0.60655314", "0.5951017", "0.59430647", "0.59430647", "0.57854086", "0.5758049", "0.5745822", "0.5726629", "0.5726629", "0.5689628", "0.5679316", "0.5653881", "0.55890256", "0.5546819...
0.75631726
0
Add a normalized version of the name of each of the given elements to the search trie.
def _add_all_to_tree(elms, trie): for elm in elms: tokens = tokenize(elm.name) for token in tokens: trie.add(token, elm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, name):\n\n # no need to add first_name while adding full_name\n name_list = name.strip().split()[1:]\n name_list.append(name)\n for item in set(name_list):\n node = self.root\n # check for every char in word, i.e. check whether is it in trie\n ...
[ "0.6495422", "0.57633054", "0.55498004", "0.551926", "0.5473458", "0.54710585", "0.54439056", "0.5428203", "0.54154366", "0.54107445", "0.540033", "0.53612226", "0.53532475", "0.52992004", "0.5283172", "0.5280405", "0.5266039", "0.52655846", "0.5262622", "0.52533853", "0.5243...
0.62476844
1
Search genres by name (case insensitive).
def search_genres(self, needle): return self._genre_search.search(searchable(needle))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_search(self, search):\n if isinstance(search, str):\n name_re = re.compile(search)\n else:\n name_re = search\n matches = [\n entry\n for entry in self\n if entry is not None and name_re.search(entry.name)\n ]\n retu...
[ "0.6541157", "0.64619416", "0.63096476", "0.61302805", "0.60045385", "0.5954881", "0.5920782", "0.59083444", "0.5869351", "0.5859055", "0.58455867", "0.5827839", "0.58124524", "0.58043694", "0.57920015", "0.578812", "0.5784027", "0.5762391", "0.5737447", "0.5736045", "0.57176...
0.7272983
0
Search for tracks that have an album, artist, genre, or name or containing the given needle (case insensitive).
def search_tracks(self, needle): # Search for the needle in albums, artists, and genres separately # so that we only check the name of an element for matches no matter # what type it is. albums = self.search_albums(needle) artists = self.search_artists(needle) genres = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_albums(self, needle):\n return self._album_search.search(searchable(needle))", "def search_artists(self, needle):\n return self._artist_search.search(searchable(needle))", "def album_search(query, term):\n table = Album.__table__\n search_statement = or_(\n table.c.name.il...
[ "0.6931198", "0.66001576", "0.6558364", "0.61579746", "0.6061394", "0.6034933", "0.6022543", "0.599821", "0.59390754", "0.59099656", "0.5880928", "0.58569926", "0.5856034", "0.58410317", "0.583117", "0.58038056", "0.5790133", "0.5779309", "0.5739341", "0.57078785", "0.569769"...
0.70684373
0
Compute the percentage of tokens in data_set that have more than one tag according to self.dictionary.
def ComputePercentAmbiguous(self, data_set): """ FEEDBACK 3.2 You should not be including the start/end tags in the calculation as they artificially decrease the ambiguity, which is misleading """ c_ambiguity = 0 for i in xrange(len(data_set)): if len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, feats, tag_set):\n corect=0\n incorect=0 \n for (tokens, tags) in zip(feats, tag_set):\n yyhat= self.tag(tokens)\n for pre, tag in zip(yyhat, tags):\n if pre==tag:\n corect+=1\n else:\n ...
[ "0.6220206", "0.6068115", "0.60247374", "0.5768209", "0.5751909", "0.57387584", "0.5737834", "0.56948954", "0.5653931", "0.5631745", "0.5608694", "0.55992377", "0.5579199", "0.55781937", "0.5567438", "0.5565369", "0.5555082", "0.5528013", "0.55016875", "0.55011725", "0.549914...
0.6903212
0
Use Viterbi and predict the most likely tag sequence for every sentence. Return a retagged test_set.
def Test(self, test_set): test_set_retagged = [] # This loop will call Viterbi method and pass each sentence (word, POS) in "test_set" one by one, # and save the returned retagged pos in "test_set_retagged" a = 0 for sent in test_set: test_set_retagged.append(self.Vit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recognize_ngram(models: dict, test_set: SinglesData,probs,BIC_guesses):\n warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n probabilities = []\n guesses = []\n\n model = arpa.loadf(\"devel-lm-M3.sri.lm\")\n lm = model[0] # ARPA files may contain several models.\n # TODO impl...
[ "0.65450424", "0.64754826", "0.6398121", "0.6314108", "0.6303395", "0.6300192", "0.62996525", "0.62992305", "0.62888825", "0.627819", "0.6259535", "0.6239735", "0.6210801", "0.61998636", "0.6169645", "0.6107174", "0.6072587", "0.60659134", "0.6063529", "0.60619617", "0.600817...
0.7499553
0
Implement the most common class baseline for POS tagging. Return the test set tagged according to this baseline.
def MostCommonClassBaseline(training_set, test_set): pos_counts_dict = defaultdict(dict) max_pos_dict = dict() test_common_tags = [] # Dictionary "pos_counts_dict" stores a dictionary for each word that stores counts of each pos of the word # This loop runs for each sentence (word, pos) in "trainin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MostCommonClassBaseline(training_set, test_set):\n wordtagcounts = {}\n\n for sentence in training_set:\n for (word, tag) in sentence:\n if word not in wordtagcounts:\n wordtagcounts[word] = {tag:1}\n elif tag in wordtagcounts[word]:\n wordtagcou...
[ "0.6392319", "0.6258691", "0.5842302", "0.5814671", "0.5603754", "0.54684585", "0.5411013", "0.52758074", "0.5231145", "0.5228434", "0.5120268", "0.50576943", "0.5027018", "0.5024414", "0.5018693", "0.5010411", "0.4997151", "0.4974543", "0.49514675", "0.49483657", "0.494152",...
0.6602187
0
Using the gold standard tags in test_set, compute the sentence and tagging accuracy of test_set_predicted.
def ComputeAccuracy(test_set, test_set_predicted): total_tokens = 0 error_counts = 0 error_counts_line = 0 # This loop runs for no. of sentences in "test_set" for idx in xrange(len(test_set)): # if sentences doesn't match exactly, count errors for line (error_counts_line) and tokens (error_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, test_X, test_Y):\n correct = 0\n total = 0.0\n\n for i, ((word_indices, word_char_indices), gold_tag_indices) in enumerate(zip(test_X, test_Y)):\n\n output = self.predict(word_indices, word_char_indices)\n predicted_tag_indices = [np.argmax(o.value()) f...
[ "0.71565366", "0.7113691", "0.7017673", "0.6960095", "0.68954587", "0.68319327", "0.65682507", "0.65535474", "0.6486874", "0.6408915", "0.6342285", "0.6269908", "0.6222514", "0.6213549", "0.6206103", "0.6200888", "0.619431", "0.61798906", "0.6172208", "0.6161185", "0.61588997...
0.7969672
0
Return the JSON data stored in a Krun results file.
def read_krun_results_file(results_file): results = None with bz2.BZ2File(results_file, 'rb') as file_: results = json.loads(file_.read()) return results return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_krun_results_file(results, filename):\n\n with bz2.BZ2File(filename, 'wb') as file_:\n file_.write(json.dumps(results, indent=4))", "def load_results(results_file) :\n with open(results_file) as json_file :\n dict = json.load(json_file)\n return dict", "def results_filename(sel...
[ "0.7282448", "0.67288566", "0.64333904", "0.63026416", "0.6273742", "0.6263891", "0.6251001", "0.6235333", "0.6175118", "0.60450363", "0.60228944", "0.6019674", "0.5942952", "0.5923856", "0.5922734", "0.58717823", "0.58572775", "0.58489215", "0.58462834", "0.581511", "0.58143...
0.7576595
0
Write a Krun results file to disk.
def write_krun_results_file(results, filename): with bz2.BZ2File(filename, 'wb') as file_: file_.write(json.dumps(results, indent=4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_keypoint_results(keypoint_results, gt_folder, pred_folder):", "def write_result_to_file(self):\n self.__test_result[Result.__RUN] = self.__run\n with open(self.__json_file_path, \"w+\") as outfile:\n json.dump(self.__test_result, outfile,\n ensure_ascii=Fa...
[ "0.7185497", "0.70248854", "0.6985095", "0.66345674", "0.6634377", "0.6602536", "0.6554241", "0.6396744", "0.6356475", "0.62578344", "0.6255311", "0.62386316", "0.62346965", "0.6223612", "0.62218827", "0.6215509", "0.62146187", "0.6204826", "0.6168562", "0.6165958", "0.615749...
0.78148484
0
Counts the maximum number of references any given production in the grammar can have on the final tree.
def countRecursiveReferences(self) -> Tuple[Dict[str, List[str]], Dict[str, Dict[str, int]]]: countReferences = {} isReferencedBy = {} for nt in self.non_terminals: # for each non-terminal in the grammar for production in self.grammar[nt]: # for each possible production on that non t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_reference(gram_list, references):\r\n gram_sub_str = ' '.join(gram_list)\r\n gram_count = []\r\n for item in references:\r\n # calculate the count of the sub string\r\n gram_count.append(len(re.findall(gram_sub_str, item)))\r\n return gram_count", "def calculate_reference(...
[ "0.6344946", "0.6331416", "0.61905414", "0.59246284", "0.57841647", "0.5763673", "0.5751604", "0.57489383", "0.57478607", "0.57450664", "0.57291263", "0.57115686", "0.56965035", "0.56922156", "0.56860703", "0.56548613", "0.56532294", "0.56429106", "0.5602189", "0.5600686", "0...
0.7292844
0
Expands an individual from its genotype fo create its fenotype. The fenotype is created as a lambda function between two arrays that returns the distance between these two points.
def expand(self, individual: Dict[str, Union[str, Dict[str, List[int]], Callable]]): genes = individual["genome"] pattern = ["<expr_0>"] # starts the pattern as the root symbol current_index = {i: 0 for i in self.grammar.keys()} # initializes the indexes for each gene respective ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_standard_mutation(individual: np.array, mutation_strength: float = 0.1) -> np.array:\n offset = np.random.randn(individual.shape[0])\n return mutation_strength * offset + individual", "def __calculate_fitness(self):\n \"\"\"\n Equation:\n f(fenotype) = cos(fenotype) * ...
[ "0.5026171", "0.49982208", "0.47738576", "0.4733734", "0.47050303", "0.4639786", "0.46333775", "0.4629979", "0.45998678", "0.45959213", "0.45939746", "0.45835358", "0.4582434", "0.45432726", "0.45205277", "0.45187935", "0.45103586", "0.4491862", "0.44897872", "0.4480345", "0....
0.52725714
0
Mutates a set of genes based on the probability of mutation set on instantiation. The mutation is applied point by point, from each section to each possible reference.
def mutate(self, genes: Dict[str, List[int]]) -> Dict[str, List[int]]: genes = deepcopy(genes) for key in genes.keys(): # the mutation gets a set number of genes from the length of the genome and changes them to # new random choices. This number is proportional to the mu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __mutate(self, chromosomes, mutation_probability):\n\n for chromosome in chromosomes:\n for i in range(self.chromosome_size):\n if random.randint(1, 100) <= mutation_probability:\n logging.getLogger().debug(\n \"---> Mutation in Chromos...
[ "0.7878527", "0.743841", "0.7115228", "0.7104298", "0.6885358", "0.68434215", "0.67995125", "0.67280686", "0.66898966", "0.66378593", "0.64746255", "0.6469716", "0.6442629", "0.6415256", "0.6408359", "0.6406499", "0.63497597", "0.63067687", "0.6250783", "0.6237677", "0.622930...
0.76477593
1
Post your current list of reminders
async def remindlist(self, ctx): id = str(ctx.author.id) if id not in self.bot.data.save['reminders'] or len(self.bot.data.save['reminders'][id]) == 0: await ctx.reply(embed=self.bot.util.embed(title="Reminder Error", description="You don't have any reminders", color=self.color)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_reminder(self):\n pass", "def get_list(update, context):\n chat = update.message.chat\n user_id = update.message.from_user.id\n if chat.id != user_id:\n msg = 'Управление Вашими напоминаниями доступно в личном диалоге'\n update.message.reply_text(msg)\n return\n\n ...
[ "0.6820424", "0.6624237", "0.65425986", "0.63318014", "0.62319106", "0.6171307", "0.61389244", "0.60928255", "0.60457665", "0.6037037", "0.6018831", "0.60046077", "0.59064823", "0.5840007", "0.5757121", "0.5732524", "0.5716296", "0.56899035", "0.5668975", "0.56656975", "0.566...
0.704931
0
Add dep_var to the children list of each parent
def add_children(self, dep_var, parents): for parent in parents: if dep_var not in self.variables[parent].children: self.variables[parent].children.append(dep_var)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependson(self, *datasets):\n self._parents = self._parents.union(datasets)\n for parent in datasets:\n if self not in parent._children:\n parent._children = parent._children.union((self,))", "def _remove_children_dependency(self):\n for child in self.children:\...
[ "0.62062305", "0.6119783", "0.6021266", "0.5730942", "0.5661162", "0.56365895", "0.56227773", "0.5602389", "0.5598109", "0.55979127", "0.5591237", "0.5537785", "0.55281043", "0.5471286", "0.54421264", "0.54186255", "0.5416549", "0.54162276", "0.53949803", "0.5365456", "0.5356...
0.8351881
0
Returns the estimated probability of the query using rejection method. Ignore any samples that result in any invalid evidence variables.
def rejection_sample(self, trial_count): count = 0 valid_trial_count = 1 for i in xrange(trial_count): values = {} valid_sample = True for letter in self.letters: prob = self.variables[letter].get_prob(values) values[letter] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirmProbability(self, totalDice, bidCount):\n result = self.choose(totalDice, bidCount) * P**bidCount * (1 - P)**(totalDice-bidCount)\n return result", "def rejection_sampling(data, weights):\n weights = np.asarray(weights)\n idx = weights > np.random.uniform(0, np.max(weights), len(we...
[ "0.6198907", "0.5918354", "0.5898204", "0.5746092", "0.5730764", "0.5658549", "0.56502354", "0.5639987", "0.5632724", "0.5616158", "0.56135935", "0.56078446", "0.5594434", "0.55477095", "0.5545576", "0.55351746", "0.5517408", "0.5516377", "0.5474847", "0.5454276", "0.54473037...
0.7291372
0
Implement this! Returns the estimated probability of the query, using gibbs method.
def gibbs_sample(self, trial_count): values = {} count = total_trials = 0 # Initialize for letter in self.letters: if (letter in self.query.evidence): # Fix evidence variables values[letter] = self.query.evidence[letter] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gibbs_sample(self):\n # Initialize the initial state of Markov Chain.\n self.initialize()\n # Gibbs Sampling.\n for iteration_index in range(0, self.iteration_number, 1):\n for m in range(0,self.document_number,1):\n for n in range(0, len(self.documents[m])...
[ "0.657267", "0.64552784", "0.64283365", "0.63060915", "0.63018113", "0.6292415", "0.6291257", "0.62162", "0.61907357", "0.6163426", "0.615303", "0.6136156", "0.61254656", "0.6104333", "0.61025655", "0.60848427", "0.60664254", "0.6055903", "0.6047602", "0.5981606", "0.5971419"...
0.65889734
0
Calculates the energy loss of a projectile in the gas using the interpolated spline.
def energy_loss(self, en, proj_mass, proj_charge): try: return self.dedx_splines[proj_mass, proj_charge](en) * self.density * 100 # in MeV/m except KeyError: raise NotImplementedError('Projectile {} not implemented for {} gas.'.format((proj_charge, proj_mass), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy_loss(self, en, proj_mass, proj_charge):\n\n if proj_mass == 1 and proj_charge == 1:\n # Protons in helium gas\n result = 6.5*(1./en**0.83)*(1./(20.+1.6/(en**1.3))) + 0.2*exp(-30.*(en-0.1)**2)\n\n elif proj_mass == 4 and proj_charge == 2:\n # Helium ions in ...
[ "0.61350954", "0.58396333", "0.58372086", "0.5825879", "0.57878405", "0.5717459", "0.5688651", "0.5686226", "0.56482613", "0.564595", "0.56152683", "0.55989367", "0.5588501", "0.5582073", "0.556661", "0.5557722", "0.55020016", "0.54747826", "0.5464847", "0.5440471", "0.539279...
0.64672244
0
Calculates the range of a projectile in the gas using the interpolated spline.
def range(self, en, proj_mass, proj_charge): try: return self.range_splines[proj_mass, proj_charge](en) / self.density / 100 # in m except KeyError: raise NotImplementedError('Projectile {} not implemented for {} gas.'.format((proj_charge, proj_mass), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_range(self, range_, proj_mass, proj_charge):\n\n try:\n return self.inv_range_splines[proj_mass, proj_charge](range_ * self.density * 100) # in m\n\n except KeyError:\n raise NotImplementedError('Projectile {} not implemented for {} gas.'.format((proj_charge, proj_m...
[ "0.58683133", "0.5856429", "0.57672423", "0.5678889", "0.56315464", "0.56202734", "0.5535866", "0.54832464", "0.54427147", "0.54384625", "0.5422371", "0.5362682", "0.53499395", "0.5297791", "0.529709", "0.5265777", "0.52474916", "0.52266055", "0.52262455", "0.5196423", "0.519...
0.6115259
0
Electron density per m^3
def electron_density_per_m3(self): return self.electron_density * 1e6
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def electron_density(self):\n return N_avo * self.num_electrons * self.density / self.molar_mass", "def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3", "def number_density(self) -> u.m**-3:\n return self._number_density", "def...
[ "0.75250614", "0.7471538", "0.6671602", "0.6617881", "0.6527502", "0.65202945", "0.6465667", "0.64480203", "0.641283", "0.6402636", "0.6392911", "0.6370481", "0.62934023", "0.62076735", "0.6181983", "0.6180715", "0.61612326", "0.6125147", "0.60930717", "0.6088828", "0.6076462...
0.8596014
0
Finds the energy loss of a projectile in the gas. This default version uses the Bethe formula (defined by the function `bethe`) to calculate the energy loss. This function may be overridden with an empirical fit to give better results.
def energy_loss(self, en, proj_mass, proj_charge): beta = rel.beta(en, proj_mass * p_mc2) return bethe(beta, proj_charge, self.electron_density_per_m3, self.mean_exc_pot)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy_loss(self, en, proj_mass, proj_charge):\n\n if proj_mass == 1 and proj_charge == 1:\n # Protons in helium gas\n result = 6.5*(1./en**0.83)*(1./(20.+1.6/(en**1.3))) + 0.2*exp(-30.*(en-0.1)**2)\n\n elif proj_mass == 4 and proj_charge == 2:\n # Helium ions in ...
[ "0.6049426", "0.598672", "0.58651185", "0.576544", "0.5604688", "0.5580732", "0.555556", "0.55546594", "0.549055", "0.54117936", "0.5397675", "0.5361286", "0.5359241", "0.5354579", "0.53457224", "0.5319123", "0.52801067", "0.52723676", "0.52723676", "0.5267061", "0.52222574",...
0.6290472
0
Calculates the energy loss of a projectile in the gas. This is an empirical fit of experimental data, and only works for a small variety of projectiles.
def energy_loss(self, en, proj_mass, proj_charge): if proj_mass == 1 and proj_charge == 1: # Protons in helium gas result = 6.5*(1./en**0.83)*(1./(20.+1.6/(en**1.3))) + 0.2*exp(-30.*(en-0.1)**2) elif proj_mass == 4 and proj_charge == 2: # Helium ions in helium gas. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy_loss(self, en, proj_mass, proj_charge):\n\n try:\n return self.dedx_splines[proj_mass, proj_charge](en) * self.density * 100 # in MeV/m\n\n except KeyError:\n raise NotImplementedError('Projectile {} not implemented for {} gas.'.format((proj_charge, proj_mass),\n ...
[ "0.65585506", "0.65404457", "0.62630594", "0.62474406", "0.5831812", "0.5763543", "0.5709243", "0.5661734", "0.56458676", "0.56303847", "0.55632615", "0.5553679", "0.5529175", "0.5521077", "0.5498527", "0.5486627", "0.54726326", "0.5452398", "0.5437678", "0.54347485", "0.5425...
0.6846502
0
Returns the current port or error if the server is not started.
def port(self): if self._server_thread is None: raise RuntimeError('Server not started.') return self._port
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_port(self) -> Optional[int]:\n return pulumi.get(self, \"server_port\")", "def port(self):\r\n _, port = self.server_address\r\n return port", "def server_port(self):\n return self._server_port", "def server_port(self):\n return self._server_port", "def port(se...
[ "0.79572636", "0.7689262", "0.76517403", "0.76517403", "0.7600503", "0.75769037", "0.75769037", "0.75769037", "0.75769037", "0.75769037", "0.75769037", "0.75769037", "0.74726135", "0.7470196", "0.74109185", "0.734024", "0.73066807", "0.73066807", "0.73066807", "0.73066807", "...
0.85782874
0
Stops the server thread.
def stop(self): if self._server_thread is None: return self._stopping.set() self._server_thread = None self._stopped.wait()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n if self.started:\n try:\n self.server.shutdown()\n self.server.server_close()\n self.server_thread.join()\n self.server_thread = None\n except AttributeError:\n pass\n self.started =...
[ "0.8628687", "0.8405863", "0.8335516", "0.82878286", "0.8270784", "0.8198127", "0.8105906", "0.80799484", "0.80334324", "0.8016418", "0.79480904", "0.79258144", "0.792019", "0.78443015", "0.78324467", "0.78081185", "0.77783096", "0.77564317", "0.7755925", "0.7724799", "0.7699...
0.87969434
0
Starts a server in a thread using the WSGI application provided. Will wait until the thread has started calling with an already serving application will simple return.
def serve(self): if self._server_thread is not None: return if self._port is None: self._port = portpicker.pick_unused_port() started = threading.Event() self._stopped = threading.Event() self._stopping = threading.Event() def build_server(started, stopped, stopping): """Closu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n threading.Thread(target=self.serve_forever).start()", "def run():\n\n # Construct a server.\n server = wsgiref.simple_server.make_server(\n _config[ 'address' ],\n _config[ 'port' ],\n application\n )\n\n # Run the server.\n server.serve_forever()\n\n ...
[ "0.7214694", "0.7182073", "0.7072779", "0.68912977", "0.6853745", "0.678554", "0.6748224", "0.6684449", "0.66118926", "0.6565547", "0.652181", "0.6484129", "0.64656293", "0.6433462", "0.6414065", "0.63859785", "0.6371956", "0.6305172", "0.6305172", "0.6293515", "0.6258598", ...
0.7625668
0
Checks for a configuration file (config.json) in ~/files/config. If the file doesn't exist, it will start the get_account_info procedure
def init(): file_name = 'config.json' home_directory_path = str(Path.home()) config_file_directory = home_directory_path+"/.config/files/" full_path = config_file_directory + file_name if os.path.isfile(full_path) and os.access(full_path, os.R_OK): # Readable Config file exists and is valid ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file():\n require_login = \"Log into KAMONOHASHI first to use 'account login' command.\"\n\n if os.path.exists(config_file_path):\n logging.info('open config file %s', config_file_path)\n with open(config_file_path) as f:\n logging.info('begin io %s', config_file_path)\n ...
[ "0.6999744", "0.6942436", "0.6825275", "0.6576089", "0.652092", "0.64405906", "0.64033026", "0.6398966", "0.62931365", "0.61986506", "0.61803526", "0.61058307", "0.61000603", "0.6027428", "0.60218555", "0.60181016", "0.60079163", "0.6004", "0.60010254", "0.59542966", "0.59519...
0.75834197
0
This procedure obtains the user's twilio credentials and a default phone number and validates them.
def get_account_info(full_path): to_phone_number = "" from_phone_number = "" account_sid = "" auth_token = "" print("\nWelcome to tell-me-when! This appears to be the first time using this tool, or maybe you haven't successfully setup a default configuration yet.\n") print("In order to get star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_phone_number(request, domain, couch_user_id):\n if 'phone_number' not in request.GET:\n return Http404('Must include phone number in request.')\n phone_number = urllib.unquote(request.GET['phone_number'])\n user = CouchUser.get_by_user_id(couch_user_id, domain)\n\n # send verification...
[ "0.5866551", "0.572897", "0.5533119", "0.5494105", "0.5437998", "0.5427547", "0.5386804", "0.53825104", "0.53706455", "0.5360489", "0.5253193", "0.5245681", "0.5245188", "0.5233599", "0.5220256", "0.51921165", "0.51767236", "0.5158377", "0.51560336", "0.5111406", "0.5103916",...
0.65381926
0
Execute the shell arguments provided and then send the message alert via twilio
def execute_and_wait(account_id, auth_token, to_phone_number, from_phone_number, command): start = time.time() os.system(command) end = time.time() execution_time = end-start if execution_time<1000: time_string = "less than a second" else: time_string=(humanize.naturaldelta(datet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_alert(*args):\n try: SmsAlarmAlert(*args)\n except: logger.exception('Fail calling SmsAlarmAlert()')\n try: EmailAlarmAlert(*args)\n except: logger.exception('Fail calling EmailAlarmAlert()')", "def main(argv=sys.argv[1:]):\n username, password, msg_to, msg_from, message =...
[ "0.5824829", "0.5702238", "0.56834704", "0.5586583", "0.55575204", "0.55013126", "0.5470509", "0.54180664", "0.54047763", "0.54016185", "0.5378545", "0.5349481", "0.5340781", "0.53116447", "0.5291999", "0.5283338", "0.5275219", "0.52644134", "0.5262438", "0.5249105", "0.52408...
0.5728118
1
Getter for the overall status of the verification Run()
def status(self): return str(self.verificationRun.status())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_status(self):\n return self.raw_check_complete()", "def check_status(self):\n return self.status", "def check_status(self):\n return self.status", "def status(self):\n\t\treturn self._status", "def get_status(self):\n if self._is_running():\n return \"RUNNING...
[ "0.72331214", "0.7224253", "0.7224253", "0.7170907", "0.71687937", "0.71192336", "0.70725757", "0.7067355", "0.7067355", "0.70421827", "0.7040033", "0.70318675", "0.70178384", "0.70135075", "0.70135075", "0.70089436", "0.70089436", "0.6983278", "0.6981522", "0.6954618", "0.69...
0.81276524
0
Getter for the analyzers and their metric results of the verification Run()
def metrics(self): return self.verificationRun.metrics()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyse(self):\n pass", "def get_results(self):\n error_dict = {'error_code_test': self.error_code_test,\n 'error_text_test': self.error_text_test}\n\n return self.testresults, error_dict, self.checkstats", "def get_analysis(self) -> Dict[str, Any]:\n return...
[ "0.63674176", "0.63475424", "0.6282761", "0.61514205", "0.61275727", "0.61016434", "0.59641373", "0.5895412", "0.5883404", "0.5875165", "0.5842811", "0.5830992", "0.5766261", "0.57656604", "0.5755758", "0.57491755", "0.5735304", "0.571053", "0.57094073", "0.56948406", "0.5685...
0.65573806
0
Returns the check verification Results as a JSON
def checkResultsAsJson(cls, spark_session: SparkSession, verificationResult, forChecks=None): if forChecks: raise NotImplementedError("forChecks have not been implemented yet.") forChecks = getattr(spark_session._jvm.com.amazon.deequ.VerificationResult, "checkResultsAsJson$default$2")() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkResults(self):\n return self.checkResultsAsJson(self._spark_session, self)", "def get_validate(self) -> dict:\n response = self.rc.execute(\"GET\",\n self._get_uri(GET_VALIDATE_URI),\n headers=self.header,\n ...
[ "0.6295973", "0.62020296", "0.6174094", "0.60371953", "0.6008228", "0.6007141", "0.6006082", "0.5994763", "0.5987428", "0.5848042", "0.5818049", "0.5789099", "0.5761356", "0.5761154", "0.5647926", "0.5609752", "0.55949247", "0.55754185", "0.55738515", "0.5557192", "0.55505", ...
0.69998616
0
Adds checks to the run using checks method.
def addCheck(self, check: Check): # TODO Support Multiple checks self.checks.append(check) self._VerificationRunBuilder.addCheck(check._Check) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_checks(self, checks: Iterable[Check]):\n self.checks.extend(checks)\n return self", "def __runChecks(self):\n runnedChecks = []\n runnedChecks.append(Checks.checksFilesInstalled(self.__targetPath, verbose=True))\n return all(runnedChecks)", "def add_check(self, check)...
[ "0.77664995", "0.6697971", "0.65466774", "0.6499686", "0.63847643", "0.6297959", "0.62818104", "0.62233675", "0.619278", "0.61758244", "0.60340226", "0.59319943", "0.5884127", "0.582085", "0.5791647", "0.5771378", "0.5762941", "0.5715807", "0.5711266", "0.57007897", "0.570005...
0.68748224
1
Add a check using anomaly_detection methods. The Anomaly Detection Strategy only checks if the new value is an Anomaly.
def addAnomalyCheck(self, anomaly, analyzer: AnalysisRunBuilder, anomalyCheckConfig=None): if anomalyCheckConfig: raise NotImplementedError("anomalyCheckConfigs have not been implemented yet, using default value") AnomalyCheckConfig = self._jvm.scala.Option.apply(anomalyCheckConfig) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_anomaly(self, category=None, level=0, request=None, parameter=\"\", info=\"\"):\n if request is not None:\n self._anomalies.append(\n [category, level, info, request.method, parameter, request.url, request.encoded_data]\n )", "def _AddAnomalyForTest(\n sel...
[ "0.60187614", "0.5959906", "0.5885708", "0.5772284", "0.569242", "0.553445", "0.5424762", "0.5377537", "0.53196263", "0.5266118", "0.52552277", "0.5208655", "0.51226884", "0.5029292", "0.5013989", "0.50084674", "0.49527568", "0.4935555", "0.4777497", "0.47576135", "0.47203133...
0.7289442
0
A method that runs the desired VerificationRunBuilder functions on the data to obtain a Verification Result
def run(self): return VerificationResult(self._spark_session, self._VerificationRunBuilder.run())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onData(self, df):\n df = ensure_pyspark_df(self._spark_session, df)\n return VerificationRunBuilder(self._spark_session, df)", "def verify(data, simFunction, paramConfig={}):\n # There are some fields can be config by user,\n # If user specified these fields in paramConfig, \n # overlo...
[ "0.5969269", "0.57839024", "0.5722319", "0.56757563", "0.56325907", "0.5613295", "0.5585265", "0.55719906", "0.55264866", "0.5465394", "0.54614305", "0.54529136", "0.54474854", "0.54361117", "0.54008996", "0.5376825", "0.53498036", "0.53460264", "0.532554", "0.53145736", "0.5...
0.6887919
0
This method reassigns our AnalysisRunBuilder because useRepository returns back a different
def useRepository(self, repository): self._VerificationRunBuilder = self._VerificationRunBuilder.useRepository(repository.repository) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_build(self):\n pass", "def code_builder(request, tmp_path_factory) -> dataset_builder.DatasetBuilder:\n tmp_path = tmp_path_factory.mktemp('tfds_datasets') # Temporary data_dir\n builder_cls = request.param\n # Generate the dataset (only once for all tests as scope == 'module').\n builder = ...
[ "0.51253766", "0.51047456", "0.50034523", "0.49952033", "0.49773082", "0.49688515", "0.49602604", "0.4960173", "0.4935789", "0.49285176", "0.48983487", "0.48916742", "0.48916742", "0.48805648", "0.48721683", "0.4869924", "0.4869924", "0.48656157", "0.48610446", "0.48558554", ...
0.6287883
0
Returns all of the Shopcarts in the database
def all(cls): cls.logger.info("Processing all Shopcarts") return cls.query.order_by(cls.id).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all(cls):\n cls.logger.info(\"Processing all Shopcart Items\")\n return cls.query.order_by(cls.id).all()", "def get_cart_contents(db):", "def get_all_shopping_list():\n all_shopping_lists = ShoppingList.query.all()\n return create_shopping_list_output(all_shopping_lists)", "def get_al...
[ "0.7695302", "0.68926364", "0.6767365", "0.67299867", "0.6605095", "0.65333813", "0.6531382", "0.6510361", "0.6435947", "0.63742346", "0.6368173", "0.63457453", "0.63254076", "0.6299422", "0.6248174", "0.6244773", "0.62338674", "0.6200673", "0.61633444", "0.61633444", "0.6162...
0.8391014
0
Finds a shopcart based on the id provided
def find(cls, sid): cls.logger.info("Processing lookup for shopcart id %s ...", sid) return cls.query.get(sid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(cls, item_id):\n cls.logger.info(\"Processing lookup for shopcart item id %s ...\", item_id)\n return cls.query.get(item_id)", "def find_by_shopcartid(cls, sid):\n cls.logger.info(\"Processing lookup or 404 for id %s ...\", sid)\n return cls.query.filter_by(sid=sid).order_by(...
[ "0.7453836", "0.7198516", "0.6898264", "0.68865025", "0.68843025", "0.66736203", "0.6583224", "0.63823205", "0.63673156", "0.63572556", "0.6306635", "0.6248824", "0.62401545", "0.6130902", "0.61161405", "0.6097903", "0.608794", "0.60253537", "0.6016732", "0.59990644", "0.5864...
0.73916173
1
Creates a ShopcartItem to the database
def create(self): shopcart = Shopcart().find(self.sid) if shopcart is None: raise DataValidationError("Invalid shopcart id: shopcart doesn't exist") self.id = None # id must be none to generate next primary key db.session.add(self) db.session.commit() db.sess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_cart(db, itemid, quantity):", "def create_item(self, obj):\n logger.info('ItemProduct adding item initiated')\n try:\n with Transaction().start(DBNAME, 1) as transaction:\n unit, = self.ProductUom.search([('name', '=', obj['units'])])\n template =...
[ "0.75287604", "0.7295029", "0.71876293", "0.71296775", "0.694095", "0.6924008", "0.6911596", "0.6884342", "0.68588626", "0.6789306", "0.6756838", "0.67439866", "0.6735223", "0.6725419", "0.67219", "0.6662857", "0.66524667", "0.6650777", "0.66326624", "0.6625988", "0.6613523",...
0.74574685
1
Serializes a Shopcart into a dictionary
def serialize(self): return { "id": self.id, "sid": self.sid, "sku": self.sku, "name": self.name, "price": self.price, "amount": self.amount, "create_time": self.create_time, "update_time": self.update_time }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n return {\n 'name': self.name,\n 'id': self.id,\n 'price': self.price,\n }", "def serialize(self):\n return {\n 'id': self.id,\n 'name': self.name,\n 'description': self.description,\n 'catalog...
[ "0.65119225", "0.64869726", "0.6469303", "0.64564174", "0.64374864", "0.64358115", "0.6374915", "0.62789077", "0.6272564", "0.6265672", "0.6261013", "0.6148694", "0.6125225", "0.61191297", "0.60856265", "0.6071333", "0.6034405", "0.603325", "0.6032883", "0.6022564", "0.602166...
0.69107395
0
Deserializes a ShopcartItem from a dictionary
def deserialize(self, data: dict): try: if "id" in data: self.id = int(data["id"]) self.sid = int(data["sid"]) self.sku = int(data["sku"]) self.name = str(data["name"]) self.price = float(data["price"]) self.amount = int(da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(document):\n\n data = document.to_dict()\n if data:\n return CartItem(\n document_id=document.id,\n item_id=data.get('item_id'),\n modify_time=data.get('modify_time'),\n uid=data.get('uid')\n )\n\n ...
[ "0.6633459", "0.65873986", "0.6422956", "0.6267294", "0.5817128", "0.5815298", "0.5787765", "0.5744972", "0.56599575", "0.56282395", "0.5626154", "0.560309", "0.5583793", "0.55749553", "0.55729145", "0.55712116", "0.5554173", "0.5534358", "0.5517276", "0.5504238", "0.5489406"...
0.6782365
0
Returns all of the Shopcart Items in the database
def all(cls): cls.logger.info("Processing all Shopcart Items") return cls.query.order_by(cls.id).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_items(self):\n cur = self.cursor\n cur.execute(f\"SELECT * FROM {self.product_name}\")\n products = cur.fetchall()\n return products", "def all(cls):\n cls.logger.info(\"Processing all Shopcarts\")\n return cls.query.order_by(cls.id).all()", "def get_cart_co...
[ "0.7488427", "0.7488118", "0.718897", "0.7052102", "0.7015289", "0.6894793", "0.68569005", "0.68569005", "0.6777023", "0.67452914", "0.6692887", "0.66834635", "0.6669049", "0.6577718", "0.6555452", "0.64787406", "0.64732945", "0.64428383", "0.644211", "0.64105165", "0.6404205...
0.8228296
0
Returns all shopcart items by sku
def find_by_sku(cls, sku: int): cls.logger.info("Processing sku query for %s ...", sku) return cls.query.filter(cls.sku == sku).order_by(cls.id).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, page=1, sku=None):\n products = []\n if sku:\n product = Product.query.filter(Product.sku == sku).first_or_404()\n products.append(product)\n else:\n paginated_prods = Product.query.order_by(Product.id).paginate(page, 20, False)\n produ...
[ "0.65102017", "0.6257574", "0.6148184", "0.6148184", "0.6087141", "0.6003955", "0.5960486", "0.58657694", "0.5852011", "0.5674433", "0.56433994", "0.5633661", "0.5617186", "0.5609175", "0.5609175", "0.5606182", "0.5584965", "0.5573926", "0.5573926", "0.55564016", "0.55564016"...
0.71167314
0
Returns all shopcart items by product price
def find_by_price(cls, price: float): cls.logger.info("Processing price query for %s ...", price) return cls.query.filter(cls.price == price).order_by(cls.id).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_item_prices(self, size, categorycode=''):\r\n item_prices = self.client['Product_Package'].getItems(\r\n id=0,\r\n mask='id,capacity,prices[id]',\r\n filter={\r\n 'items': {\r\n 'capacity': {'operation': int(size)},\r\n ...
[ "0.6679233", "0.65119493", "0.6377143", "0.62181354", "0.61589795", "0.60201263", "0.60165656", "0.6004052", "0.5918643", "0.58500487", "0.58497036", "0.5845891", "0.5814287", "0.5776372", "0.5771714", "0.5764622", "0.5739127", "0.57076573", "0.56681174", "0.56589353", "0.565...
0.68058646
0