query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Update all of the properties of the lines to match those specified by the lines dictionaries.
def update_lines(self): self._checkfigure() for ld in self.lines: line = ld['line'] color = ld['color'] line.set_color(color) lw = ld['linewidth'] hlf = ld['highlight factor'] highlight = hlf if ld['highlighted'] else 1.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_dict(self, lines):\n for line in lines:\n line = line.rstrip()\n split_line = line.split(\"\\t\")\n old_gene_id = split_line[0]\n new_gene_id = split_line[2]\n conv_dict = self.conversion_dict\n conv_dict[old_gene_id] = new_gene_id\n ...
[ "0.6635039", "0.6558961", "0.61416423", "0.6050221", "0.60437894", "0.59587663", "0.59425133", "0.59164494", "0.5850133", "0.5814374", "0.57916486", "0.56902176", "0.5680567", "0.5630113", "0.56012625", "0.5566768", "0.5527338", "0.5511613", "0.54785407", "0.5465747", "0.5459...
0.66452
0
Change the scale of the x axis.
def xscale(self, newscale, linthreshx=1.e-4): self._checkfigure() if newscale == 'symlog': self.axes.set_xscale(newscale, linthreshx=linthreshx) else: self.axes.set_xscale(newscale)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xscale(self, kind):\n self._xscale = str(kind).strip() # remove whitespace eventually\n if self._xscale not in self.xscaling():\n self._xscale = self.xscaling(1)", "def setScaleX(self,startx,endx):\r\n if startx == endx:\r\n endx += 1\r\n self.scaleLock.acqui...
[ "0.75162244", "0.749704", "0.74579763", "0.7220122", "0.69459987", "0.6915198", "0.6820812", "0.6799988", "0.6794418", "0.6695604", "0.6602468", "0.6586427", "0.653044", "0.65237784", "0.6494618", "0.6494618", "0.6425369", "0.64223045", "0.6365275", "0.63600373", "0.63461554"...
0.7631463
0
Change the scale of the y axis.
def yscale(self, newscale, linthreshy=1.e-4): self._checkfigure() if newscale == 'symlog': self.axes.set_yscale(newscale, linthreshy=linthreshy) else: self.axes.set_yscale(newscale)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yscale(self, value='linear'):\r\n for ax in self._subaxes:\r\n ax.set_yscale(value)\r\n self.figure.canvas.draw()", "def setScaleY(self,starty,endy):\r\n if starty == endy:# Prevent /0 errors when scaling\r\n endy += 0.1\r\n self.scaleLock.acquire()\r\n ...
[ "0.83540624", "0.7639247", "0.76304406", "0.7609599", "0.7424399", "0.7308757", "0.7259377", "0.72316325", "0.7127579", "0.7097566", "0.7009638", "0.6943726", "0.69134957", "0.6899598", "0.6857216", "0.6814696", "0.67792916", "0.6751122", "0.6750558", "0.67136586", "0.6713658...
0.77396965
1
Automatically adjusts the range of the x and y axes to fit the data.
def autorange(self): self._checkfigure() self.axes.autoscale_view(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _use_data_bounds_changed_for_axes(self):\n self.update_pipeline()", "def auto_adjust_axes(self, *args):\n\n xmin, xmax = self.axes.get_xlim()\n ymin, ymax = self.axes.get_ylim()\n self.adjust_axes(xmin, ymin, xmax, ymax)", "def fix_auto(self):\n if self.share_x:\n ...
[ "0.73429817", "0.7191217", "0.6581325", "0.6449581", "0.6447283", "0.6441026", "0.6410359", "0.63285774", "0.63280755", "0.6320955", "0.63067925", "0.6260221", "0.62177235", "0.61656487", "0.6165544", "0.6160994", "0.6160898", "0.6155022", "0.61368674", "0.6122708", "0.606950...
0.0
-1
Set the x label.
def xlabel(self, xlabel): self._checkfigure() self.axes.set_xlabel(xlabel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xlabel(self, xlabel: str):\n\n self.ax.set_xlabel(xlabel)\n self.canvas.draw()", "def set_label(self, x=None, y=None):\n\n if x:\n self.axes.set_xlabel(x)\n if y:\n self.axes.set_ylabel(y)", "def xaxis(self,label,units):\r\n if units != \"\": label =...
[ "0.83227915", "0.78510827", "0.768761", "0.763404", "0.71824145", "0.71818656", "0.71470004", "0.71255195", "0.7057654", "0.7001613", "0.6981948", "0.6973022", "0.6868358", "0.68305385", "0.68288565", "0.68243974", "0.6804483", "0.67813873", "0.67813873", "0.67813873", "0.676...
0.8380205
0
Set the y label.
def ylabel(self, ylabel): self._checkfigure() self.axes.set_ylabel(ylabel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setYLabel(self, label):\n self.__y_label__ = label", "def ylabel(self, ylabel: str):\n self.ax.set_ylabel(ylabel)\n self.canvas.draw()", "def yaxis(self,label,units):\n if units != \"\": label = label + \" (\" + units + \")\"\n self.subplot.set_ylabel(label)\n pass...
[ "0.9190329", "0.86456215", "0.79426026", "0.78730667", "0.7797612", "0.7762227", "0.7726272", "0.7642364", "0.7614121", "0.7587614", "0.7587614", "0.75765777", "0.75309575", "0.7481715", "0.7420434", "0.7352702", "0.72147393", "0.71600896", "0.71437305", "0.71182877", "0.7114...
0.8489198
2
Save a figure to disk with the specified filename.
def savefig(self, filename, dpi=300): self._checkfigure() self.figure.savefig(filename, dpi=dpi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_fig(fig, filename):\n fig_filepath = figures_path / filename\n fig.write_image(str(fig_filepath))\n logging.info(f\"Written figure to {fig_filepath.resolve()}\")", "def save(file_name):\n setup()\n plt.savefig(file_name)", "def _save_mpl_figure(self, fig, filename, **kwargs):\n\n ...
[ "0.83919364", "0.81133604", "0.803917", "0.7967601", "0.7860805", "0.7696905", "0.7623614", "0.758016", "0.7493179", "0.74178004", "0.7385424", "0.7373886", "0.7336211", "0.7331587", "0.732086", "0.7289239", "0.7277271", "0.72658956", "0.72639364", "0.7245444", "0.7184908", ...
0.7356999
12
Show and redraw the figure. Generally not useful if HKEPlotter is being used to serve up figures to a different frontend, but is useful for interactive use of HKEPlotter on its own.
def draw(self): self.figure.show() self.figure.canvas.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_figure(self):\n\n self.draw()", "def show_figure(self):\n pylab.show()", "def redraw(self):\n dummy_figure = plt.figure()\n new_manager = dummy_figure.canvas.manager\n new_manager.canvas.figure = self.figure\n self.figure.set_canvas(new_manager.canvas)\n ...
[ "0.7442054", "0.72985405", "0.72740227", "0.7139864", "0.7054566", "0.70101815", "0.6959752", "0.6950756", "0.68631804", "0.68610996", "0.68610996", "0.68610996", "0.6855939", "0.66993093", "0.668948", "0.668948", "0.65383893", "0.64258283", "0.6350744", "0.63269967", "0.6323...
0.7369711
1
Create and get database session.
async def get_db_session(request: Request) -> AsyncGenerator[AsyncSession, None]: session: AsyncSession = request.app.state.db_session_factory() try: # noqa: WPS501 yield session finally: await session.commit() await session.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dbsession(cls):\n sqlahelper = cls.dbsqlahelper\n return sqlahelper.getmake_session()", "def get_or_create_session(db):", "def get_db():\n if not hasattr(g, 'Session'):\n Session, engine = db_connect(database_path=app.config['DATABASE_PATH'],\n en...
[ "0.8232138", "0.81293833", "0.78142273", "0.7806508", "0.77904016", "0.7696183", "0.7656676", "0.76449305", "0.7638493", "0.76233536", "0.7606411", "0.7503729", "0.7498254", "0.7467674", "0.745921", "0.7457411", "0.7410705", "0.7404447", "0.7404092", "0.7368332", "0.73582894"...
0.68070346
63
Grabbing category pages from UPD.
def parse(self, response, **kwargs): categories = response.xpath("//ul[@id='navcat']//a[contains(@href,'catid')]/@href").extract() yield from response.follow_all(categories, self.parse_details)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_category(self, response):\n print(response.url)\n \n yield None\n #current_url = response.url\n #for i in range(1, number_of_pages + 1):\n # yield scrapy.Request(url='%s?page=%d' % (current_url, i), callback=self.parse_page)", "def category_index(request, sl...
[ "0.64237756", "0.63790303", "0.6375456", "0.6321574", "0.62103164", "0.6167238", "0.60869426", "0.6016122", "0.592989", "0.5928638", "0.59256095", "0.5907109", "0.58935356", "0.5876387", "0.5860246", "0.58479667", "0.5836295", "0.57793176", "0.5769943", "0.57407695", "0.57292...
0.5636073
24
Grabbing items from a category page.
def parse_details(self, response): items = response.xpath("//*[@id='all']//div[@class='prdct-box']") for i in items: image_url = response.urljoin(i.xpath(".//div[@class='prdct-box1']/a[1]/@href").get()) description = i.xpath(".//div[@class='prdct-box2']//a[1]/text()").get() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_parsing_category(self, response):\n # ### First thing to do is to get the # of pages in the category.\n # Note: suppose a category has 189 entries. There are 48 entries per page.\n # 189 / 48 = 3.93. There are 4 pages. Therefore, deploy a ceil() function.\n #\n path_to_...
[ "0.6977426", "0.6966306", "0.69649124", "0.6818274", "0.675134", "0.6723163", "0.67167073", "0.66166425", "0.65816635", "0.6577138", "0.65685225", "0.65192044", "0.6517263", "0.6489112", "0.64841604", "0.6424634", "0.6419997", "0.63991076", "0.6374411", "0.63453954", "0.63298...
0.0
-1
Parse a string containing a CIGAR string. Converts it into a suitable format for the other functions of this module >>> CIGAR.fromString("5M20I2M5D").toList() [(5, 'M'), (20, 'I'), (2, 'M'), (5, 'D')] >>> CIGAR.fromString("").toList() [''] >>> CIGAR.fromString("").toList() [] >>> CIGAR.fromString("4F")
def fromString(cls, string): # From SAM specification v1.5, slightly adapted for single-token parsing pattern = r"^[0-9]+[MIDNSHPX=]" string = string.strip() if string == '*': return CIGAR.fromList(['*']) parsed = [] s = string # Parse string token (e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_string_to_listint(string):\n\tstring = string.split()\n\tlength = len(string)\n\tnewlist = []\n\tfirst = int (string[0])\n\tsecond = int (string[1])\n\tthird = int (string[2])\n\tforth = int (string[3])\n\tfifth = int (string[4])\n\tnewlist.append(first)\n\tnewlist.append(second)\n\tnewlist.append(third)...
[ "0.61173743", "0.5562493", "0.5561425", "0.550409", "0.5474138", "0.5468441", "0.54449433", "0.54384106", "0.54120386", "0.54009825", "0.5395243", "0.5395102", "0.535296", "0.53439724", "0.52883965", "0.52763444", "0.5264064", "0.52568686", "0.5254977", "0.52531236", "0.52431...
0.71512187
0
>>> str(CIGAR.fromList([(4,'M')])) '4M' >>> str(CIGAR.fromList([(4,'M'),(3,'I')])) '4M3I' >>> str(CIGAR.fromList([(3,'M'),(3,'M')])) '6M'
def fromList(cls, list): obj = CIGAR() if list == ['*']: obj._tokens = '*' else: if not all( type(e) == tuple and len(e) == 2 and type(e[0]) == int and e[0] >= 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_string(self):\n\n return '[%s], [%s]' % \\\n (', '.join(str(x) for x in self.pot),\n ', '.join(INT2STRING_CARD[p] for p in self.pub))", "def get_atril_string(self):\n return \", \".join(str(item) for item in self.atril)", "def convert_int_encoded_cards_to_str_encoded...
[ "0.59029216", "0.56521", "0.56327", "0.5588273", "0.55033386", "0.54973626", "0.5496627", "0.5454236", "0.544231", "0.53954923", "0.5380563", "0.5378427", "0.53657615", "0.5361758", "0.5347632", "0.534503", "0.530223", "0.526734", "0.52624476", "0.52619827", "0.52292615", "...
0.52328736
20
Convert a CIGAR string object >>> str(CIGAR.fromList([(3,'I'),(14,'M')])) '3I14M' >>> str(CIGAR.fromString('')) ''
def __str__(self): if self._tokens == '*' or self._tokens == '': return self._tokens self.compact() return "".join(str(s[0])+s[1] for s in self._tokens)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromString(cls, string):\n # From SAM specification v1.5, slightly adapted for single-token parsing\n pattern = r\"^[0-9]+[MIDNSHPX=]\" \n string = string.strip()\n if string == '*':\n return CIGAR.fromList(['*'])\n parsed = []\n s = string\n # Parse ...
[ "0.64767164", "0.5503787", "0.54652095", "0.51764154", "0.49903855", "0.49820456", "0.48756266", "0.47967613", "0.47786036", "0.47597682", "0.4754142", "0.47428882", "0.47245598", "0.47059748", "0.4688669", "0.46815938", "0.46791205", "0.4638526", "0.4637253", "0.4633566", "0...
0.0
-1
Join duplicate tokens together. This is done automatically before printing and does not need to be explicitly called in normal operation >>> c = CIGAR.fromList([]) >>> c._tokens = [(2,'M'),(3,'I'),(4,'M'),(3,'M')] >>> c.compact() >>> c._tokens [(2, 'M'), (3, 'I'), (7, 'M')] >>> c = CIGAR.fromList([]) >>> c._tokens = [(...
def compact(self): if self._changed == False: return t = self._tokens if t in [[], '*']: return # Tokens which can be reordered and joined if juxtapoxed. # E.g. 3I3D3I --> 3D6I freeToks = ['I','D'] iFirstFree = None for i in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CompactTokens(self):\n map = {}\n for token_ in self.tokens_:\n hash_string = token_.EncodeForHash()\n try: map[hash_string].append(token_)\n except KeyError: map[hash_string] = [token_]\n ntokens = []\n keys = map.keys()\n keys.sort()\n for k in keys:\n token_ = map[k][0]...
[ "0.6678322", "0.59820163", "0.56799006", "0.5620844", "0.5576293", "0.55237937", "0.5503982", "0.52999336", "0.5281514", "0.520811", "0.520811", "0.520811", "0.520811", "0.5125486", "0.5053332", "0.5034395", "0.5030067", "0.5002936", "0.49746132", "0.49096557", "0.48882848", ...
0.7703922
0
Change this CIGAR string, starting at base `at` (integer) by
def operationAt(self, op, n, at): self._changed = True bpTokenStart = 0 # in bp (base pairs) # iToken and tokenLength are used ouside of loop for iStartToken,tokenLength in enumerate(t[0] for t in self._tokens): if bpTokenStart + tokenLength > at: break bpTokenSt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_fill(i, n):\r\n return str(i).zfill(n)", "def string(self,pos_0,pos_1,n):\r\n n=int(n)\r\n if pos_0 <10:\r\n pos_0=\"00\"+str(pos_0)\r\n elif pos_0<100:\r\n pos_0=\"0\"+str(pos_0)\r\n\r\n if n <10:\r\n n=\"0\"+str((n))\r\n \r\n\r\n\r\...
[ "0.59899414", "0.58692604", "0.5826843", "0.5657849", "0.55905974", "0.5525048", "0.54885286", "0.5405841", "0.53604394", "0.53604394", "0.53569674", "0.53217363", "0.5308425", "0.52913743", "0.5268704", "0.5261682", "0.52560335", "0.5253637", "0.52421796", "0.5230379", "0.52...
0.49945837
44
Changes the token t1 by an operation t2. Both t1 and t2 are of the format (N, X) where N is an integer and X is a onechar string out of "MIDNSHPX=". Its meaning is that of a CIGAR string 'NX' p is an integer giving the position (relative to t1) where to change the CIGAR string t1 by the operation t2. The function retur...
def _mutateToken(t1, p, t2): if not isinstance(p, int): raise ValueError("p must be integer") if(p < 0): raise ValueError("p may not be smaller than 0") if(p > t1[0]-1): raise ValueError("p may not be larger than t1 length - 1") x1 = t1[1] # Type o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operationAt(self, op, n, at):\n self._changed = True\n\n bpTokenStart = 0 # in bp (base pairs)\n # iToken and tokenLength are used ouside of loop\n for iStartToken,tokenLength in enumerate(t[0] for t in self._tokens):\n if bpTokenStart + tokenLength > at: break\n ...
[ "0.5909464", "0.54508114", "0.5353232", "0.53109324", "0.5183065", "0.5157569", "0.51135975", "0.50226814", "0.4987378", "0.49470899", "0.49032512", "0.48813334", "0.48719415", "0.4846766", "0.48339766", "0.47886705", "0.47811374", "0.47744894", "0.47724745", "0.4759226", "0....
0.80241114
0
normalize col and row number for all board size by taking the floor of event's x and y coords as col and row, respectively
def floor_of_row_col(self, col, rw): col_flr = col // self.sq_size rw_flr = rw // self.sq_size return col_flr, rw_flr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resizeEvent(self, event):\n # gets nearest width/height divisible by cell length\n nearest_w = event.size().width() // Config.CELL_LENGTH\n nearest_h = event.size().height() // Config.CELL_LENGTH - 1\n \n Config.NUM_CELLS_X = nearest_w\n Config.NUM_CELLS_Y = nearest_h\...
[ "0.6193175", "0.61367476", "0.59963244", "0.59421545", "0.57849133", "0.5775196", "0.57631814", "0.57459", "0.5720018", "0.5627904", "0.5625103", "0.56076854", "0.55925536", "0.55625093", "0.5556446", "0.5548683", "0.5542725", "0.553251", "0.55263674", "0.54682046", "0.545060...
0.5631687
9
finding coords in a 9sq grid
def find_coords_of_selected_sq(self, evt): # saves row and col tuple into two variables column, row = self.get_row_col(evt) # normalize for all square size by keeping the floor column_floor, row_floor = self.floor_of_row_col(column, row) corner_column = (column_floor * self.sq_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_points(self):\n for i in range(self.rows):\n for j in range(self.cols):\n min_lat,max_lat,min_lon,max_lon = self.coords_to_min_max_lat_lon((i,j))\n if i == 0:\n print_gps(max_lat,max_lon,\"grid\")\n if j == 0:\n ...
[ "0.7066006", "0.6986872", "0.6782247", "0.67565817", "0.6611911", "0.6550267", "0.65442395", "0.65442395", "0.6534613", "0.6534613", "0.6530289", "0.65220416", "0.6475809", "0.6464717", "0.64588034", "0.64530015", "0.6443492", "0.6440157", "0.64399004", "0.64394623", "0.64171...
0.0
-1
No sigmoid in forward because we are going to use BCEWithLogitsLoss Which applies sigmoid for us when calculating a loss
def forward(self, inputs): x, meta = inputs features = self.arch(x) if self.n_meta_features: meta_features = self.meta(meta) features = torch.cat((cnn_features, meta_features), dim=1) return self.ouput(features)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_propagate(self, x):\n self.z_h = np.dot( x, self.w_ih ) + self.b_h\n #Activations of hidden layer\n self.a_h = self.sigmoid( self.z_h )\n self.z_o = np.dot( self.a_h, self.w_ho ) + self.b_o\n #yEst = activations of output layer\n yEst = self.sigmoid( self.z_o )...
[ "0.718558", "0.7111254", "0.70874214", "0.70765215", "0.7072784", "0.703616", "0.7004094", "0.70040655", "0.6996144", "0.69507974", "0.69271636", "0.69134355", "0.68908584", "0.6888275", "0.68787265", "0.6857336", "0.68468887", "0.68463176", "0.6829951", "0.6828119", "0.68076...
0.0
-1
Set the default values for the configs sections.
def build_config(self, config): config.setdefaults('Makesmith Settings', {'COMport': 'COM5', 'xPitch': 20, 'openFile': " "})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_config_all_to_defaults():\n logging.debug(\"Creating default config\")\n for section in all_defaults:\n set_config_section_to_defaults(section)\n global config_changed\n config_changed = True", "def set_default_configs(self):\n\n raise Exception(\"Child classes must override set...
[ "0.7351159", "0.7339281", "0.72598445", "0.7222325", "0.7089661", "0.70572126", "0.6905622", "0.6813617", "0.6731078", "0.6685258", "0.6658991", "0.6594983", "0.659285", "0.6589595", "0.6574724", "0.65554917", "0.65229684", "0.6500052", "0.64604515", "0.6447857", "0.6442133",...
0.5929824
68
Add custom section to the default configuration object.
def build_settings(self, settings): settings.add_json_panel('Makesmith Settings', self.config, data=self.json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(self, section):", "def add_section(self, name, **defaults):\n if name in self._config_obj and not isinstance(self._config_obj[name], Section):\n raise SectionError(\"Cannot override value with section.\")\n if name not in self._config_obj:\n self._config_obj[name...
[ "0.6948539", "0.6916051", "0.65798974", "0.65221095", "0.64149725", "0.6406309", "0.6323181", "0.6323181", "0.6278571", "0.61800945", "0.61796504", "0.61749244", "0.60594046", "0.5995549", "0.59369934", "0.59015507", "0.58119464", "0.572047", "0.57180816", "0.56477875", "0.56...
0.0
-1
Respond to changes in the configuration.
def on_config_change(self, config, section, key, value): if section == "Makesmith Settings": if key == "COMport": self.data.comport = value elif key == 'xPitch': print "xPitch changed"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conf_update(self):\n pass", "def _on_config_changed(self, _):\n self._configure_pod()", "def check_update(self):\r\n with open('new_config.json', 'rt') as jsonfile:\r\n configuration = jsonfile.read()\r\n configuration_data = json.loads(configuration)\r\n with ...
[ "0.72056526", "0.66558397", "0.6500768", "0.64954627", "0.6412859", "0.6325383", "0.62285906", "0.61843014", "0.6140129", "0.61337703", "0.6130938", "0.6104602", "0.6017188", "0.60130835", "0.5995604", "0.5976737", "0.59728676", "0.595852", "0.5947268", "0.5928649", "0.589380...
0.555047
59
Finds the minimum number of points required so that each segment contains at least one marked point.
def optimal_points(segments): points = [] segments.sort(key=lambda x: x.end) while len(segments) != 0: s = segments[0] points.append(s.end) j = 0 while j < len(segments): temp = segments[j] if temp.start <= s.end and temp.end >= s.end: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required_points(self):\n req_points = self.min_performance * self.initial_available_points()\n return np.maximum(0, np.int64(np.ceil(req_points)))", "def get_minimum_number_of_data_points(cls):\n return cls._MINIMUM_NUMBER_OF_DATA_POINTS", "def count_segments(markers) -> int:\n cnt = ...
[ "0.6540888", "0.6392515", "0.6236526", "0.6167579", "0.61282146", "0.61146337", "0.60847116", "0.60146016", "0.5985607", "0.5973496", "0.5965992", "0.5892332", "0.5892332", "0.58477896", "0.58179706", "0.5793226", "0.57863146", "0.5763089", "0.57490504", "0.57437086", "0.5736...
0.61889994
3
Set up 1Wire integrations.
async def async_setup(hass, config): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.raw_wires = PyWires.WireNetwork();\n self.__initialize_wires();", "def startup( self ):\n # ---- Setup UPNPC ----\n if self.config.neuron.use_upnpc:\n bittensor.logging.success(prefix = 'Set upnpc', sufix = '<green>ON</green>')\n try:\n...
[ "0.60688394", "0.5936431", "0.58194745", "0.58194745", "0.5771031", "0.5715141", "0.5670098", "0.5669543", "0.5668779", "0.5655381", "0.56505156", "0.5618671", "0.56069756", "0.55828696", "0.55751944", "0.55751944", "0.55751944", "0.55751944", "0.55751944", "0.55751944", "0.5...
0.0
-1
Set up a 1Wire proxy for a config entry.
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry): hass.data.setdefault(DOMAIN, {}) onewirehub = OneWireHub(hass) try: await onewirehub.initialize(config_entry) except CannotConnect as exc: raise ConfigEntryNotReady() from exc hass.data[DOMAIN][config_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configureProxy():\n # config\n port = config.get(\"proxy\", \"port\")\n allowedDomains = config.get(\"proxy\", \"alloweddomains\")\n listeningIP = config.get(\"hotspot\", \"ip\")\n # wan dns\n proxyNSConfig = \"\"\n for dnsServer in wandns:\n proxyNSConfig = f\"{proxyNSConfig}nserve...
[ "0.66180223", "0.62802416", "0.61690414", "0.6010491", "0.5921584", "0.5850278", "0.57319605", "0.57271814", "0.57271814", "0.5701102", "0.56759375", "0.56625265", "0.5626089", "0.5621118", "0.5605153", "0.5568972", "0.5554984", "0.55459726", "0.55438066", "0.55358803", "0.55...
0.0
-1
Unload a config entry.
async def async_unload_entry(hass: HomeAssistantType, config_entry: ConfigEntry): unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(config_entry, component) for component in SUPPORTED_PLATFORMS ] ) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.697284", "0.6888074", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601"...
0.64135826
39
Select peaks that follow a particular pattern for merge The table passed in will be cut in place.
def chopnod_sort(self, table): if not isinstance(table, Table): return elif None in [self.chopdist, self.noddist]: return elif 'xcentroid' not in table.columns or \ 'ycentroid' not in table.columns: return dist = np.sqrt((self.chopdist ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_peaks(peak_table, ref_distance_map, ref_distance_indexmap, output='./extend_100_10/'):\n peaks = open(peak_table, 'r')\n info = peaks.readlines()\n peaks.close()\n\n results = []\n\n for line in info:\n line = line.strip()\n line = line.split('\\t')\n if line[1] == \"...
[ "0.63739586", "0.605613", "0.5531051", "0.54668343", "0.5459717", "0.5381175", "0.5375321", "0.5363828", "0.53531426", "0.5348113", "0.5344547", "0.53287023", "0.5325218", "0.5281158", "0.5273783", "0.5266891", "0.52546704", "0.5208344", "0.51937574", "0.5186177", "0.51843375...
0.0
-1
Initial search for peaks in the image
def search_peaks(self, image): table = Table() if not isinstance(image, np.ndarray): return table search_image = image if self.smooth: with catch_warnings(): simplefilter('ignore') search_image = convolve_fft( s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_peaks(image):\r\n\r\n # define an 8-connected neighborhood\r\n neighborhood = ndimage.morphology.generate_binary_structure(2,2)\r\n\r\n #apply the local maximum filter; all pixel of maximal value \r\n #in their neighborhood are set to 1\r\n local_max = ndimage.filters.maximum_filter(image...
[ "0.7422308", "0.7376325", "0.7278992", "0.71904063", "0.71288425", "0.6954977", "0.690354", "0.68966377", "0.67058456", "0.66651887", "0.6639898", "0.66282046", "0.6626508", "0.6614091", "0.65927845", "0.6578624", "0.65582496", "0.65490305", "0.651271", "0.6481589", "0.64671"...
0.736257
2
Refine table contents with a fit on the image The table is modified in place.
def refine_table(self, image, table): if table is None or len(table) == 0 or \ not isinstance(image, np.ndarray): return x0, y0 = np.mgrid[-self.ncut:self.ncut, -self.ncut:self.ncut] model_g = models.Gaussian2D( 1.0, self.ncut, self.ncut, x_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete_images_table(self, table):\r\n # Variable initialization\r\n cmp_double = 0\r\n cmp_img = 0\r\n\r\n # Connection to database\r\n conn, cursor = connection_database(self.db_name, self.host, self.user, self.password, self.local, self.ssl_ca)\r\n\r\n # Get images...
[ "0.5431792", "0.5344389", "0.51285285", "0.5111027", "0.5101912", "0.5088771", "0.5080382", "0.50031626", "0.49684134", "0.4954868", "0.49354628", "0.4919202", "0.4917076", "0.48899812", "0.48867348", "0.48697388", "0.48675102", "0.48475635", "0.4847346", "0.48268786", "0.481...
0.7310207
0
Find peaks (stars) in FORCAST images Identifies the desired number of peaks in the image using the DAO search algorithm followed by optional (default=True) Levenberg Marquardt least squares fitting of a gaussian psf to refine the fit.
def peakfind(coadded, newimage=None, refine=True, npeaks=4, fwhm=4.5, sharplo=0.2, sharphi=1.0, roundlo=-0.75, roundhi=0.75, silent=False, maxiter=1000, epsilon=5, eps=1e-7, ncut=30, chopnoddist=None, positive=False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peakFinder(self, fit_peaks_image):\n if self.check_mode:\n tifffile.imsave(\"fit_peaks.tif\", fit_peaks_image.astype(numpy.float32))\n\n # Calculate background variance.\n #\n # Notes:\n #\n # 1. The assumption here is that we are working in units of photo-e...
[ "0.6971431", "0.695021", "0.6889149", "0.6687948", "0.6558322", "0.62923485", "0.6172872", "0.6101547", "0.6086589", "0.60263014", "0.60255814", "0.5992918", "0.5991013", "0.5968996", "0.5959041", "0.59579647", "0.5947159", "0.5904097", "0.5867966", "0.58373225", "0.58348125"...
0.5402981
66
Initialize the RAMSTKWorkView metaclass.
def __init__(self, controller, **kwargs): _module = kwargs['module'] gtk.HBox.__init__(self) ramstk.RAMSTKBaseView.__init__(self, controller, module=_module) self._module = None for __, char in enumerate(_module): if char.isalpha(): self._module = _mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, controller, **kwargs): # pylint: disable=unused-argument\n RAMSTKWorkView.__init__(self, controller, module='Function')\n\n # Initialize private dictionary attributes.\n\n # Initialize private list attributes.\n self._lst_assess_labels[1].append(_(u\"Total Mode Count...
[ "0.6240101", "0.59596485", "0.579034", "0.5773658", "0.5769354", "0.5749818", "0.56876385", "0.56521547", "0.5582976", "0.555983", "0.55574834", "0.5523128", "0.5515693", "0.5504477", "0.55011004", "0.54869395", "0.5480955", "0.5474198", "0.5460474", "0.54480135", "0.5437854"...
0.64453584
0
Create the gtk.Notebook() page for displaying assessment results.
def _make_assessment_results_page(self): _hbox = gtk.HBox() # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Build the left half of the page. # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # _fx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_assessment_results_page(self, notebook):\r\n\r\n _hbox = gtk.HBox()\r\n\r\n # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #\r\n # Build the left half of the page. #\r\n # +++++++++++++++++++++++++++++++++++++++++++++...
[ "0.8329622", "0.7571663", "0.72755533", "0.71898496", "0.7028935", "0.6892961", "0.6792773", "0.6667084", "0.66336125", "0.64590913", "0.64258105", "0.6100222", "0.6006352", "0.59311277", "0.58841544", "0.5749062", "0.5729164", "0.5685445", "0.5673195", "0.5663004", "0.563122...
0.76316273
1
Respond to load the Work View gtk.Notebook() widgets. This method handles the results of the an individual module's _on_select() method. It sets the title of the RAMSTK Work Book and raises an error dialog if needed.
def on_select(self, **kwargs): _title = kwargs['title'] _error_code = kwargs['error_code'] _user_msg = kwargs['user_msg'] _debug_msg = kwargs['debug_msg'] try: _workbook = self.get_parent().get_parent() _workbook.set_title(_title) except Attribute...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, controller, **kwargs):\n _module = kwargs['module']\n gtk.HBox.__init__(self)\n ramstk.RAMSTKBaseView.__init__(self, controller, module=_module)\n\n self._module = None\n for __, char in enumerate(_module):\n if char.isalpha():\n self....
[ "0.5903212", "0.5611034", "0.5532166", "0.5440121", "0.5369993", "0.5311868", "0.52511024", "0.5176978", "0.51719844", "0.51626706", "0.51476216", "0.5146475", "0.5130871", "0.51127416", "0.50981665", "0.5091824", "0.50823027", "0.5081134", "0.50551033", "0.5042717", "0.50361...
0.6752174
0
Respond to the `selectedRevision` signal from pypubsub.
def _on_select_revision(self, **kwargs): self._revision_id = kwargs['module_id'] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_notify(self,event):\n # pysvn.wc_notify_action.update_completed\n if event['action'] == pysvn.wc_notify_action.update_completed:\n revision = event['revision']\n self.revision = revision", "def onSelected(self):\n pass", "def selection_changed(self):\n ...
[ "0.62416744", "0.60654837", "0.59142613", "0.58489025", "0.58353555", "0.5674044", "0.54842246", "0.54825467", "0.5423293", "0.53679717", "0.53676856", "0.5355891", "0.5354404", "0.53491926", "0.53078157", "0.53046656", "0.5300872", "0.5299296", "0.52821183", "0.5278814", "0....
0.670077
0
Get the translation for a string using Qt translation API. We implement this ourselves since we do not inherit QObject.
def tr(self, message): # noinspection PyTypeChecker,PyArgumentList,PyCallByClass return QCoreApplication.translate('Orthodem2xyzrgb', message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gettext(self, string):\n return self._translations.gettext(string)", "def gettext_translate(string):\n # Try default translation first\n translation = localizer.old_translate(i18n.TranslationString(string))\n if translation == string:\n # translation failed then use For...
[ "0.7165638", "0.68708587", "0.65502787", "0.64578044", "0.6359209", "0.6349498", "0.6337029", "0.62444365", "0.6222953", "0.6222953", "0.6210399", "0.61061776", "0.60911477", "0.59815615", "0.5970113", "0.5915851", "0.59141165", "0.5894791", "0.58896285", "0.5876152", "0.5869...
0.0
-1
Add a toolbar icon to the toolbar.
def add_action( self, icon_path, text, callback, enabled_flag=True, add_to_menu=True, add_to_toolbar=True, status_tip=None, whats_this=None, parent=None): icon = QIcon(icon_path) action = QAction(icon, text, parent) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_toolbar ( self, toolbar_item ):\r\n pass", "def AddIcon(*args, **kwargs):\n return _gdi_.IconBundle_AddIcon(*args, **kwargs)", "def icon(self, icon):\n self._icon = icon", "def add_toolbar(self, title=None, toolbar=None):\n if 1 != bool(toolbar) + bool(title):\n ...
[ "0.69304866", "0.66122353", "0.6507136", "0.6479284", "0.64467525", "0.6425615", "0.64154416", "0.6344951", "0.6340648", "0.6300516", "0.62950766", "0.62950766", "0.6277065", "0.6277065", "0.6277065", "0.62653816", "0.62580323", "0.6251146", "0.6251146", "0.6251146", "0.62511...
0.6272122
21
Removes the plugin menu item and icon from QGIS GUI.
def unload(self): for action in self.actions: self.iface.removePluginMenu( self.tr(u'&Create xyzrgb from Mosaic/DSM'), action) self.iface.removeToolBarIcon(action)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unload(self):\n self.iface.removePluginRasterMenu(self.menu, self.action)\n self.iface.removeRasterToolBarIcon(self.action)", "def unload(self):\n for action in self.actions:\n self.iface.removePluginWebMenu(\n self.tr(u'&Buienradar Plugin'),\n ac...
[ "0.75985533", "0.7490045", "0.74875885", "0.74644965", "0.74293286", "0.73977417", "0.7351217", "0.7302819", "0.72957236", "0.7280735", "0.72645974", "0.7254971", "0.7249904", "0.7242769", "0.7236294", "0.7224091", "0.7221227", "0.7193434", "0.7174475", "0.7174303", "0.706305...
0.73383284
7
clean up the worker and thread
def workerExceptionThrown(self, exc, tb): self.worker.deleteLater() self.thread.quit() self.thread.wait() self.thread.deleteLater() print str(tb) self.iface.messageBar().pushMessage('Error:' + str(tb), level=QgsMessageBar.CRITICAL, duration=3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_threading(self):\n self.pids = []\n self.receiver_thread = None\n self.manager_thread = None\n self.workflows_executed = 0\n self.threading_is_initialized = False\n self.load_balancer = None\n self.receiver = None", "def cleanup():", "def clean_up(se...
[ "0.7617214", "0.75679314", "0.7493909", "0.7443149", "0.7439993", "0.7439993", "0.7439993", "0.7412886", "0.7412886", "0.740551", "0.73626775", "0.73626775", "0.73626775", "0.73626775", "0.73626775", "0.73626775", "0.73626775", "0.73626775", "0.73626775", "0.73626775", "0.736...
0.0
-1
clean up the worker and thread
def workerFinished(self, ret): self.worker.deleteLater() self.thread.quit() self.thread.wait() self.thread.deleteLater() # remove widget from message bar self.iface.messageBar().popWidget(self.messageBar) if ret is not None: # report the result ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_threading(self):\n self.pids = []\n self.receiver_thread = None\n self.manager_thread = None\n self.workflows_executed = 0\n self.threading_is_initialized = False\n self.load_balancer = None\n self.receiver = None", "def cleanup():", "def clean_up(se...
[ "0.7618245", "0.756773", "0.74941987", "0.7443747", "0.74397534", "0.74397534", "0.74397534", "0.7412843", "0.7412843", "0.7405907", "0.7362572", "0.7362572", "0.7362572", "0.7362572", "0.7362572", "0.7362572", "0.7362572", "0.7362572", "0.7362572", "0.7362572", "0.7362572", ...
0.0
-1
Start task in a separate worker thread
def startWorker(self): worker = Worker(self) # configure the QgsMessageBar messageBar = self.iface.messageBar().createMessage('Started to create file', ) progressBar = self.dlg.progressBar cancelButton = self.dlg.pbCancel cancelButton.clicked.connect(worker.kill) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_task(self, task):\n t = threading.Thread(target=task)\n t.start()", "def start(self):\n if self.threadPool:\n self.threadPool.addTask(self)\n\n # Lets other threads have a chance to run\n time.sleep(0)\n else:\n raise TaskError(\...
[ "0.72511715", "0.7200598", "0.7173589", "0.7115231", "0.7037704", "0.701224", "0.701224", "0.69576657", "0.693258", "0.6605127", "0.65964097", "0.656866", "0.6543169", "0.6533425", "0.648766", "0.64696765", "0.6452332", "0.6406273", "0.63960487", "0.63709843", "0.63425493", ...
0.6265067
24
file chooser for orthomosaic
def choosefilenameortho(self, e): filename = QFileDialog.getOpenFileName(self.dlg,"Select TIFF file", "/home", "TIF files (*.tif);;All files (*.*)") if filename: self.dlg.leOrthomosaic.setText(filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_file(self):\n pass", "def fileCmd(self):\n filename = askopenfilename() \n self.cnvImgOrig.displayImage(filename)\n self.cnvImgTest.displayImage(filename)", "def chooseOpenFile(self):\n fname = QFileDialog.getOpenFileName(self, 'Open file',\n ...
[ "0.68460006", "0.6781604", "0.6464207", "0.6318979", "0.6274876", "0.6174504", "0.6145747", "0.6051645", "0.6024273", "0.6023101", "0.58995837", "0.5868736", "0.5868575", "0.58656466", "0.5854936", "0.58537596", "0.58488727", "0.58395654", "0.58267856", "0.5804377", "0.577666...
0.7535651
0
file chooser for DSM file
def choosefilenamedsm(self, e): filename = QFileDialog.getOpenFileName(self.dlg,"Select TIFF file", "/home", "TIF files (*.tif);;All files (*.*)") if filename: self.dlg.leDem.setText(filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_file(self):\n pass", "def choosefile():\r\n\r\n # get filename\r\n filename = tkFileDialog.askopenfilename(**options)\r\n #print filename, '*****'\r\n\r\n # open file on your own\r\n if filename:\r\n #return open(filename, 'r')\r\n tasks.upload_chosen = filename", ...
[ "0.7694681", "0.6940432", "0.6824514", "0.6824514", "0.67526436", "0.67517835", "0.6737426", "0.6693227", "0.6636667", "0.6618639", "0.6614086", "0.65942067", "0.65742457", "0.65133035", "0.65074074", "0.65001905", "0.64629984", "0.64560777", "0.64248145", "0.642477", "0.6422...
0.69285095
2
Wire in the event bindings
def run(self): # show the dialog self.dlg.pbOrtho.clicked.connect(self.choosefilenameortho) self.dlg.pbDem.clicked.connect(self.choosefilenamedsm) self.dlg.pbStart.clicked.connect(self.startWorker) self.dlg.show() # Run the dialog event loop result = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events(self):", "def bind( self, context ):\n if not self.bound:\n self.bound = True\n context.addEventHandler(\n 'mousein', node=self, \n function = self.OnMouseIn,\n )\n context.addEventHandler(\n 'mouseout', no...
[ "0.70708", "0.68839735", "0.6836781", "0.66658187", "0.65025246", "0.6466312", "0.64557165", "0.6414354", "0.64101064", "0.6395929", "0.63834065", "0.6380132", "0.63736653", "0.6305454", "0.627618", "0.62598383", "0.6257808", "0.6153896", "0.6099257", "0.60847014", "0.6074706...
0.0
-1
Turn debugging on or off. flag (boolean) True means output debugging, False means no.
def set_debug(flag): global debug debug = flag XLM.XLM_Object.debug = flag XLM.xlm_library.debug = flag XLM.ms_stack_transformer.debug = flag XLM.stack_transformer.debug = flag XLM.excel2007.debug = flag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pma_set_debug_flag(flag):\n global _pma_debug\n\n if not isinstance(flag, (bool)):\n raise Exception(\"flag argument must be of class bool\")\n _pma_debug = flag\n if flag is True:\n print(\"Debug flag enabled. You will receive extra feedback and messages from pma_python (like this o...
[ "0.8442389", "0.8004203", "0.7552657", "0.7459034", "0.74430126", "0.7386035", "0.7369075", "0.733531", "0.73233885", "0.72165483", "0.71832865", "0.7181144", "0.71762866", "0.711174", "0.6919977", "0.69111127", "0.6909054", "0.68787426", "0.68384385", "0.6745519", "0.6719568...
0.773577
2
Run olevba on the given file and extract the XLM macro code lines. maldoc (str) The fully qualified name of the Excel file to analyze. (str) The XLM macro cells extracted from running olevba on the given file. None will be returned on error.
def _extract_xlm(maldoc): # Run olevba on the given file. olevba_out = None FNULL = open(os.devnull, 'w') try: cmd = "timeout 30 olevba -c \"" + str(maldoc) + "\"" olevba_out = subprocess.check_output(cmd, shell=True, stderr=FNULL) except Exception as e: color_print.output('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_workbook_97(maldoc):\n\n # Run olevba on the file and extract the XLM macro code lines.\n color_print.output('g', \"Analyzing Excel 97 file ...\")\n xlm_code = _extract_xlm(maldoc)\n color_print.output('g', \"Extracted XLM with olevba.\")\n if debug:\n print(\"=========== START RAW ...
[ "0.6144289", "0.6018125", "0.57654345", "0.4963401", "0.49541065", "0.48330134", "0.46645972", "0.45865145", "0.45475653", "0.4467187", "0.44324526", "0.4419184", "0.441069", "0.44008112", "0.43970215", "0.4365387", "0.43541402", "0.43446854", "0.42940488", "0.42849368", "0.4...
0.733833
0
Guess the sheet containing the XLM macros by finding the sheet with the most unresolved "NAME" cells. workbook (ExcelSheet object) The Excel spreadsheet to check. (str) The name of the sheet that might contain the XLM macros.
def _guess_xlm_sheet(workbook): # TODO: If plugin_biff.py used by olevba to dump XLM includes sheet names this # function will no longer be needed. # Look at each sheet. xlm_sheet = None unresolved_count = -1 for curr_sheet_name in workbook.sheet_names(): curr_sheet = workbook.sheet_by...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_workbook_2007(maldoc):\n\n # Read in the 2007+ cells.\n color_print.output('g', \"Analyzing Excel 2007+ file ...\")\n workbook_info = XLM.excel2007.read_excel_2007_XLM(maldoc) \n color_print.output('g', \"Extracted XLM from ZIP archive.\")\n if (workbook_info is None):\n return (...
[ "0.6036669", "0.60088015", "0.5607725", "0.56071246", "0.5354856", "0.52406216", "0.518099", "0.51746696", "0.50699383", "0.5010548", "0.49969032", "0.49915874", "0.49154997", "0.48782837", "0.48635158", "0.48627582", "0.48588476", "0.48369735", "0.47476253", "0.46648648", "0...
0.82565725
0
Merge the given XLM cells into the value cells read from the given Excel file. maldoc (str) The fully qualified name of the Excel file to analyze. xlm_cells (dict) A dict of XLM formula objects (XLM_Object objects) where dict[ROW][COL] gives the XLM cell at (ROW, COL). (tuple) A 3 element tuple where the 1st element is...
def _merge_XLM_cells(maldoc, xlm_cells): # Read in the Excel workbook data. color_print.output('g', "Merging XLM macro cells with data cells ...") workbook = excel.read_excel_sheets(maldoc) if (workbook is None): color_print.output('r', "ERROR: Reading in Excel file " + str(maldoc) + " failed."...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_workbook_2007(maldoc):\n\n # Read in the 2007+ cells.\n color_print.output('g', \"Analyzing Excel 2007+ file ...\")\n workbook_info = XLM.excel2007.read_excel_2007_XLM(maldoc) \n color_print.output('g', \"Extracted XLM from ZIP archive.\")\n if (workbook_info is None):\n return (...
[ "0.604738", "0.6008518", "0.5825835", "0.5649459", "0.55426455", "0.52557373", "0.48428568", "0.48080117", "0.475572", "0.4632839", "0.4576498", "0.45346174", "0.4532015", "0.4509528", "0.44865486", "0.4460298", "0.444932", "0.44257683", "0.44192648", "0.44060838", "0.4393537...
0.8173978
0
Read in an Excel 2007+ workbook and the XLM macros in the workbook. maldoc (str) The fully qualified name of the Excel file to analyze. (tuple) A 3 element tuple where the 1st element is the workbook object, the 2nd element is a list of XLM cell indices ((row, column) tuples) and the 3rd element is a sheet element for ...
def _read_workbook_2007(maldoc): # Read in the 2007+ cells. color_print.output('g', "Analyzing Excel 2007+ file ...") workbook_info = XLM.excel2007.read_excel_2007_XLM(maldoc) color_print.output('g', "Extracted XLM from ZIP archive.") if (workbook_info is None): return (None, None, None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_workbook_97(maldoc):\n\n # Run olevba on the file and extract the XLM macro code lines.\n color_print.output('g', \"Analyzing Excel 97 file ...\")\n xlm_code = _extract_xlm(maldoc)\n color_print.output('g', \"Extracted XLM with olevba.\")\n if debug:\n print(\"=========== START RAW ...
[ "0.72741294", "0.7015034", "0.69145006", "0.5732033", "0.5640195", "0.55930376", "0.5567607", "0.556654", "0.5291013", "0.5264286", "0.510124", "0.5087777", "0.503987", "0.50384337", "0.5029056", "0.50221443", "0.5013305", "0.5012877", "0.50087535", "0.49634397", "0.49184382"...
0.7939801
0
Read in an Excel 97 workbook and the XLM macros in the workbook. maldoc (str) The fully qualified name of the Excel file to analyze. (tuple) A 3 element tuple where the 1st element is the workbook object, the 2nd element is a list of XLM cell indices ((row, column) tuples) and the 3rd element is a sheet element for the...
def _read_workbook_97(maldoc): # Run olevba on the file and extract the XLM macro code lines. color_print.output('g', "Analyzing Excel 97 file ...") xlm_code = _extract_xlm(maldoc) color_print.output('g', "Extracted XLM with olevba.") if debug: print("=========== START RAW XLM =============...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_workbook_2007(maldoc):\n\n # Read in the 2007+ cells.\n color_print.output('g', \"Analyzing Excel 2007+ file ...\")\n workbook_info = XLM.excel2007.read_excel_2007_XLM(maldoc) \n color_print.output('g', \"Extracted XLM from ZIP archive.\")\n if (workbook_info is None):\n return (...
[ "0.79433113", "0.72427917", "0.7036231", "0.5774751", "0.57168466", "0.5638217", "0.563626", "0.5588673", "0.53787875", "0.5337786", "0.5189825", "0.5149428", "0.51007754", "0.5068647", "0.5065638", "0.5052728", "0.5047861", "0.5045103", "0.5043639", "0.5033287", "0.49730438"...
0.7649732
1
Emulate the behavior of a given Excel file containing XLM macros. maldoc (str) The fully qualified name of the Excel file to analyze. (tuple) 1st element is a list of 3 element tuples containing the actions performed by the sheet, 2nd element is the human readable XLM code.
def emulate(maldoc): # Excel 97 file? if (XLM.utils.is_excel_file_97(maldoc)): workbook, xlm_cell_indices, xlm_sheet = _read_workbook_97(maldoc) if (workbook is None): color_print.output('r', "ERROR: Reading Excel 97 file failed. Emulation aborted.") return ([], "") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_workbook_2007(maldoc):\n\n # Read in the 2007+ cells.\n color_print.output('g', \"Analyzing Excel 2007+ file ...\")\n workbook_info = XLM.excel2007.read_excel_2007_XLM(maldoc) \n color_print.output('g', \"Extracted XLM from ZIP archive.\")\n if (workbook_info is None):\n return (...
[ "0.6723555", "0.6653062", "0.6573594", "0.5674583", "0.50879794", "0.4930489", "0.49133873", "0.47957298", "0.4716508", "0.4700348", "0.46856138", "0.46792737", "0.46772945", "0.45869985", "0.4560465", "0.45124787", "0.4482203", "0.44816422", "0.44635886", "0.44590777", "0.44...
0.74941033
0
restores the previous value that appeared on screen before the current value
def undo(): # pressing undo twice restores the original value global current_value, operations # solution: since there are only 2 values stored, swap operations[0], operations[1] = operations[1], operations[0] current_value = operations[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def previous(self, _event):\n self.set_val(self.val - 1)", "def _reset(self):\n self._value = self._default", "def reset(self):\n if np.any(self.val != self.valinit):\n self.set_val(self.valinit)", "def reset(self):\n self.value = self.min_value", "def back( self ...
[ "0.7064052", "0.67926604", "0.6779316", "0.67684746", "0.6731488", "0.6712456", "0.66832244", "0.6680013", "0.6603748", "0.66011363", "0.6588475", "0.64831895", "0.64447075", "0.6402228", "0.63306135", "0.6300861", "0.6258527", "0.6232558", "0.62290627", "0.62260324", "0.6209...
0.6586685
11
export the object as a DOM node
def _exportNode(self): node = self._extractProperties() self._logger.info('settings exported.') return node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dom_element(self, doc):\n string = \"This should never be printed. - EGCryptoSystem.py\"\n return self.to_stub(string, string).to_dom_element(doc)", "def saveToXml(self) -> org.jdom.Element:\n ...", "def dom(self):\n raise NotImplementedError(\"base class called\")", "def t...
[ "0.6095584", "0.6086931", "0.60766387", "0.5632199", "0.55993336", "0.5587957", "0.5569819", "0.55200905", "0.55086356", "0.54823077", "0.5463836", "0.5459833", "0.5445634", "0.54350054", "0.5427114", "0.54055375", "0.5374137", "0.53687066", "0.53391767", "0.53107303", "0.530...
0.53783166
16
import the object from the DOM node
def _importNode(self, node): if self.environ.shouldPurge(): self._purgeProperties() self._initProperties(node) self._logger.info('settings imported.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loads(src):\n return Document(src).root()", "def loadFromDom(self, root):\n if hasattr(root, \"documentElement\"):\n self.xml = root\n else:\n # Encase the given tree fragment in a Document\n self.xml = createRootNode()\n self.xml.appendChild(self....
[ "0.56948936", "0.5567659", "0.541593", "0.5304131", "0.52615625", "0.5225738", "0.521192", "0.5209291", "0.5179152", "0.5168463", "0.51372474", "0.5137079", "0.51219136", "0.51199913", "0.51124996", "0.5111796", "0.5098951", "0.5096477", "0.50870323", "0.5080122", "0.506883",...
0.5070543
20
import settings for websocket client integration from an XML file
def importWebSocketClientSettings(context): site = context.getSite() utility = queryUtility(IWebSocketConnectionConfig, context=site) if utility is None: logger = context.getLogger('collective.websocketclient') logger.info('Nothing to import.') return if IPersistent.providedBy(ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_settings(self):\n # Set the default settings. In case in a later version of this script the settings change, new default variables will be added automatically\n self.settings = {\n # Connection settings to OBS Studio websockets plugin\n \"host\": \"localhost\",\...
[ "0.58948606", "0.57333976", "0.5718949", "0.54858726", "0.54734534", "0.5444267", "0.5406738", "0.53434104", "0.52570355", "0.525459", "0.52514964", "0.5226953", "0.5206524", "0.520246", "0.5165548", "0.50997484", "0.50673604", "0.50673604", "0.5064736", "0.50557166", "0.5043...
0.6708304
0
export settings for websocket client integration as an XML file
def exportWebSocketClientSettings(context): site = context.getSite() utility = queryUtility(IWebSocketConnectionConfig, context=site) if utility is None: logger = context.getLogger('collective.websocketclient') logger.info('Nothing to export.') return if IPersistent.providedBy(ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_config_xml_to_broker(self):\n xmlObject = xml.dom.minidom.parse(\"config_setup.xml\")\n pretty_xml_as_string = xmlObject.toprettyxml()\n self.client.publish(\"users/everyone/inbox/server/deviceList\", pretty_xml_as_string)\n print(\"XML config sent.\")", "def write_config(sel...
[ "0.6345738", "0.59505016", "0.5862077", "0.5750333", "0.5711413", "0.566478", "0.5633414", "0.55401486", "0.5536291", "0.5536282", "0.5519001", "0.5490517", "0.54668343", "0.54395074", "0.5418738", "0.54035866", "0.5395367", "0.5363175", "0.5324485", "0.5318015", "0.5297074",...
0.7233053
0
A function to react to key being pressed on an image canvas.
def doSomething(imp, keyEvent): IJ.log("clicked keyCode " + str(keyEvent.getKeyCode()) + " on image " +
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onKeyPress(self, widget, event):\n\t\t#print event.hardware_keycode\n\t\tif event.hardware_keycode in [102,100,98,104] and self.fullscreenToggle:\n\t\t\t# Binding: arrow keys: move image (Fs)\n\t\t\t# Binding: arrow keys+Shift: move image faster (Fs)\n\t\t\tif event.state & gtk.gdk.SHIFT_MASK:\n\t\t\t\tamount...
[ "0.6845082", "0.68138224", "0.68048865", "0.6795043", "0.6732254", "0.66485685", "0.6618535", "0.65895975", "0.65495425", "0.65127254", "0.64510345", "0.64482975", "0.6427912", "0.6411434", "0.64104617", "0.63843274", "0.6371269", "0.6336644", "0.63249564", "0.63180494", "0.6...
0.70632905
0
Borra una asignatura Borra una asignatura y todas sus notas.
def borra_asignatura(id): try: cnx = mysql.connector.connect(user=user, password=password, database=database) cursor = cnx.cursor() #cursor.execute("DELETE FROM `calificacion` WHERE `calificacion`.`id_asignatura` = {}".format(id)) cursor.execute("DELETE FROM `asignatura` WHERE `a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archivos_de_texto():\n palabra = \"\" \n palabras_candidatas = [] #lista donde se guardara las palabras candidatas de cada linea\n palabra_cantidad = {} #diccionario con la palabra candidata de clave y las veces que esta repetida en cada texto de valor\n with open(\"Cuentos.txt\",\"r\") as Cuentos:...
[ "0.6330623", "0.6197294", "0.61444724", "0.61302763", "0.60686797", "0.60686797", "0.60686797", "0.60686797", "0.60686797", "0.599808", "0.59829855", "0.5942891", "0.5915584", "0.5878275", "0.5834363", "0.5825661", "0.5819315", "0.58142996", "0.57805777", "0.5764775", "0.5745...
0.5463605
42
Returns whether a metric is considered healthy Function compares the metric mapped to by key it was initialized with
def is_healthy(self, metric_results): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def check_health():\n return {\"healthy\": True}", "def is_healthy(self) -> bool:\n try:\n self.health()\n except MeiliSearchError:\n return False\n return True", "def is_healthy(self) -> bool:\n return False", "def healthy(self) -> bool:\n re...
[ "0.6246055", "0.6168581", "0.60983115", "0.6049883", "0.6007633", "0.5973169", "0.59227043", "0.5918034", "0.58422655", "0.5830914", "0.5814101", "0.58081686", "0.5798145", "0.5791956", "0.57410717", "0.57409346", "0.56640285", "0.56574523", "0.5646705", "0.56458324", "0.5634...
0.67867005
0
This method will return the closest point index for a given point P from list of points given in centers
def closestCluster(p, centers): bestIndex = 0 closest = float("+inf") for i in range(len(centers)): distance = np.sqrt(np.sum((np.array(p) - centers[i]) ** 2)) if distance < closest: closest = distance bestIndex = i return bestIndex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closestClusterAndDistance(p, centers):\n\tbestIndex = 0\n closest = float(\"+inf\")\n for i in range(len(centers)):\n distance = np.sqrt(np.sum((np.array(p) - centers[i]) ** 2))\n if distance < closest:\n closest = distance\n bestIndex = i\n ...
[ "0.81604385", "0.7818576", "0.76468176", "0.7452406", "0.7312577", "0.7209503", "0.7146841", "0.7022789", "0.7015073", "0.69740677", "0.69587153", "0.69570583", "0.6940364", "0.6904534", "0.6889646", "0.68861485", "0.685346", "0.68314093", "0.6825442", "0.6790361", "0.6773268...
0.8303884
0
This method will return the closest point index and its ditance for a given point P from list of points given in centers
def closestClusterAndDistance(p, centers): bestIndex = 0 closest = float("+inf") for i in range(len(centers)): distance = np.sqrt(np.sum((np.array(p) - centers[i]) ** 2)) if distance < closest: closest = distance bestIndex = i return (best...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closestCluster(p, centers):\n\tbestIndex = 0\n closest = float(\"+inf\")\n for i in range(len(centers)):\n distance = np.sqrt(np.sum((np.array(p) - centers[i]) ** 2))\n if distance < closest:\n closest = distance\n bestIndex = i\n\treturn bestIn...
[ "0.80020124", "0.7691775", "0.7506859", "0.7360311", "0.7189735", "0.71564335", "0.71380126", "0.71302176", "0.69669247", "0.6954315", "0.6937151", "0.6917281", "0.6860945", "0.6839078", "0.67988765", "0.67920554", "0.6790271", "0.6789571", "0.6771405", "0.67593086", "0.67492...
0.80924296
0
train method will take dataframe as an input and returns centers using kmeans algorithm with L2 distance
def train(self, data): epsilon = self.epsilon tempDist = 1.0 k = self.k centers = data.rdd.takeSample(False, k, 1) i = 0 while tempDist > epsilon or self.maxNoOfIteration > i: i+=1 closest = data.map(lambda p: (closestCluster(p, centers), (np.array(p), 1))) pointStats = closest.reduceByK...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def k_means_model(df, numOfClusters):\n # Perform scaling on the dataframe containing the selected features\n data = scale(df)\n\n # Train a model\n model = KMeans(init=\"k-means++\", n_clusters=numOfClusters, n_init=20).fit(data)\n return model", "def calculate_kmeans(df, clusters=10):\r\n kme...
[ "0.71723557", "0.691053", "0.6901916", "0.6852868", "0.68385345", "0.68138105", "0.67475885", "0.6669792", "0.65544796", "0.6422493", "0.64189833", "0.6411663", "0.63902324", "0.6388245", "0.63098115", "0.6305227", "0.6287323", "0.6283454", "0.62477034", "0.62462896", "0.6237...
0.7532827
0
returns the index of the closest cluster for a given data point data
def predict(self, data): return closestCluster(data, self.centers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clusterAndDistance(self, data):\n\t\treturn closestClusterAndDistance(data, self.centers)", "def closest_cluster(cluster_averages, example):\n\n # just do a normal search for a minimum\n best_index = -1\n best_distance = 10000000\n for (i, cluster_average) in enumerate(cluster_averages):\n ...
[ "0.76343995", "0.74881965", "0.7465451", "0.7393315", "0.73417085", "0.71406156", "0.70573294", "0.7044991", "0.68879014", "0.68158907", "0.675538", "0.66819733", "0.66790366", "0.66746634", "0.6630393", "0.65902525", "0.6589684", "0.65885776", "0.65667975", "0.6524308", "0.6...
0.7158905
5
returns the index of the closest cluster and its distance for a given data point data
def clusterAndDistance(self, data): return closestClusterAndDistance(data, self.centers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closestClusterAndDistance(p, centers):\n\tbestIndex = 0\n closest = float(\"+inf\")\n for i in range(len(centers)):\n distance = np.sqrt(np.sum((np.array(p) - centers[i]) ** 2))\n if distance < closest:\n closest = distance\n bestIndex = i\n ...
[ "0.7288707", "0.7270212", "0.72385883", "0.71241885", "0.7107449", "0.70917314", "0.7035779", "0.6971508", "0.6815752", "0.65985656", "0.65984434", "0.6574564", "0.6555377", "0.6491588", "0.6482346", "0.6465322", "0.6464889", "0.6460569", "0.64458454", "0.64357096", "0.643149...
0.8121391
0
Filter annsets to annotations overlapping candidate.
def filter_to_candidate(self): filtered = { k: [] for k in self.annsets } for key, annset in self.annsets.items(): for a in annset: if a.overlaps(self.candidate): filtered[key].append(a) self.annsets = filtered
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlap(annotations1, annotations2):\n return [val for val in annotations1 if val in annotations2]", "def overlapping_aids(self, gid, region, visible_thresh=0.0):\n overlap_aids = self.isect_index.overlapping_aids(gid, region)\n if visible_thresh > 0 and len(overlap_aids) > 0:\n #...
[ "0.6370355", "0.58862954", "0.56585723", "0.5642055", "0.5398902", "0.5389672", "0.5317603", "0.5258657", "0.5253353", "0.5193474", "0.5176536", "0.51494116", "0.51470774", "0.5127493", "0.51185286", "0.51145107", "0.5083101", "0.50759697", "0.5057774", "0.50500035", "0.50029...
0.77305436
0
Get collection contents organized by file extension.
def _get_contents_by_ext(self, collection): contents_by_ext = defaultdict(list) collection_dir = os.path.join(self.root_dir, collection) for name in sorted(os.listdir(collection_dir)): path = os.path.join(collection_dir, name) if os.path.isfile(path): root...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_contents_with_ext(self, ext):\n for filename in self.project.namelist():\n if filename.endswith('.'+ext):\n contents = self.project.open(filename, 'r')\n return contents\n return None", "def content(self, extensionFilter=[]):\r\n\r\n if self....
[ "0.6799076", "0.6698243", "0.62939227", "0.5981953", "0.597571", "0.5942609", "0.5938336", "0.5910077", "0.5861005", "0.5847813", "0.58334965", "0.58313465", "0.5780494", "0.5774376", "0.57720035", "0.57720035", "0.57720035", "0.5757031", "0.5736017", "0.5729282", "0.57288516...
0.84675837
0
Atomic write using os.rename().
def safe_write_file(self, fn, text): fd, tmpfn = mkstemp(dir=self.temp_dir) with open(fd, 'wt') as f: f.write(text) # https://stackoverflow.com/a/2333979 f.flush() os.fsync(f.fileno()) os.rename(tmpfn, fn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rename_ondisk(self):\n if not self.has_moved or not self.renames_remaining:\n return\n\n try:\n os.rename(self.rename_phase_src, self.rename_phase_dst)\n except Exception:\n sys.stderr.write(\"Failed to renamed '%s' to '%s'\\n\" %\n ...
[ "0.6895058", "0.65596277", "0.6537626", "0.64969563", "0.62407434", "0.62288344", "0.621589", "0.621589", "0.61950946", "0.61240774", "0.6068798", "0.60534745", "0.6049205", "0.60448855", "0.60263747", "0.6019295", "0.599629", "0.5951231", "0.59394264", "0.59154314", "0.5915"...
0.60334814
14
Run one epoch of supervised training.
def train(args, model, data_loader, optimizer): # Keep track of average accuracy and loss avg_loss = utils.AverageMeter() # Set training mode model.train() # for inputs, target in tqdm(data_loader): for inputs, targets in tqdm(data_loader): # Prep inputs = utils.wrap_variables(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_one_epoch(self):\n raise NotImplementedError", "def train_one_epoch(self):\n\t\tself.model.train()\n\t\ttrain_loss = 0\n\n\t\tfor batch_idx, data in enumerate(self.data_loader.train_loader):\n\t\t\tInput = data[0].float().to(self.device)\n\t\t\tOutput = data[1].float().to(self.device)\n\n\t\t\ts...
[ "0.80954355", "0.75742745", "0.75505626", "0.743583", "0.743583", "0.743583", "0.743583", "0.7434428", "0.7377287", "0.7295083", "0.72670895", "0.7232734", "0.72042525", "0.71757835", "0.7169562", "0.70450747", "0.70069456", "0.6976382", "0.6933775", "0.6905024", "0.6881554",...
0.0
-1
Make and score predictions over a validation set.
def validate(args, gold, model, data_loader, test=False): # Keep track of average accuracy and loss avg_loss = utils.AverageMeter() # Set eval mode model.eval() tags = [] # for inputs, target in tqdm(data_loader): for inputs, targets in tqdm(data_loader): # Prep inputs = ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_predictions(model, test_set, val_set):\n \n ## Uses model to predict some amount of images\n predict = model.predict_classes(test_set, batch_size=5, verbose=1)\n \n ## We use the length of these two arrays when we sift through the data to find\n ## the right predictions and wrong predic...
[ "0.7228824", "0.7145484", "0.70474017", "0.69962245", "0.6961123", "0.69058377", "0.6893376", "0.6873761", "0.68471813", "0.6821834", "0.6819396", "0.66773593", "0.66623193", "0.66238314", "0.6610336", "0.6605166", "0.65586555", "0.65393037", "0.6513405", "0.6509343", "0.6506...
0.0
-1
Set up optimizer with appropriate hyper parameters.
def initialize_optimizer(model, args): parameters = [p for p in model.parameters() if p.requires_grad] if args.optimizer == 'sgd': optimizer = optim.SGD(parameters, args.learning_rate, momentum=args.momentum, weight_decay=args.weight_decay) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self): \n self.optimizer = torch.optim.Adam(self.model.parameters(), lr=config.LR)", "def setup_optims(self):\n lr = self.train_config['lr']\n b1 = self.train_config['b1']\n b2 = self.train_config['b2']\n weight_decay = self.train_config['weight_decay']\n ...
[ "0.7506818", "0.7411478", "0.72629744", "0.7237952", "0.72072446", "0.72070575", "0.7093286", "0.70762485", "0.7066376", "0.7042463", "0.7042463", "0.69938517", "0.693997", "0.693997", "0.69101626", "0.69048315", "0.68350106", "0.6829197", "0.6809148", "0.6802163", "0.6789328...
0.6327329
58
Since EXPN isn't implemented by aiosmtpd, it raises an exception by default.
async def test_expn_error( smtp_client: SMTP, smtpd_server: asyncio.AbstractServer ) -> None: async with smtp_client: with pytest.raises(SMTPResponseException): await smtp_client.expn("a-list")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connect_fail(self):\n with pytest.raises(InstrumentGatewayError):\n with InstrumentGateway(addr='an invalid ip!'):\n pass", "def test_invalid_host_expression_prop(self):\n block = SNMPBase()\n block._create_data = MagicMock()\n block.execute_request ...
[ "0.5509301", "0.54383117", "0.5364098", "0.5273363", "0.5237218", "0.52316636", "0.5167674", "0.5159681", "0.5133844", "0.51326466", "0.51005864", "0.5098053", "0.5096402", "0.50824183", "0.50808847", "0.5040562", "0.5016725", "0.4992853", "0.49822763", "0.4979743", "0.495856...
0.5898231
0
Test destination name if valid.
def valid_destination_name(destination): regex = "^[a-zA-Z0-9_ ]{1,}$" return re.match(regex, destination)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_name(name):\r\n\tif HOST_NAME != name and len(name) > 0 and ZOOM_PHRASES[0] not in name and name not in WAITING_ROOM:\r\n\t\treturn True\r\n\treturn False", "def _check_name(self):\n\t\tpass", "def check_name(self, name: str):\n if name[0] == \"/\" or self.check_end_streaming(name):\n ...
[ "0.6535112", "0.6483265", "0.645965", "0.643167", "0.64052624", "0.6389805", "0.6371145", "0.6364668", "0.6258072", "0.61742145", "0.61726576", "0.614411", "0.61119163", "0.6093495", "0.60323554", "0.60181886", "0.60100025", "0.6006968", "0.59973705", "0.5990156", "0.5984307"...
0.8409464
0
Takes in a pandas df with columns as symbols and vals representing those symbol close values
def calcBollinger(df_data, lBack): df_rollingMean = pd.DataFrame(index = df_data.index) df_rollingStd = pd.DataFrame(index = df_data.index) df_bollinger = pd.DataFrame(index = df_data.index) for sym in df_data.columns: rollingSeries = df_data[sym].rolling(window = lBack, center = False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def price_dataframe(symbols=('sne',),\n start=datetime.datetime(2008, 1, 1),\n end=datetime.datetime(2009, 12, 31),\n price_type='actual_close',\n cleaner=util.clean_dataframe,\n ):\n if isinstance(price_type, basestring):\n price_type = [price_type]\n start = nlp.util.normalize_date(st...
[ "0.5885016", "0.58074105", "0.5763836", "0.5630117", "0.5587682", "0.55351543", "0.5534801", "0.5518426", "0.5350534", "0.533454", "0.5312944", "0.52825993", "0.5211557", "0.520425", "0.51822555", "0.5174227", "0.5174091", "0.5152903", "0.5138558", "0.51347065", "0.5122696", ...
0.0
-1
Load the model, training and evaluation configs for PET from the given command line arguments.
def load_pet_configs(args) -> Tuple[WrapperConfig, pet.TrainConfig, pet.EvalConfig]: model_cfg = WrapperConfig(model_type=args.model_type, model_name_or_path=args.model_name_or_path, wrapper_type=args.wrapper_type, task_name=args.task_name, label_list=args.label_list, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args():\n hpo_warning = 'Flag overwrites config value if set, used for HPO and PBT runs primarily'\n parser = argparse.ArgumentParser('train.py')\n add_arg = parser.add_argument\n add_arg('config', nargs='?', default='configs/hello.yaml')\n add_arg('-d', '--distributed', choices=['ddp-file...
[ "0.64883953", "0.6423853", "0.6339392", "0.63173246", "0.63055223", "0.6296296", "0.6258348", "0.6205302", "0.6176762", "0.61579216", "0.61514276", "0.61273324", "0.6091553", "0.6090854", "0.60844326", "0.608109", "0.6078909", "0.607694", "0.6071167", "0.60487896", "0.6036241...
0.6690745
0
Load the model, training and evaluation configs for a regular sequence classifier from the given command line arguments. This classifier can either be used as a standalone model or as the final classifier for PET/iPET.
def load_sequence_classifier_configs(args) -> Tuple[WrapperConfig, pet.TrainConfig, pet.EvalConfig]: model_cfg = WrapperConfig(model_type=args.model_type, model_name_or_path=args.model_name_or_path, wrapper_type=SEQUENCE_CLASSIFIER_WRAPPER, task_name=args.task_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(command_line_parameters=None):\n args = command_line_arguments(command_line_parameters)\n\n logger.debug(\"Loading preprocessor\")\n preprocessor = bob.bio.base.load_resource(' '.join(args.preprocessor), \"preprocessor\")\n logger.debug(\"Loading extractor\")\n extractor = bob.bio.base.load_resource(...
[ "0.6719115", "0.64597875", "0.64026177", "0.6383858", "0.6353411", "0.6342971", "0.6329676", "0.62917", "0.61846244", "0.6178162", "0.61706626", "0.6156029", "0.61509514", "0.61228794", "0.61039567", "0.6080009", "0.6074509", "0.60659707", "0.603283", "0.602758", "0.59777206"...
0.67100024
1
Load the iPET config from the given command line arguments.
def load_ipet_config(args) -> pet.IPetConfig: ipet_cfg = pet.IPetConfig(generations=args.ipet_generations, logits_percentage=args.ipet_logits_percentage, scale_factor=args.ipet_scale_factor, n_most_likely=args.ipet_n_most_likely) return ipet_cfg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(args):\n load_args={}\n with open(args.config, 'r') as f:\n for line in f:\n key, value = line.strip().split('=')\n try:\n value = int(value)\n except ValueError:\n try:\n value = float(value)\n ...
[ "0.6620625", "0.65885556", "0.65620697", "0.6530543", "0.65282035", "0.65250957", "0.63654464", "0.63244563", "0.62861556", "0.6278691", "0.62023723", "0.6184847", "0.61702293", "0.61346585", "0.6072536", "0.6040853", "0.6028272", "0.6002226", "0.5997254", "0.59311545", "0.59...
0.6928259
0
Generate result lists (image names and list with scores)
def build_retrieved_list(self, scores): res = self.index.rank(scores) tmp_res = [] # keep scores too tmp_scores = [] # build the list tmp_res = [] #print rank, "<--" for i, k in res: tmp_res.append( self.indices[i] ) tmp_scores.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yolo_show(image_path_list, batch_list):\n font = cv2.FONT_HERSHEY_SIMPLEX\n for img_path, batch in zip(image_path_list, batch_list):\n result_list = batch.tolist()\n img = cv2.imread(img_path)\n for result in result_list:\n cls = int(result[0])\n bbox = result[1...
[ "0.6683602", "0.65201557", "0.64013934", "0.6362181", "0.62997663", "0.62602174", "0.6209405", "0.6145581", "0.61233777", "0.61121494", "0.6098388", "0.60845476", "0.60814047", "0.6066887", "0.6045889", "0.6020761", "0.5991178", "0.598916", "0.5951274", "0.5938158", "0.593636...
0.5793339
40
Load the STS Benchmark csv format.
def load_file(fpath): sick_data = {'X_A': [], 'X_B': [], 'y': []} with open(fpath, 'r', encoding='utf-8') as f: for line in f: text = line.strip().split('\t') sick_data['X_A'].append(text[5].split()) sick_data['X_B'].append(text[6].split()) sick_data['y']....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runs_loader(path):\n files = sorted(glob.glob(f\"{path}/*_runs.csv\"))\n df_lis = list(range(len(files)))\n for i, f in enumerate(files):\n try:\n df_lis[i] = pd.read_csv(f, sep=\",\", header=0)\n print('Read runs.csv\\n', f, df_lis[i].shape,\n df_lis[i]['...
[ "0.61960995", "0.6105455", "0.5986365", "0.5912232", "0.58732283", "0.5808441", "0.57353777", "0.5726986", "0.5686586", "0.568514", "0.5670385", "0.56530213", "0.5645176", "0.5643989", "0.56404597", "0.5638081", "0.562153", "0.5615256", "0.5598542", "0.5506595", "0.550397", ...
0.0
-1
Label encoding from Tree LSTM paper (Tai, Socher, Manning).
def encode_labels(labels, nclass=5): y = np.zeros((len(labels), nclass)).astype('float32') for j, yj in enumerate(labels): for i in range(nclass): if i+1 == np.floor(yj) + 1: y[j, i] = yj - np.floor(yj) if i+1 == np.floor(yj): y[j, i] = np.floor(yj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLabelEncoder():\n classes = list(string.letters + string.digits)\n classes.append('')\n le = LabelEncoder()\n le.fit(classes)\n\n return le", "def build_label_transform():\n\n return NALabelEncoder()", "def lblencoder(self):\n for i in self.data.columns:\n if self.dat...
[ "0.70767474", "0.702532", "0.6875088", "0.6661352", "0.6608816", "0.651388", "0.64687127", "0.6330287", "0.63131607", "0.62710196", "0.6238585", "0.62264204", "0.62100923", "0.620349", "0.6152642", "0.61374915", "0.60997736", "0.60554326", "0.601872", "0.6012537", "0.59937024...
0.62131274
12
Transform probs to logprobs for KLdivergence.
def prepare_data(train_x, train_y, dev_x, dev_y, test_x, testy): train_x = torch.FloatTensor(train_x).cuda() train_y = torch.FloatTensor(train_y).cuda() dev_x = torch.FloatTensor(dev_x).cuda() dev_y = torch.FloatTensor(dev_y).cuda() test_x = torch.FloatTensor(test_x).cuda() test_y = torch.FloatT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_probs(self):\n return np.array([m['log_probs'] for m in self.model_outs], dtype=np.float32)", "def to_logprobs(x):\n N = x.size(0)\n sid_bins = x.size(1)//2\n H, W = x.size()[-2:]\n A = x[:, ::2, :, :].clone()\n B = x[:, 1::2, :, :].clone()\n\n A = A.view(N, 1, -1)\n B = B.vie...
[ "0.69283354", "0.66957754", "0.65397966", "0.637631", "0.6367839", "0.63648623", "0.63648623", "0.63457084", "0.63122123", "0.6291868", "0.62705356", "0.61518747", "0.6108963", "0.6101549", "0.6047805", "0.6036303", "0.6034293", "0.59642345", "0.5948823", "0.5943543", "0.5934...
0.0
-1
Assumes that 'hand' has all the letters in word. In other words, this assumes that however many times a letter appears in 'word', 'hand' has at least as many of that letter in it.
def updateHand(hand, word): # TO DO ... <-- Remove this comment when you code this function handCopy = hand.copy() for l in word: if handCopy[l] >= 1: handCopy[l] -= 1 print handCopy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValidWord(word, hand, wordList):\n myHand = hand.copy() \n for letter in word:\n if letter not in hand or myHand[letter] <= 0:\n return False\n else:\n myHand[letter] -= 1 \n if word not in wordList:\n return False\n else:\n return T...
[ "0.7523875", "0.7382198", "0.7290641", "0.7285861", "0.7223651", "0.72069925", "0.7139263", "0.7120952", "0.70973337", "0.70633984", "0.6983601", "0.6970582", "0.69672215", "0.69574076", "0.6905207", "0.6899507", "0.68932843", "0.6694957", "0.66840017", "0.66779584", "0.66185...
0.59908813
61
Train or update a spaCy model. Requires data to be formatted in spaCy's JSON format. To convert data from other formats, use the `spacy convert` command.
def train( # fmt: off lang: ("Model language", "positional", None, str), output_path: ("Output directory to store model in", "positional", None, Path), train_path: ("Location of JSON-formatted training data", "positional", None, Path), dev_path: ("Location of JSON-formatted development data", "posit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_nlu(data, config, model_dir):\n # Read the config_spacy.json as JSON \n with open(config) as f: config = json.load(f)\n\n training_data = load_data(data)\n trainer = Trainer(RasaNLUModelConfig(config))\n trainer.train(training_data)\n\n model_directory = trainer.persist(model_dir, fixed...
[ "0.6168623", "0.60145473", "0.59643066", "0.59500396", "0.59390277", "0.5891947", "0.58586216", "0.58549035", "0.5753519", "0.569553", "0.5639808", "0.5621899", "0.56205606", "0.561257", "0.56034636", "0.55959255", "0.559412", "0.5584512", "0.55254185", "0.54839414", "0.54839...
0.7009214
0
Returns mean score between tasks in pipeline that can be used for early stopping.
def _score_for_model(meta): mean_acc = list() pipes = meta["pipeline"] acc = meta["accuracy"] if "tagger" in pipes: mean_acc.append(acc["tags_acc"]) if "morphologizer" in pipes: mean_acc.append((acc["morphs_acc"] + acc["pos_acc"]) / 2) if "parser" in pipes: mean_acc.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avgcpu(self):\n return (self._total_cpu['value'] / self._total_cpu['count']) if self._total_cpu['count'] else 0", "def score(self, task):\n raise NotImplementedError(\"must subclass and implement score(task)\")", "def getAverage(self):\n return sum(self.scores) / len(self.scores)", "...
[ "0.6135161", "0.60931313", "0.60613865", "0.5927177", "0.5919117", "0.59168655", "0.58380854", "0.58222544", "0.5811924", "0.57893497", "0.5779506", "0.57702696", "0.5763837", "0.5745407", "0.57277334", "0.5717946", "0.571239", "0.568665", "0.567822", "0.567822", "0.567822", ...
0.6233691
0
Load pretrained weights for the 'tokentovector' part of the component models, which is typically a CNN. See 'spacy pretrain'. Experimental.
def _load_pretrained_tok2vec(nlp, loc): with loc.open("rb") as file_: weights_data = file_.read() loaded = [] for name, component in nlp.pipeline: if hasattr(component, "model") and component.model.has_ref("tok2vec"): component.get_ref("tok2vec").from_bytes(weights_data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self):\n if self.ckpt_flag:\n LOG('Skip Loading Pre-trained Model......')\n else:\n if self.params.pre_trained_from is not None and os.path.exists(self.params.pre_trained_from):\n try:\n LOG('Loading Pre-trained Model at %s' % sel...
[ "0.6386861", "0.63678175", "0.6225031", "0.62216717", "0.61162937", "0.6101295", "0.6054075", "0.6042603", "0.6018365", "0.59910965", "0.59458715", "0.5943918", "0.59387076", "0.5920058", "0.5915071", "0.59099936", "0.59086907", "0.5901546", "0.59015244", "0.58882916", "0.588...
0.6853876
0
Check that t is a tree, with the correct interla structure. (Helper function not a unit test.)
def isTree(self, t): if type(t) != tree: return False; if not hasattr(t, "label"): return False; if type(t.label) != str: return False; if not hasattr(t, "children"): return False; if type(t.children) != list: return Fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_tree(t):\n if type(t) != list or len(t) < 1:\n return False\n elif is_leaf(t):\n return True\n else:\n return all([is_tree(b) for b in t[1:]])", "def test01(self):\n\n t = tree(\"a\", [tree(\"b\"), tree(\"c\")]);\n self.assertTrue(self.isTree(t))", "def test_t...
[ "0.7773105", "0.7650496", "0.7045109", "0.7035572", "0.6966886", "0.6953431", "0.69326895", "0.68154866", "0.680478", "0.6793031", "0.66768706", "0.6661258", "0.6602542", "0.6554972", "0.6527791", "0.6508529", "0.65084046", "0.65048134", "0.64875036", "0.6486214", "0.64814633...
0.7827654
0
Test that a tree has the correct internal structure
def test01(self): t = tree("a", [tree("b"), tree("c")]); self.assertTrue(self.isTree(t))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Tree():", "def test_tree_with_one_node_has_correct_value(one_t):\n assert one_t.root.value == 10", "def test_small_tree_has_root_value(small_tree):\n assert small_tree.root.right.value == 11", "def test_children_tree(depth_one_tree):\n assert str(depth_one_tree.root.children) == str([1, 2, ...
[ "0.8074132", "0.75645053", "0.75372213", "0.75328934", "0.7508595", "0.74147695", "0.7401527", "0.73936456", "0.7295448", "0.7258387", "0.72362375", "0.7197044", "0.7170132", "0.71507156", "0.7150426", "0.71499306", "0.71315193", "0.70960915", "0.708435", "0.7022881", "0.7012...
0.80878603
0
Test __len__ on a threenode tree.
def test02(self): t = tree("a", [tree("b"), tree("c")]); self.assertEqual(len(t), 3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return len(self.subtrees())", "def __len__(self):\n return len(self.node)", "def __len__(self):\n return self.tree.filled_size()", "def __len__(self) -> int:\n return len(self.nodes)", "def __len__(self) -> int:\r\n return len(self._nodes)", "def __...
[ "0.7968297", "0.7580855", "0.74269414", "0.73743844", "0.7341332", "0.716077", "0.71163964", "0.69386286", "0.69055265", "0.6814265", "0.67931795", "0.6781239", "0.67347807", "0.666625", "0.65411854", "0.65411854", "0.65411854", "0.6505981", "0.6462519", "0.6437713", "0.64302...
0.65768653
14
Test __str__ on a singlenode tree.
def test03(self): t = tree("a"); s = str(t) self.assertEqual(re.sub("\s+", "", s), "a;") # Remove spaces and test equality
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_node_str():\n a_left = Node(7, data='pl left')\n a_right = Node(42, data='pl right')\n a = Node(13, data='pl a', left=a_left, right=a_right)\n string_a = str(a)\n expect_string = '13'\n assert string_a == expect_string", "def __str__(self):\n # Tricky to do iteratively so we do ...
[ "0.7350977", "0.68626225", "0.66907823", "0.6621794", "0.66000634", "0.6573606", "0.642054", "0.63686234", "0.62550914", "0.62465364", "0.61168313", "0.6109845", "0.61042523", "0.61012125", "0.6084556", "0.60727394", "0.6066159", "0.6063924", "0.6031296", "0.6014376", "0.6004...
0.67876506
2
Test parse_newick on a singlenode tree representation.
def test04(self): s = "a;" t = parse_newick(s); self.assertTrue(self.isTree(t) and t.label == "a" and t.isLeaf())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tree_support(self):\r\n master_tree = parse_newick('((a:2,b:3)ab:2,(c:1,d:2)cd:7)rt;')\r\n \"\"\"\r\n /-------.5 /-a\r\n ---1| \\-b\r\n \\------.5 /-c\r\n \\-d\r\n \"\"\"\r\n t2 = parse_newick('((a:2,b:3,c:33)ho:2,d...
[ "0.67046046", "0.66692567", "0.6668407", "0.6530691", "0.64476365", "0.64186615", "0.6259178", "0.6180899", "0.6084381", "0.60290694", "0.6021466", "0.600306", "0.5996744", "0.5918722", "0.5868246", "0.58530134", "0.57235086", "0.56478876", "0.5604132", "0.55337864", "0.55275...
0.76883775
0
Test that parse_newick throws the right kind of exception when the ; is missing.
def test05(self): s = "a" with self.assertRaises(ParserException): t = parse_newick(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_start_open_parens(self):\n self.assertRaises(ValueError, NewickTokenizer, newick='hi')", "def test_extra_closed(self):\n nt = NewickTokenizer(newick='(a,(b,c)));')\n self.assertRaises(ValueError, nt.tokens)", "def test_unclosed_comment(self):\n nt = NewickTokenizer(newic...
[ "0.71277916", "0.6992496", "0.6932686", "0.69308096", "0.67307556", "0.6727998", "0.6665779", "0.65718716", "0.6517503", "0.63459533", "0.6345652", "0.62765884", "0.6201289", "0.6190885", "0.61274683", "0.6123086", "0.6117942", "0.61088365", "0.6092642", "0.6080887", "0.60476...
0.75182545
0
This function parses arguments like argv and returns a dictionary with keys action tags
def parse_arguments(args):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_args(argv):\n result = {}\n for arg in argv:\n k, v = arg.split(\"=\")\n result[k] = v\n return result", "def retrieve_args_dict():\n process_args = sys.argv[1:]\n dictionary = dict()\n for process_arg in process_args:\n splitted = process_arg.split(\":\")\n if len(spli...
[ "0.656502", "0.64459336", "0.64356583", "0.6318063", "0.6279127", "0.62615263", "0.6145342", "0.6143788", "0.6119476", "0.60930604", "0.60857743", "0.6077435", "0.60595834", "0.60482275", "0.60474616", "0.6030172", "0.6011784", "0.59997857", "0.598045", "0.5979317", "0.597013...
0.65210056
1
Try to open the config file if it does not exist, assume default configuration, else exit with an error
def load_config(config=CONFIGFILE): try: cfg = open(config, 'r').read() return sanitize_config(json.loads(cfg)) except IOError as e: (errno, errstr) = e.args if errno == 2: return DEFAULTCONFIG else: print("An error occured opening the configuration file '%s':"%(config), file=stderr) print(err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_config_file():\n # Locate and init config.\n default_config = \"config.json\"\n if len(sys.argv) == 2:\n # config from command line\n app_config = config_reader(sys.argv[1])\n else:\n # config should be in default\n app_config = config_reader(default_config)\n #...
[ "0.7525276", "0.7193444", "0.71882033", "0.71124953", "0.7107984", "0.6897188", "0.6821535", "0.6812968", "0.6799228", "0.67775863", "0.6752519", "0.67052954", "0.66308767", "0.66073364", "0.65852654", "0.656446", "0.65604955", "0.654337", "0.6540201", "0.6525114", "0.6507747...
0.5841644
100
Check if dbfile is set; else replace with dbfile of default config. Further default values might come. Also expand tilde in filepaths.
def sanitize_config(config): if not 'dbfile' in config.keys(): config['dbfile'] = DEFAULTCONFIG['dbfile'] for path in ['dbfile']: config[path]=os.path.expanduser(config[path]) return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_db_file():\n\n return os.path.join(db_path, db_file)", "def default_bug_db(configfile=None):\n\n configs=None\n if not configfile:\n configs=default_configs()\n else:\n configs=configparser.ConfigParser()\n configs.read(configfile)\n\n db_file=os.path.normpath(configs....
[ "0.724011", "0.7007624", "0.63317364", "0.59065104", "0.5838431", "0.5786949", "0.5773432", "0.57708883", "0.57708883", "0.5744681", "0.5727951", "0.5716239", "0.563708", "0.56251484", "0.5617629", "0.5604145", "0.5599592", "0.5594931", "0.55584013", "0.5538118", "0.552904", ...
0.6772628
2
requires amount, context and date are optional. If no date is present, assume today.
def add(config, args): if args == []: help() return amount, context, date = 0, "", "" for arg in args: if re.match("^[0-9]*([\.,][0-9]{0,2}){0,1}$", arg) and not amount: amount = float(arg.replace(',', '.')) elif arg.startswith("@") and (len(arg) > 1): context = ','.join([context, arg[1:]]) elif not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_today():\n return datetime.today()", "def get_today_date():\n return date.today()", "def _today() -> datetime.date:\n return datetime.today().date()", "def get_today() -> datetime.date:\n return datetime.date.today()", "def today():\n return date.today()", "def today():\n return...
[ "0.5370315", "0.53645146", "0.53539944", "0.53277975", "0.5276431", "0.5236099", "0.5217637", "0.51641953", "0.516228", "0.51084334", "0.5088825", "0.50885737", "0.5048977", "0.5037175", "0.5029199", "0.5022949", "0.5022212", "0.5007552", "0.49963936", "0.4955769", "0.4952214...
0.0
-1
lists all entries, displays the total amount and budgets if defined.
def ls(config, args): result = read() if args == []: _prettyprint(result) else: for arg in args: if "@" == arg[0]: result = list(filter(lambda x: _is_in(arg[1:], x["context"]), result)) if "since" in args: try: date = datetime.datetime.strptime(args[args.index("since")+1], "%Y-%m-%d").st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_budgets(self) -> None:\n Menu.prompt_view_budgets()\n for budget in self.user.budget_manager:\n print(f\"{budget}\\n\")", "def view(self):\n\n print('Here\\'s your expense and income records:\\n'+' '*3+'Category'+' '*7+\\\n 'Description'+' '*4+'Amount\\n'+'='*4...
[ "0.6818141", "0.6373648", "0.6282395", "0.6123618", "0.5956045", "0.5908045", "0.587244", "0.58472174", "0.58132833", "0.5761324", "0.57453924", "0.5715379", "0.57048655", "0.5656268", "0.5623658", "0.5612284", "0.5593725", "0.55616355", "0.55489856", "0.55394465", "0.5528048...
0.0
-1
returns the budget for the defined tag
def budget(config, tag): if tag in config["budget"].keys(): print(tag) else: print(config["budget"].keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budget(self):\n return self._budget", "def getBudget(movieInfo):\n if \"budget\" in movieInfo:\n return int(movieInfo[\"budget\"])\n else:\n raise AttributeError(\"%s instance has no attribute budget\" % movieInfo)", "def get_budget(self, category: BudgetCategory) -> Budget:\n ...
[ "0.7083501", "0.65791714", "0.6482024", "0.63894933", "0.6077988", "0.58800274", "0.5838075", "0.58222085", "0.5746922", "0.5691997", "0.5674798", "0.56654537", "0.5650313", "0.56176656", "0.55753535", "0.55744225", "0.5489822", "0.53618115", "0.53394234", "0.5320373", "0.531...
0.719083
0
Classification model that does the mapping of
def __init__(self, names, data, embedding_fns, encoder_fns_1, encoder_fns_2, logits_fns, evaluation_fns, # MTL mixing_ratios, L2_coefficient=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_category(self):\n pass", "def classify(self, data):\n \"*** YOUR CODE HERE ***\"\n return self.sklearn_classifier.predict(data)", "def model(self):\n filePath = self.config['data_path']['train_data']\n data = self.loadCSV(filePath)\n cleandata = self.prepro...
[ "0.6690187", "0.64756536", "0.6441268", "0.6374809", "0.63580745", "0.6353296", "0.6329436", "0.6312559", "0.6221688", "0.6219069", "0.6196666", "0.618929", "0.6177566", "0.61771584", "0.6163415", "0.6138004", "0.6116106", "0.6072633", "0.60633653", "0.6055231", "0.60338527",...
0.0
-1
Initialize data generators. This function assumes the wrapped model to have `._data` field.
def initialize_data_iterator(self, model_idx=None): if model_idx and not isinstance(model_idx, (list, tuple)): raise TypeError("`model_idx` must be list-like structure") model_indices = ( # if model_idx is None # model_idx = [all_models_indices] model_idx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_model(self):\n pass", "def initialize_model(self):\n pass", "def initialize(self, model):\n pass", "def init_from_data(self, data):\n self.data = data\n self.norm_data()", "def __init__(self, model: Any, data: Iterable[Any]):\n super().__init__(model, data...
[ "0.6300777", "0.62807715", "0.6212327", "0.61153483", "0.61078835", "0.6094563", "0.60931665", "0.6075413", "0.59868747", "0.59868747", "0.59868747", "0.59868747", "0.5954239", "0.5919463", "0.5886439", "0.58657", "0.58602965", "0.5820341", "0.58048314", "0.5776811", "0.57676...
0.660022
0
Fetch Data and Predictions
def _fetch_data_batch(self, logits, predictions, data=None): if data is not None: # this will explicitly avoid data.initializer (fetched_target, fetched_logits, fetched_predictions) = self._sess.run( [data.target, logits, predictions]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch_data(self):\n pass", "def fetch_data():\n for category in CHEATSHEETS.items():\n subprocess.call(f'curl -o {PATH}{category[0] + \".csv\"} {category[1]}', shell=True)\n\n index = -1\n for filename in os.listdir(PATH):\n for idx, row in pd.read_csv(PATH + filename, on_bad_l...
[ "0.67397493", "0.66788644", "0.65545076", "0.64402926", "0.6339428", "0.63302475", "0.63217604", "0.62826043", "0.6261717", "0.62599313", "0.62335795", "0.61924237", "0.6142523", "0.61279005", "0.61167353", "0.6081533", "0.60656494", "0.60575473", "0.6055011", "0.6031515", "0...
0.666906
2
Sample from model predictions, and evaluate outputs
def _evaluate(self, logits, predictions, data, evaluation_fn, max_eval_batches=None, calculate_scores=True, write_results=False): # counting the evaluation batches num_eval_batches = 0 # l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(model, test_files):\n print(\"Running predictions.\")\n models = load_model(model)\n predictions = predict(models, test_files)\n\n # # write predictions to file\n # write_predictions(\"evaluate_out.json\",predictions)\n evaluate_individual(predictions, test_files, models)\n evalua...
[ "0.7101648", "0.6955216", "0.6852982", "0.6852803", "0.6742147", "0.6641561", "0.66390866", "0.65709037", "0.6543093", "0.64913476", "0.64873594", "0.64872164", "0.6486736", "0.64565843", "0.6448053", "0.6428368", "0.64260185", "0.6417553", "0.6416274", "0.6413926", "0.641122...
0.0
-1