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
Called whenever a TreeView CellRendererCombo changes.
def _callback_combo_cell(self, cell, path, row, position, treemodel): _model = cell.get_property('model') _text = _model.get_value(row, 0) _index = _model.get_value(row, 1) _row = treemodel.get_iter(path) _position = treemodel.get_value(_row, 0) self._file_ind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dtype_renderer(_, cell_combobox, tree_model, tree_iter, data):\n\n cell_data = tree_model.get(tree_iter, data)[0]\n cell_combobox.set_property('markup', cell_data)", "def on_update(self, evt):\n print(evt)\n for name in self.widgetNames:\n try:\n widget =...
[ "0.6301629", "0.60591346", "0.5772276", "0.5725532", "0.570038", "0.5699218", "0.5694901", "0.56887126", "0.56836426", "0.5682939", "0.5668681", "0.5616144", "0.56152225", "0.5610774", "0.5610497", "0.55741537", "0.54920083", "0.5479639", "0.546265", "0.542697", "0.54137105",...
0.58461034
2
Method to select the next page to display in the gtk.Assistant().
def _forward_page_select(self, current_page): if current_page == 0: Widgets.select_source_file() else: self.assistant.set_current_page(current_page + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def next_page(self):\n await self.checked_show_page(self.current_page + 1)", "def on_btPageNext_clicked(self, widget, data=None):\n\n self.page += 1\n self.part = 1\n self.refresh()", "def page_next(self):\n if self._pos >= self._npages - 1:\n # exit if we ar...
[ "0.7328594", "0.7100112", "0.70442396", "0.69027823", "0.6866997", "0.68475306", "0.6694222", "0.66374034", "0.66024095", "0.65457445", "0.6483976", "0.6460912", "0.6437389", "0.63962895", "0.63957286", "0.63767684", "0.6374295", "0.63613486", "0.63521147", "0.6341415", "0.63...
0.7017663
3
Method to perform the import from an external file to the database.
def _import(self, __button): # WARNING: Refactor _import; current McCabe Complexity metric = 18. Widgets.set_cursor(self.modulebook.mdcRTK, gtk.gdk.WATCH) _import_errors = 0 self._import_log.info('The following records could not be imported to ' 'the open RTK...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_db(import_file):\n import_data(import_file)", "def doImport(self,textFile):\n self.loadText(textFile)\n self.getBooks()\n #self.copyBooks()\n self.genLibData()\n self.genLibCells()\n self.sortRecords()", "def import_datafile(db, infile):\n res = stat(i...
[ "0.7735373", "0.7295176", "0.697421", "0.68624216", "0.678745", "0.6640836", "0.6624564", "0.6623868", "0.6601897", "0.6507418", "0.64830714", "0.64803714", "0.64775556", "0.6451412", "0.64196897", "0.64148647", "0.63720393", "0.63610643", "0.6337512", "0.6286383", "0.6262567...
0.56376576
88
Method to destroy the gtk.Assistant() when the 'Cancel' button is pressed.
def _cancel(self, __button=None): self.destroy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cancel(self, __button):\r\n\r\n self.assistant.destroy()", "def _cancel(self, __button):\r\n\r\n self.assistant.destroy()", "def _cancel(self, __button):\r\n\r\n self.assistant.destroy()\r\n\r\n return True", "def _cancel(self, __button):\r\n\r\n self.assistant.destroy...
[ "0.8206024", "0.8206024", "0.79243636", "0.79243636", "0.778344", "0.7699403", "0.7565627", "0.7277799", "0.7239998", "0.7185877", "0.71814096", "0.71814096", "0.71814096", "0.71814096", "0.7146208", "0.7134025", "0.7118102", "0.7106568", "0.70976335", "0.70909566", "0.702251...
0.7773188
5
Method to initialize the Dataset Creation Assistant.
def __init__(self, revision_id, dao, modulebook): self._revision_id = revision_id self._dao = dao self._mdcRTK = modulebook.mdcRTK self._user_log = self._mdcRTK.user_log self._error_log = self._mdcRTK.debug_log self.assistant = gtk.Assistant() self.assi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.args = self._prepare_args(locals())\n self.requires_full_dataset_in_memory = False", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def __init__(self, config):\n logger.info(f\"{self.__class__.__name__}: Dataset initializing ...\")\n ...
[ "0.7250235", "0.71499467", "0.7128493", "0.71102935", "0.7108117", "0.70734257", "0.6980016", "0.69373757", "0.69373757", "0.6916405", "0.6898898", "0.6836148", "0.67758644", "0.6714511", "0.669846", "0.6692336", "0.66413635", "0.657534", "0.65685534", "0.6556035", "0.6534137...
0.0
-1
Method to create the desired data set.
def _create(self, __button): _starttime = 0.01 if self.chkIncludeZeroHour.get_active(): _starttime = 0.0 _window = self.assistant.get_root_window() _window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) self._user_log.info('The following records contained incon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataset(self, df, **kwargs):\n\t\treturn df", "def create_dataset(self, config, rng):\n raise NotImplementedError()", "def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n da...
[ "0.70453256", "0.6922411", "0.6899861", "0.68166924", "0.6785154", "0.67195886", "0.67177", "0.66705185", "0.66680634", "0.6660379", "0.66327846", "0.6578836", "0.6565758", "0.65452504", "0.6543981", "0.654061", "0.6494028", "0.6439976", "0.6436005", "0.6413727", "0.63693416"...
0.0
-1
Method to retrieve the needed information from the Incidents used to create the dataset. These records are selected for each unique unit (serial number). Index Field 0 Unit 1 Incident ID 2 Age at Incident 3 Failure 4 Suspension 5 CND/NFF 6 OCC 7 Initial Installation 8 Interval Censored 9 Date of the failure 10 ID of th...
def _get_unit_records(self, start_time): if self.optMTTF.get_active(): _query = "SELECT t2.fld_unit, t1.fld_incident_id, \ t1.fld_age_at_incident, t1.fld_failure, \ t1.fld_suspension, t1.fld_cnd_nff, \ t1.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_incident(self, __assistant):\r\n\r\n _report_date = int(datetime.strptime(self.txtIncidentDate.get_text(),\r\n '%Y-%m-%d').toordinal())\r\n\r\n # Retrieve the hardware ID.\r\n _model = self.cmbHardware.get_model()\r\n _row = self.cmbH...
[ "0.57536614", "0.5481979", "0.53963405", "0.5357369", "0.5326373", "0.5305927", "0.52503014", "0.5235574", "0.52347976", "0.52118707", "0.5211007", "0.51795655", "0.51644355", "0.5160609", "0.5141189", "0.5104027", "0.5090462", "0.50888133", "0.5073454", "0.50615627", "0.5048...
0.5210027
11
Method to create the dataset in the open RTK Program database.
def _create_database_dataset(self, records): _error_codes = {} _n_records = len(records) _model = self.cmbAssembly.get_model() _row = self.cmbAssembly.get_active_iter() if _row is not None: _assembly_id = int(_model.get_value(_row, 1)) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset():\n with open(\"/root/config.json\", \"r\") as f:\n config = json.load(f)\n\n # create environmental variables\n for (key, value) in config.items():\n os.environ[key] = str(value)\n\n # run blender\n command = '/usr/lib/blender/blender {} --python {} --background'.\...
[ "0.66761166", "0.66439116", "0.6432056", "0.6427152", "0.636086", "0.63562626", "0.63007087", "0.6297554", "0.6290237", "0.6272374", "0.62524605", "0.61955", "0.6192515", "0.6177259", "0.61664534", "0.6138961", "0.61388063", "0.6124431", "0.61214566", "0.61212283", "0.6097022...
0.5956848
34
Method to write the dataset to a tabdelimited text file.
def _create_file_dataset(self, records): _error_codes = {} _n_inconsistent = 0 _n_records = len(records) _dialog = gtk.FileChooserDialog(_(u"RTK: Save Data Set to File ..."), None, gtk.DIALOG_MODAL ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_tsv(self, filename):\n f = open(filename,'wb')\n wr = csv.writer(f,delimiter='\\t',quoting=csv.QUOTE_ALL)\n colrow = []\n for col in self.cols:\n colrow.append('<undefined>' if len(col) == 0 else unicode(iter(col).next()).encode('unicode-escape'))\n wr.writerow(colrow)\n for row in...
[ "0.74253374", "0.702671", "0.69083136", "0.6866071", "0.68016654", "0.67348534", "0.66835433", "0.6676557", "0.64720863", "0.6466156", "0.63180023", "0.6286354", "0.62192506", "0.6193875", "0.6173985", "0.6165282", "0.6139323", "0.61242396", "0.6102107", "0.6093505", "0.60915...
0.0
-1
Method to find the left of the censoring interval.
def _interval_left(self, current_id, previous_id, current_time, previous_time): _left = 0.0 # Create the next set of values to insert to the RTK Program database. if current_id == previous_id: # Same assembly. # Failures occurred at same time. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left(self):\n x, y = (self.loc[0] - 1, self.loc[1])\n\n if x < 0:\n return None # None\n\n return self.garden.cells[y][x]", "def left(self) -> float:\n points = self.get_adjusted_points()\n x_points = [point[0] for point in points]\n return min(x_points)"...
[ "0.6929066", "0.6657257", "0.6575676", "0.6462427", "0.64477015", "0.644351", "0.63599294", "0.63291794", "0.62973046", "0.6228218", "0.62196445", "0.6210174", "0.6169352", "0.6147318", "0.6147318", "0.61322093", "0.61322093", "0.6128858", "0.609009", "0.609009", "0.60566986"...
0.55960745
65
Method to check the consistency of the data records.
def _consistency_check(self, results1, results2): _return = False _previous_date = Utilities.ordinal_to_date(results1[9]) _current_date = Utilities.ordinal_to_date(results2[9]) # Failure dates are descending on the same unit. if results1[0] == results2[0] and _current_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_consistency(self):\n raise NotImplementedError()", "def check_consistency(self, es):", "def _check_write_consistency(self):\n self.logger.warning('Not checking write consistency')", "def testConsistency(self):", "def check_integrity(self):\n curves = list()\n data = li...
[ "0.76115924", "0.70205414", "0.6738994", "0.6574973", "0.6547124", "0.6460398", "0.6396284", "0.63230306", "0.6292776", "0.62845105", "0.6257688", "0.6257247", "0.62293327", "0.61924773", "0.61882615", "0.61746573", "0.6087411", "0.608622", "0.6084936", "0.6073561", "0.607011...
0.59595335
27
Method to destroy the gtk.Assistant() when the 'Cancel' button is pressed.
def _cancel(self, __button): self.assistant.destroy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cancel(self, __button):\r\n\r\n self.assistant.destroy()\r\n\r\n return True", "def _cancel(self, __button):\r\n\r\n self.assistant.destroy()\r\n\r\n return True", "def _cancel(self, __button):\r\n\r\n self.destroy()", "def _cancel(self, __button=None):\r\n\r\n ...
[ "0.79243636", "0.79243636", "0.778344", "0.7773188", "0.7699403", "0.7565627", "0.7277799", "0.7239998", "0.7185877", "0.71814096", "0.71814096", "0.71814096", "0.71814096", "0.7146208", "0.7134025", "0.7118102", "0.7106568", "0.70976335", "0.70909566", "0.702251", "0.6953730...
0.8206024
1
This function calculate the area limited by two parallels with latitude phi1 and phi2 and two meridians with longitudes lambda1 & lambda2
def CalculateArea(**kwargs): a = 0 b = 0 try: if kwargs["ref"] == "local": a = 6378249.145 b = 6356515 elif kwargs["ref"] == "global": a = 6378137 b = 6356752.314 elif kwargs["a"] and kwargs["b"]: a = kwargs["a"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_area(self):\n min_lat_point = self.latitude_min\n max_lat_point = self.latitude_max\n min_lon_point = self.longitude_min\n max_lon_point = self.longitude_max\n self.rename_latitude()\n self.rename_longitude()\n all_lat_bounds = self.cube.coord('latitude').b...
[ "0.6399715", "0.6087621", "0.60766757", "0.5999493", "0.58296216", "0.5825475", "0.5802816", "0.5800075", "0.5776443", "0.57385135", "0.57352257", "0.5726864", "0.5686812", "0.56670666", "0.5606422", "0.55991405", "0.5575907", "0.55371463", "0.5506155", "0.5502419", "0.549210...
0.71243757
0
Delete nonASCII characters from the value and replace spaces with underscores. Also strip slashes and percent signs.
def create_filename(value): return '%s.mp3' % slugify(value, u'_')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize(value):\n from re import sub\n from unicodedata import normalize\n value = normalize('NFKD', value).encode('ascii', 'ignore')\n value = sub('[^\\w\\s\\.-]', '', value.decode('utf-8')).strip().lower()\n return sub('[-_\\s]+', '_', value)", "def clean(value):\r\n return re.sub('_+', ...
[ "0.7760493", "0.737788", "0.7278582", "0.71347755", "0.7038228", "0.6997225", "0.6973475", "0.6943967", "0.68070024", "0.67693675", "0.673018", "0.66745275", "0.6669343", "0.6668114", "0.66416174", "0.66414165", "0.6625625", "0.66158426", "0.6610128", "0.6579192", "0.65424407...
0.0
-1
Retrieve the YouTube videos' information without downloading it.
def get_video_info(url): ydl = youtube_dl.YoutubeDL() ydl.add_default_info_extractors() try: return ydl.extract_info(url, download=False) except youtube_dl.DownloadError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_video_data(self):\n\n def scrape_url(url):\n \"\"\"Scrape the video list, youtube_dl does all the heavy lifting\"\"\"\n ydl_opts = {\n \"ignoreerrors\": True, # Skip private and unavaliable videos\n }\n\n ydl = youtube_dl.YoutubeDL(ydl...
[ "0.73148847", "0.7152286", "0.70561045", "0.6936934", "0.68171096", "0.6795956", "0.67740524", "0.6649615", "0.663882", "0.66018647", "0.65990466", "0.65833545", "0.6548317", "0.6514101", "0.64686304", "0.64671814", "0.6407992", "0.6407309", "0.64061856", "0.6404336", "0.6380...
0.6628065
9
Retrieve the client's IPv4 address from the request object.
def get_client_ip(request): x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') if x_forwarded_for: ip = x_forwarded_for.split(',')[0] else: ip = request.META.get('REMOTE_ADDR') return ip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ipv4_address(self) -> str:\n return pulumi.get(self, \"ipv4_address\")", "def ipv4_address(self) -> str:\n return pulumi.get(self, \"ipv4_address\")", "def ipv4_address(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"ipv4_address\")", "def get_address(self):\n ...
[ "0.79848325", "0.79848325", "0.7941039", "0.757721", "0.7535313", "0.7535313", "0.7535313", "0.73409903", "0.72676724", "0.7096782", "0.7019107", "0.69941103", "0.6992066", "0.6960158", "0.6907224", "0.6884196", "0.6871216", "0.6774593", "0.67610097", "0.6737544", "0.6726408"...
0.67145073
21
get TranslationAnnotSlice for coordinates given by slice k
def __getitem__(self, k): start = k.start # deal with [:stop] slices if start is None: start = self.start stop = k.stop # deal with [start:] slices if stop is None: stop = self.stop annoID = self._get_anno_id(start) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self,k):\n if type(k) is IntType: return self.data[k, 0]\n \n vec = [type(x) is SliceType for x in k]\n \n if True in vec: #suppose only one slice\n ii=vec.index(True)\n indices=[]\n k = list(k)\n import numpy\n ...
[ "0.60602176", "0.5904046", "0.58273673", "0.56727195", "0.56727195", "0.5564237", "0.55084896", "0.5456498", "0.54498935", "0.5358629", "0.5333956", "0.53280276", "0.53136736", "0.52776814", "0.52688247", "0.52572376", "0.5237321", "0.52247524", "0.52165806", "0.52149373", "0...
0.7238009
0
get protein slice in absolute nucleotide coords; perform negation before slicing
def absolute_slice(self, start, stop): if start<0: return (-self)[start:stop] else: return self[start:stop]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slice_pdb(self, start, stop):\n return", "def get_slice(self, n):\n if n == 0:\n return slice(self._lo_atom, self._lo_atom + self._n_atoms)\n raise IndexError(f\"{n} is invalid for a 1 dimension Slice \")", "def test_slice(self):\n r = self.RNA(\"UCAGG\")\n sel...
[ "0.5700618", "0.5650147", "0.54527736", "0.5450388", "0.54253125", "0.5353585", "0.53056103", "0.5296624", "0.5295448", "0.528871", "0.52498925", "0.52498925", "0.5244434", "0.5232741", "0.5228222", "0.5197033", "0.51797944", "0.5173883", "0.5171855", "0.51631117", "0.5149656...
0.64477485
0
get SeqTranslator for the opposite strand
def __neg__(self): try: return self._reverse except AttributeError: self._reverse = self.__class__(self.db, self.id, reversePath=self) return self._reverse
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self) -> Seq:\n AA = \"\".join(\n self.codons[self.sequence[i : i + 3]]\n for i in range(0, len(self.sequence), 3)\n if self.codons[self.sequence[i : i + 3]] != \"Stop\"\n )\n return Seq(AA, self.id)", "def back_translate(self):\n base = Bio....
[ "0.6367083", "0.63132405", "0.621737", "0.59582543", "0.587932", "0.5725467", "0.56722116", "0.56457007", "0.56433344", "0.5594834", "0.5594834", "0.55757517", "0.5554063", "0.5548373", "0.5535726", "0.55112606", "0.55029726", "0.54945356", "0.5487586", "0.54656327", "0.54530...
0.0
-1
get annotation ID for frame starting at start
def _get_anno_id(self, start): if self.orientation > 0: # positive strand return '%s:%d' % (self.id, start % 3) else: # negative strand return '%s:-%d' % (self.id, (-start) % 3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_annotations(self, frame):\n # self.annotations_timestamp = (self.vid.frame_number + self.annotations_offset) / self.vid.fps\n self.annotations_timestamp = self.vid.frame_number / self.vid.fps\n frame = self.video_annotations.get_frame(frame_num=self.vid.frame_number).show(image=frame,\...
[ "0.6424396", "0.6209977", "0.5938962", "0.59239894", "0.5912636", "0.57275146", "0.5695372", "0.5637109", "0.56301993", "0.5578931", "0.55571216", "0.54928", "0.5473145", "0.54474056", "0.54357296", "0.540583", "0.53773195", "0.5367013", "0.53608567", "0.53608567", "0.5360856...
0.653489
0
Use cached seqDB.translationDB if already present, or create it
def get_translation_db(seqDB): try: return seqDB.translationDB except AttributeError: # create a new TranslationAnnot DB tdb = TranslationDB(seqDB) try: seqDB.translationDB = tdb except AttributeError: pass # won't let us cache? Just hand back the Translat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_or_create_db(self):\n try:\n with open(self._filename, 'rb') as f:\n self.db = pickle.load(f)\n except FileNotFoundError:\n pass", "def test_translation_default_language_cache(self):\n pool = Pool()\n Config = pool.get('ir.configuration')\...
[ "0.59522355", "0.5939561", "0.58453393", "0.569624", "0.5674226", "0.560327", "0.5590969", "0.5586558", "0.55840147", "0.55140877", "0.53780013", "0.5314531", "0.527767", "0.5274716", "0.52287686", "0.52222425", "0.521809", "0.51946694", "0.5179504", "0.5158498", "0.5153249",...
0.75349766
0
input potentioal float or int number as string. Return true if string can be converted to float or int
def isfloat(string:str) -> bool: try: float(string) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isFloat(string):\n return (True)", "def isit_float(s):\r\n try:\r\n int(s)\r\n return False\r\n except ValueError:\r\n try:\r\n float(s)\r\n return True\r\n except ValueError:\r\n return False", "def isFloat(string):\n try: float(string...
[ "0.807928", "0.80468637", "0.7996885", "0.7991415", "0.7991415", "0.7976601", "0.79161644", "0.79036456", "0.78637165", "0.7823357", "0.7816794", "0.7810914", "0.7794406", "0.77861154", "0.77389413", "0.7716778", "0.77161455", "0.770957", "0.76762354", "0.76555103", "0.765193...
0.8084781
0
getting str like test TITLE return TITLE
def getTitle(test:str) -> str: return test[5:].strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_title():", "def test_title(names):", "def test_getTitle(self):\n def checkNameAndTitle(name, titlesolution):\n title = self._nameClassifierBuilder._getTitle(name)\n self.assertEquals(titlesolution, title)\n\n checkNameAndTitle(\"Mrs. ldajfhgp\", \"Mrs\")\n che...
[ "0.78204143", "0.72284156", "0.7191392", "0.7058093", "0.69778836", "0.6975434", "0.6827347", "0.6767443", "0.67635095", "0.6747392", "0.67466706", "0.67249984", "0.67033744", "0.66948754", "0.65919375", "0.6564572", "0.6545067", "0.6512289", "0.64957863", "0.648631", "0.6470...
0.7312333
1
get string and finds from it number
def get_numbers(string:str, type_="int") -> list: num_list = [] for word in string.split(): if type_ == "int": try: num_list.append(int(word)) except: pass elif type_ == "float": if isfloat(word): num_list.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_number(self, string):\n #string = string.encode('ascii', 'ignore')\n #return int(filter(str.isdigit, string))\n s = (re.findall('\\d+', string))\n return int(''.join(s))", "def find_string_by_number(number, path) -> str:\n with open(path, 'r') as f:\n line =...
[ "0.74069595", "0.72147894", "0.6761149", "0.6746768", "0.6735846", "0.66291636", "0.6520586", "0.641135", "0.6338338", "0.62304825", "0.62230194", "0.6165489", "0.60952914", "0.6060857", "0.60447884", "0.60340077", "0.60206664", "0.60114574", "0.6010703", "0.5960047", "0.5946...
0.0
-1
Checking if path marks on existing file and that file is Cfile
def isCfile(path:str) -> bool: if not isexist(path): return False name, ext = path.split(".") return ext == "c"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isfile (self, path):\r\n pass", "def is_file(self, path: PathLike):", "def is_declaring_file(self, address, file_path):", "def fileexists(cpath, create=True):\n dpath = os.path.dirname(cpath)\n if not os.path.isfile(cpath):\n if direxists(dpath) and create:\n try:\n ...
[ "0.72933257", "0.70916677", "0.7048014", "0.69319016", "0.69264036", "0.67290795", "0.6715949", "0.6701889", "0.66560394", "0.6652754", "0.6630722", "0.66039884", "0.6591077", "0.65735334", "0.6571813", "0.6570691", "0.65631735", "0.65568924", "0.653619", "0.6534776", "0.6529...
0.7938118
0
func for gettign words from string for execution's arguments purposes
def split_args(args): words = [] quoted_words = [] quoted = re.compile('"([^"]+)"') for value in quoted.findall(args): quoted_words.append(value) new_str = args for i in quoted_words: new_str = re.sub('"[^"]+"', '', new_str) for i in new_str.split(): words.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_word():\n return ' '.join(sys.argv[1:])", "def extract_words(string):\n l = []\n word = ''\n for c in string+' ':\n if c.isalpha():\n word += c\n else:\n if word != '':\n l.append(word.lower())\n word = ''\n return l", "def ma...
[ "0.69411373", "0.64223933", "0.6341651", "0.6286244", "0.62439966", "0.6197393", "0.61656463", "0.6130973", "0.60521656", "0.60521656", "0.60474706", "0.60473394", "0.5921567", "0.5913012", "0.5867635", "0.5863066", "0.5863066", "0.5862466", "0.5860841", "0.5852893", "0.58297...
0.6378412
2
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(y_true, y_pred, classes, normalize=False, title=None, cmap=plt.cm.Blues): if not title: if normalize: title = 'Normalized confusion matrix' else: title = 'Confusion matrix,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8195649", "0.8095532", "0.803007", "0.8019817", "0.7994959", "0.7991904", "0.79818887", "0.79766536", "0.7961735", "0.7957412", "0.79385704", "0.7935568", "0.79352015", "0.7932079", "0.79270303", "0.7925357", "0.79243845", "0.7923781", "0.792341", "0.79226786", "0.7918532"...
0.0
-1
Creates a list of style [PartitionOffsetFetchRequest('topic', partition_id)]
def _get_member_assignment(self, member_assignment: Dict[str, Any]) -> List[PartitionOffsetFetchRequest]: return [ PartitionOffsetFetchRequest(topic, partition) for member in member_assignment for topic, partitions in member["member_assignment"]["partition"].items() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_consumer_group_offsets_send_request(self, group_id, group_coordinator_id, partitions=None):\n version = self.kafka_client._matching_api_version(OffsetFetchRequest)\n if version <= 3:\n if partitions is None:\n if version <= 1:\n raise ValueError(...
[ "0.6404822", "0.60598373", "0.60253394", "0.60014105", "0.5983734", "0.5758242", "0.56885225", "0.56700534", "0.5592149", "0.55870277", "0.55855834", "0.5576057", "0.5516484", "0.54638916", "0.54388255", "0.5422308", "0.5374278", "0.5338019", "0.530182", "0.5297637", "0.52293...
0.45333427
65
Check that all positions are within the field of view. The field of view must have 1 pixel buffer around the edge. i.e. positions must be >= 1 and < the object shape 1 probe.shape. This padding is to allow approximating gradients and to provide better interpolation near the edges of the field of view.
def check_allowed_positions(scan, psi, probe_shape): int_scan = scan // 1 less_than_one = int_scan < 1 greater_than_psi = np.stack( (int_scan[..., -2] >= psi.shape[-2] - probe_shape[-2], int_scan[..., -1] >= psi.shape[-1] - probe_shape[-1]), -1, ) if np.any(less_than_one) or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_masked (self, pos : list,) :\n count = 0\n total = 0\n for x in range(pos[0],min(pos[0] + AUTO_width1, self.m_x)) :\n for y in range(pos[1], min(pos[1] + AUTO_width1, self.m_y)) :\n total += 1\n if self.current_grid[x][y] :\n ...
[ "0.6320155", "0.6030945", "0.5792432", "0.5713508", "0.55996454", "0.55865943", "0.5577543", "0.5562522", "0.55420154", "0.5487889", "0.5470789", "0.5459432", "0.5428483", "0.5413073", "0.54005986", "0.5399487", "0.53966665", "0.5385833", "0.53747547", "0.5369235", "0.5366344...
0.62226385
1
Return a onesinitialized object and shifted scan positions. An complex object array is initialized with shape such that the area covered by the probe is padded on each edge by a full probe width. The scan positions are shifted to be centered in this newly initialized object array.
def get_padded_object(scan, probe): # Shift scan positions to zeros scan[..., 0] -= np.min(scan[..., 0]) scan[..., 1] -= np.min(scan[..., 1]) # Add padding to scan positions of field-of-view / 8 span = np.max(scan[..., 0]), np.max(scan[..., 1]) scan[..., 0] += probe.shape[-2] scan[..., 1] +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __new__(\n cls, array, mask, original_roe_corner=(1, 0), scans=None, exposure_info=None\n ):\n\n if type(array) is list:\n array = np.asarray(array)\n\n array[mask == True] = 0.0\n\n obj = array.view(cls)\n obj.mask = mask\n obj.exposure_info = exposure_i...
[ "0.58131224", "0.51213783", "0.5079498", "0.5028104", "0.49811327", "0.4950484", "0.494122", "0.49258816", "0.49250904", "0.492351", "0.4919611", "0.4918343", "0.48927116", "0.48808226", "0.48763034", "0.48542187", "0.48492554", "0.48279655", "0.4818469", "0.48093873", "0.480...
0.67473125
0
Return the leastsquares solution for a @ x = b. This implementation, unlike np.linalg.lstsq, allows a stack of matricies to be processed simultaneously. The input sizes of the matricies are as
def _lstsq(a, b, xp): assert a.shape[:-1] == b.shape, (f"Leading dims of a {a.shape}" f"and b {b.shape} must be same!") shape = a.shape[:-2] a = a.reshape(-1, *a.shape[-2:]) b = b.reshape(-1, *b.shape[-1:], 1) aT = np.swapaxes(a, -1, -2) x = xp.empty((a.shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_least_squares(a, b, residuals=False):\n if type(a) != np.ndarray or not a.flags[\"C_CONTIGUOUS\"]:\n main_warning(\n \"Matrix a is not a C-contiguous numpy array. The solver will create a copy, which will result\"\n + \" in increased memory usage.\"\n )\n\n a = ...
[ "0.7446885", "0.72660464", "0.71506184", "0.6994703", "0.69503105", "0.6924677", "0.68110734", "0.67889744", "0.6778403", "0.67641145", "0.6712708", "0.66284937", "0.6548539", "0.6547693", "0.6538386", "0.6529908", "0.65134645", "0.64990497", "0.6474921", "0.6450039", "0.6416...
0.7792954
0
prints the titles of the first 10 hot posts
def top_ten(subreddit): headers = {"User-Agent": "Holberton"} url = "https://www.reddit.com/r/{}/hot.json?limit=10".format( subreddit) req = requests.get(url, headers=headers) if req.status_code != 200: print(None) return redit = req.json().get("data").get("ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_ten(subreddit):\n req = get(\n \"https://www.reddit.com/r/{}/hot.json\".format(subreddit),\n headers={\n \"User-Agent\": \"alx_app\"},\n params={\n \"limit\": 10},\n allow_redirects=False)\n if req.status_code != 200:\n print(None)\n else:\n...
[ "0.7419805", "0.7209465", "0.71907574", "0.716994", "0.71192235", "0.7089789", "0.70455706", "0.7008906", "0.7000312", "0.6992015", "0.6947489", "0.69119495", "0.69093746", "0.68866277", "0.68074715", "0.67921644", "0.6764587", "0.6674961", "0.6588401", "0.6194042", "0.612289...
0.70645916
6
Get an existing Kubernetes Source Control Configuration.
def show_k8s_configuration(client, resource_group_name, cluster_name, name, cluster_type): # Determine ClusterRP cluster_rp = __get_cluster_type(cluster_type) try: config = client.get(resource_group_name, cluster_rp, cluster_type, cluster_name, name) return __fix_compliance_state(config) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pnccd_config_object(env, src):\n cfg = env.configStore()\n o = cfg.get(_psana.PNCCD.ConfigV2, src)\n if o is not None: return o\n\n o = cfg.get(_psana.PNCCD.ConfigV1, src)\n if o is not None: return o\n\n return None", "def source_configuration(self) -> pulumi.Output['outputs.ServiceSou...
[ "0.649569", "0.64631176", "0.6276266", "0.62534004", "0.61637574", "0.61064196", "0.6083393", "0.5969127", "0.5967068", "0.59580755", "0.5877695", "0.5829907", "0.57299304", "0.5724188", "0.5720489", "0.56674016", "0.5654966", "0.5639779", "0.56251794", "0.5613918", "0.558458...
0.53083175
31
Create a new Kubernetes Source Control Configuration.
def create_k8s_configuration(client, resource_group_name, cluster_name, name, repository_url, scope, cluster_type, operator_instance_name=None, operator_namespace='default', helm_operator_chart_version='1.2.0', operator_type='flux', operator_params='', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_config(self) -> None:\n pass", "def create_config(self) -> None:\n pass", "def create_source_config(self, index):\n source_config = index + \".source_config\"\n if not self.client.indices.exists(source_config):\n body = {\n \"settings\": {\"numbe...
[ "0.56187147", "0.56187147", "0.54795116", "0.529751", "0.5251602", "0.5231606", "0.52245486", "0.52073604", "0.51837826", "0.5166928", "0.51589006", "0.5154786", "0.5154429", "0.51478034", "0.512585", "0.51165026", "0.510743", "0.5098092", "0.5093743", "0.5081327", "0.5077801...
0.61110246
0
Update an existing Kubernetes Source Control Configuration.
def update_k8s_configuration(client, resource_group_name, cluster_name, name, cluster_type, repository_url=None, operator_params=None, ssh_known_hosts='', ssh_known_hosts_file='', enable_helm_operator=None, helm_operator_chart_version=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_source():\n\n require('environment', provided_by=env.environments)\n with cd(env.code_root):\n sudo('git pull', user=env.deploy_user)\n sudo('git checkout %(branch)s' % env, user=env.deploy_user)", "def update_config(\n source,\n target,\n force=True,\n):\n\n ...
[ "0.58912355", "0.5811905", "0.5643692", "0.5556213", "0.5532521", "0.54837143", "0.5382294", "0.53634936", "0.53116333", "0.5306757", "0.5301925", "0.5267546", "0.5190358", "0.5172564", "0.51306444", "0.5122302", "0.5119971", "0.5108999", "0.50907415", "0.5077623", "0.5073569...
0.58269465
1
Delete an existing Kubernetes Source Control Configuration.
def delete_k8s_configuration(client, resource_group_name, cluster_name, name, cluster_type): # Determine ClusterRP cluster_rp = __get_cluster_type(cluster_type) source_control_configuration_name = name return client.delete(resource_group_name, cluster_rp, cluster_type, cluster_name, source_control_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_conf(src_ip):\n return delete_route(src_ip)", "def kubeconfig_delete(self):\n\n self._client.delete(\n \"{}/kubeconfig\".format(LKECluster.api_endpoint), model=self\n )", "def test_delete_hyperflex_vcenter_config_policy(self):\n pass", "def test_delete_namespaced_d...
[ "0.626437", "0.6239767", "0.58826417", "0.582381", "0.57499677", "0.57489693", "0.5654267", "0.5627715", "0.5582473", "0.5576249", "0.5512736", "0.5408252", "0.5398997", "0.53942674", "0.5376546", "0.53701496", "0.53552383", "0.53517985", "0.53445673", "0.53374743", "0.531342...
0.7078715
0
When timezone and language are not provided mixin should use timezone and language that are already active
def test_without_change(self, monkeypatch): berlin = pytz.timezone("Europe/Berlin") def check(): assert translation.get_language() == 'de' assert timezone.get_current_timezone() == berlin with nested(timezone.override(berlin), translation.override('de')): mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone():\n \n pass", "def english_speaking(timezone, lang, text):\n return 1 if timezone in EN_TIMEZONES else 0", "def process_request(self, request):\n if request.user.is_authenticated():\n if request.user.timezone:\n timezone.activate(pytz.timezone(request.user...
[ "0.6305629", "0.6078683", "0.5515769", "0.54813665", "0.541261", "0.5396957", "0.53821135", "0.5366447", "0.5301656", "0.5292768", "0.5290754", "0.5290754", "0.52619773", "0.5257348", "0.52499264", "0.52384144", "0.52362454", "0.52246565", "0.5222712", "0.52159184", "0.521522...
0.64543843
0
Checks if 'site' has been added to context
def test_context_data(self): mixin = mixins.SiteMixin(site=Site(domain='test', name='test')) ret = mixin.get_context_data() # make sure data is just updated, not replaced assert ret['builder'] is mixin # check if 'site' is in context and if it's valid assert ret['site'].d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_site_to_context(self):\n g.current_site = self", "def check_site(site):\n return _READY(site)", "def is_request_in_themed_site():\n # We need to give priority to theming/site-configuration over microsites\n return configuration_helpers.is_site_configuration_enabled()", "def curren...
[ "0.6862472", "0.6629423", "0.66158265", "0.6284106", "0.6206635", "0.6142709", "0.6007134", "0.59886575", "0.5917819", "0.591397", "0.591397", "0.591397", "0.5897216", "0.5873566", "0.5806039", "0.578241", "0.5759842", "0.57438666", "0.57122135", "0.569605", "0.56820613", "...
0.63269395
3
test API endpoint with the relevant variable
def test_api(test_name, endpoint, method, body, expected_response, expected_status_code, validation, params): response = None with allure.step(' '.join(['getting API response on endpoint:', str(endpoint)])): response = APIRequestor().request(method=method, url_path=endpoint, body=body, params=params) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testApi(self):", "def test_api_response_data(self):", "def test_1():\n\tassert api_call().status_code == 200", "def test_00_api_get(self):\r\n # GET as Anonymous\r\n url = '/api/'\r\n action = 'get'\r\n self.check_limit(url, action, 'app')", "def test_api_sample(self):\n ...
[ "0.7413242", "0.73184425", "0.7103814", "0.7087691", "0.69126666", "0.69029206", "0.6893685", "0.6868759", "0.686106", "0.6838196", "0.6820688", "0.68138856", "0.6805327", "0.6781806", "0.6781618", "0.67569596", "0.67515665", "0.67416143", "0.6717166", "0.6711927", "0.6710387...
0.66786957
22
Main function. Run this to run the app
def main(): st.sidebar.title("Controlling") st.markdown( """ # Bewegungsdaten verschiedener Datenquellen - Social Distancing Resulate von politischen Maßnamen sowie andere Faktoren die sich auf die Anzahl der Infektionen auswirken. """ ) select_block_container_style() # Map with data from...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n app = App()\n app.run()", "def main():\n print(\"def main\")\n return APP.run()", "def run(self):\n self.app.run()", "def run(self):\n self.app.run()", "def main(args=None):\n app()\n return 0", "def main():\n CLI_APP.run()", "def main(self) -> None:\n ...
[ "0.8298598", "0.81067544", "0.79186285", "0.79186285", "0.7852414", "0.7793305", "0.76040673", "0.7545489", "0.75222534", "0.74684304", "0.7402196", "0.740148", "0.73792434", "0.72882473", "0.72864336", "0.72864336", "0.72864336", "0.72741276", "0.7272972", "0.7269209", "0.71...
0.0
-1
Add selection section for setting setting the maxwidth and padding of the main block container
def select_block_container_style(): st.sidebar.header("Block Container Style") max_width_100_percent = st.sidebar.checkbox("Max-width: 100%?", False) if not max_width_100_percent: max_width = st.sidebar.slider("Select max-width in px", 100, 2000, 1200, 100) else: max_width = 1200 dar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_selection(self):\n select_txt = wx.StaticText(self, -1, 'Selection Options')\n select_txt.SetForegroundColour('blue')\n self.selection_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)\n list_of_options = ['Select all Data',\n 'Unselect all Data',\n...
[ "0.5504615", "0.5499572", "0.5268356", "0.524024", "0.51872855", "0.5111512", "0.5083585", "0.507568", "0.50537217", "0.5052583", "0.5034852", "0.50306165", "0.49910054", "0.49860722", "0.49823803", "0.4976081", "0.49657044", "0.4940333", "0.49394554", "0.49240482", "0.492404...
0.5830852
0
Receive the local language setting from 'langConf'(E.g. "zhcn"), to render the translation of GUI elements. The translation will be stored in self.translation temporarily
def __init__(self, langConf: str) -> None: with open(r"localization\localization.json", "rt", encoding="utf-8") as lang: try: self.translation = json.load(lang)[langConf] except KeyError: self.translation = json.load(lang)["config"]["default"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _change_lang(self):\n lang = self.ddnGuiLanguage.get()\n self.lblProject['text'] = LOCALIZED_TEXT[lang]['Current Project>'] + \\\n ' ' + self.ddnCurProject.get()\n\n pass", "def translate(self, language=None):", "def translate_to(self, lang...
[ "0.679323", "0.6563822", "0.6341792", "0.61459655", "0.61015123", "0.6086731", "0.60347253", "0.6019798", "0.6009097", "0.6002391", "0.5989115", "0.59671193", "0.5892512", "0.58748144", "0.5870441", "0.58494335", "0.5792226", "0.5770893", "0.57640386", "0.57636833", "0.576100...
0.59466743
12
Create the function "reverseString" that reverses a string, and returns the value of the reversed string.
def reverse_string(sen): return sen[::-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_string(str):\n # start = 0, stop = len(str), hence range is whole string.\n # step = -1, hence go backwards through range.\n reversed_str = str[::-1]\n return reversed_str # return the reversed string to the caller", "def reverseString(string):\n return string[::-1]", "def reverse...
[ "0.79813826", "0.79736084", "0.79577136", "0.7839222", "0.78306365", "0.7825854", "0.75440544", "0.7425964", "0.7106993", "0.7055854", "0.705052", "0.7008575", "0.6991312", "0.6956781", "0.68475884", "0.67978305", "0.6787142", "0.6745776", "0.6675063", "0.66538405", "0.663077...
0.73078597
8
O(k) complexity, where k == no ones
def solve_ok(number: int) -> int: return no_ones(number) % 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(arr, k):\n ans = []\n for i, x in enumerate(arr): \n while ans and ans[-1] < x and len(ans) + len(arr) - i > k: ans.pop()\n if len(ans) < k: ans.append(x)\n return ans", "def beautifulSubsets(self, nums: List[int], k: int) -> int:\n\n \...
[ "0.6785851", "0.6264644", "0.60669446", "0.6048191", "0.603835", "0.60232204", "0.5979014", "0.5966001", "0.5960862", "0.59149104", "0.5905383", "0.5899332", "0.58778626", "0.58674407", "0.58535844", "0.5850503", "0.5822443", "0.5803091", "0.5796934", "0.57908297", "0.5790199...
0.0
-1
Get a user object based on event attributes
def user(self): return resources.User(self._client, id=self.actor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_user_from_event(event):\n args = event.pattern_match.group(1).split(' ', 1)\n extra = None\n if event.reply_to_msg_id:\n previous_message = await event.get_reply_message()\n user_obj = await event.client.get_entity(previous_message.from_id)\n extra = event.pattern_match....
[ "0.69418275", "0.6205706", "0.6114066", "0.60633534", "0.6010524", "0.5989375", "0.5977147", "0.5941867", "0.5878637", "0.5871201", "0.5867785", "0.5864181", "0.5864181", "0.58199185", "0.5809417", "0.5809417", "0.5800145", "0.5800145", "0.5800145", "0.5800145", "0.5800145", ...
0.0
-1
Returns a filtered view of the events,
def filter(self, start_id=None, suppress=None, folder=None, types=None): if types is not None: types = '|'.join(types) d = self.__dict__.copy() d.update(base.filter_none_values(dict(start_id=start_id, suppress=suppress, folder=folder, type=types))) return self.__class__(**d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n\t\treturn Event.objects.filter(eDate__gte= timezone.now()).order_by('-eDate')", "def events(self):\n return self.search(comp_class=Event)", "def get_events(self, type_filter=None):\n\n if type_filter:\n filtered_events = self.__events.get(type_filter, [])\n ...
[ "0.67336285", "0.6721536", "0.66938895", "0.6561632", "0.65125376", "0.65090245", "0.64060014", "0.6363465", "0.63076025", "0.62766224", "0.6271868", "0.6249313", "0.62235683", "0.6210422", "0.61923665", "0.6183344", "0.6177567", "0.61673486", "0.6165287", "0.61134976", "0.61...
0.0
-1
Get detailed data about up to 'count' events 'start_id'.
def list(self, start_id, count=None): if start_id is None: start_id = self.start_id params = base.filter_none_values(dict(id=start_id, suppress=self.suppress, type=self.types, count=count, folder=self.folder)) url = self._client.get_url(self._url_template_list) json = exc.no_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poll(self, count=None):\n if self.start_id is None:\n self.start_id = self.latest_event_id\n results = self.list(self.start_id, count)\n if results:\n last = results[-1]\n self.start_id = last.id\n self.timestamp = last.timestamp\n return ...
[ "0.61484927", "0.5886256", "0.58498895", "0.58498895", "0.5743069", "0.56684434", "0.5491046", "0.546203", "0.5443169", "0.5424351", "0.53335845", "0.52730596", "0.5272853", "0.5269081", "0.52653646", "0.5262519", "0.5240888", "0.5224492", "0.5221655", "0.52156323", "0.520447...
0.65827274
0
List events starting with latest_event_id, if any found, update start_id and return them.
def poll(self, count=None): if self.start_id is None: self.start_id = self.latest_event_id results = self.list(self.start_id, count) if results: last = results[-1] self.start_id = last.id self.timestamp = last.timestamp return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, request, event_id):\n try:\n event = Event.objects.get(id=event_id)\n except Event.DoesNotExist:\n raise ResourceDoesNotExist\n\n self.check_object_permissions(request, event.group)\n\n Event.objects.bind_nodes([event], 'data')\n\n # HACK(dcram...
[ "0.5495549", "0.53788286", "0.5307777", "0.5186725", "0.50521994", "0.5006927", "0.4993703", "0.49558806", "0.49139443", "0.49034473", "0.4888902", "0.48577592", "0.48198426", "0.47652552", "0.47584885", "0.47502953", "0.47255573", "0.47253814", "0.4700429", "0.46996495", "0....
0.59295905
0
Never ending generator of events. Will block if necessary
def __iter__(self): while True: results = self.poll() for x in results: yield x if not results: time.sleep(self.poll_delay)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yield_(cls):\n cls.sleep(0.0)\n #note that we don't use stackless.schedule() here anymore. This would still hog the CPU, never getting\n #never getting into the libevent loop again. by using sleep we prevent this", "def emptyGenerator():\n return\n yield", "def block(self):\n ...
[ "0.7117498", "0.6647457", "0.63669586", "0.6313349", "0.62980855", "0.62973547", "0.6292376", "0.6250869", "0.62352437", "0.6125331", "0.61185205", "0.61147493", "0.61069524", "0.6082039", "0.6049135", "0.6047834", "0.6020268", "0.60159254", "0.6002388", "0.5993972", "0.59858...
0.55723983
86
convert data as indexes using word2index dicts.
def load_data_multilabel(traning_data_path,vocab_word2index, vocab_label2index,sentence_len,training_portion=0.95): file_object = codecs.open(traning_data_path, mode='r', encoding='utf-8') lines = file_object.readlines() random.shuffle(lines) label_size=len(vocab_label2index) X = [] Y = [] f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_idx2word():\n idx2word = {}\n d = train_data.shared['word2idx']\n for word, idx in d.items():\n print(word)\n idx2word[idx] = word\n if config.use_glove_for_unk:\n d2 = train_data.shared['new_word2idx']\n for word, idx in d2.items():\...
[ "0.70507044", "0.67736685", "0.65944964", "0.6500153", "0.6487883", "0.6464562", "0.64508516", "0.64376414", "0.6355237", "0.6346937", "0.62950283", "0.6266865", "0.6258912", "0.62465096", "0.62320375", "0.62229455", "0.61633605", "0.6162098", "0.6132909", "0.61317205", "0.61...
0.0
-1
convert to multihot style
def transform_multilabel_as_multihot(label_list,label_size): result=np.zeros(label_size) #set those location as 1, all else place as 0. result[label_list] = 1 return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_class_to_one_hot(global_class):\n if global_class == 'Store':\n return [1, 0, 0, 0, 0]\n elif global_class == 'Home':\n return [0, 1, 0, 0, 0]\n elif global_class == 'Public spaces':\n return [0, 0, 1, 0, 0]\n elif global_class == 'Leisure':\n return [0, 0, 0, 1, ...
[ "0.7076578", "0.6815769", "0.679942", "0.6644232", "0.6643239", "0.6643062", "0.6641423", "0.66325814", "0.6587665", "0.65310293", "0.6526953", "0.65207046", "0.652039", "0.65046185", "0.6502985", "0.64955145", "0.64955145", "0.64955145", "0.64955145", "0.6466975", "0.6462809...
0.74439895
1
load data from h5py and pickle cache files, which is generate by take step by step of preprocessing.ipynb
def load_data(cache_file_h5py,cache_file_pickle): if not os.path.exists(cache_file_h5py) or not os.path.exists(cache_file_pickle): raise RuntimeError("############################ERROR##############################\n. " "please download cache file, it include training data and voc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadData(self, path):\n os.chdir(path)\n folders=os.listdir()\n if 'data.hdf5' in folders:\n print('Loading data from hdf5 file! Might take some time, be patient!')\n file=h5py.File('data.hdf5','r+')\n data=(np.array(list(file['imgs'])),np.array(list(file['...
[ "0.6643617", "0.66191584", "0.65291446", "0.65057594", "0.65028816", "0.6463237", "0.63583684", "0.63442963", "0.6261597", "0.625074", "0.62329966", "0.62261707", "0.6173299", "0.6156784", "0.6156044", "0.6155324", "0.6144407", "0.6143092", "0.6138589", "0.612844", "0.6127438...
0.67722714
3
Build text dataset from valid sentences in READ_DIRECTORY Creates files 'train.npy', 'validation.npy' in DATA_SAVE_DIRECTORY and 'data_model.pickle' in DATA_MODEL_SAVE_DIRECTORY READ_DIRECTORY is directory to read processed senteces from.
def build_features_and_save_dataset(read_directory, data_save_directory, data_model_save_directory): dataset.build_dataset_and_datamodel( read_directory=read_directory, data_save_directory=data_save_directory, data_model_save_directory=data_model_save_directory, vectorizer_params=dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_training_data():\r\n for i in range(len(FILE_NAMES)):\r\n input_text = read_file(FILE_NAMES[i])\r\n list_of_word_lines = limiting_sentence_length(input_text)\r\n data = create_training_data_file(list_of_word_lines, LANGUAGE[i])\r\n write_training_data(data, LANGUAGE[i])\r\...
[ "0.75706136", "0.66289955", "0.66102684", "0.6391998", "0.63572866", "0.6347409", "0.633092", "0.6327748", "0.6323463", "0.6260119", "0.62313855", "0.62169856", "0.62026703", "0.61640215", "0.61560875", "0.61556214", "0.6155509", "0.6132884", "0.6104501", "0.6100967", "0.6085...
0.6795215
1
Converts each region into chunks if the chunk_size is smaller than the region size.
def region_chunker(regions: Iterable[BedRegion], chunk_size: int, overlap: int ) -> Generator[BedRegion, None, None]: for contig, start, end in regions: position = start # This will cause the last chunk to be between 0.5 and 1.5 # times the chunk_size in length, this way w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(self, list_to_chunk, size):\n for i in range(0, len(list_to_chunk), size):\n yield list_to_chunk[i:i + size]", "def perform_chunking(self, data_size, chunk_size):\r\n\r\n chunks, i = [], 0\r\n while True:\r\n chunks.append((i * (chunk_size - self.overlap / 2)...
[ "0.6636159", "0.65703976", "0.65456533", "0.6484405", "0.64694905", "0.63109094", "0.6300842", "0.6280196", "0.60906184", "0.60639226", "0.6051643", "0.6004283", "0.60017264", "0.5998705", "0.5970686", "0.59704196", "0.5970175", "0.5911755", "0.59085363", "0.58943653", "0.588...
0.74834573
0
Scatter regions in chunks with an overlap. It returns Lists of regions where each list of regions has the regions describe at least the amount of base pairs in minimum bas pairs. Except the last list.
def chunked_scatter(regions: Iterable[BedRegion], chunk_size: int, overlap: int, list_size: int, size_is_maximum: bool = False, contigs_can_be_split: bool = False, ) -> Generator[List[BedRegion], None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_regions(base_pairs, scores):\n # Make sure the lower residue is on the left for each row\n sorted_base_pairs = np.sort(base_pairs, axis=1)\n\n # Sort the first column in ascending order\n original_indices = np.argsort(sorted_base_pairs[:, 0])\n sorted_base_pairs = sorted_base_pairs[origina...
[ "0.62757033", "0.6139482", "0.6121993", "0.6094671", "0.60852635", "0.5971739", "0.5971285", "0.5950996", "0.58377177", "0.5798233", "0.5722346", "0.569577", "0.56510615", "0.56162935", "0.5603435", "0.55737406", "0.5572107", "0.5565849", "0.55580723", "0.5515881", "0.5509429...
0.6774003
0
Convert lists of BedRegions to '{prefix}{number}.bed' files. The number starts at 0 and is increased with 1 for each file.
def region_lists_to_scatter_files(region_lists: Iterable[List[BedRegion]], prefix: str) -> List[str]: parent_dir = Path(prefix).parent if not parent_dir.exists(): parent_dir.mkdir(parents=True) output_files: List[str] = [] for scatter_number, region_list in enum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_regions(bed_files, out_bed):\n merge_all = (\"zcat {0} | \"\n \"sort -k1,1 -k2,2n | \"\n \"bedtools merge -i stdin | \"\n \"gzip -c \"\n \"> {1}\").format(' '.join(bed_files), out_bed)\n print merge_all\n os.system(merge_all)\n\n ...
[ "0.5811469", "0.57198805", "0.5622001", "0.5562359", "0.5456798", "0.5386436", "0.537686", "0.53308827", "0.5307604", "0.52402455", "0.52274424", "0.5204288", "0.5200815", "0.51784396", "0.5158024", "0.5143059", "0.5101236", "0.5091111", "0.5063313", "0.5059401", "0.5051228",...
0.66358685
0
Commmon arguments for chunkedscatter and scatterregions.
def common_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser() parser.add_argument("-p", "--prefix", type=str, default="scatter-", help="The prefix of the ouput files. Output will be " "named like: <PREFIX><N>.bed, in which N is an " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cmd_scatter(args):\n cnarr = read_cna(args.filename, sample_id=args.sample_id) if args.filename else None\n segarr = read_cna(args.segment, sample_id=args.sample_id) if args.segment else None\n varr = load_het_snps(\n args.vcf,\n args.sample_id,\n args.normal_id,\n args.mi...
[ "0.64741015", "0.5842866", "0.55324745", "0.5439487", "0.5385588", "0.53329253", "0.5324963", "0.53106254", "0.5304849", "0.5217032", "0.5203139", "0.51827645", "0.51780653", "0.5165851", "0.5165851", "0.51186925", "0.5099081", "0.50974053", "0.50931007", "0.5066854", "0.5066...
0.0
-1
Argument parser for the chunkedscatter program.
def parse_args(): parser = common_parser() parser.description = ( "Given a sequence dict, fasta index or a bed file, scatter over the " "defined contigs/regions. Each contig/region will be split into " "multiple overlapping regions, which will be written to a new bed " "file. Eac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_args():\n parser = argparse.ArgumentParser(description=\"Bandits algorithms on a click-through \"\n \"rate dataset.\")\n parser.add_argument('--plot', action='store_true')\n return parser.parse_args()", "def parse_command_line...
[ "0.6662891", "0.66337186", "0.66122687", "0.6549749", "0.65275127", "0.6519762", "0.6458982", "0.641025", "0.63903356", "0.63732386", "0.63631916", "0.6354082", "0.6325997", "0.63239706", "0.63074183", "0.62884784", "0.62832284", "0.62800217", "0.6271708", "0.62590134", "0.62...
0.6856216
0
Construct a reverse dependency graph for the given tables. Returns a dict which maps a table to the list of tables which depend on it.
def compute_dependencies(tables): tables = list(tables) graph = {} def visit_foreign_key(fkey): if fkey.use_alter: return parent_table = fkey.column.table if parent_table in tables: child_table = fkey.parent.table if parent_table is not child_table...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dependent_tables(tables, graph=None):\n if graph is None:\n graph = _pokedex_graph\n tables = list(tables)\n dependents = set()\n def add_dependents_of(table):\n for dependent_table in graph.get(table, []):\n if dependent_table not in dependents:\n depen...
[ "0.69427735", "0.61397785", "0.58996993", "0.5879737", "0.58512306", "0.58380896", "0.5765764", "0.5514511", "0.55016583", "0.5487928", "0.54594654", "0.5439578", "0.5423852", "0.5391774", "0.5357538", "0.53466797", "0.53311527", "0.53097713", "0.52684534", "0.5259335", "0.51...
0.78140616
0
Recursively find all tables which depend on the given tables. The returned set does not include the original tables.
def find_dependent_tables(tables, graph=None): if graph is None: graph = _pokedex_graph tables = list(tables) dependents = set() def add_dependents_of(table): for dependent_table in graph.get(table, []): if dependent_table not in dependents: dependents.add(dep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_dependencies(tables):\n tables = list(tables)\n graph = {}\n def visit_foreign_key(fkey):\n if fkey.use_alter:\n return\n parent_table = fkey.column.table\n if parent_table in tables:\n child_table = fkey.parent.table\n if parent_table is n...
[ "0.67526245", "0.6205177", "0.6078723", "0.585772", "0.58402073", "0.58020824", "0.57992023", "0.57208854", "0.566076", "0.5643069", "0.56195253", "0.55561763", "0.5519054", "0.54829293", "0.53970766", "0.53318137", "0.5278792", "0.52506405", "0.52483636", "0.5241787", "0.522...
0.77396166
0
Returns an unrendered representation of this strategy.
def unrendered(self) -> str:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self):\n self.increase_view_count()\n return render_to_string(self.template.template_file, {'advert':self})", "def render(self):\n raise NotImplementedError", "def render(self):\n raise NotImplementedError()", "def render(self) -> str:\n with no_colors():\n ...
[ "0.6479097", "0.6427954", "0.6388897", "0.63168555", "0.62177557", "0.61986595", "0.61986595", "0.61986595", "0.61986595", "0.61986595", "0.61986595", "0.61877984", "0.6187231", "0.6187231", "0.6131751", "0.610918", "0.60881495", "0.6065048", "0.6021125", "0.60132897", "0.601...
0.7091934
0
Render the project's build directory. If rendering is not possible, the unrendered representation is provided and an error will be loggged.
def rendered( self, project: tp.Optional['benchbuild.project.Project'] = None, **kwargs: tp.Any ) -> Path: del kwargs if project is None: LOG.error("Cannot render a build directory without a project.") return Path(self.unrendered) return Path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rendered(\n self,\n project: tp.Optional['benchbuild.project.Project'] = None,\n **kwargs: tp.Any\n ) -> Path:\n del kwargs\n\n if project is None:\n LOG.error(\"Cannot render a source directory without a project.\")\n return Path(self.unrendered)\n\n...
[ "0.6681", "0.6304552", "0.60405934", "0.599331", "0.58563274", "0.5839519", "0.5824633", "0.5738838", "0.5692952", "0.56889725", "0.56846964", "0.56190807", "0.55945814", "0.5566248", "0.5494656", "0.5475181", "0.53834", "0.5377323", "0.53750783", "0.53675413", "0.5355115", ...
0.7442607
0
Render the project's source directory. If rendering is not possible, the unrendered representation is provided and an error will be loggged.
def rendered( self, project: tp.Optional['benchbuild.project.Project'] = None, **kwargs: tp.Any ) -> Path: del kwargs if project is None: LOG.error("Cannot render a source directory without a project.") return Path(self.unrendered) if (src_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rendered(\n self,\n project: tp.Optional['benchbuild.project.Project'] = None,\n **kwargs: tp.Any\n ) -> Path:\n del kwargs\n\n if project is None:\n LOG.error(\"Cannot render a build directory without a project.\")\n return Path(self.unrendered)\n\n ...
[ "0.68619233", "0.60243595", "0.6001584", "0.5980786", "0.59798557", "0.5696066", "0.5657194", "0.5615238", "0.5614794", "0.5573921", "0.55593765", "0.55544454", "0.5512919", "0.5442804", "0.53868985", "0.5381254", "0.53646857", "0.53539443", "0.53451514", "0.53353864", "0.532...
0.7361598
0
Renders the PathToken as a standard pathlib Path. Any kwargs will be forwarded to the PathRenderStrategy.
def render(self, **kwargs: tp.Any) -> Path: token = self.renderer.rendered(**kwargs) p = Path() if self.left: p = self.left.render(**kwargs) p = p / token if self.right: p = p / self.right.render(**kwargs) return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DrawPath(*args, **kwargs):\n return _gdi_.GraphicsContext_DrawPath(*args, **kwargs)", "def path(self, cmd, cls=None, style=None):\n cls_str = 'class=\"%s\" ' % cls if cls else ''\n style_str = 'style=\"%s\" ' % self._meta.make_style(style) if style else ''\n cmd_str = ' '.join(str...
[ "0.6224211", "0.58091444", "0.58091444", "0.55861455", "0.5514318", "0.54257166", "0.54219663", "0.54219663", "0.54219663", "0.5413109", "0.53643227", "0.53334355", "0.53281635", "0.53047687", "0.52978337", "0.5269925", "0.52407306", "0.52206856", "0.5198254", "0.51587677", "...
0.7062216
0
Create a SourceRoot token for the given name.
def source_root(local_name: str) -> PathToken: return PathToken.make_token(SourceRootRenderer(local_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createNode(self, name):\n return Node(name)", "def create_master_token(user, repo, config, name):\n url = \"{}/repos/{}/{}/master_tokens\".format(config['url_base'], user, repo)\n postdata = (\"master_token[name]={}\".format(name))\n\n try:\n resp = (api_call(url, 'post', config['debug...
[ "0.58197236", "0.58120185", "0.5461257", "0.5330099", "0.52970916", "0.5290789", "0.52864885", "0.514151", "0.5125505", "0.51005894", "0.50946856", "0.50913566", "0.50799656", "0.5078524", "0.5072293", "0.50189483", "0.49877277", "0.49553236", "0.4923021", "0.49081895", "0.49...
0.7293271
0
Implement the `SupportsUnwrap` protocol. WorkloadSets only implement identity.
def unwrap(self, project: "benchbuild.project.Project") -> "WorkloadSet": del project return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unwrap(self, project: \"benchbuild.project.Project\") -> WorkloadSet:\n source = primary(*project.source)\n self.rev_range.init_cache(source.fetch())\n\n revision = project.version_of_primary\n if revision in set(self.rev_range):\n return self.workload_set\n return...
[ "0.5175993", "0.46047267", "0.44359973", "0.44290382", "0.42905238", "0.4283248", "0.42586493", "0.42538634", "0.42417073", "0.42362952", "0.4233518", "0.42226675", "0.42205516", "0.4218237", "0.42081583", "0.42040357", "0.41993237", "0.4195591", "0.41841477", "0.41818616", "...
0.5051381
1
Provide the store WorkloadSet only if our revision is in the range.
def unwrap(self, project: "benchbuild.project.Project") -> WorkloadSet: source = primary(*project.source) self.rev_range.init_cache(source.fetch()) revision = project.version_of_primary if revision in set(self.rev_range): return self.workload_set return WorkloadSet()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __and__(self, rs):\n revs = {}\n for r in self._revs.keys():\n if r in rs:\n revs[r] = 1\n return RevisionSet(revs)", "def get_store(self, subset: str) -> AbstractStore:\n return self.get_source(subset).get_driver().store", "def get_bookset(self): # pra...
[ "0.5471049", "0.5289642", "0.50833374", "0.5080772", "0.50565416", "0.5049684", "0.5047519", "0.4785766", "0.47622177", "0.4720354", "0.46804672", "0.46708968", "0.4526999", "0.45052436", "0.45024467", "0.45024055", "0.44985983", "0.4474408", "0.44708422", "0.4458724", "0.445...
0.6174194
0
Run the command in foreground.
def __call__(self, *args: tp.Any, **kwargs: tp.Any) -> tp.Any: cmd_w_output = self.as_plumbum(**kwargs) return watch(cmd_w_output)(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_current_selection(self):\n import subprocess\n name, data, _ = self.matches_copy[self.selected_item]\n try:\n needs_term = data[\"Terminal\"].lower() == \"true\"\n except KeyError:\n needs_term = False\n if needs_term:\n with open(os.devnu...
[ "0.63322735", "0.62880206", "0.6268796", "0.61993796", "0.6169974", "0.6123801", "0.5984392", "0.5953493", "0.5937315", "0.59277993", "0.5923064", "0.58983076", "0.5887867", "0.58835435", "0.5873847", "0.5831763", "0.5829652", "0.58249116", "0.5816179", "0.5785724", "0.576576...
0.0
-1
Convert this command into a plumbum compatible command. This renders all tokens in the command's path and creates a new plumbum command with the given parameters and environment.
def as_plumbum(self, **kwargs: tp.Any) -> BoundEnvCommand: cmd_path = self.path.render(**kwargs) assert cmd_path.exists(), f"{str(cmd_path)} doesn't exist!" cmd = local[str(cmd_path)] cmd_w_args = cmd[self._args] cmd_w_output = cmd_w_args if self.output: outp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_command(self, cmd, unit):\n return '#' + unit + cmd + NEWLINE", "def command_create(self):\n command = []\n for macro in self.my_xml.tool_data[self.shell_dict['short_name']]['pre_tmpls']:\n command.append(self.my_xml.chth_tmpl.substitute(macro=macro))\n command.e...
[ "0.5472302", "0.5020931", "0.49380094", "0.49344808", "0.48843986", "0.48163372", "0.47575694", "0.47425863", "0.4723837", "0.4718866", "0.47012642", "0.46963745", "0.46777338", "0.46764538", "0.46709517", "0.46280432", "0.46111864", "0.45973215", "0.45898268", "0.45858732", ...
0.7630991
0
Encapsulate a command in automatic backup, restore and prune. This will wrap a ProjectCommand inside a contextmanager. All consumed files inside the project's build directory will be backed up by benchbuild. You can then run your command as usual. When you leave the context, all created paths are deleted and all consum...
def cleanup( project_command: ProjectCommand, backup: BackupFn = _default_backup, restore: RestoreFn = _default_restore, prune: PruneFn = _default_prune ): backup_paths = backup(project_command) yield project_command prune(project_command) restore(backup_paths)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_run_cli(\n # fmt: off\n ctx: typer.Context, # This is only used to read additional arguments\n subcommand: str = Arg(None, help=f\"Name of command defined in the {PROJECT_FILE}\"),\n project_dir: Path = Arg(Path.cwd(), help=\"Location of project directory. Defaults to current working direc...
[ "0.56189156", "0.55472064", "0.53668106", "0.53224593", "0.5310589", "0.52562124", "0.5201688", "0.5180331", "0.5120521", "0.50925434", "0.5060089", "0.5042031", "0.5035103", "0.5023706", "0.5018057", "0.5006276", "0.49892634", "0.49649376", "0.49586257", "0.49490285", "0.493...
0.7337432
0
Unwrap all keys in a workload index. 'Empty' WorkloadSets will be removed. A WorkloadSet is empty, if it's boolean representation evaluates to `False`.
def unwrap( index: WorkloadIndex, project: 'benchbuild.project.Project' ) -> WorkloadIndex: return {k: v for k, v in index.items() if bool(k.unwrap(project))}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_workload_index(\n only: tp.Optional[WorkloadSet], index: WorkloadIndex\n) -> tp.Generator[tp.List[Command], None, None]:\n\n keys = [k for k in index if k and ((only and (k & only)) or (not only))]\n for k in keys:\n yield index[k]", "def without_keys(keys):\n keys = frozenset(keys)...
[ "0.5987424", "0.5359634", "0.5116948", "0.50576454", "0.49657622", "0.49277607", "0.49024755", "0.48685038", "0.48530674", "0.48389393", "0.48361847", "0.47933555", "0.47767672", "0.47717446", "0.47539616", "0.47511247", "0.473958", "0.4738811", "0.4729646", "0.47286484", "0....
0.6152042
0
Yield only commands from the index that match the filter. This removes all command lists from the index not matching `only`.
def filter_workload_index( only: tp.Optional[WorkloadSet], index: WorkloadIndex ) -> tp.Generator[tp.List[Command], None, None]: keys = [k for k in index if k and ((only and (k & only)) or (not only))] for k in keys: yield index[k]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self, inputs: Iterable[Chunk]) -> Iterable[Chunk]:", "def only(self, fields):\r\n return self._only_or_defer('only', fields)", "def filter_all(_):\n return True", "def filter_commands(self, how, flags=DEFAULT_FLAGS):\n # convert the filter into a function\n if isinstance(ho...
[ "0.5246415", "0.52019507", "0.5104248", "0.50775677", "0.50498474", "0.5046479", "0.50438625", "0.50250715", "0.49934337", "0.4992865", "0.49820873", "0.49567518", "0.4938405", "0.49066398", "0.48806572", "0.48377234", "0.48302686", "0.4821006", "0.48163643", "0.48097342", "0...
0.79332024
0
Create a summary writer logging to log_dir.
def __init__(self, log_dir): self.writer = tf.summary.FileWriter(log_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, log_dir):\n self.writer = SummaryWriter(log_dir)", "def _create_writer(self, sess_path, log_foldername, comment=''):\n logdir = os.path.join(sess_path, log_foldername)\n print(\"LOGDIR:\", logdir)\n writer = SummaryWriter(logdir=logdir, comment=comment)\n ret...
[ "0.7565108", "0.75489604", "0.7339683", "0.72330046", "0.7162868", "0.6932504", "0.6791952", "0.673854", "0.6560298", "0.65343267", "0.65076673", "0.64512265", "0.63786143", "0.6277499", "0.6273053", "0.6269045", "0.62369066", "0.6148293", "0.6146728", "0.61350995", "0.611146...
0.7149351
5
Log a scalar variable.
def scalar_summary(self, tag, value, step): summary = tf.Summary(value=[tf.Summary.Value(tag=tag, simple_value=value)]) self.writer.add_summary(summary, step)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_scalar(tag: str,\n data: float,\n global_step: int,\n walltime: Optional[float] = None,\n logger: Optional[logging.Logger] = None) -> None:\n logger = logger or _get_context_logger()\n logger.info(ScalarT(tag=tag, scalar_value=data, global_step=...
[ "0.768164", "0.7405269", "0.6838726", "0.66579974", "0.64215994", "0.633521", "0.633521", "0.63333976", "0.6205251", "0.6186292", "0.6127355", "0.6097684", "0.6094468", "0.6078118", "0.6052655", "0.60229844", "0.589007", "0.5860449", "0.57479894", "0.57424384", "0.569418", ...
0.52661103
64
Log a list of images.
def image_summary(self, tag, images, step): img_summaries = [] for i, img in enumerate(images): # Write the image to a string try: s = StringIO() except: s = BytesIO() scipy.misc.toimage(img).save(s, format="png") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_stage(self, images):\n\n for i, image in enumerate(images):\n pass\n # logging_tags = logs.image_config_to_tags(image, self.group_by_keywords)", "def log_images(self, image_dict,\n iterations, step_in_epoch=None, cur_epoch=None,\n save_to_ou...
[ "0.70306057", "0.68595123", "0.67045456", "0.6475185", "0.6469947", "0.64632344", "0.64393103", "0.63934153", "0.6360708", "0.6312807", "0.62935907", "0.6290032", "0.6252595", "0.6245926", "0.6154681", "0.6133359", "0.6130312", "0.6108486", "0.60504884", "0.6026077", "0.60188...
0.5464511
70
Log a histogram of the tensor of values.
def histo_summary(self, tag, values, step, bins=1000): # Create a histogram using numpy counts, bin_edges = np.histogram(values, bins=bins) # Fill the fields of the histogram proto hist = tf.HistogramProto() hist.min = float(np.min(values)) hist.max = float(np.max(value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log10(tensor):\n return log(tensor, base=10)", "def log(tensor, base=np.e):\n if base == np.e:\n return _elementary_op(tensor, np.log, lambda x: 1 / x)\n return log(tensor) / log(base)", "def plt_log_hist(v, **kwargs):\n # Handle input paramaters\n bins = kwargs.get('bins', 10)\n i...
[ "0.6635403", "0.6599441", "0.65499413", "0.640473", "0.63136995", "0.627168", "0.6237387", "0.6237387", "0.6200863", "0.61935997", "0.61915267", "0.61248237", "0.61070186", "0.6079362", "0.6059931", "0.6039507", "0.60228795", "0.59952927", "0.59877276", "0.59646887", "0.59608...
0.5879018
25
Apply LocalPlugin to additional widgets.
def add_widgets(self, widgets): target_widgets = [] for widget in widgets: target_widgets.append(widget) target_widgets.extend(widget.findChildren(QWidget)) for widget in target_widgets: if hasattr(widget, "channels"): for channel in widget.cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_plugin(self):\n self.create_toggle_view_action()\n\n self.main.add_dockwidget(self)", "def Custom(\n owner: QWidget,\n name: str,\n widget: QWidget\n):\n return widget", "def add_plugin(self, plugin):\n\n if not plugin:\n return\n\n plugin_btn = P...
[ "0.571816", "0.54625845", "0.5379212", "0.525324", "0.51787555", "0.5162809", "0.5156135", "0.51529145", "0.5135846", "0.5132016", "0.5131427", "0.5126573", "0.51148033", "0.50824106", "0.507493", "0.5069745", "0.5048146", "0.5044024", "0.50205326", "0.50173813", "0.5015853",...
0.50230086
18
Connect signal to the update slot of the connection associated with address. This allows a user to manage update timings without polling.
def connect_to_update(self, address, signal): try: connection = self.connections[address] except KeyError: err = "No connectino with address {} found!" raise KeyError(err.format(address)) signal.connect(connection.update)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to_update(self, method):\n self._update_signal.connect(method)", "def signal_device_update(self) -> str:\n return f\"{DOMAIN}-{self._host}-device-update\"", "def onConnect(self, *args):\n UAV_Logger.log(\"connect signal recieved\")\n self.socketIO.emit('CORE_SL_SLOTS_SET...
[ "0.67650616", "0.60726666", "0.60720134", "0.56234455", "0.5479016", "0.54782236", "0.5402329", "0.5321059", "0.5299692", "0.5283976", "0.527752", "0.5272966", "0.5239577", "0.52377826", "0.5206199", "0.5197094", "0.51910365", "0.51896334", "0.5172977", "0.5171491", "0.517149...
0.78523546
0
Create a Connection class for connecting to fields of an object.
def connection_class_factory(obj, refresh=1.0): class Connection(PyDMConnection): """ Class that manages object attribute access. """ def __init__(self, channel, address, parent=None): """ Parse address, apply options, and add the first listener. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_connection(module):\n connection = dict((k, module.params.get(k)) for k in (\n 'id',\n 'name',\n 'description',\n 'speed',\n 'billing_term',\n 'customer_networks',\n 'primary_ocid',\n 'secondary_ocid'\n ))\n connection.update(dict(\n ...
[ "0.61630636", "0.6122042", "0.6103119", "0.6076694", "0.60189474", "0.590895", "0.5884315", "0.58604395", "0.5855946", "0.5815163", "0.5778145", "0.5745945", "0.5725575", "0.57156295", "0.5699175", "0.5683897", "0.5673337", "0.5671581", "0.5665592", "0.56447214", "0.56410515"...
0.6107817
2
Parse address, apply options, and add the first listener. Start polling the field/method if applicable.
def __init__(self, channel, address, parent=None): super(Connection, self).__init__(channel, address, parent) self.obj = obj self.refresh = refresh # remove all whitespace from address and convert to str address = "".join(str(address).split()) # se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_address(self, address: str) -> Optional[Address]:\n raise NotImplemented", "def listener(address):\n\n\tlisten_socket = socket(AF_INET, SOCK_DGRAM)\n\tlisten_socket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n\tlisten_socket.bind(address)\n\n\twhile True:\n\t\tmessage, client_address = listen_socke...
[ "0.5272946", "0.5252478", "0.5049684", "0.5013451", "0.50115204", "0.49883822", "0.49749982", "0.48436213", "0.47963017", "0.4780593", "0.4727479", "0.47240946", "0.47194868", "0.47181323", "0.47080204", "0.4702675", "0.4695171", "0.4688278", "0.46875724", "0.46641213", "0.46...
0.0
-1
Return the current value of this connection.
def get_value(self): attr = getattr(self.obj, self.attr) try: args = self.args kwargs = self.kwargs return attr(*args, **kwargs) except AttributeError: return attr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_value(self):\n assert(self.is_started())\n return self.currValue", "def value(self):\n\n\t\treturn self.__value", "def value(self):\n return self._read()", "def value(self):\n return self.__value", "def value(self):\n return self.__value", "def get(self)...
[ "0.7694323", "0.76275814", "0.7609642", "0.75263494", "0.75263494", "0.7512191", "0.7442435", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", "0.74387866", ...
0.0
-1
Get a new value from the object and send it to all listeners. If an exception was thrown, send a disconnected signal.
def update(self): try: value = self.get_value() except: self.send_connection_state(False) return self.send_connection_state(True) self.send_new_value(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_value(self):\n if self._not_connected:\n self.connect(False)\n if self._status == 1:\n self._update_value()\n elif self._status == 2:\n raise SignalValueError('The signal %r is not initialized.' % self._name)\n elif self._status == 3:\n ...
[ "0.6135663", "0.58255106", "0.57733446", "0.5717795", "0.56895155", "0.5656427", "0.5588149", "0.5515135", "0.5416162", "0.537164", "0.53613234", "0.527445", "0.5263136", "0.52511084", "0.52493536", "0.52368975", "0.5235674", "0.5216354", "0.5202464", "0.5184765", "0.5150538"...
0.63411987
0
Send a value to every channel listening for our obj.
def send_new_value(self, value=None): if isinstance(value, np.generic): value = np.asscalar(value) if isinstance(value, np.ndarray): self.new_waveform_signal.emit(value) elif isinstance(value, (int, float, str)): self.new_value_signal[t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, sender=None, *, value=NOTHING, **kwargs):\n\t\treturn [r for r in self.trigger(sender, value=value, **kwargs)]", "def _send_value(self):\n self.new_cycle()\n if self.stop_cycle and self.cycle_count >= self.stop_cycle:\n self.finished()\n return\n msg = Mg...
[ "0.662985", "0.64048797", "0.63022316", "0.6018219", "0.60056007", "0.59776825", "0.5934194", "0.5911138", "0.58284795", "0.5803214", "0.5787825", "0.5784593", "0.5711648", "0.5652716", "0.56409997", "0.56399184", "0.56261945", "0.56138104", "0.5613133", "0.5611763", "0.55756...
0.0
-1
Send an update on our connection state to every listener.
def send_connection_state(self, conn=None): self.connection_state_signal.emit(conn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_state(self):\n for listener in self.listeners:\n listener['callback']()", "def send_state(self):\n self.state = self.enigma.get_state()\n messages = self.notify_slaves()\n for message in messages:\n self.network.messages_to_slaves.append(message)", "...
[ "0.7342474", "0.6991233", "0.653894", "0.65111196", "0.6457511", "0.6416774", "0.63002044", "0.62633836", "0.6217835", "0.6206397", "0.6182732", "0.6158061", "0.61436594", "0.6129375", "0.61186033", "0.61155987", "0.61122745", "0.6088854", "0.60534143", "0.60534143", "0.60391...
0.6392696
6
Return True if we can get a value.
def is_connected(self): try: self.get_value() return True except: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_value(self):\n return hasattr(self, '_value')", "def value(self) -> bool:", "def hasVeryTrustedValue(self):", "def _check_value(self, value):\n raise NotImplementedError", "def __bool__(self):\n return bool(self.get_value())", "def check_value(self, value):", "def val(self)...
[ "0.7801285", "0.7355578", "0.70215636", "0.68094605", "0.6710279", "0.66967314", "0.6636511", "0.66324806", "0.662596", "0.6607568", "0.6605401", "0.660154", "0.655073", "0.655073", "0.655073", "0.655073", "0.655073", "0.65428174", "0.650341", "0.64836", "0.64632744", "0.63...
0.61091936
35
Set our object attribute's value. If the attribute is a function, we will execute it.
def put_value(self, value): # Field: replace value if self.nargs is None: try: setattr(obj, self.attr, value) except: return # Function of zero arguments: call function elif self.nargs == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, attribute: str, value: Any):\n return setattr(self, attribute, value)", "def setter(self, func):\n self.fset = func\n self.set_setattr_mode(SetAttr.CallObject_ObjectValue, func)\n return self", "def __setattr__ (self, attr, value):\n self.set_value (attr, value)", ...
[ "0.7261213", "0.7160641", "0.712291", "0.70666087", "0.70423454", "0.69700164", "0.69217324", "0.6841145", "0.68363243", "0.6817219", "0.6715014", "0.6715014", "0.6715014", "0.6715014", "0.6715014", "0.6715014", "0.6715014", "0.67075944", "0.66938466", "0.6691974", "0.6689480...
0.7409989
0
This is a deprecated function kept temporarily for compatibility with old code.
def put_waveform(self, value): self.put_value(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __upgrade(self):", "def _getParameters(self):\n warnings.warn(\"This function is deprecated; parameters have been replaced with uniform inputs in 1.38.\", DeprecationWarning, stacklevel = 2)\n return list()", "def _getParameterValueString(self, name):\n warnings.warn(\"This function is deprecated;...
[ "0.65171736", "0.55589485", "0.5551494", "0.55456954", "0.548942", "0.5479055", "0.54717064", "0.5444835", "0.5433667", "0.5429895", "0.542037", "0.5416015", "0.5385065", "0.53743964", "0.53695077", "0.53270537", "0.5313229", "0.5311496", "0.53075457", "0.53075457", "0.530754...
0.0
-1
Connect a channel's signals and slots with this object's signals and slots.
def add_listener(self, channel): super(Connection, self).add_listener(channel) if self.is_connected(): self.send_connection_state(conn=True) self.update() try: channel.value_signal[str].connect(self.put_value, Qt.QueuedConnection) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self, channel, a, b):\n a.sender.channels.append(channel)\n channel.receivers.append(b)", "def connect_slots(self):\n\n self.set_elf_sig.connect(self.set_elf)\n self.run_target_sig.connect(self.run_target)\n self.continue_target_sig.connect(self.continue_target)\n ...
[ "0.6872633", "0.6626917", "0.63380224", "0.6281445", "0.6226184", "0.61543494", "0.6071881", "0.591992", "0.5799329", "0.5768482", "0.5746394", "0.5714361", "0.5684149", "0.5669694", "0.5657587", "0.5638242", "0.5598887", "0.5586812", "0.5574482", "0.5567418", "0.5500283", ...
0.648095
2
Return WHERE conditions for ensuring the actor isn't null
def _get_not_null_actor_condition(self) -> str: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_is_not_null(self, queryobject):\n raise NotImplementedError()", "def filter_is_null(self, queryobject):\n raise NotImplementedError()", "def get_queryset(self):\n q_kwargs = {\n \"awardsearch__latest_transaction__isnull\": True,\n \"date_signed__isnull\": T...
[ "0.5867336", "0.5730494", "0.55360276", "0.5418935", "0.5336228", "0.5330968", "0.5328018", "0.532107", "0.5277532", "0.52022845", "0.51524246", "0.5152247", "0.511795", "0.51002675", "0.5090225", "0.5083719", "0.5032093", "0.49824524", "0.49707043", "0.49696237", "0.49655968...
0.55624276
2
Generates interarrival times for queries with a uniform distribution. It should satisfy both min_duration and min_queries
def generate_linear_trace(self, min_queries, min_duration, qps): timestamp = 0 arrival = [] timestep = 1 / qps while timestamp < min_duration and len(arrival) < min_queries: timestamp += timestep arrival.append(timestep) self.arrival = arrival
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_exp_trace(self, min_queries, min_duration, qps, seed=123):\n timestamp = 0\n arrival = []\n num_samples = int(qps)\n if num_samples == 0:\n num_samples = 1\n np.random.seed(seed)\n samples = np.random.exponential(scale=1.0, size=num_samples)\n ...
[ "0.6274016", "0.5883859", "0.56784564", "0.5614999", "0.54858136", "0.5481464", "0.54684126", "0.54684126", "0.5407055", "0.540266", "0.5378793", "0.5353982", "0.53470653", "0.53143066", "0.53066677", "0.525709", "0.5220114", "0.51363957", "0.51264083", "0.5097455", "0.508488...
0.6014486
1
Generates interarrival times for queries with a poisson distribution. It should satisfy both min_duration and min_queries
def generate_exp_trace(self, min_queries, min_duration, qps, seed=123): timestamp = 0 arrival = [] num_samples = int(qps) if num_samples == 0: num_samples = 1 np.random.seed(seed) samples = np.random.exponential(scale=1.0, size=num_samples) while times...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_poisson_workload(wid_args: dict, mix: list, n: int, t: float) -> list:\n workload = generate_workload(wid_args, mix, n)\n\n time = t * 3600 #t is in hours\n lambda_poisson = n / time\n #Generate intervals via Poisson\n intervals = rng.exponential(1.0/lambda_poisson, len(workload))\n\n ...
[ "0.61667186", "0.60143256", "0.58186364", "0.5700144", "0.55323154", "0.53599703", "0.5328297", "0.530108", "0.5251466", "0.51380277", "0.50701696", "0.49611342", "0.49417326", "0.49405834", "0.4938794", "0.4935624", "0.4934501", "0.49250054", "0.4906135", "0.48757946", "0.48...
0.6036634
1
Updates the turbo state (checks for stopping condition) Essentially this checks our TURBO stopping condition.
def update_state(state, Y_next): if max(Y_next) > state.best_value + 1e-3 * fabs(state.best_value): state.success_counter += 1 state.failure_counter = 0 else: state.success_counter = 0 state.failure_counter += 1 if state.success_counter == state.success_tolerance: # Expand ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_shuttle_state(self):\n if len(self.steps) > self.current_step >= 0:\n step = self.steps[self.current_step]\n if step.is_fulfilled():\n step.end(True)", "def _update_status(self):\n if any([abs(v) > LIMITS[i] for i, v in enumerate(self.state)]):\n sel...
[ "0.625781", "0.60271853", "0.59617275", "0.5868128", "0.5811896", "0.57584614", "0.57368046", "0.57330966", "0.56894845", "0.5651865", "0.56268835", "0.56053036", "0.5596309", "0.55944943", "0.5593896", "0.55907565", "0.5581187", "0.55652255", "0.5562906", "0.55497634", "0.55...
0.0
-1
generate a batch for the Bayesian Optimization
def generate_batch( state, model, X, Y, batch_size, n_candidates=None, num_restarts=10, raw_samples=512, acqf="ts", # "ei" or "ts", dtype = torch.float32, device = None ): assert acqf in ("ts", "ei") assert X.min() >= 0.0 and X.max() <= 1.0 and torch.all(torch.isfi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_batch():\n\n # Initialize variables\n example = np.zeros(self.batch_size)\n labels = np.zeros((self.batch_size, 1))\n alphas = np.zeros(self.batch_size)\n n_items = 0\n index = 0\n\n while index < len(data):\n ...
[ "0.7156559", "0.6675926", "0.6484803", "0.64537615", "0.6439719", "0.63298804", "0.6313098", "0.629422", "0.6292286", "0.6282321", "0.62772465", "0.62722385", "0.62591076", "0.6255684", "0.6244277", "0.6213893", "0.62077737", "0.6185972", "0.6175707", "0.61558586", "0.6106689...
0.0
-1
Given a connectivity threshold, the method will return the sparse matrix most closely matching that threshold.
def get_approx_preRes(self, connectivity_threshold): #print("sparse_keys", self.sparse_keys_, "connectivity_threshold", connectivity_threshold ) key_ = self.sparse_keys_[self.sparse_keys_ > connectivity_threshold][0] val = self.sparse_book[key_].clone() return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_approx_preRes_old(self, connectivity_threshold, i):\n key_ = self.sparse_keys_[self.sparse_keys_ > connectivity_threshold][0]\n val = np.array(sparse_dict[key_]).copy()\n return val", "def nearest_sparse(self, query):\n self.best_dist = float(\"inf\")\n self.best_elem...
[ "0.601332", "0.5888134", "0.5505533", "0.5345215", "0.53447497", "0.5290988", "0.5274916", "0.52567625", "0.5246018", "0.52018654", "0.5155741", "0.5143733", "0.51208174", "0.51169515", "0.50919425", "0.50628674", "0.5052682", "0.5040834", "0.5035942", "0.5035092", "0.4997945...
0.628852
0
Add a sparse reservoir set by looping through different different connectivity values and assigining one reservoir weight matrix per connetivity level and storing these for downstream use by EchoStateNetwork We generate the reservoir weights and store them in the sparse library.
def addBook(self, random_seed): book = {} n = self.n_nodes_ random_state = Generator(device = self.device).manual_seed(random_seed) accept = rand(n, n, generator = random_state, device = self.device) reservoir_pre_weights = rand(n, n, generator = random_state, device =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparsify(W,conn):\n \n N = W.shape[0]\n W_sparse = sparse.lil_matrix((N,N)) \n for row, weights in itertools.izip(conn, W):\n W_sparse[row[0],row[1:]] = weights[1:]\n return W_sparse", "def set_sparse_signals(self):\n\t\n\t\tparams_dSs = [self.mu_dSs, self.sigma_dSs]\n\t\tparams_Ss0...
[ "0.6089268", "0.6017336", "0.5878965", "0.5767021", "0.56920177", "0.55312884", "0.54914916", "0.5485382", "0.5406257", "0.5383976", "0.53821015", "0.5346184", "0.5324348", "0.5309101", "0.5281269", "0.5279852", "0.5268382", "0.5256985", "0.5256985", "0.52415115", "0.5205314"...
0.56783235
5
This function is for use by EchoStateNetwork to access different sets of reservoir matrices. Given a connectivity threshold we access a reservoir by approximate sparcity / connectivity. But which randomly generated reservoir we select is determined by the index, which is what ESN uses if the one reservoir is nilpotent.
def get_approx_preRes(self, connectivity_threshold, index = 0): if self.flip_the_script: index = np.random.randint(len(self.book_indices)) #print("index", index, "book indices", self.book_indices, "self.library", self.library) book = self.library[self.book_indices[index]] if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(indices_to_visit = None):\n ##0 Chicago\n ##1 New York City\n ##2 Los Angeles\n ##3 Minneapolis\n ##4 Denver\n ##5 Dallas\n ##6 Seattle\n ##7 Boston\n ##8 San Francisco\n ##9 St. Louis\n ##10 Houston\n ##11 Phoenix\n ##12 Salt Lake City\n ##13 Miami\n ##14 Atla...
[ "0.5653433", "0.5381229", "0.53606856", "0.5151725", "0.515109", "0.5149648", "0.5137952", "0.5123968", "0.5091534", "0.50662845", "0.50472456", "0.49676326", "0.49329218", "0.48787913", "0.48551527", "0.48445284", "0.48404717", "0.48297074", "0.48243114", "0.48206934", "0.48...
0.52776587
3
Generates the matrices required for generating reservoir weights
def gen_ran_res_params(self): gen = Generator(device = self.device).manual_seed(self.random_seed) n = self.n_nodes_ self.accept = rand(n, n, **self.tensorArgs, generator = gen) self.reservoir_pre_weights = rand(n, n, **self.tensorArgs, generator = gen) * 2 - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_weight_matrices(self):\n rad = 1 / np.sqrt(self.no_of_in_nodes)\n X = truncated_normal(mean=0, \n sd=1, \n low=-rad, \n upp=rad)\n self.wih = X.rvs((self.no_of_hidden_nodes, \n ...
[ "0.72100776", "0.7078924", "0.69424677", "0.6844303", "0.66958326", "0.6464861", "0.6418851", "0.64160824", "0.63530934", "0.6338389", "0.62734073", "0.6259906", "0.6180129", "0.61764675", "0.6155642", "0.61368394", "0.61362815", "0.6122882", "0.60942763", "0.60886437", "0.60...
0.0
-1
You can use the matrix returned instead of...
def get_approx_preRes(self, connectivity_threshold, i): val = sparse_dict.get_approx_preRes(connectivity_threshold, index = i) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, mat):", "def lap_mat(self):", "def matrix_add():", "def as_matrix(self) -> types.Matrix:", "def getMatrix(self) -> CMatrix4:\n ...", "def get_stain_matrix(I):", "def CreateMatrix(self) -> BaseMatrix:", "def CreateMatrix(self) -> BaseMatrix:", "def T(self) -> BaseMatrix:", ...
[ "0.73965985", "0.72873676", "0.7231809", "0.72027314", "0.68871105", "0.68203425", "0.6809076", "0.6809076", "0.6786066", "0.6786066", "0.6742204", "0.67335075", "0.6574923", "0.65624046", "0.65345794", "0.65269136", "0.65112585", "0.6453542", "0.6378975", "0.6354362", "0.630...
0.0
-1
You can use the matrix returned instead of...
def get_approx_preRes_old(self, connectivity_threshold, i): key_ = self.sparse_keys_[self.sparse_keys_ > connectivity_threshold][0] val = np.array(sparse_dict[key_]).copy() return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, mat):", "def lap_mat(self):", "def matrix_add():", "def as_matrix(self) -> types.Matrix:", "def getMatrix(self) -> CMatrix4:\n ...", "def get_stain_matrix(I):", "def CreateMatrix(self) -> BaseMatrix:", "def CreateMatrix(self) -> BaseMatrix:", "def T(self) -> BaseMatrix:", ...
[ "0.73965985", "0.72873676", "0.7231809", "0.72027314", "0.68871105", "0.68203425", "0.6809076", "0.6809076", "0.6786066", "0.6786066", "0.6742204", "0.67335075", "0.6574923", "0.65624046", "0.65345794", "0.65269136", "0.65112585", "0.6453542", "0.6378975", "0.6354362", "0.630...
0.0
-1
Generates the reservoir input weight matrix This method assigns the reservoir input weights for later use downstream by the EchoStateNetworkClass.
def gen_in_weights(self): gen = Generator(device = self.device).manual_seed(self.random_seed) n, m = self.n_nodes_, self.n_inputs_ in_w_shape_ = (n, m) print('m,n', m,n) #at the moment all input weight matrices use uniform bias. self.bias = rand( n, 1, generator = gen, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_weight_matrices(self):\n rad = 1 / np.sqrt(self.no_of_in_nodes)\n X = truncated_normal(mean=0, \n sd=1, \n low=-rad, \n upp=rad)\n self.wih = X.rvs((self.no_of_hidden_nodes, \n ...
[ "0.6588077", "0.6578553", "0.6390781", "0.63611436", "0.62566054", "0.6168489", "0.61538434", "0.6151322", "0.61275256", "0.60950416", "0.6008337", "0.60010517", "0.5981402", "0.597326", "0.5969377", "0.59672725", "0.5951049", "0.5945711", "0.59425867", "0.5930853", "0.588238...
0.688277
0