query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Sets the color at the specified cells on the gameboard.
def set_color(self, color, filled): for cell in filled: self.board[cell[0], cell[1]] = color
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_color(board, tile, color):\n for el in tile:\n el_x = el[0]\n el_y = el[1]\n board[el_x,el_y] = color", "def set(self, row: int, col: int, color: Color) -> None:\n super(ColorGrid, self).set(row, col, color)", "def change_cell_bgcolor(self, cell: tuple, color: str = \"...
[ "0.66752845", "0.6670882", "0.6661175", "0.6591124", "0.6471529", "0.6251041", "0.61291766", "0.61236733", "0.61236733", "0.60985804", "0.60878223", "0.60815275", "0.60369647", "0.6032888", "0.6024978", "0.60133576", "0.60054994", "0.59898573", "0.5964465", "0.59419614", "0.5...
0.7248661
0
Checks if the new cell has the same color. If so, then it will be added to filled_edges.
def check_if_filled(self, new_cell, cell_color, filled_edges, filled_surrounded): new_cell_color = self.get_color(new_cell) if new_cell_color != cell_color: return False if new_cell not in filled_edges + filled_surrounded: filled_edges.append(new_cell) return Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_filled(self, filled_edges, filled_surrounded):\n surrounded_cells = []\n for cell in filled_edges:\n coord_x = cell[1]\n coord_y = cell[0]\n color = self.get_color(cell)\n surrounded = True\n\n # up\n if coord_y - 1 >= 0:\n ...
[ "0.68136656", "0.6298156", "0.62293226", "0.61843455", "0.60629505", "0.6019774", "0.5996726", "0.59899193", "0.59833056", "0.59146136", "0.58846736", "0.58377993", "0.57722366", "0.5716285", "0.5706663", "0.56588453", "0.5620642", "0.5616831", "0.56144696", "0.56116164", "0....
0.8191558
0
Counts the number of adjacent cells of the specified color.
def get_color_count(self, color, filled): count = 0 for cell in filled: coord_x = cell[1] coord_y = cell[0] # up if coord_y - 1 >= 0: new_cell = (coord_y-1, coord_x) cell_up_color = self.get_color(new_cell) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_colors(board, color):\n n = 0\n for cell in board:\n if cell == color:\n n += 1\n elif cell == cinv(color):\n n -= 1\n return n", "def countDiff(self, color):\n count = 0\n for y in range(self.n):\n for x in range(self.n):\n ...
[ "0.7808628", "0.7358172", "0.7177182", "0.6915037", "0.6702927", "0.66539484", "0.634662", "0.6150625", "0.60990244", "0.6096208", "0.6083482", "0.59975606", "0.5963964", "0.59438294", "0.5927667", "0.5881134", "0.58247036", "0.58202237", "0.5811849", "0.5797079", "0.57578915...
0.74115384
1
Find apropriate files for the subject and download them Search through all files for all acquisitions for all sessions for this subject and download only the T1 nifti files. If file names are repeated a number is prepended. Troublesome characters in the file name are replaced with "_". The file's original name, full pa...
def find_and_download_files(context): input_path = 'input/' if os.path.isdir(input_path): log.debug('Path already exists: ' + input_path) else: log.debug('Creating: ' + input_path) os.mkdir(input_path) fw = context.client if 'classification_measurement' in context.config:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_subject(self, subject_ID):\r\n hcp_data_path = os.path.join(self.hcp_directory, str(subject_ID))\r\n\r\n if not os.path.exists(hcp_data_path):\r\n os.makedirs(hcp_data_path)\r\n\r\n print('Downloading data to {}'.format(hcp_data_path))\r\n\r\n counter = 0\r\n ...
[ "0.6075932", "0.5923535", "0.58468294", "0.5837011", "0.57766956", "0.5741573", "0.5726924", "0.5726823", "0.56845653", "0.56502473", "0.556752", "0.55647373", "0.5562809", "0.55589074", "0.5542313", "0.55303603", "0.5507099", "0.54877055", "0.54732233", "0.5440725", "0.54362...
0.64693093
0
Set final status to last line of reconallstatus.log.
def set_recon_all_status(subject_dir): path = context.gear_dict['output_analysisid_dir'] + '/' + \ subject_dir + '/scripts/recon-all-status.log' if os.path.exists(path): with open(path, 'r') as fh: for line in fh: pass last_line = line else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_status(self, final_status):\n\n self._final_status = final_status", "def after_epoch(self):\n line = ' '.join([str(k) + ': ' + str(v) for k, v in self.trainer.status.items()])\n with open(os.path.join(self.root_path, 'log.txt'), 'a+') as fout:\n fout.write(line + '\\n')...
[ "0.6525308", "0.63573575", "0.61293614", "0.5867392", "0.58495337", "0.5713314", "0.56992143", "0.5678644", "0.5619614", "0.5558952", "0.5548329", "0.55442154", "0.54692274", "0.54651254", "0.5439889", "0.54174083", "0.53965306", "0.5389551", "0.53609776", "0.53462833", "0.53...
0.71194637
0
Set final status to last line of reconallstatus.log.
def set_recon_all_status(subject_dir): path = context.gear_dict['output_analysisid_dir'] + '/' + \ subject_dir + '/scripts/recon-all-status.log' if os.path.exists(path): with open(path, 'r') as fh: for line in fh: pass last_line = line else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_status(self, final_status):\n\n self._final_status = final_status", "def after_epoch(self):\n line = ' '.join([str(k) + ': ' + str(v) for k, v in self.trainer.status.items()])\n with open(os.path.join(self.root_path, 'log.txt'), 'a+') as fout:\n fout.write(line + '\\n')...
[ "0.65249884", "0.6357503", "0.61292785", "0.58676416", "0.5849602", "0.57127684", "0.56986594", "0.56790066", "0.56193364", "0.55592257", "0.5547861", "0.5544232", "0.54690313", "0.5465183", "0.543945", "0.54176474", "0.53966546", "0.5389639", "0.5360609", "0.5345862", "0.533...
0.71203095
1
Check if the given value is "close enough" to the desired value Because sometimes MagneticFieldStrength can be provide in mT (3000, 1500) or something like 2.9721T
def field_strength_close_enough(field_strength, desired_value): if field_strength > 100: # assume it is in mT instead of Teslas field_strength /= 1000 # and turn it into Teslas diff = abs(field_strength - desired_value) if diff < 0.2: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def above_threshold(self, value):\n # We use floating point number here so we have to take care\n return finf(value,self.min) or finf(self.max,value)", "def check_value(value, sensor):\n if not GraphModel.check_if_int(value):\n return False\n\n return (sensor == 't' and ba....
[ "0.6649637", "0.6314969", "0.6307575", "0.6263273", "0.621036", "0.61276513", "0.61120135", "0.60805684", "0.6008309", "0.59797776", "0.59608775", "0.59385926", "0.59351903", "0.5876801", "0.5854414", "0.5851238", "0.58508086", "0.58508086", "0.58364314", "0.58322096", "0.582...
0.788576
0
Powers or unpowers the bells.
def power_bells(state): if not pinlessMode: if state: for pin in bellPins: GPIO.output(pin, GPIO.HIGH) elif not state: for pin in bellPins: GPIO.output(pin, GPIO.LOW) else: logging.debug("Bell state: " + str(state))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handlePowers(self):\n self.player.sprite.handlePowers(self.get_remaining_time())", "def poweroff(self) -> None:\n pass", "def poweroff(self):\n raise NotImplementedError()", "def set_powers(self, power_1, power_2):\n pass", "def power_off(self):\n raise NotImplemented...
[ "0.64014935", "0.6041298", "0.5899135", "0.5873446", "0.58522767", "0.5775622", "0.5713468", "0.5671503", "0.5662006", "0.56604326", "0.56582326", "0.5653668", "0.56442696", "0.5575584", "0.5575584", "0.55735165", "0.55625665", "0.5539788", "0.55348086", "0.5527003", "0.55260...
0.6172118
1
Rings the school bells in a pattern for the given schedule/time.
def ring_bells(): # Need to get the pattern for this time slot and apply it. curTime = time.strftime("%H:%M") if curTime not in jsonConfig["schedules"][curSchedule]: logging.error("Couldn't find time record for time " + curTime + " in schedule " + curSchedule) return # Obtain the patter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tick(self) -> None:\n\n bell = self._row[self._place]\n user_controlled = self._user_assigned_bell(bell)\n\n self._rhythm.wait_for_bell_time(time.time(), bell, self._row_number, self._place,\n user_controlled, self.stroke)\n\n if not user_contr...
[ "0.5695601", "0.5432977", "0.5410973", "0.5381197", "0.53569686", "0.51683617", "0.5059934", "0.50112706", "0.49925143", "0.49726513", "0.49589247", "0.49199778", "0.49188292", "0.4897901", "0.48784587", "0.48409376", "0.48267853", "0.4821929", "0.4812405", "0.47980654", "0.4...
0.72606444
0
Reloads the schedule from our json file.
def reload_schedule(): global jsonConfig global curSchedule jsonConfig = None curSchedule = None # Clear currently scheduled bells. schedule.clear("current") logging.debug("Reloading schedule...") with open(jsonFile) as jsonFileHandle: jsonConfig = json.load(jsonFileHandle) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload(self):\n with open(self._config) as f:\n self.data = json.load(f)", "def reload(self):\n try:\n with open(self.__file_path, 'r') as f:\n for key, value in json.load(f).items():\n self.__objects[key] = eval(key.split('.')[0])(**value...
[ "0.719504", "0.69318056", "0.6864976", "0.67585194", "0.6752321", "0.6690034", "0.66177434", "0.6605925", "0.65952766", "0.6545089", "0.64971936", "0.6459408", "0.6386498", "0.632974", "0.62427646", "0.62313604", "0.62149954", "0.61784226", "0.61701703", "0.6152167", "0.61414...
0.7724108
0
Undistort the image using distortion coefficients
def undistort_image(mtx_, dist_, img_): dst = cv2.undistort(img_, mtx_, dist_, None, mtx_) return dst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def undistort(self, image):\n return cv2.undistort(image, self.camera_matrix, self.distortion_coeffs, None, self.camera_matrix)", "def undistort(self, image):\n dst = cv2.undistort(image, self.mtx, self.dist_coeff, None)\n\n if self.args.is_test:\n self.image_logger.save_image(dst...
[ "0.7884479", "0.7551686", "0.7374037", "0.7349525", "0.7250263", "0.72426575", "0.71945417", "0.7146802", "0.7065099", "0.671219", "0.66244733", "0.6621529", "0.64361244", "0.6337158", "0.6207002", "0.6132985", "0.6115165", "0.59107697", "0.59106004", "0.5851052", "0.5788503"...
0.7565127
1
Calculate Perspective and Inverse Perspective Transform Matrices
def calc_transform(src_, dst_): M_ = cv2.getPerspectiveTransform(src_, dst_) Minv_ = cv2.getPerspectiveTransform(dst_, src_) return M_, Minv_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perspective_transform():\n src = np.float32([(220,720), (1110, 720), (570, 470), (722, 470)]) # Manually get these numbers from plot\n dst = np.float32([[320, 720], [920, 720], [320, 1], [920, 1]])\n M = cv2.getPerspectiveTransform(src, dst)\n Minv = cv2.getPerspectiveTransform(dst, src)\n\n re...
[ "0.77655315", "0.6772391", "0.67308986", "0.669059", "0.6618192", "0.65587133", "0.64216304", "0.6264239", "0.6257005", "0.62168366", "0.6215676", "0.6160854", "0.6142326", "0.6108185", "0.6086129", "0.6077356", "0.60574424", "0.6047167", "0.6012863", "0.599367", "0.5987706",...
0.7251248
1
Extract all Non Zero Pixels and return X, Y Coordinates
def extract_pixels(img_): non_zero_pixels = np.argwhere(0 < img_) x = non_zero_pixels.T[0].astype(np.float32) y = non_zero_pixels.T[1].astype(np.float32) return x, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_xyz_points(raster, no_data=-9999):\n y, x = np.where(raster != no_data)\n z = np.extract(raster != no_data, raster)\n\n return x, y, z", "def find_pixels(self):\n ref_image=Image.open('sample0000.png')\n imarray=np.array(ref_image)\n ref_image.close()\n ...
[ "0.655391", "0.64457804", "0.6414161", "0.63365555", "0.6304538", "0.62975013", "0.6216841", "0.62149465", "0.6204824", "0.61987865", "0.6195701", "0.6187824", "0.61301506", "0.60819465", "0.6074533", "0.60721606", "0.60360277", "0.6013827", "0.59923506", "0.597244", "0.59497...
0.81292105
0
Get x intercepts for given y value
def get_intercepts(fit, y): x = fit[0] * (y * y) + fit[1] * y + fit[2] return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_x_y_for_line(bounds, y_intercept, slope): \n\n x = np.sort(bounds)\n\n y = y_intercept + (slope * x)\n\n return x, y", "def intercept(x1, y1, x2, y2):\r\n m = slope(x1, y1, x2, y2)\r\n return y1 - m*x1", "def get_fit_x(self, y):\n if self.line_fit_m.size == 0:\n retu...
[ "0.63922507", "0.6389413", "0.6266955", "0.6237579", "0.62286144", "0.609001", "0.60876924", "0.6066772", "0.605182", "0.605182", "0.6022421", "0.59712934", "0.5959732", "0.5946199", "0.5945855", "0.5922003", "0.59173673", "0.5792059", "0.57911325", "0.57743794", "0.57610834"...
0.7766451
0
Get Left_x, Right_x, Left_y, Right_y, Image , return Image with Polygon
def draw_polygon(left_x, right_x, left_y, right_y, img_): pts_left = np.array([np.flipud(np.transpose(np.vstack([left_x, left_y])))]) pts_right = np.array([np.transpose(np.vstack([right_x, right_y]))]) pts = np.hstack((pts_left, pts_right)) img_ = cv2.polylines(img_, np.int_([pts]), isClosed=False, colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_image(self):\n dir_ship = self.direction\n dir_cannon=self.cannon_dir\n temp_image = self.base_image.copy()\n pygame.draw.polygon(temp_image, (0,0,0), [(2,2),(2,3),(3,3),(3,2)])\n if dir_cannon == dir_ship:\n pygame.draw.polygon(temp_image, (60,60,60), [(4,3),...
[ "0.65409863", "0.6449552", "0.62613237", "0.61531603", "0.61507094", "0.6134605", "0.5918344", "0.5892853", "0.58924294", "0.58919007", "0.58887494", "0.58701646", "0.58659583", "0.5839686", "0.58155435", "0.5813019", "0.581092", "0.5798064", "0.57906735", "0.5779135", "0.576...
0.7396713
0
Draw Polylines for points with given thickness specified by Window Size
def draw_polylines(input_img, pts, window_size): return cv2.polylines(input_img, np.int_([pts]), isClosed=False, color=(255, 255, 255), thickness=2 * window_size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_lines(self, color, points, width = 1, closed = False):\n color = spyral.color._determine(color)\n pygame.draw.aalines(self._surf, color, closed, points)", "def drawLines(self):\n\t\tintersections = [[], []]\n\t\tfor l in self.lines:\n\t\t\tif l.direction == 'v':\n\t\t\t\tif l.rtc:\n\t\t\t\...
[ "0.6230124", "0.61896694", "0.61215425", "0.6083533", "0.5963582", "0.5954477", "0.58733976", "0.58443934", "0.5826821", "0.58263594", "0.58262116", "0.5811678", "0.57939386", "0.573556", "0.5720824", "0.5711357", "0.57111347", "0.57054645", "0.56073576", "0.557913", "0.55431...
0.69677657
0
Use polyfit from the mask points for smoothening them
def smoothen_masks(fit, img_, window_size): img_size = img_.shape mask_poly = np.zeros_like(img_) # Get top to Bottom for refactoring # mask_y = np.linspace(0, img_size[0] - 1, img_size[0]) mask_x = get_intercepts(fit, mask_y) # Smoothen the mask # pts = coordinates_to_imgpts(mask_x, mask_y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigclip_polyfit(p, xx, yy, degree, weight = None):\n # read constants from p\n sigclip = p['WAVE_SIGCLIP']\n # initialise the while loop\n sigmax = sigclip + 1\n # initialise mask\n mask = np.ones_like(xx, dtype='Bool')\n while sigmax > sigclip:\n # Need to mask weight here if not N...
[ "0.62117845", "0.62038964", "0.60165256", "0.5831612", "0.5827311", "0.57904327", "0.572582", "0.5706521", "0.56874967", "0.56852", "0.56852", "0.56852", "0.56538486", "0.5650198", "0.5639281", "0.5617409", "0.5605478", "0.5585841", "0.557275", "0.55547965", "0.5492608", "0...
0.7063888
0
Get the mean value of fit "Left" and "Right" based on flag
def get_mean_fit(flag='L'): if flag == 'L': return np.mean(np.vstack(l_coeff_queue), axis =0) if len(l_coeff_queue)>1 else l_coeff_queue[-1] else: return np.mean(np.vstack(r_coeff_queue), axis =0) if len(r_coeff_queue)>1 else r_coeff_queue[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mask_and_avg(values, padding_mask):\n\tdec_lens = torch.sum(padding_mask,dim=1)\n\tlosses = torch.stack(values, dim=1)\n\tlosses = losses * padding_mask\n\tvalues_per_ex = torch.sum(losses, dim=1)/dec_lens\n\treturn torch.sum(values_per_ex)", "def mean(self):\n\n\t\tif not self._masked:\n\t\t\t\n\t\t\tretur...
[ "0.60307616", "0.59903556", "0.5989535", "0.5927027", "0.58250964", "0.58250463", "0.58083445", "0.5792237", "0.57348174", "0.57280666", "0.57189894", "0.571298", "0.56587595", "0.5591607", "0.5536695", "0.55357367", "0.5512962", "0.55089694", "0.5496177", "0.5463986", "0.545...
0.7186115
0
Gets the Last Fit depending on the flag
def get_last_fit(flag='L'): if flag == 'L': return l_coeff_queue[-1] else: return r_coeff_queue[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFit(self):\n if self.fits.has_key('default'):\n return self.fits['default']\n else:\n return None", "def last_fmeasure(self):\n return self.get_fvalue(self.last_position())", "def get_last_saved_estimation(self):\n return None", "def get_fit(self, spac...
[ "0.6239705", "0.6228102", "0.6141779", "0.6008824", "0.59334695", "0.5871821", "0.5755246", "0.5743263", "0.5716989", "0.57042426", "0.5698672", "0.56794965", "0.56396884", "0.56118524", "0.55922616", "0.55794775", "0.55546254", "0.55316406", "0.55230576", "0.5493914", "0.547...
0.8070429
0
Use The current values of Curvature and Offset from Left and Right Lanes to decide if Lanes are sane
def curvature_sanity(left_curvature, left_offset, right_curvature, right_offset): if return_queue_len(flag='L') >= 1 and return_queue_len(flag='R') >= 1: offset = center_position - (left_offset + right_offset) / 2. offset_measure = np.abs(overall_offset - offset) return True if offset_measur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _curvature(self):\n y_eval = self.left_fitx.shape[0] - 10\n left_curverad = (((1 + (2 * self.left_fit[0] * y_eval + self.left_fit[1]) ** 2) ** 1.5) /\n np.absolute(2 * self.left_fit[0]))\n right_curverad = (((1 + (2 * self.right_fit[0] * y_eval + self.right_fit[1]) ...
[ "0.63404727", "0.6133634", "0.6060749", "0.58401936", "0.56271565", "0.5616536", "0.5516699", "0.5483635", "0.54565936", "0.5450176", "0.5428849", "0.54229635", "0.540363", "0.54026043", "0.53971386", "0.5384905", "0.53581065", "0.5353302", "0.53430974", "0.5340143", "0.53293...
0.70147413
0
Use the left and right fit
def update_lanewidth(left_fit, right_fit, img_): img_size = img_.shape y_eval = np.linspace(0, img_size[0], 20) left_x = get_intercepts(left_fit, y_eval) right_x = get_intercepts(right_fit, y_eval) return np.clip(right_x - left_x, 400, 800)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, left, mode, right, size=None, **kwargs):\n return super().__call__(left, mode, right, size=size, **kwargs)", "def hflip(self):\n self.leftimg, self.rightimg = self.rightimg, self.leftimg", "def rightbox(self):\r\n pass", "def check_extent(self):\n if self.lower_...
[ "0.5895596", "0.5836528", "0.5623411", "0.55394584", "0.5525405", "0.5424819", "0.53840476", "0.53774345", "0.53398556", "0.53164613", "0.52830184", "0.5280889", "0.5272965", "0.52709484", "0.52354926", "0.51937866", "0.51937866", "0.51937866", "0.51937866", "0.51937866", "0....
0.6062885
0
Create an ISO 6346 shipping container code.
def create(owner_code, serial, category='U'): if not (len(owner_code) == 3 and owner_code.isalpha()): raise ValueError("Invalid ISO 6346 owner code '{}'".format(owner_code)) if category not in ('U', 'J', 'Z', 'R'): raise ValueError("Invalid ISO 6346 category identifier '{}'".format(category)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def USCode(self, short):\n states = {\n 'AK': 'Alaska',\n 'AL': 'Alabama',\n 'AR': 'Arkansas',\n 'AS': 'American Samoa',\n 'AZ': 'Arizona',\n 'CA': 'California',\n 'CO': 'Colorado',\n 'CT': 'Connecticut',\n 'D...
[ "0.5175448", "0.5125011", "0.50932604", "0.49715528", "0.49012083", "0.48026282", "0.48011735", "0.47937286", "0.47771695", "0.47705403", "0.47160998", "0.47139278", "0.47057864", "0.47034556", "0.46948606", "0.46944666", "0.4689189", "0.4687901", "0.46823987", "0.46695173", ...
0.5852458
0
Compute the check digit for an ISO 6346 code without that digit
def check_digit(raw_code): s = sum(code(char) * 2**index for index, char in enumerate(raw_code)) return s % 11 % 10
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkdigit(code):\n check = sum((i+1)*int(code[i]) for i in range(9)) % 11\n return 'X' if check == 10 else str(check)", "def calc_check_digit_issn(issn):\n\n total = 0\n lissn = list(issn.replace('-', ''))\n\n for i, v in enumerate(lissn[:-1]):\n total = total + ((8-i) * int(v))\n\n ...
[ "0.6888133", "0.6631145", "0.6620832", "0.6535597", "0.6298015", "0.6270086", "0.6102347", "0.6022895", "0.6003835", "0.59928644", "0.5986576", "0.59091353", "0.58925956", "0.5891122", "0.5886155", "0.5840528", "0.58109224", "0.5803279", "0.5776782", "0.5743615", "0.5738659",...
0.697806
0
Determine the ISO 6346 numeric code for a letter.
def letter_code(letter): value = ord(letter.lower()) - ord('a') + 10 return value + value // 11
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha_number(alpha):\r\n if alpha.isupper() == False:\r\n num = ord(alpha) - 96\r\n return num\r\n elif alpha.isupper() == True:\r\n num = ord(alpha) - 64\r\n return num", "def code(char):\n return int(char) if char.isdigit() else letter_code(char)", "def letter_num(num...
[ "0.7418329", "0.7332461", "0.6975198", "0.6789075", "0.6789075", "0.67152506", "0.65995985", "0.65995985", "0.65719616", "0.6529032", "0.64173263", "0.6383725", "0.63769406", "0.63268995", "0.6257811", "0.62500453", "0.62329525", "0.6205183", "0.61922914", "0.6171451", "0.606...
0.73669213
1
Insert item into dynamic vp tree by first adding to pool, and then building a tree from the pool if min size reached Then merge trees of equal sizes so that there are at most log(log (n)) trees, with the largest tree having roughly n/2 nodes
def insert(self, item): self.pool.append(item) if len(self.pool) == self.min_tree_size: self.trees.append(_ExtendedVPTree(self.pool, self.dist_fn)) self.pool = [] while len(self.trees) > 1 and self.trees[-1].size == self.trees[-2].size: a = self.trees.pop() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bst_insert(sizes):\n tree = rbTree_main.BinarySearchTree();\n for i in range(sizes):\n tree.insert(random.random())", "def rbt_insert(sizes):\n tree = rbTree_main.RBTree();\n for i in range(sizes):\n tree.rb_insert(random.random());\n pass", "def _insort(self, node):\n l...
[ "0.65738744", "0.59414244", "0.58873856", "0.5721595", "0.5673607", "0.5613784", "0.5607082", "0.5599457", "0.5549631", "0.54778767", "0.5471518", "0.53812885", "0.5376035", "0.53730154", "0.53416336", "0.5339837", "0.5338522", "0.5326516", "0.5284125", "0.52726436", "0.52688...
0.7945118
0
Return node nearest to query by finding nearest node in each tree and returning the global minimum (including nodes in pool)
def nearest(self, query): nearest_trees = list(map(lambda t: t.get_nearest_neighbor(query), self.trees)) distances_pool = list(zip(map(lambda x: self.dist_fn(x, query), self.pool), self.pool)) best = None best_cost = np.inf for cost, near in nearest_trees + distances_pool: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_neighbor(self, xRand):\n # TODO: Make this more efficient?\n #within a neighborhood of XRand, determine the lowest cost to go\n minCost = np.inf\n minNode = None\n\n for node in self.Tree:\n\n cost = self.compute_dist(node.state_time[0:6], xRand)\n\n ...
[ "0.73361427", "0.73361427", "0.73157585", "0.72876966", "0.7200594", "0.71982765", "0.7060152", "0.70410466", "0.69066334", "0.6884978", "0.68516064", "0.6803381", "0.67801213", "0.6773021", "0.67226744", "0.6675192", "0.6634299", "0.66336787", "0.66082364", "0.65941596", "0....
0.80384624
0
Return all nodes within distance radius of the given query, by collating neighbourhoods for each internal tree (and pool)
def neighbourhood(self, query, radius): tree_neighbourhood = lambda tree: list(map(lambda x: x[1], tree.get_all_in_range(query, radius))) neighbourhood_trees = list(itertools.chain.from_iterable(map(tree_neighbourhood, self.trees))) return neighbourhood_trees + list(filter(lambda x: self.dist_fn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbours(self):\n\n neighbours = []\n root = self.root\n if self == root:\n return neighbours\n\n ########################\n # IMMEDIATELY ADJACENT #\n sizes = [self.maxs[0] - self.mins[0], self.maxs[1] - self.mins[1]]\n coords = [(self.mins[0] + si...
[ "0.6189898", "0.6067114", "0.5967871", "0.5918009", "0.5853346", "0.5850977", "0.57527864", "0.5742722", "0.57373124", "0.57318693", "0.5728062", "0.5716135", "0.5708966", "0.569612", "0.5669883", "0.5667582", "0.5654472", "0.5650004", "0.5642539", "0.56394213", "0.5612371", ...
0.79401344
0
Add a new pair of products with times purchased together if the pair existed, just increase the times purchased otherwise just add the new pair
def add(self, prod1_name, prod2_name, times): if prod1_name == prod2_name: return try: self._purchased.update({PROD1: prod1_name, PROD2: prod2_name, TIMES: {'$exists': True}}, {'$inc': {TIMES: times}}, True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, product, order_type, pickup, drop, quantity=1, update_quantity=False):\n\n #calculate duratin\n start_date = datetime.strptime(pickup, \"%Y-%m-%d %H:%M\")\n end_date = datetime.strptime(drop, \"%Y-%m-%d %H:%M\")\n duration = end_date-start_date\n\n #end of calculati...
[ "0.6113706", "0.6062423", "0.6022032", "0.57448155", "0.5658234", "0.5507529", "0.54974794", "0.5474968", "0.5401568", "0.5374355", "0.5366406", "0.5358892", "0.5353692", "0.5345051", "0.53433794", "0.5340769", "0.53113306", "0.529849", "0.529575", "0.5261819", "0.52604914", ...
0.65889096
0
Assign a fixed times of the given pair of products with times purchased together
def assign(self, prod1_name, prod2_name, times): try: self._purchased.update({PROD1: prod1_name, PROD2: prod2_name}, {'$set': {TIMES: times}}, True ) self._purchased.update({PROD1: pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def given_a_series_of_prices(self, prices):\n timestamps = [datetime(2015, 5, 28), datetime(2015, 5, 29),\n datetime(2015, 5, 30)]\n for timestamp, price in zip(timestamps, prices):\n self.goog.update(timestamp, price)", "def promotion(time, sum_price):\n time = s...
[ "0.56735665", "0.5642687", "0.5597733", "0.55516917", "0.55381095", "0.54918313", "0.5367134", "0.53548855", "0.53330797", "0.5317737", "0.5311256", "0.5310855", "0.5292983", "0.5248051", "0.5220131", "0.52120817", "0.5160664", "0.51471895", "0.51454437", "0.51453066", "0.514...
0.5754572
0
Recommend the next best relevant product
def recommend_next_product(self, prod_list): scores = defaultdict(float) for prod in prod_list: for item in self._purchased.find({PROD1: prod}): if not item[PROD2] in prod_list: scores[item[PROD2]] += math.log(item[TIMES]) if len(scores) == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _choose_best_option(self):", "def popular_recommend(row):\n actual = new_purchase_row(row)\n return f1(actual, popular_products)", "def step(self):\n highest_offer = None\n\n if self.manager is None:\n highest_rep = 0\n\n else:\n highest_rep = self.manager.r...
[ "0.6451906", "0.6248928", "0.6203764", "0.6144406", "0.610878", "0.60792506", "0.59292257", "0.579324", "0.57634926", "0.5680954", "0.56799036", "0.56428087", "0.56206936", "0.55952084", "0.55937326", "0.5577743", "0.5574243", "0.5536686", "0.55234545", "0.55225116", "0.54792...
0.69993323
0
Trains the classifier model on the training set stored in file trainfile
def train(self, trainfile): sentences_emb,labels=self.read_data(trainfile) logReg = LogisticRegression(penalty="l2",C = 10, multi_class='auto',solver='newton-cg') logReg.fit(sentences_emb,labels) self.clf=logReg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, trainfile):", "def trainModel( self, featureTrain, classTrain):", "def train(self):\n self.log(f\"{self.cur_file_path}\\t\\tInfo: train method invoked!\")\n self.log(f\"{self.cur_file_path}\\t\\tInfo: training {self.model.__class__.__name__} model!\")\n\n self.model.fit(sel...
[ "0.8426095", "0.74116445", "0.73872614", "0.72419417", "0.71222615", "0.7112658", "0.7041241", "0.70203024", "0.7007973", "0.69176805", "0.69125766", "0.6865418", "0.6846726", "0.68443483", "0.68333745", "0.68271935", "0.6823557", "0.6811905", "0.6811905", "0.6811905", "0.681...
0.7566852
1
Convenience split function for inverted index attributes. Useful for attributes that contain filenames. Splits the given string s into components parts (directories, filename), discarding the extension and all but the last two directories. What's remaining is split into words and the result is returned.
def split_path(s): dirname, filename = os.path.split(s) fname_noext, ext = os.path.splitext(filename) levels = dirname.strip('/').split(os.path.sep)[2:][-2:] return PATH_SPLIT.split(' '.join(levels + [fname_noext]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_path(s):\n dirname, filename = os.path.split(s)\n fname_noext, ext = os.path.splitext(filename)\n for part in dirname.strip('/').split(os.path.sep)[2:][-2:] + [fname_noext]:\n for match in PATH_SPLIT.split(part):\n if match:\n yield match", "def tokenize(\n ...
[ "0.63968426", "0.6263762", "0.61884594", "0.58648413", "0.5765297", "0.5761506", "0.5726431", "0.56870097", "0.56813276", "0.56165", "0.55843884", "0.5512251", "0.5427378", "0.5423563", "0.54086035", "0.5384905", "0.5383309", "0.5346063", "0.53299356", "0.52875656", "0.528058...
0.7065876
0
Registers one or more object attributes and/or multicolumn indexes for the given type name. This function modifies the database as needed to accommodate new indexes and attributes, either by creating the object's tables (in the case of a new object type) or by altering the object's tables to add new columns or indexes....
def register_object_type_attrs(self, type_name, indexes = [], **attrs): if len(indexes) == len(attrs) == 0: raise ValueError, "Must specify indexes or attributes for object type" table_name = "objects_%s" % type_name # First pass over the attributes kwargs, sanity-checking provided...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_object_type_attrs(self, type_name, indexes = [], **attrs):\n if len(indexes) == len(attrs) == 0:\n raise ValueError(\"Must specify indexes or attributes for object type\")\n\n table_name = \"objects_%s\" % type_name\n\n # First pass over the attributes kwargs, sanity-ch...
[ "0.77066755", "0.6361328", "0.6264673", "0.61884093", "0.5833767", "0.57452655", "0.57315993", "0.56269467", "0.54736567", "0.544051", "0.54389435", "0.5431951", "0.53999454", "0.5295605", "0.52132535", "0.5177261", "0.5129444", "0.51156485", "0.5099704", "0.50790924", "0.505...
0.7726764
0
Registers a new inverted index with the database. An inverted index maps arbitrary terms to objects and allows you to query based on one or more terms. If the inverted index already exists with the given parameters, no action is performed. name is the name of the inverted index and must be alphanumeric. min and max spe...
def register_inverted_index(self, name, min = None, max = None, split = None, ignore = None): # Verify specified name doesn't already exist as some object attribute. for object_name, object_type in self._object_types.items(): if name in object_type[1] and name != object_type[1][name][2]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_inverted_index(self, name, min = None, max = None, split = None, ignore = None):\n # Verify specified name doesn't already exist as some object attribute.\n for object_name, object_type in self._object_types.items():\n if name in object_type[1] and name != object_type[1][name]...
[ "0.8106289", "0.5157404", "0.513424", "0.49950093", "0.4974171", "0.48789895", "0.48250076", "0.47591364", "0.47572297", "0.4660967", "0.46581295", "0.46503413", "0.464838", "0.46435705", "0.46280825", "0.46089694", "0.46081924", "0.4605972", "0.4580362", "0.4576036", "0.4573...
0.81983155
0
Adds an object of type 'object_type' to the database. Parent is a (type, id) tuple which refers to the object's parent. 'object_type' and 'type' is a type name as given to register_object_type_attrs(). attrs kwargs will vary based on object type. ATTR_SIMPLE attributes which a None are not added. This method returns th...
def add(self, object_type, parent = None, **attrs): type_attrs = self._get_type_attrs(object_type) if parent: attrs["parent_type"] = self._get_type_id(parent[0]) attrs["parent_id"] = parent[1] # Increment objectcount for the applicable inverted indexes. inverted_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Add(self, obj_type, name, node=None, obj=None):\n print \"Adding object %s, node: %s\" % (name, node)\n #check for duplicate object\n # also raise error if no such object type\n if self.ObjectExists(obj_type, name):\n raise DuplicateObjectError(name)\n \n ...
[ "0.6409624", "0.62771475", "0.60935414", "0.6087404", "0.60587406", "0.5914331", "0.5884166", "0.55695456", "0.5552869", "0.53761256", "0.53064", "0.52908915", "0.5275135", "0.5275135", "0.5275135", "0.5275135", "0.5275135", "0.52567697", "0.514278", "0.51280934", "0.5127361"...
0.6481042
0
Update an object in the database. For updating, object is identified by a (type, id) tuple or an ObjectRow instance. Parent is a (type, id) tuple or ObjectRow instance, which refers to the object's parent. If specified, the object is reparented, otherwise the parent remains the same as when it was added with add(). att...
def update(self, obj, parent=None, **attrs): if isinstance(obj, ObjectRow): object_type, object_id = obj['type'], obj['id'] else: object_type, object_id = obj type_attrs = self._get_type_attrs(object_type) get_pickle = False # Determine which inverted in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, obj, parent=None, **attrs):\n if self._readonly:\n raise DatabaseReadOnlyError('upgrade_to_py3() must be called before database can be modified')\n object_type, object_id = self._to_obj_tuple(obj)\n\n type_attrs = self._get_type_attrs(object_type)\n get_pickl...
[ "0.74381167", "0.6614651", "0.6315451", "0.61962694", "0.614676", "0.6144914", "0.6054113", "0.6040945", "0.5997564", "0.5952653", "0.5952653", "0.59390825", "0.59053296", "0.5887963", "0.5873624", "0.5767497", "0.57389915", "0.57276726", "0.5707913", "0.5680127", "0.5647404"...
0.786734
0
Scores the terms given in terms_list, which is a list of tuples (terms, coeff, split, ivtidx), where terms is the string or sequence of terms to be scored, coeff is the weight to give each term in this part (1.0 is normal), split is the function or regular expression used to split terms (only used if a string is given ...
def _score_terms(self, terms_list): terms_scores = {} total_terms = 0 for terms, coeff, split, ivtidx in terms_list: if not terms: continue # Swap ivtidx name for inverted index definition dict ivtidx = self._inverted_indexes[ivtidx] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _score_terms(self, terms_list):\n terms_scores = {}\n total_terms = 0\n\n for terms, coeff, split, ivtidx in terms_list:\n if not terms:\n continue\n # Swap ivtidx name for inverted index definition dict\n ivtidx = self._inverted_indexes[ivti...
[ "0.8230414", "0.54937506", "0.54905194", "0.5479236", "0.5440691", "0.5430716", "0.54254556", "0.5392035", "0.53528565", "0.51504266", "0.5112394", "0.510215", "0.5097729", "0.50681865", "0.5062038", "0.4980558", "0.49433053", "0.49381447", "0.49258786", "0.49234137", "0.4917...
0.82383937
0
Removes all indexed terms under the specified inverted index for the given object. This function must be called when an object is removed from the database, or when an ATTR_INVERTED_INDEX attribute of an object is being updated (and therefore that inverted index must be reindexed).
def _delete_object_inverted_index_terms(self, (object_type, object_id), ivtidx): self._delete_multiple_objects_inverted_index_terms({object_type: ((ivtidx,), (object_id,))})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_object_inverted_index_terms(self, obj, ivtidx):\n object_type, object_id = obj\n self._delete_multiple_objects_inverted_index_terms({object_type: ((ivtidx,), (object_id,))})", "def _delete_multiple_objects_inverted_index_terms(self, objects):\n for type_name, (ivtidxes, object_id...
[ "0.81035614", "0.75411546", "0.75411546", "0.6139424", "0.6045582", "0.603692", "0.6007786", "0.60001457", "0.59316987", "0.584059", "0.5829414", "0.5817072", "0.5789952", "0.57787883", "0.5730306", "0.56770205", "0.56318223", "0.5610385", "0.55822736", "0.5505812", "0.549647...
0.80202085
1
Adds the dictionary of terms (as computed by _score_terms()) to the specified inverted index database for the given object.
def _add_object_inverted_index_terms(self, (object_type, object_id), ivtidx, terms): if not terms: return # Resolve object type name to id object_type = self._get_type_id(object_type) # Holds any of the given terms that already exist in the database # with their id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_object_inverted_index_terms(self, obj, ivtidx, terms):\n object_type, object_id = obj\n if not terms:\n return\n\n # Resolve object type name to id\n object_type = self._get_type_id(object_type)\n\n # Holds any of the given terms that already exist in the data...
[ "0.8023277", "0.61256963", "0.5922523", "0.57880175", "0.5704644", "0.56919354", "0.56858873", "0.56835586", "0.56740934", "0.56609404", "0.56487274", "0.5621855", "0.56036234", "0.55900854", "0.5573914", "0.5557396", "0.5548084", "0.5533701", "0.55311424", "0.53814083", "0.5...
0.7867361
1
Queries the inverted index ivtidx for the terms supplied in the terms argument. If terms is a string, it is parsed into individual terms based on the split for the given ivtidx. The terms argument may also be a list or tuple, in which case no parsing is done. The search algorithm tries to optimize for the common case. ...
def _query_inverted_index(self, ivtidx, terms, limit = 100, object_type = None): t0 = time.time() # Fetch number of files the inverted index applies to. (Used in score # calculations.) objectcount = self._inverted_indexes[ivtidx]['objectcount'] if not isinstance(terms, (list, t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _query_inverted_index(self, ivtidx, terms, limit = 100, object_type = None):\n t0 = time.time()\n # Fetch number of files the inverted index applies to. (Used in score\n # calculations.)\n objectcount = self._inverted_indexes[ivtidx]['objectcount']\n\n if not isinstance(term...
[ "0.7995925", "0.75903076", "0.74195915", "0.64581156", "0.6457221", "0.59554505", "0.5865238", "0.5861748", "0.58322316", "0.5811512", "0.5693761", "0.5638802", "0.5617676", "0.5603782", "0.55951315", "0.55166435", "0.530402", "0.5279322", "0.52687097", "0.52252996", "0.51968...
0.8012516
0
Obtains terms for the given inverted index name. If associated is None, all terms for the inverted index are returned. The return value is a list of 2tuples, where each tuple is (term, count). Count is the total number of objects that term is mapped to. Otherwise, associated is a specified list of terms, and only those...
def get_inverted_index_terms(self, ivtidx, associated = None, prefix = None): if ivtidx not in self._inverted_indexes: raise ValueError, "'%s' is not a registered inverted index." % ivtidx if prefix: where_clause = 'WHERE terms.term >= ? AND terms.term <= ?' where_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_inverted_index_terms(self, ivtidx, associated = None, prefix = None):\n if ivtidx not in self._inverted_indexes:\n raise ValueError(\"'%s' is not a registered inverted index.\" % ivtidx)\n\n if prefix:\n where_clause = 'WHERE terms.term >= ? AND terms.term <= ?'\n ...
[ "0.72814137", "0.5312216", "0.51168823", "0.50760156", "0.5040851", "0.49835056", "0.48447284", "0.4833117", "0.48034608", "0.47988817", "0.4782228", "0.46925923", "0.46841052", "0.4615586", "0.461366", "0.45966607", "0.45822227", "0.45699117", "0.45678702", "0.45583963", "0....
0.7293714
0
Test that trailing @ used for extracting does not interfere with untag.
def test_untag_with_trailing_extract(self): fields_to_test = { 'foo@': 'bar-base', 'foo@de@': 'bar-de', 'foo@(.*_FR|.*_SG)@': 'bar-fr', 'nested': { 'nested@': 'nested-base', 'nested@de_AT@': 'nested-de', 'nested@(.*_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mention(result):\n return result.text.find('@') != -1", "def testUnindentedFields(self):\n self.checkParse(\"\"\"\n This is a paragraph.\n \n @foo: This is a field.\"\"\")\n \n self.checkParse(\"\"\"\n This is a paragraph.\n @foo: This is a field.\"\...
[ "0.6034205", "0.59515476", "0.59357536", "0.58285934", "0.57458454", "0.54263383", "0.5389915", "0.5322321", "0.53162247", "0.527235", "0.5249418", "0.5217515", "0.5167631", "0.5140492", "0.5128733", "0.5124771", "0.5098799", "0.5088662", "0.50590724", "0.5033587", "0.5031845...
0.6260769
0
Test that not having a base key does not interfere with untag and locales.
def test_untag_with_no_base(self): fields_to_test = { 'foo@de': 'bar-de', 'baz@de': { 'fum@de': 'boo-de' }, } fields = copy.deepcopy(fields_to_test) self.assertDictEqual({}, document_fields.DocumentFields.untag(fields)) self.ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unset_key(self):\n context = {'help_key': 'unused-key'}\n self.assertRaises(\n ImproperlyConfigured,\n tags.madcap_flare_help,\n context)", "def __missing__(self, key):\n global MISSING\n MISSING = key # For debugging - save name of missing k...
[ "0.61089957", "0.60943186", "0.6040597", "0.60356236", "0.58925235", "0.58480316", "0.5847725", "0.5817884", "0.5728378", "0.5715855", "0.57137895", "0.57015187", "0.5691672", "0.5673796", "0.56599385", "0.56495875", "0.5617581", "0.56079537", "0.5602262", "0.55924207", "0.55...
0.6586597
0
Untag when there is a none value for the tagged value.
def test_untag_none(self): untag = document_fields.DocumentFields.untag fields_to_test = { 'foo': 'base', 'foo@env.prod': None, } fields = copy.deepcopy(fields_to_test) self.assertDictEqual({ 'foo': 'base', }, untag(fields, locale=None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, value):\n tags = self.__all_tags()\n if value in tags:\n tags.remove(value)\n self.__post_changes(tags)", "def testNoneValue(self):\n objectID = uuid4()\n user = createUser(u'username', u'password', u'User',\n u'user@exam...
[ "0.6135915", "0.5967588", "0.59159297", "0.580774", "0.57716626", "0.57520264", "0.56370187", "0.56107867", "0.5567301", "0.5549925", "0.55275375", "0.55266446", "0.54774225", "0.5460869", "0.54421735", "0.54349834", "0.54182965", "0.54049665", "0.5401856", "0.5396873", "0.53...
0.64906526
0
Summary of the time series. include mean, std, max, min and range
def summaryone(x): print 'mean and std are ',np.mean(x), np.std(x) print 'max and min are ',np.max(x), np.min(x) print 'the range is ',np.max(x)-np.min(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_series_stats(time_series):\n return pd.Series([np.mean(time_series), np.std(time_series), get_frequency(time_series)])", "def show_stats(x):\n print(\"min =\", x.min())\n print(\"max =\", x.max())\n print(\"median =\", np.median(x))\n print(\"average =\", x.mean())\n print(\"std =\...
[ "0.6649429", "0.6533868", "0.6494436", "0.64276904", "0.63289535", "0.6307185", "0.62566227", "0.6218539", "0.6188114", "0.6148697", "0.6121931", "0.60502344", "0.6021406", "0.60148054", "0.5986059", "0.59573406", "0.5942241", "0.5935031", "0.5930992", "0.5924357", "0.5903259...
0.7294873
0
Creates and returns a MySQL database engine.
def create_mysql_engine(dbname, prod=True, driver="pymysql"): db_config = toolbox.open_system_config(prod=prod, config_type="DB_CONFIG")[dbname] db_url = URL( drivername="mysql+{}".format(driver), username=db_config.get("username"), password=db_config.get("password"), host=db_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mysql_engine():\n\n return sa.create_engine(\n sa.engine.url.URL(\n drivername=\"mysql+pymysql\",\n username=\"username\", # Change that!!\n password=\"password\", # Change that!!\n host=\"host\", # Change that!!\n port=c.PORT,\n ...
[ "0.77028465", "0.75408655", "0.740179", "0.73909706", "0.71847886", "0.7134698", "0.7087348", "0.70744014", "0.7018489", "0.6846384", "0.679343", "0.6783817", "0.676985", "0.670791", "0.670791", "0.670791", "0.670791", "0.66787875", "0.66645664", "0.6635707", "0.6618998", "...
0.7968073
0
Creates and returns a connection to a Microsoft SQL Server database.
def create_mssql_connection( dbname, prod=True, driver="{ODBC Driver 17 for SQL Server}", driver_type="pyodbc" ): db_config = toolbox.open_system_config(prod=prod, config_type="DB_CONFIG")[dbname] if driver_type == "pyodbc": connection = pyodbc.connect( driver=driver, server=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createConnection(self):\n comp_name = os.environ['COMPUTERNAME']\n conn = py.connect('Driver=ODBC Driver 11 for SQL Server;SERVER=' +\n comp_name + '\\HAZUSPLUSSRVR; UID=SA;PWD=Gohazusplus_02')\n self.conn = conn\n return conn", "def create_connection():\r\n tr...
[ "0.69744205", "0.6950537", "0.67107075", "0.64784396", "0.6422242", "0.6395865", "0.638747", "0.638506", "0.6319929", "0.6319132", "0.6210808", "0.6189856", "0.6167106", "0.61432165", "0.6121374", "0.6109558", "0.61014706", "0.60880446", "0.60853744", "0.60759133", "0.6063821...
0.72884434
0
Fix the dates for the CEMS data Three date/datetime changes (not all implemented) Make op_date a DATE type Make an appropriate INTERVAL type (not implemented) Add a UTC timestamp (not implemented)
def fix_up_dates(df): # Convert to interval: # df = convert_time_to_interval(df) # Convert op_date and op_hour from string and integer to datetime: # Note that doing this conversion, rather than reading the CSV with # `parse_dates=True` is >10x faster. # Make an operating timestamp df["oper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datefixer(ds):\n\n\n\t# ========== create the new dates ==========\n\tyear = ds.Year\n\n\t# +++++ set up the list of dates +++++\n\tdates = OrderedDict()\n\ttm = [dt.datetime(int(year) , int(np.floor(tm)), int(tm%1*30+1)) for tm in ds.time]\n\tdates[\"time\"] = pd.to_datetime(tm)\n\n\tdates[\"calendar\"] = 'st...
[ "0.6125357", "0.5819586", "0.5773256", "0.57689685", "0.57060605", "0.5502692", "0.55019426", "0.5471219", "0.54283524", "0.54059875", "0.54014325", "0.53956264", "0.53769857", "0.5311041", "0.5306806", "0.5298646", "0.52898556", "0.52759445", "0.5245434", "0.5235692", "0.518...
0.6865202
0
Test whether every element in the series is either missing or in values This is fiddly because isin() changes behavior if the series is totally NaN (because of type issues)
def _all_na_or_values(series, values): series_excl_na = series[series.notna()] if not len(series_excl_na): out = True elif series_excl_na.isin(values).all(): out = True else: out = False return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nan_value(data):\n return data.isnull().any()", "def is_empty(series):\n return series.isna().all()", "def checkNaN(data):\n if data.isnull().values.any():\n N = data.isnull().sum().sum()\n print(\"There are {} missing values.\".format(N))", "def pd_isnan(val):\n return val is N...
[ "0.6702152", "0.65366334", "0.64191544", "0.6405477", "0.6321939", "0.63141245", "0.61905783", "0.6163543", "0.61403567", "0.6065991", "0.60013145", "0.59662825", "0.592186", "0.5896812", "0.5895072", "0.58945686", "0.5826522", "0.5777309", "0.57611376", "0.57524323", "0.5752...
0.73976064
0
Drop these calculated rates because they don't provide any information. If you want these, you can just use a view.
def drop_calculated_rates(df): if not _all_na_or_values(df["so2_rate_measure_flg"], {"Calculated"}): raise AssertionError() if not _all_na_or_values(df["co2_rate_measure_flg"], {"Calculated"}): raise AssertionError() del df["so2_rate_measure_flg"], df["so2_rate_lbs_mmbtu"] del df["co2_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rates(self):\n return self._rates", "def rates(self):\n raise NotImplementedError(\"Must be implemented by subclass.\")", "def get_zero_rates(self):\r\n self.__bootstrap_zero_coupons__()\r\n self.__get_bond_spot_rates__()\r\n return [self.zero_rates[T] for T in self.get_matur...
[ "0.61796653", "0.6036099", "0.5962428", "0.57073414", "0.565551", "0.5630784", "0.56072664", "0.5545332", "0.55377626", "0.5521308", "0.5488782", "0.5419411", "0.5387603", "0.5350166", "0.53407055", "0.53198713", "0.5319001", "0.52960646", "0.52811706", "0.5280485", "0.526765...
0.635766
0
Calculates the bins used in the Riemann sum over metallicities
def calculateMetallicityBinEdges(self): if self.binInLogSpace: logMetallicities = np.log10(self.metallicityGrid) b= logMetallicities[:-1] + (logMetallicities[1:] - logMetallicities[:-1])/2. b = 10.**b #the boundaries for integration are not in log space so ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_energy_bins(image, num_bins=4):\r\n h, _ = image.shape\r\n C = np.linspace(0, h//2, num=num_bins+1, dtype=\"int\")\r\n # Create a list of dense square mask\r\n mask_list = [square_mask(image, c) for c in C[1:]]\r\n # Extract a list of hollow mask\r\n square_zones = [~mask_list[k]*mask_lis...
[ "0.63174194", "0.6299061", "0.62940705", "0.6222577", "0.6208876", "0.6017929", "0.598964", "0.59230375", "0.59167486", "0.58886397", "0.58843166", "0.5880696", "0.58755875", "0.58755875", "0.58666515", "0.5855976", "0.58558095", "0.584502", "0.5839998", "0.5780967", "0.57703...
0.6595891
0
Make component fields, other info into dict for template context
def make_context( container: ServiceContainer, component_name: str, **kwargs ) -> Dict[str, Any]: from wired_components.component import IWrapComponents, IComponent # Start with all the wrapped components context: Dict[str, Any] = container.get(IWrapComponents) # We get the co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _template_data(self):\n return {\"form\": self.form.render()}", "def _get_render_context(self):\r\n context = {\r\n 'id': self.input_id,\r\n 'value': self.value,\r\n 'status': Status(self.status, self.capa_system.i18n.ugettext),\r\n 'msg': self.msg,\r...
[ "0.65645075", "0.6080614", "0.5978665", "0.58917844", "0.5774367", "0.5748968", "0.57399213", "0.57305616", "0.56950396", "0.5634534", "0.55968183", "0.55514616", "0.5549723", "0.5531995", "0.550397", "0.54978746", "0.5492822", "0.5489106", "0.54887336", "0.54638904", "0.5444...
0.6259585
1
Launch training of the model with a set of hyperparameters in parent_dir/job_name
def launch_training_job(model_dir,job_name, params, implementation_dir): # Create a new folder in implementation corresponding to the model implementation_dir = os.path.join(implementation_dir, os.path.basename(os.path.normpath(model_dir))) if not os.path.exists(implementation_dir): os.makedirs(impl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launch_training_job(parent_dir, data_dir, job_name, params):\n # Create a new folder in parent_dir with unique_name \"job_name\"\n model_dir = os.path.join(parent_dir, job_name)\n if not os.path.exists(model_dir):\n os.makedirs(model_dir)\n\n # Write parameters in json file\n json_path = ...
[ "0.80069077", "0.7198703", "0.71838933", "0.6437247", "0.63805366", "0.629484", "0.62795806", "0.6278729", "0.62004155", "0.6189536", "0.6156923", "0.6135809", "0.61020046", "0.6097955", "0.60901624", "0.60863006", "0.60771877", "0.6063894", "0.6054576", "0.6025766", "0.60214...
0.7579028
1
Takes a positive list of integers along with a target and returns a subset of
def diophantine_subset_sum(number_list, target, time_limit=TIME_LIMIT): started_at = time.time() # Sort numbers list. number_list = sorted(number_list) # Build sums list. sums_list = [number_list[0]] for n in range(1, len(number_list)): sums_list.append(number_list[n] + sums_list[n-1])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _select_sublist(lst, target):\n ln = len(lst)\n\n # Generate an array that indicates the decision bit for each element in the list.\n # If an element is deterministically true, then no decision bit is needed.\n choice_bits = [None] * ln\n x = 0\n for i in range(0, ln):\n if lst[i][1] n...
[ "0.7094783", "0.65067834", "0.6460729", "0.63038445", "0.6270336", "0.62450624", "0.62270397", "0.61682236", "0.61059326", "0.6029637", "0.6015087", "0.5967162", "0.5875812", "0.5808211", "0.5807387", "0.57974637", "0.5757506", "0.5754575", "0.5735689", "0.5707086", "0.569802...
0.693455
1
Convert unit conversion with custom UnitRegistry
def test_convert_unit_with_custom_registry(test_df): df = get_units_test_df(test_df).rename(unit={"EJ/yr": "foo"}) # check that conversion fails with application registry with pytest.raises(pint.UndefinedUnitError): df.convert_unit("foo", "baz") # define a custom unit registry ureg = pint....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_unit(self, unit):\n if unit in self.units:\n return self.units[unit]\n elif unit in unit_map:\n return unit_map[unit]\n else:\n raise SBMLError('Unit not recognized: ' + str(unit))", "def convertUnit(*args, fromUnit: AnyStr=\"\", toUnit: AnyStr=\"...
[ "0.72558576", "0.7242834", "0.69972605", "0.67883354", "0.6740144", "0.6727505", "0.6723467", "0.67014116", "0.66655236", "0.6658775", "0.6603207", "0.65299666", "0.64555025", "0.64369696", "0.6419799", "0.64174867", "0.64120305", "0.6399249", "0.63895", "0.6342039", "0.63326...
0.72553796
1
insert a column to tb. if called, all operation related to db must be fitted.
def insert_column(self, tb_name, column_name, data_type): sentences = f""" ALTER TABLE {tb_name} ADD COLUMN {column_name} {data_type}; """ print(sentences) self.commit(sentences)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addColumn(self, table, column, init_data):\n\t\tcommand = \"ALTER TABLE \" + table + \" ADD COLUMN \" + str(column) + \" \" + getSQLiteType(init_data)\n\t\ttry:\n\t\t\tself._run_command(command)\n\t\texcept sqlite3.OperationalError:\n\t\t\tprint(\"Column \" + str(column) + \" already exists!\")", "def inser...
[ "0.6773", "0.65841776", "0.64992654", "0.6474949", "0.6455139", "0.64373386", "0.6368149", "0.6303153", "0.629054", "0.6239281", "0.6229999", "0.622003", "0.6205193", "0.6202118", "0.6199418", "0.6196598", "0.6169299", "0.6163966", "0.613079", "0.60933846", "0.60929984", "0...
0.76917046
0
Throw double buffer into widget drawable
def on_draw(self, widget, cr): #print "starting to draw" if self.double_buffer is not None: self.draw_tiles() cr.set_source_surface(self.double_buffer, 0.0, 0.0) cr.paint() else: print('Invalid double buffer') #print "done drawing" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_buffer(self):\n \n self.shape.buf = [pi3d.Buffer(self.shape, self.verts, self.texcoords, self.inds, self.norms)]\n self.shape.set_draw_details(self.shader, [self.spritesheet.img])", "def draw(self):", "def draw(self, screen):", "def pre_draw(self):", "def on_configure(self, wi...
[ "0.5492979", "0.54373515", "0.541417", "0.5406553", "0.53597254", "0.5355659", "0.5354216", "0.5340868", "0.53357756", "0.5319597", "0.52766144", "0.5271925", "0.5259718", "0.5236922", "0.52361697", "0.5216407", "0.5194417", "0.5152858", "0.51386267", "0.51239336", "0.5107952...
0.6775266
0
Configure the double buffer based on size of the widget
def on_configure(self, widget, event, data=None): print "reconfiguring" # Destroy previous buffer if self.double_buffer is not None: self.double_buffer.finish() self.double_buffer = None # Create a new buffer self.double_buffer = cairo.ImageSurface(cairo....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setBufferSize(self, buffer_size):\n DPxSetDinBuffSize(buffer_size)", "def _changed_size(self, **kw):\n\t\tself._clear_matrix()\n\t\t\n\t\tself._recalc_adjustments()\n\t\t\n\t\tif self.flags() & gtk.REALIZED:\n\t\t\tif kw.get('resize', True): self.queue_resize()\n\t\t\tif kw.get('draw', True): self.que...
[ "0.610253", "0.5766414", "0.5608554", "0.56082743", "0.5588019", "0.55230093", "0.5471639", "0.54091835", "0.5401123", "0.5401123", "0.5352664", "0.53298753", "0.5326704", "0.5319585", "0.53189176", "0.53112936", "0.53038687", "0.5290001", "0.52694154", "0.5253243", "0.524766...
0.6723716
0
Shows a category item
def showItem(category_item_id): return render_template('item.html', item=db.findItem(id=category_item_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showCategory(category_id):\n category = session.query(Category).\\\n filter_by(id=category_id).one()\n item = session.query(Item).\\\n filter_by(category_id=category.id)\n return render_template('item.html', category=category, item=item)", "def showItem(category_id):\n category = se...
[ "0.79654604", "0.7739004", "0.7643676", "0.7522781", "0.7224209", "0.702118", "0.7007901", "0.69838154", "0.6969686", "0.68813515", "0.67284054", "0.6714985", "0.67128104", "0.6640791", "0.65600896", "0.6559297", "0.65177655", "0.6493208", "0.6447697", "0.6445132", "0.6391688...
0.7802788
1
Allow user to create new catalog item
def newItem(): if request.method == 'POST': db.createItem( title=request.form['title'], description=request.form['description'], category_id=request.form['category'], user_id=login_session['user_id']) flash("New catalog item created!", 'success') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_item(self, user: User, **kwargs) -> None:", "def addCatalogItem(sport_id):\n\n sport = session.query(Sport).filter_by(id=sport_id).one()\n if request.method == 'POST':\n newCatalogItem = Item(\n name=request.form['itemName'],\n description=request.form['itemDescripti...
[ "0.73387873", "0.69759136", "0.69521016", "0.68233764", "0.6724789", "0.66220343", "0.65843236", "0.6572441", "0.6484448", "0.6453141", "0.6386233", "0.6372381", "0.6363761", "0.6352616", "0.6330959", "0.6315789", "0.63058573", "0.6267776", "0.6242766", "0.6202442", "0.618346...
0.76763475
0
Allows user to edit an existing category item
def editItem(category_item_id): editedItem = db.findItem(id=category_item_id) if editedItem.user_id != login_session['user_id']: return not_authorized() if request.method == 'POST': db.updateItem(editedItem, request.form) return redirect(url_for('showCatalog')) return render_temp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def editItem(category_id, item_id):\n editedItem = session.query(Item).filter_by(id=item_id).one()\n category = session.query(Category).filter_by(id=category_id).one()\n\n if editedItem.user_id != login_session['user_id']:\n flash(\"You are authorised to edit items created by you!\")\n ...
[ "0.79928815", "0.7969549", "0.79305446", "0.76757014", "0.7604712", "0.7579564", "0.7493831", "0.74769086", "0.74194235", "0.7385975", "0.7354665", "0.73481214", "0.7337863", "0.7281295", "0.7241027", "0.723668", "0.71674097", "0.7164873", "0.7072671", "0.70634896", "0.700564...
0.82450867
0
Allows user to delete an existing category item
def deleteItem(category_item_id): itemToDelete = db.findItem(id=category_item_id) if itemToDelete.user_id != login_session['user_id']: return not_authorized() if request.method == 'POST': db.deleteItem(itemToDelete) flash('%s Successfully Deleted' % itemToDelete.title, 'success') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category_delete(request):\n if request.POST:\n cat = get_object_or_404(Category, pk=request.POST.get('id'))\n cat.delete()\n return HttpResponse(status=200)", "def deleteCategory():\n deletecategory = deleteCategoryForm()\n # Look for CSRF token in form, verify POST method, and vali...
[ "0.8067774", "0.8005237", "0.7868571", "0.78579575", "0.7821217", "0.77969927", "0.7698097", "0.7654832", "0.7649916", "0.76128393", "0.75621045", "0.7551869", "0.74583393", "0.74365985", "0.73939204", "0.73760337", "0.734237", "0.726488", "0.7225764", "0.72094333", "0.717729...
0.80150735
1
Compute average return and of steps.
def compute_avg_return_and_steps(environment, policy, num_episodes=10): total_return = 0.0 total_steps = 0.0 for _ in range(num_episodes): time_step = environment.reset() episode_return = 0.0 episode_steps = 0.0 while not time_step.is_last(): action_step = polic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mean(self, sums, step):\n\n return sums/step", "def calculate(self):\n avg = self.sum / self.n if self.n != 0 else 0\n self.running_avg.append(avg)\n return avg", "def average(self):\n return (self.current + self.last) / 2.0", "def average(self, start, end):\n ...
[ "0.7158892", "0.6989263", "0.6973302", "0.68902016", "0.67515194", "0.6697132", "0.652611", "0.6519316", "0.64798063", "0.6475223", "0.64444023", "0.6367762", "0.630979", "0.6308836", "0.62865496", "0.62865496", "0.62865496", "0.62493414", "0.61997265", "0.61639595", "0.61119...
0.75718766
0
Return the camera's mac address as the serial number.
def serial_number(self) -> str: return self.mac_address
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_mac_address(self):\n str_hex_mac = uuid.UUID(int=uuid.getnode()).hex[-12:]\n return str_hex_mac", "def mac(self) -> str:\n return self.camera_info[\"wifi_mac\"]", "def mac_address(self) -> str:\n return self._device.mac", "def serial(self) -> str:\n return self.ca...
[ "0.74284977", "0.7396035", "0.7244921", "0.7241079", "0.7186397", "0.71549183", "0.6929182", "0.6929182", "0.68750423", "0.686168", "0.6835941", "0.6835715", "0.68190706", "0.67833877", "0.6717112", "0.6596283", "0.65792704", "0.6549326", "0.6522258", "0.6508936", "0.6494126"...
0.77441496
0
Return True if capture clip on motion is active.
def capture_clip_on_motion(self) -> bool: return self.data[Attribute.CAPTURE_CLIP_ON_MOTION]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capture_is_active(self):\n return self.um in self._streams", "def can_activate(self):\n if self.video_library.get_number_of_video_clips() == 0:\n return False\n else:\n return True", "def motion_detection_enabled(self):\n return self._motion_status", "def...
[ "0.6876677", "0.6634053", "0.63762534", "0.6186591", "0.60965234", "0.605035", "0.6013605", "0.6006316", "0.5958077", "0.59114885", "0.5910525", "0.5908825", "0.5908825", "0.58919317", "0.58919317", "0.5860505", "0.5826048", "0.5814718", "0.5800764", "0.5795898", "0.5795898",...
0.8491094
0
Return True if privacy mode is active.
def is_in_privacy_mode(self) -> bool: return self.data[Attribute.CAMERA_PRIVACY]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_aprentice(self):\n return self.user_profile_status == self.APPRENTICE", "def private(self) -> bool:\n return pulumi.get(self, \"private\")", "def authorized(self) -> bool:\n\n return (\n self.activated\n or self.on_screen\n or self.on_file\n ...
[ "0.6490553", "0.6430658", "0.64281636", "0.638807", "0.63529915", "0.63529915", "0.63529915", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", "0.6319265", ...
0.86465675
0
Camera's wireless signal strength.
def wireless_signal_strength(self) -> int: return self.data[Attribute.WIRELESS_SIGNAL_STRENGTH]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCurrentSignalStrength(self, iwconfig=None):\n try:\n strength = int(self.wifi.GetSignalStrength(iwconfig))\n except:\n strength = 0\n return strength", "def strength(self) -> float:\n ...", "def sensorStrength(self):\n # TODO: also return type of sens...
[ "0.7031714", "0.6994032", "0.67061955", "0.6649575", "0.64029896", "0.63176775", "0.6286045", "0.61830634", "0.61751175", "0.6073168", "0.6055971", "0.6050908", "0.5939323", "0.59383196", "0.59170634", "0.5894795", "0.5874123", "0.5873845", "0.58524925", "0.5838355", "0.58368...
0.8146503
0
Request a new thumbnail for the camera.
async def request_thumbnail(self) -> None: await self.vivintskyapi.request_camera_thumbnail( self.alarm_panel.id, self.alarm_panel.partition_id, self.id )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thumbnail(self, thumbnail):\n self._thumbnail = thumbnail", "def set_thumbnail(self, **kwargs):\n self.thumbnail_url = kwargs.get('url')", "def GetThumbnail(self, type, maxsize): # real signature unknown; restored from __doc__\n pass", "def thumbnail(self, width, height, path, **kwargs):...
[ "0.6508987", "0.6476307", "0.6436708", "0.6407975", "0.6400892", "0.63398254", "0.6334903", "0.62879765", "0.6212906", "0.62107", "0.6181639", "0.60656625", "0.6060553", "0.60002947", "0.5988563", "0.59305435", "0.59282035", "0.5918891", "0.5912826", "0.59014267", "0.58705056...
0.821199
0
Return the latest camera thumbnail URL.
async def get_thumbnail_url(self) -> str: # Sometimes this date field comes back with a "Z" at the end # and sometimes it doesn't, so let's just safely remove it. camera_thumbnail_date = datetime.strptime( self.data[Attribute.CAMERA_THUMBNAIL_DATE].replace("Z", ""), "%Y-%...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_camera_image_url(self) -> str:\n return self.camera_info[\"cover_path\"]", "def get_thumbnail_url(self):\n if not self.id_video or not self.original_url or not self.xml_response:\n return ''\n return self.xml_response.find('framegrab_url').text", "def get_thumbnail_url(...
[ "0.7910915", "0.7836688", "0.7768984", "0.7726674", "0.7721377", "0.7670391", "0.7665452", "0.76559013", "0.76526964", "0.75800186", "0.75523674", "0.74557847", "0.7306187", "0.7166377", "0.70493877", "0.70226187", "0.7014065", "0.6992731", "0.6937823", "0.6921818", "0.691271...
0.8384189
0
Return the rtsp URL for the camera.
async def get_rtsp_url(self, internal: bool = False, hd: bool = False) -> str: credentials = await self.alarm_panel.get_panel_credentials() url = self.data[f"c{'i' if internal else 'e'}u{'' if hd else 's'}"][0] return f"{url[:7]}{credentials[PanelCredentialAttribute.NAME]}:{credentials[PanelCred...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rtsp_stream_url(self) -> str:\n return self.properties.get(MessageField.RTSP_STREAM_URL.value)", "async def get_direct_rtsp_url(self, hd: bool = False) -> str:\n return (\n f\"rtsp://{self.data[Attribute.USERNAME]}:{self.data[Attribute.PASSWORD]}@{self.ip_address}:{self.data[Attribut...
[ "0.79006195", "0.689613", "0.6728681", "0.63702255", "0.6178544", "0.61279833", "0.6083949", "0.6080557", "0.5965044", "0.575143", "0.5714059", "0.56403685", "0.5609133", "0.55965275", "0.5580069", "0.55688417", "0.5547634", "0.55053115", "0.55026656", "0.5496402", "0.5487867...
0.6958374
1
Return the direct rtsp url for this camera, in HD if requested, if any.
async def get_direct_rtsp_url(self, hd: bool = False) -> str: return ( f"rtsp://{self.data[Attribute.USERNAME]}:{self.data[Attribute.PASSWORD]}@{self.ip_address}:{self.data[Attribute.CAMERA_IP_PORT]}/{self.data[Attribute.CAMERA_DIRECT_STREAM_PATH if hd else Attribute.CAMERA_DIRECT_STREAM_PATH_STANDA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rtsp_stream_url(self) -> str:\n return self.properties.get(MessageField.RTSP_STREAM_URL.value)", "async def get_rtsp_url(self, internal: bool = False, hd: bool = False) -> str:\n credentials = await self.alarm_panel.get_panel_credentials()\n url = self.data[f\"c{'i' if internal else 'e'}...
[ "0.72032493", "0.68680316", "0.61045647", "0.60359323", "0.6011566", "0.5905714", "0.5760486", "0.56779563", "0.5652585", "0.56033957", "0.55442023", "0.5505961", "0.5492464", "0.5490018", "0.5473845", "0.5441808", "0.5429904", "0.54259044", "0.54249716", "0.53899205", "0.534...
0.76972985
0
Handle a pubnub message addressed to this camera.
def handle_pubnub_message(self, message: dict) -> None: super().handle_pubnub_message(message) event = None if message.get(Attribute.CAMERA_THUMBNAIL_DATE): event = THUMBNAIL_READY elif message.get(Attribute.DING_DONG): event = DOORBELL_DING elif message...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_message(self, msg):\n self.event('message', msg)", "def handle(self, message):\n print(\"You received a message:\")\n print(message)\n # Overwrite this function to do something with the message!", "def received_message(self, m):\n self.receiver.handle_message(m)",...
[ "0.7261088", "0.6893499", "0.689115", "0.67964315", "0.6787809", "0.6784308", "0.67636156", "0.6758844", "0.67415947", "0.6718704", "0.67065203", "0.66710377", "0.66152173", "0.6600205", "0.65741396", "0.65554744", "0.6550199", "0.6538151", "0.6529823", "0.65268636", "0.65175...
0.7852151
0
Return all .js files in the project root folder The project file is not included.
def get_all_js_files(self, root): res = [] for fname in os.listdir(root): mo = re.match(r'(\w+)\.js$', fname) if mo: res.append({ 'name': mo.group(1), 'src': file_contents(os.path.join(root, mo.group())) }) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_project_source_files():\n source_files = glob.glob(PROJECT_SOURCE_FILES_FOLDER + '/**/*.py', recursive=True)\n # Insert root main.py at the beginning.\n source_files.insert(0, os.path.join(PROJECT_ROOT_FOLDER, 'main.py'))\n return list(map(lambda path: posixpath.join(*path.split('\\\\')), s...
[ "0.7026188", "0.663383", "0.66265917", "0.6534242", "0.6475579", "0.6318005", "0.62322176", "0.62103647", "0.62050897", "0.61848503", "0.618283", "0.6143342", "0.6108959", "0.60054374", "0.59731764", "0.59707844", "0.5969685", "0.5961811", "0.59470624", "0.59345275", "0.59284...
0.7880714
0
if we've got a cropping annotation for the given fieldname and scale, set self._rescale to False, to prevent plone.app.imaging traverser to overwrite our cropped scale since the self.modified() method does not know about the currently requested scale name, we need to use the _rescale property
def _need_rescale(self, fieldname, scale): cropped = IAnnotations(self.context).get(PAI_STORAGE_KEY) if cropped and '%s_%s' % (fieldname, scale) in cropped: self._allow_rescale = False else: self._allow_rescale = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _crop(self, fieldname, scale, box):\n croputils = IImageCroppingUtils(self.context)\n data = croputils.get_image_data(fieldname)\n\n original_file = StringIO(data)\n image = PIL.Image.open(original_file)\n image_format = image.format or self.DEFAULT_FORMAT\n\n cropped_...
[ "0.7229034", "0.6486539", "0.63547015", "0.6094969", "0.5937726", "0.5919167", "0.5832441", "0.5809148", "0.57294387", "0.56831604", "0.5682105", "0.55893314", "0.557489", "0.55414176", "0.55127174", "0.5507968", "0.5507968", "0.5496308", "0.54725057", "0.54692656", "0.546926...
0.87613535
0
we overwrite the default method that would return the modification time of the context, to return a way back modification time in case the currently requested scale is a cropped scale. (so plone.scale does not create a new scale w/o cropping information
def modified(self): if self._allow_rescale: return super(ImageScaling, self).modified() else: return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified(self):\n if self._allow_rescale:\n return super(NamedfileImageScaling, self).modified()\n else:\n return 1", "def get_modified_time(self, name):\n raise NotImplementedError(\n \"subclasses of Storage must provide a get_modified_ti...
[ "0.6460381", "0.56831473", "0.5679432", "0.5437756", "0.53410375", "0.5333899", "0.5274236", "0.5244045", "0.51951635", "0.51917946", "0.516668", "0.51533455", "0.51174325", "0.5113334", "0.509966", "0.5089414", "0.5071341", "0.5068429", "0.5064854", "0.50535154", "0.50339556...
0.6318901
1
we overwrite the default method that would return the modification time of the context, to return a way back modification time in case the currently requested scale is a cropped scale. (so plone.scale does not create a new scale w/o cropping information
def modified(self): if self._allow_rescale: return super(NamedfileImageScaling, self).modified() else: return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified(self):\n if self._allow_rescale:\n return super(ImageScaling, self).modified()\n else:\n return 1", "def get_modified_time(self, name):\n raise NotImplementedError(\n \"subclasses of Storage must provide a get_modified_time() method\"\n )"...
[ "0.63181275", "0.5682004", "0.56780356", "0.5436276", "0.53405464", "0.53323674", "0.52736956", "0.5243496", "0.5193847", "0.5192097", "0.51653427", "0.51530874", "0.51168525", "0.5112648", "0.50986654", "0.5087256", "0.5069669", "0.50668234", "0.5063405", "0.50531495", "0.50...
0.6459762
0
Set the pair and reload data if its new.
def set_pair(self, pair: Pair): if pair != self.pair: self.pair = pair self.load_candles()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pair(self, pair: StudentPair) -> None:\n self._edit_pair = pair\n self.line_edit_title.setText(str(self._edit_pair[\"title\"]))\n self.line_edit_lecturer.setText(str(self._edit_pair[\"lecturer\"]))\n self.combo_box_type.setCurrentText(str(self._edit_pair[\"type\"]))\n sel...
[ "0.6273834", "0.62562305", "0.62263435", "0.6111727", "0.5962303", "0.59485316", "0.59118456", "0.5875051", "0.58309335", "0.58295953", "0.58218694", "0.58065355", "0.5751621", "0.5708703", "0.5699012", "0.56972504", "0.5696664", "0.5620271", "0.55983835", "0.5595588", "0.559...
0.76077706
0
Set the granularity and reload data if its new.
def set_gran(self, gran: Gran): if gran != self.gran: self.gran = gran self.load_candles()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resolution_changed(self):\n self.reinitialiseData()", "def reload(self):\n self._populate(self.hierarchy[-1])", "def refresh(self) -> None:\n self.data = {}\n self.load_settings_file(self.default_settings_path / \"settings.yaml\", file_key=\"internal\")\n self.load_syste...
[ "0.5652916", "0.5497101", "0.54564565", "0.5395625", "0.53053933", "0.5266499", "0.51898026", "0.51679134", "0.5159813", "0.5147838", "0.51331675", "0.5116666", "0.5112451", "0.50447494", "0.5042116", "0.5025085", "0.50143266", "0.50115645", "0.49833155", "0.4946549", "0.4946...
0.61495394
0
Set the quote kind and reload data if its new.
def set_quote_kind(self, quote_kind: QuoteKind): if quote_kind != self.quote_kind: self.quote_kind = quote_kind if self.geo is None: self.load_candles() else: self.geo.update(quote_kind=quote_kind) self.chart.redraw(self.geo)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quotes(self, quotes):\n\n self._quotes = quotes", "def quote_type(self, quote_type):\n allowed_values = [None,\"Price\", \"Spread\", \"Rate\", \"LogNormalVol\", \"NormalVol\", \"ParSpread\", \"IsdaSpread\", \"Upfront\", \"Index\", \"Ratio\", \"Delta\", \"PoolFactor\"] # noqa: E501\n if ...
[ "0.61072516", "0.60456073", "0.5505138", "0.5404351", "0.5160823", "0.51101786", "0.50316006", "0.5006308", "0.49826854", "0.4947969", "0.4940617", "0.49285766", "0.492396", "0.49115217", "0.49072197", "0.49046135", "0.48957124", "0.48728767", "0.48653087", "0.48302495", "0.4...
0.8109521
0
Return a list of completion strings Simple completion based on pythonlike identifiers and whitespace
def get_completions(self, info): items = [] if (info.line.strip().startswith(('import ', 'from ')) and info.is_python_like): items += module_completion(info.line, [info.filename]) elif info.obj: base = info.obj tokens = set(info.split_wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completenames(self, text, line, begidx, endidx):\n command = text\n if self.case_insensitive:\n command = text.lower()\n\n # Call super class method. Need to do it this way for Python 2 and 3 compatibility\n cmd_completion = cmd.Cmd.completenames(self, command)\n\n ...
[ "0.6619886", "0.66005045", "0.6515913", "0.63659024", "0.6294996", "0.6283689", "0.62707794", "0.6202358", "0.6130983", "0.61280894", "0.6114059", "0.6094237", "0.6084692", "0.6065162", "0.6063104", "0.6040103", "0.6009062", "0.5986601", "0.59493244", "0.59490955", "0.5941500...
0.6904953
0
Find the definition for an object within a set of source code This is used to find the path of pythonlike modules (e.g. cython and enaml) for a goto definition
def get_definition(self, info): token = info.obj lines = info.lines source_code = info.source_code filename = info.filename line_nr = None if '.' in token: token = token.split('.')[-1] line_nr = get_definition_with_regex(source_code, token,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findsource(object):\r\n file = getsourcefile(object)\r\n if not file:\r\n raise IOError('source code not available')\r\n module = getmodule(object, file)\r\n if module:\r\n lines = linecache.getlines(file, module.__dict__)\r\n else:\r\n lines = linecache.getlines(file)\r\n ...
[ "0.6904011", "0.6001746", "0.59132284", "0.58806264", "0.5847208", "0.58444947", "0.5813577", "0.5789314", "0.567056", "0.5662456", "0.5642679", "0.56179917", "0.56179917", "0.56179917", "0.56179917", "0.56179917", "0.56179917", "0.56179917", "0.56179917", "0.56179917", "0.56...
0.639387
1
Locate a module path based on an import line in an pythonlike file import_line is the line of source code containing the import alt_path specifies an alternate base path for the module stop_token specifies the desired name to stop on This is used to a find the path to pythonlike modules (e.g. cython and enaml) for a go...
def python_like_mod_finder(import_line, alt_path=None, stop_token=None): if stop_token and '.' in stop_token: stop_token = stop_token.split('.')[-1] tokens = re.split(r'\W', import_line) if tokens[0] in ['from', 'import']: # find the base location tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moduleCompletion(line):\n def tryImport(mod, only_modules=False):\n def isImportable(module, attr):\n if only_modules:\n return inspect.ismodule(getattr(module, attr))\n else:\n return not(attr[:2] == '__' and attr[-2:] == '__')\n try:\n ...
[ "0.64819837", "0.6139575", "0.6079234", "0.5968648", "0.5918364", "0.5828221", "0.55816394", "0.5489672", "0.544243", "0.5438753", "0.5432876", "0.5428505", "0.5426799", "0.542341", "0.53607404", "0.5345444", "0.5345008", "0.53337634", "0.5321171", "0.5308447", "0.5307642", ...
0.811714
0
Find the definition of an object within a source closest to a given line
def get_definition_with_regex(source, token, start_line=-1): if not token: return None if DEBUG_EDITOR: t0 = time.time() patterns = [ # python / cython keyword definitions '^c?import.*\W{0}{1}', 'from.*\W{0}\W.*c?import ', 'from .* c?i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_relevant_line(self):\n # () -> (Phi.Line)\n line_name = self._get_line_name()\n print(\"looking for \"+str(line_name))\n return Phi.findLine(line_name)", "def findsource(object):\r\n file = getsourcefile(object)\r\n if not file:\r\n raise IOError('source code not...
[ "0.6721103", "0.6425865", "0.594324", "0.5941179", "0.59397006", "0.59163904", "0.5842844", "0.58050025", "0.5782345", "0.5758031", "0.5743304", "0.5533894", "0.5482378", "0.54344255", "0.5429776", "0.54285425", "0.5424473", "0.54120266", "0.5374897", "0.5373373", "0.5371944"...
0.66474533
1
Return a list of all pythonlike extensions
def python_like_exts(): exts = [] for lang in sourcecode.PYTHON_LIKE_LANGUAGES: exts.extend(list(sourcecode.ALL_LANGUAGES[lang])) return ['.' + ext for ext in exts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extensions():\n\n pass", "def all_editable_exts():\r\n exts = []\r\n for (language, extensions) in sourcecode.ALL_LANGUAGES.items():\r\n exts.extend(list(extensions))\r\n return ['.' + ext for ext in exts]", "def get_loaded_extensions():\n raise NotImplementedError()", "def get_supp...
[ "0.7843823", "0.77088356", "0.7419539", "0.7320552", "0.714457", "0.70847607", "0.70469284", "0.7008349", "0.6991765", "0.6977103", "0.69406205", "0.69406205", "0.6892772", "0.68143374", "0.6790699", "0.67160887", "0.6696911", "0.6656253", "0.665139", "0.6639324", "0.66269875...
0.86687607
0
Return a list of all editable extensions
def all_editable_exts(): exts = [] for (language, extensions) in sourcecode.ALL_LANGUAGES.items(): exts.extend(list(extensions)) return ['.' + ext for ext in exts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_extensions(self, **_params):\r\n return self.get(self.extensions_path, params=_params)", "def extensions(self):\n return list(self._list(extension.Extension, paginated=False))", "def extensions(self):\n return self.properties.get('extensions',\n E...
[ "0.6947238", "0.6891938", "0.6843709", "0.6733824", "0.66740257", "0.66740257", "0.6525709", "0.63423103", "0.6303439", "0.62761074", "0.6270803", "0.624791", "0.62398034", "0.61868507", "0.6155842", "0.604202", "0.6034626", "0.6003988", "0.5982591", "0.5959434", "0.59400076"...
0.82879215
0
Tests the recipe for AWS>GCP disk copy.
def testRunRecipe(self): warnings.filterwarnings( action="ignore", message="unclosed", category=ResourceWarning) # Load the recipe, set the arguments, and run self.test_state.LoadRecipe(RECIPE, TEST_MODULES) self.test_state.command_line_options = { 'aws_region': self.aws_region, 'gc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testFetchGs(self):\n # pylint: disable=unused-argument\n def _Fetch(_ctx, cmd, capture_output):\n # Touch file we tried to copy too.\n osutils.Touch(cmd[-1])\n\n self.gs_mock.AddCmdResult(\n ['cp', '-v', '--', partial_mock.Ignore(), partial_mock.Ignore()],\n side_effect=_Fetch)...
[ "0.64040744", "0.6082685", "0.57742435", "0.5700392", "0.5675572", "0.56447816", "0.56269157", "0.5600139", "0.55963385", "0.55918896", "0.55627227", "0.5555737", "0.55307716", "0.5498585", "0.54770666", "0.5464479", "0.54632187", "0.5451441", "0.54501855", "0.54433", "0.5442...
0.70389867
0
Deletes an AWS EBS Snapshot with ID `id`.
def _removeAWSSnapshot(self, snap_id: str): log.warning(f'Deleting AWS EBS Snapshot {snap_id}') ec2_client = boto3.client('ec2', region_name=self.aws_region) try: ec2_client.delete_snapshot(SnapshotId=snap_id) except Exception as error: # pylint: disable=broad-except log.error(f'Failed to d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_snapshot(self, snapshot_id):\r\n\r\n self.iscsi_svc.deleteObject(id=snapshot_id)", "def cli(env, snapshot_id):\n block_manager = SoftLayer.BlockStorageManager(env.client)\n deleted = block_manager.delete_snapshot(snapshot_id)\n\n if deleted:\n click.echo('Snapshot %s deleted' % ...
[ "0.78719264", "0.7736575", "0.7644279", "0.75770277", "0.736929", "0.71240944", "0.69008183", "0.68352735", "0.67959744", "0.6736099", "0.6706821", "0.66655517", "0.6488515", "0.63967794", "0.6360391", "0.61587834", "0.6127205", "0.60837644", "0.6061843", "0.60463864", "0.604...
0.78926736
0
Deletes an S3 object at `path`.
def _removeAWSS3Object(self, path: str): log.warning(f'Deleting AWS S3 object {path}') bucket, key = storage_utils.SplitStoragePath(path) s3_client = boto3.client('s3') try: s3_client.delete_object(Bucket=bucket, Key=key) except Exception as error: # pylint: disable=broad-except log.err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_object(self, s3_path):\n logging.info(\"Deleting \\\"{}\\\" file from S3\".format(s3_path))\n bucket_name, key = S3Util.get_bucket_and_key(s3_path)\n self.s3_resource.ObjectSummary(bucket_name, key).delete()", "def delete_object(self, object_path):\n bucket_name, save_path ...
[ "0.8589754", "0.81548566", "0.7849945", "0.7838405", "0.7520646", "0.7260223", "0.7242306", "0.7200459", "0.709181", "0.7063145", "0.7008641", "0.6976428", "0.6947444", "0.6919413", "0.69042146", "0.6903383", "0.69029564", "0.6900946", "0.6897261", "0.68503684", "0.685027", ...
0.85541904
1
Delete a GCS object at `path`.
def _removeGCSObject(self, path: str): log.warning(f'Deleting GCS object {path}') try: storage.GoogleCloudStorage(self.gcp_project_id).DeleteObject(path) except Exception as error: # pylint: disable=broad-except log.error(f'Failed to delete GCS Object {path}: {str(error)}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def rm(path: str):\n _ = path.strip('/').split('/')\n bucket = _[0]\n key = '/'.join(_[1:])\n if path.endswith('/'):\n key += '/'\n async with _create_client() as client:\n try:\n await client.delete_object(Bucket=bucket, Key=key)\n logger.info(f'Delete file...
[ "0.78189796", "0.7468063", "0.7263031", "0.7235776", "0.7158689", "0.7100991", "0.7084128", "0.7063686", "0.7039927", "0.70041424", "0.69738555", "0.6940997", "0.69260657", "0.68535155", "0.6739612", "0.6701492", "0.66956896", "0.6692519", "0.66546154", "0.66297257", "0.65918...
0.8232839
0
Remove GCE Image with name `name`.
def _removeGCEImage(self, name: str): log.warning(f'Deleting GCE Image {name}') try: compute.GoogleComputeImage( self.gcp_project_id, self.gcp_zone, name ).Delete() except Exception as error: # pylint: disable=broad-except log.error(f'Failed to delete GCE Image {name}: {str(erro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_image(Name=None):\n pass", "def del_image(self, name):\r\n if self.images is None or name not in self.images:\r\n return\r\n l = self.images\r\n self.images = None\r\n l.setdefault('/empties/', [])\r\n # push the number on the empties list\r\n l[...
[ "0.77334917", "0.75917494", "0.7531193", "0.722961", "0.7067009", "0.69292396", "0.68562293", "0.6789977", "0.67663544", "0.6758139", "0.6702444", "0.66960543", "0.66144276", "0.6586997", "0.6548269", "0.6530188", "0.64906603", "0.6479747", "0.6467619", "0.6458344", "0.645698...
0.8452742
0
Remove the disk with name `name`.
def _removeGCEDisk(self, name: str): log.warning(f'Deleting GCE Disk {name}') try: gce_disk_client = common.GoogleCloudComputeClient( project_id=self.gcp_project_id).GceApi().disks() gce_disk_client.delete( project=self.gcp_project_id, zone=self.gcp_zone, disk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rm(self, name: str) -> None:\n path = self.get_path(name)\n if os.path.exists(path):\n os.remove(path)", "def vm_diskdelete(args):\n name = args.name\n diskname = args.diskname\n pool = args.pool\n config = Kconfig(client=args.client, debug=args.debug, region=args.region,...
[ "0.75362515", "0.71105665", "0.70604837", "0.69789946", "0.69264275", "0.69136286", "0.6910295", "0.68948543", "0.6887401", "0.684326", "0.67783725", "0.6729041", "0.67081046", "0.66445243", "0.6617731", "0.65383613", "0.6531545", "0.65064126", "0.64904535", "0.6488289", "0.6...
0.76121897
0
Add blogpost to manuscript
def add_blogpost(manuscript, subject, url): line_number = 0 with open(manuscript, "r") as file: lines = file.readlines() for line in lines: if ("## ブロマガ全集" in line): lines.insert(line_number + 2, f"- [{subject}]({url})\n") with open(manuscript, "w") as file: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(blog, date):\n template = front_matter({\n \"title\": blog,\n \"date\": get_date(\"%Y-%m-%d %H:%M:%S %z\"),\n })\n new_blog(date + '-' + blog + '.markdown', template)", "def add_blog(self, text):\n self.blog.add_blog(text)\n self.refre...
[ "0.6208906", "0.6076283", "0.59839743", "0.59753376", "0.5914017", "0.5913528", "0.58720726", "0.58409494", "0.5834559", "0.582747", "0.57706946", "0.57343227", "0.56686044", "0.5657509", "0.56546366", "0.5640166", "0.5577207", "0.557562", "0.557433", "0.556912", "0.55233467"...
0.7508624
0
Evalutes whether the passed dict matches the complex logic of the LogicNode
def eval_logic(self, checkDict): result = True #gets individual evaluations from children passList = [] for child in self.children: myVal = child.eval_comparison(checkDict) passList.append(child.eval_comparison(checkDict)) #if only one child returns the o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_RestrictingNodeTransformer__visit_In_Dict():\n assert restricted_eval('2 in {1: 1, 2: 2, 3: 3}') is True", "def eval_act_logic(self, act_logic_str):\n if self.ignore_act_logic:\n return True\n # return true for empty string\n if len(act_logic_str) == 0:\n re...
[ "0.61918426", "0.6141805", "0.6042099", "0.5969799", "0.5877197", "0.586158", "0.58614135", "0.58304363", "0.581069", "0.5801263", "0.5798829", "0.57972205", "0.57903963", "0.57780564", "0.57741153", "0.57624376", "0.57561654", "0.57198983", "0.5661767", "0.56597126", "0.5608...
0.6642864
0
add the keeper to the player's field
def play(self, game, playerNumber): # needs check for keeper limit? super(Keeper, self).play(game, playerNumber) p = game.players[playerNumber] p.field.add(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_player(self, player):\n\t\tself.players.append(player)", "def add_player(self, players):\n try:\n players[self.ward]\n except:\n players[self.ward] = self", "def add_played_disk(self, x, y, player):\n self.played_disks.append((x, y, player))", "def add_playe...
[ "0.6364632", "0.6120998", "0.601679", "0.5704426", "0.5608644", "0.55661637", "0.5504809", "0.54787284", "0.54737884", "0.54316384", "0.5415775", "0.5406429", "0.5401013", "0.53916353", "0.5390193", "0.53633857", "0.53564775", "0.5346505", "0.5302579", "0.5288975", "0.5288402...
0.7416112
0
Returns `model_fn` closure for TPUEstimator. model_fn_builder actually creates the model function using the passed parameters for num_labels, learning_rate, etc.
def model_fn_builder(num_labels, learning_rate, num_train_steps, num_warmup_steps): def model_fn(features, labels, mode, params): """The `model_fn` for TPUEstimator.""" input_ids = features["input_ids"] input_mask = features["input_mask"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_fn_builder(model_config,\n train_params):\n def model_fn(features, labels, mode, params):\n \"\"\"The `model_fn` for TPUEstimator.\"\"\"\n logging.info(\"*** Features ***\")\n for name in sorted(features.keys()):\n logging.info(\" name = %s, shape = %s\" % (name, featu...
[ "0.7927153", "0.79216784", "0.78488064", "0.7728147", "0.7653819", "0.7596977", "0.7499681", "0.7498984", "0.74952537", "0.74641263", "0.746087", "0.7454586", "0.7400736", "0.73545307", "0.7325875", "0.73120433", "0.72905254", "0.72691625", "0.72314054", "0.71903694", "0.7071...
0.81900585
0
Defines input column according to model (raw text or clean text)
def define_input_output(self): if self.classifier_model.text_preprocessing == ClassifierModel.TEXT_CLEAN: self.clean_range() self.input_col = self.df["clean_text"] elif self.classifier_model.text_preprocessing == ClassifierModel.TEXT_RAW: self.input_col = self.df[se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruct_input_ext(self, model_in):", "def on_columnvalue_modified( self, *data ):\n\t\tif (len(data) == 4):\t( cell, path, model, user_data ) = data\n\t\telse:\t\t\t( cell, path, new_text, model, user_data ) = data\n\t\t(datatype,) = user_data\n\t\tcolid = self.window2.type2colid[datatype]\n\t\tif \t(dat...
[ "0.5679452", "0.56548154", "0.5609584", "0.5550475", "0.5462915", "0.5444646", "0.53719866", "0.52677375", "0.5246684", "0.52359515", "0.52223074", "0.51953554", "0.5169166", "0.5150608", "0.51421463", "0.5139192", "0.5078079", "0.507589", "0.50427675", "0.5032137", "0.499628...
0.6507603
0
Return a saved state value, None if item is undefined.
def __getitem__(self, item): return self._state["data"].get(item, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, item):\n return self._state[\"data\"].get(item, None)", "def __getitem__(self, item):\n return self._state[\"data\"].get(item, None)", "def __getitem__(self, item):\n return self._state[\"data\"].get(item, None)", "def __getattr__(self, item):\r\n return self...
[ "0.63567495", "0.63567495", "0.63567495", "0.6147721", "0.6147721", "0.6143838", "0.61314815", "0.60985714", "0.60985714", "0.60985714", "0.5938411", "0.5815865", "0.5792894", "0.57494944", "0.57324725", "0.57256", "0.5721121", "0.5721121", "0.5684823", "0.5684823", "0.568482...
0.6427416
0
Interleave bits from two sort keys to form a joint sort key. Examples that are similar in both of the provided keys will have similar values for the key defined by this function. Useful for tasks with two text fields like machine translation or natural language inference.
def interleave_keys(a, b): def interleave(args): return ''.join([x for t in zip(*args) for x in t]) return int(''.join(interleave(format(x, '016b') for x in (a, b))), base=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addKey(s1, s2): \r\n return [i ^ j for i, j in zip(s1, s2)]", "def concatKey(str1,str2):\n return concat(concat(str1, '_'), str2)", "def inner_join(sorted1, sorted2, key1, key2):\n p1 = 0\n p2 = 0\n result = []\n\n while (p1 < len(sorted1) and p2 < len(sorted2)):\n # if entries\n ...
[ "0.61941266", "0.61463404", "0.5867205", "0.5854237", "0.57316273", "0.57308954", "0.56912524", "0.56198055", "0.5488593", "0.53060853", "0.53048044", "0.52917767", "0.5274578", "0.5135413", "0.5129714", "0.5127249", "0.5121423", "0.51084983", "0.5099582", "0.50963557", "0.50...
0.7362512
0
verifica se tem o link para voltar para a listagem de animais
def test_animais_list_link(self): PropriedadeUser.objects.create(propriedade=self.propriedade1, user=self.user1, owner=True) login = self.client.login(username='user1', password='12345') response = self.client.get(reve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLink(self):", "def add_link():\n return True", "def requestShowLink(self, *args, **kwargs): # real signature unknown\n pass", "def is_valid_listings(link):\n if link.has_attr(\"href\") and link.attrs[\"href\"].startswith(LISTING_PREFIX):\n return True\n return False", "def rem...
[ "0.5543123", "0.5494667", "0.53836703", "0.5344362", "0.52966595", "0.5271885", "0.52616286", "0.5257237", "0.5244915", "0.5165959", "0.51506627", "0.5111753", "0.50975", "0.5086898", "0.5062339", "0.5051371", "0.50483936", "0.5039112", "0.50307196", "0.49970207", "0.49806777...
0.5964893
0
verifica os textos no html
def test_textos_no_html(self): PropriedadeUser.objects.create(propriedade=self.propriedade1, user=self.user1, owner=True) login = self.client.login(username='user1', password='12345') response = self.client.get(reverse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getText():", "def getText():", "def getText():", "def getText():", "def getText():", "def is_text( self ):\n return self.get_main_type() == 'text'", "def obtain_text():\n pass", "def hasRawText(self, text):\n r = re.compile(r'<(p|blockquote|div|form|table|ul|ol|dl|pre|h\\d)[^>]*?...
[ "0.675838", "0.675838", "0.675838", "0.675838", "0.675838", "0.66166764", "0.6557563", "0.65164775", "0.6472427", "0.64069116", "0.6390485", "0.6258951", "0.6230542", "0.6212179", "0.6210339", "0.6207658", "0.6206313", "0.6205104", "0.62009335", "0.61976314", "0.6178452", "...
0.6883659
0