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
Checks for a given location and direction if the new location is a Passage.
def check_direction(self, board: np.array, location: tuple, direction: Direction) -> bool: new_location = np.array(location) + direction.array if not self.in_bounds(new_location): return False # Note that this is already a boolean (so no need for if statements) return board...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isPassable(self, newLocation, includeRobots=True):\n passable = True\n\n if newLocation[0] < 0 or newLocation[0] > len(self.map):\n passable = False\n elif newLocation[1] < 0 or newLocation[1] > len(self.map):\n passable = False\n elif not self.map[newLocation[...
[ "0.5080698", "0.5074103", "0.49655122", "0.48840016", "0.48770916", "0.485853", "0.4811152", "0.47649765", "0.4757737", "0.47268003", "0.4680223", "0.46624434", "0.4652471", "0.463892", "0.46108526", "0.4597246", "0.45960486", "0.45833278", "0.45755276", "0.45537534", "0.4549...
0.6641834
0
Returns a location to which we can safely move.
def move_to_safe_location(self, obs, location: tuple): # Create a mapping of positions and danger level danger_map = self.create_danger_map(obs) # Check if our current position is safe, if so we can go/stay there. return self.find_reachable_safe_location(obs['board'], danger_map, locat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_toward(state, location):\n return move_relative(state, location, True)", "def _calculate_move_location(self, direction):\n current_row = self._current_loc.get_row()\n current_column = self._current_loc.get_column()\n\n # Calculate the new location for a left move\n if (dir...
[ "0.68402696", "0.6645437", "0.64134586", "0.6402261", "0.6401443", "0.6365496", "0.63403916", "0.6289275", "0.6260041", "0.6241965", "0.6212907", "0.61765695", "0.6175093", "0.6167111", "0.6164323", "0.6143258", "0.61229134", "0.6118263", "0.610832", "0.6099639", "0.60875195"...
0.68152356
1
A function to predict the values on the basis of theta and bias calculated while training. Use two methods of Gradient Descents i.e. SGD and BGD
def predict(self, X): SGD_predicted = [] for i in range(len(X)): hypothesis = 0 hypothesis = self.SGD_bias hypothesis += np.matmul(X[i], np.array(self.SGD_theta_list).T) de = 1.0 + np.exp(-hypothesis) sigmoidhypothesis = 1.0/de ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(theta, X, y, learning_rate):\n m = len(y)\n\n theta = theta.reshape((-1,1))\n grad = np.zeros(theta.shape)\n h = sigmoid(np.dot(X, theta)) \n \n grad = np.dot((h-y).T, X)/m\n grad = grad.T\n grad[1:] += (learning_rate/m)*theta[1:]\n return...
[ "0.6837035", "0.6770644", "0.6731572", "0.67110485", "0.65978616", "0.6540341", "0.65132535", "0.65127486", "0.6446373", "0.6436468", "0.6436399", "0.64101183", "0.6386439", "0.6377556", "0.6373297", "0.6338615", "0.6332807", "0.63193727", "0.6307247", "0.6301047", "0.629691"...
0.6816453
1
Get motif set from predefined motif database.
def get_default_motif_set(database="three_databases"): if database == "three_databases": motif_set = _parse_meme_database( f"{DEFAULT_MOTIF_DIR}/JASPAR2018HOCOMOCOv11Jolma2013.meme", f"{DEFAULT_MOTIF_DIR}/JASPAR2018HOCOMOCOv11Jolma2013.metadata.csv", ) # default thre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, x):\n m = Motif()\n if self.pwm:\n m.pwm = self.pwm[x]\n if self.pfm: \n m.pfm = self.pfm[x]\n if self.seqs:\n m.seqs = [seq[x] for seq in self.seqs]\n if self.consensus:\n m.consensus = self.consensus[x]\n ...
[ "0.54484785", "0.53700095", "0.53541404", "0.5332993", "0.52551323", "0.52422", "0.52266103", "0.5208843", "0.5205663", "0.5146029", "0.51407963", "0.5140519", "0.5140519", "0.5140519", "0.5116847", "0.50997657", "0.49866575", "0.49866575", "0.49732527", "0.49585566", "0.4928...
0.6435459
0
Fix duplicate field names by appending an integer to repeated names.
def fix_duplicate_field_names(self,names): used = [] new_names = [] for name in names: if name not in used: new_names.append(name) else: new_name = "%s_%d"%(name,used.count(name)) new_names.append(new_name) used....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_duplicates(self):\n names: Dict[str, int] = dict()\n for step in self.Sequence:\n if isinstance(step, Repeater):\n continue\n name = step.Name\n if name != '':\n if name not in names:\n names[name] = 1\n ...
[ "0.67453194", "0.6440248", "0.6375717", "0.59917706", "0.58438915", "0.5807908", "0.5782446", "0.56516784", "0.5629432", "0.5595076", "0.55664474", "0.5514417", "0.55063826", "0.5475275", "0.5426433", "0.5420128", "0.53905916", "0.5383994", "0.5356543", "0.5355158", "0.535031...
0.815471
0
Postprune your DecisionTreeClassifier given some optional validation dataset. You can ignore x_val and y_val if you do not need a validation dataset for pruning.
def prune(self, x_val, y_val): # make sure that the classifier has been trained before predicting if not self.is_trained: raise Exception("DecisionTreeClassifier has not yet been trained.") ####################################################################### # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prune(self, x_val, y_val):\n\n # make sure that the classifier has been trained before predicting\n if not self.is_trained:\n raise Exception(\"DecisionTreeClassifier has not yet been trained.\")\n\n # get the maximum depth\n deepest_depth = get_max_depth(self.root)\n\n ...
[ "0.67797667", "0.6212472", "0.5939172", "0.5722555", "0.5690408", "0.5677571", "0.56589794", "0.56499636", "0.54752153", "0.54396915", "0.5306659", "0.52988374", "0.52950144", "0.5282576", "0.5205058", "0.5198362", "0.51826364", "0.51412004", "0.5104261", "0.51032805", "0.508...
0.670663
1
Takes the transform and modifies it such that we compare each line to its transformation. If they are different, that means the line is a special ipython command. We strip that from the output, but record the special command in a comment so we can restore it.
def tweak_transform(orig_transform): def new_push_builder(push_func): def new_push(line): result = push_func(line) if line != result: return "# EPY: ESCAPE {}".format(line) return result return new_push orig_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_code_annotations(line_to_transform):\n line_to_transform = str(line_to_transform)\n line_to_transform = line_to_transform.split(' #', 1)[0]\n line_to_transform = line_to_transform.replace(':', '')\n line_to_transform = line_to_transform.replace('\\t', '')\n line_to_transform = line_to_tra...
[ "0.57870024", "0.57229006", "0.5347111", "0.5332499", "0.5299576", "0.5287035", "0.52425563", "0.51901084", "0.51834416", "0.5165385", "0.51439965", "0.5127348", "0.51111", "0.51033163", "0.50811535", "0.5080613", "0.50641346", "0.50605935", "0.50574213", "0.5019805", "0.4987...
0.5754396
1
fit_polynomial(self,x,t,m,lambda_reg) returns w_ml, design_matrix
def fit_polynomial(self,x,t,m,lambda_reg=0): phi = self.designMatrix(x,m) phi_trans = np.transpose(phi) a = phi_trans.dot(phi) + lambda_reg*np.identity(phi.shape[1]) b = np.linalg.inv(a) c = b.dot(phi_trans) w_ml = c.dot(t) return w_ml, phi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_regression(x, t, basis, reg_lambda=0, degree=0):\n\n # TO DO:: Complete the design_matrix function.\n # e.g. phi = design_matrix(x,basis, degree)\n \n phi=design_matrix(x,basis,degree)\n phi_cross=np.linalg.pinv(phi)\n #t_tranpose=t.T\n # TO DO:: Compute coefficients using phi matri...
[ "0.738815", "0.697625", "0.6394653", "0.6176027", "0.6173952", "0.60188985", "0.5927562", "0.59180886", "0.5911577", "0.5900892", "0.5876136", "0.5827293", "0.5761197", "0.575524", "0.5746262", "0.5731043", "0.5644557", "0.5626945", "0.5575663", "0.5564698", "0.5564148", "0...
0.8932719
0
Makes image passed in darker by halving red, green, blue values.
def darker(image): # Demonstrate looping over all the pixels of an image, # changing each pixel to be half its original intensity. for pixel in image: pixel.red = pixel.red // 2 pixel.green = pixel.green // 2 pixel.blue = pixel.blue // 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def brighten(image_path, factor=1.5):\n BasicTransform.darken(image_path, factor)", "def dark(r, d):\n return d * 1.0 / (r + d) + d * r * 1.0 / ((r + d) ** 2)", "def black_and_white(img):\n\n # Brightness levels range from 0 to 255.\n # Change the colour of each pixel to black or white, dependi...
[ "0.7009777", "0.69753677", "0.6722256", "0.67102313", "0.66983384", "0.6662073", "0.6658688", "0.6574357", "0.65480953", "0.65014017", "0.64791524", "0.6456639", "0.63893676", "0.63877463", "0.6370266", "0.6343691", "0.6314397", "0.62887245", "0.6270608", "0.62383425", "0.623...
0.8426494
0
Calculates the luminosity of a pixel using NTSC formula to weight red, green, and blue values appropriately.
def compute_luminosity(red, green, blue): return (0.299 * red) + (0.587 * green) + (0.114 * blue)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def luminance(self):\n \n return (self.r + self.g + self.b) // 3", "def get_luminosity(self):\n\n h, l, s = colorsys.rgb_to_hls(self.r, self.g, self.b)\n return l", "def sRGBLuminance(x):\n lin=linearFromsRGB3(x)\n return lin[0]*0.2126+lin[1]*0.7152+lin[2]*0.0722", "def luminanc...
[ "0.74587977", "0.73837173", "0.7349204", "0.71710247", "0.7163813", "0.71358424", "0.7112867", "0.7086464", "0.70701617", "0.68698156", "0.6779134", "0.66723603", "0.6648898", "0.6620733", "0.65805507", "0.6461369", "0.6402575", "0.6371502", "0.63506085", "0.63104725", "0.628...
0.8495261
0
Reads image from file specified by filename. Change the image to be grayscale using the NTSC luminosity formula and return it.
def grayscale(filename): image = SimpleImage(filename) for pixel in image: luminosity = compute_luminosity(pixel.red, pixel.green, pixel.blue) pixel.red = luminosity pixel.green = luminosity pixel.blue = luminosity return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_image(filename, representation):\n image = imread(filename)\n image = image.astype(np.float64)\n image /= (COLOR_SIZE-1)\n\n if representation == RGB_NUMBER:\n return image\n image_gray = rgb2gray(image)\n return image_gray", "def read_image(filename, representation):\n image...
[ "0.7593421", "0.7481676", "0.7350865", "0.72359395", "0.72038066", "0.7199556", "0.71684676", "0.7154702", "0.71451586", "0.7139073", "0.7129202", "0.7042127", "0.70342237", "0.70312667", "0.69811714", "0.6969206", "0.69589406", "0.68581265", "0.68440765", "0.6801254", "0.677...
0.7784341
0
Implements the notion of "redscreening". That is, the image in the main_filename has its "sufficiently red" pixels replaced with pixel from the corresponding x,y location in the image in the file back_filename. Returns the resulting "redscreened" image.
def find_flames(main_filename, back_filename): image = SimpleImage(main_filename) back = SimpleImage(main_filename) for pixel in image: average = (pixel.red + pixel.green + pixel.blue) // 3 # See if this pixel is "sufficiently" red if pixel.red >= average * INTENSITY_THRESHOLD:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def red_filter(img):\r\n #with Image.open(filename) as img:\r\n w = img.width\r\n h = img.height\r\n\r\n newimg = Image.new('RGB', (w,h))\r\n for y in range(h):\r\n for x in range(w):\r\n r, g, b = img.getpixel((x,y))\r\n \r\n newimg.putpixel((x, y), (r, 0, 0)...
[ "0.5427992", "0.53621465", "0.5279287", "0.52323866", "0.523031", "0.51725817", "0.51725817", "0.51725817", "0.5140284", "0.51325184", "0.5129068", "0.5095678", "0.50948733", "0.5090392", "0.5063293", "0.5041981", "0.50126094", "0.49978104", "0.4983544", "0.49638897", "0.4960...
0.66778153
0
Get the episode with the provided id
def get_episode(self, object_id): return self.get_object("episode", object_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_episode(self, ep_id):\n sub_id = self._get_sub_id_for_ep(ep_id)\n html = self._get_html_for_subject_eps(sub_id)\n return BangumiEpisode.from_html(ep_id, html)", "def episode(request, ep_id):\n new_episode = get_object_or_404(Episode, id=ep_id)\n crisis_updates = new_episode.get...
[ "0.7616944", "0.6823168", "0.6769487", "0.6677436", "0.653121", "0.6446594", "0.6443719", "0.63802534", "0.6366759", "0.63300574", "0.62921387", "0.6288312", "0.6236712", "0.6220643", "0.6176177", "0.6173768", "0.61699325", "0.6149242", "0.6130359", "0.6118653", "0.61078084",...
0.8348588
0
Get the playlist with the provided id
def get_playlist(self, object_id): return self.get_object("playlist", object_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_playlist_by_id(cls, id):\n try:\n return cls._playlists_by_id[id]\n except KeyError:\n return None", "def from_id(id):\n response = settings.database.get_item(Key={'id': id})\n raise_for_response(response)\n if not \"Item\" in response.keys():\n ...
[ "0.87621826", "0.8102629", "0.7769187", "0.76710147", "0.7378535", "0.70554125", "0.70487064", "0.70224446", "0.7019646", "0.6998071", "0.6995391", "0.6962732", "0.69288164", "0.6883034", "0.6856321", "0.68518907", "0.683349", "0.68297327", "0.6815455", "0.6811708", "0.680870...
0.842591
1
Get the podcast with the provided id
def get_podcast(self, object_id): return self.get_object("podcast", object_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_podcast(_id):\r\n return [Podcast.podcast_json(Podcast.query.filter_by(id=_id).first())]\r\n # Podcast.podcast_json() coverts our output to the json format defined earlier\r\n # the filter_by method filters the query by the id\r\n # since our id is unique we will only get one re...
[ "0.7452995", "0.6581852", "0.6306836", "0.6286226", "0.6072798", "0.5965769", "0.5944957", "0.5912328", "0.5883828", "0.58431435", "0.5803886", "0.5803825", "0.5777084", "0.57747805", "0.5746887", "0.56918514", "0.5660251", "0.5643321", "0.563209", "0.56292826", "0.5618074", ...
0.7796137
0
Get the radio with the provided id.
def get_radio(self, object_id=None): return self.get_object("radio", object_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_radio(name: str) -> Radio:\n for radio in RADIOS:\n if radio.name == name:\n return radio\n raise KeyError", "def get_radios(self):\n return self.get_object(\"radio\")", "def find_by_id(self, id_):\n return self.by_id.get(id_)", "def from_id(self, id_):\n ...
[ "0.69556546", "0.5978823", "0.5748372", "0.57119036", "0.56869835", "0.566257", "0.56379473", "0.5623837", "0.5607163", "0.5503359", "0.54589427", "0.54589427", "0.54420716", "0.54328054", "0.5425849", "0.53907144", "0.5380342", "0.53719866", "0.5363625", "0.5355202", "0.5337...
0.8003017
0
Get a list of radios.
def get_radios(self): return self.get_object("radio")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_radio(self):\n #Get the index on radio in the table, to keep a list of name\n index_radio = self.fields.index(self._radio_colname)\n\n #Retrieve in the indexed column radio names\n for row in self.table[1:]:\n radio_name = row[index_radio]\n #Remove ra...
[ "0.71114707", "0.6784095", "0.6644644", "0.6352699", "0.61304504", "0.60955876", "0.5945896", "0.5938714", "0.57973224", "0.57337034", "0.57027763", "0.56212956", "0.5599691", "0.5546482", "0.54818195", "0.54537714", "0.5351347", "0.5333433", "0.52955335", "0.5248767", "0.522...
0.84104383
0
Get the top radios (5 radios).
def get_radios_top(self): return self.get_object("radio", relation="top")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_radios(self):\n return self.get_object(\"radio\")", "def top(self):\r\n return self.topele", "def get_widgets_array(self, g_parent, r_parent, gamut_list=gamut_list):\n widget_list = {\"gamut_button\": [], \"radio_button\": [], \"primary\": []}\n widget_list[\"gamut_button\"]...
[ "0.6282855", "0.5377629", "0.53662175", "0.5362392", "0.52673805", "0.5217393", "0.51464427", "0.51435196", "0.50028193", "0.49742544", "0.49416357", "0.4881351", "0.4881351", "0.48519942", "0.48407713", "0.48281154", "0.48156843", "0.48067117", "0.47948283", "0.4774771", "0....
0.84127396
0
parses a sabdb format status line. Support v1 and v2.
def parse_statusline(line): if line.startswith("="): line = line[1:] if not line.startswith("sabdb:"): raise OperationalError("wrong result received") code, prot_version, rest = line.split(":", 2) if prot_version not in ["1", "2"]: raise InterfaceError("unsupported sabdb protoc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_status_line(line):\n # Up to the first space is the protocol version.\n index0 = line.index(SPACE)\n http_version = line[: index0]\n # Make sure it's the protocol version we recognize.\n assert http_version == HTTP_VERSION\n # Starting from the first space, up to the next space is the ...
[ "0.7230448", "0.6078743", "0.6008353", "0.59836125", "0.59530354", "0.57845265", "0.57617307", "0.5716899", "0.56662333", "0.56501174", "0.555316", "0.5539407", "0.55288374", "0.5521709", "0.55102456", "0.55006564", "0.54837614", "0.54548305", "0.5392202", "0.538681", "0.5379...
0.7980249
0
raises an exception if the result is not empty
def isempty(result): if result != "": raise OperationalError(result) else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_results_empty():\n assert [] == parse_results({})", "def pcp_result_is_empty(self):\n\t\treturn len(self.results) == 0", "def testEmpty(self):\n data = fetchers.fetch('http://unittest/200.txt').read()\n self.assertRaises(\n xrds.XRDSError,\n xrds.get_elemen...
[ "0.65747255", "0.65264606", "0.6433956", "0.6298372", "0.6294657", "0.6204573", "0.6204573", "0.6111557", "0.61079293", "0.6105248", "0.6088604", "0.60673475", "0.59785974", "0.59734946", "0.59049535", "0.5854445", "0.58434033", "0.58416456", "0.58383894", "0.58155394", "0.58...
0.71893454
0
Starts the given database, if the MonetDB Database Server is running.
def start(self, database_name): return isempty(self._send_command(database_name, "start"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_database():\r\n con = sqlite.connect(core.config.DBFILE)\r\n \r\n if con:\r\n cur = con.cursor()\r\n\r\n # Execute the SELECT statement:\r\n cur.execute(\"select * from monrito_systems\")\r\n\r\n # Retrieve all rows as a sequence and print that sequence:\r\n log.d...
[ "0.6643701", "0.6603755", "0.61932796", "0.61612797", "0.61077976", "0.60270625", "0.59510607", "0.59425277", "0.5940684", "0.59308577", "0.59053016", "0.59032226", "0.5882804", "0.5842914", "0.5804809", "0.5786571", "0.57759666", "0.5774746", "0.5762028", "0.57545155", "0.57...
0.7263805
0
Stops the given database, if the MonetDB Database Server is running.
def stop(self, database_name): return isempty(self._send_command(database_name, "stop"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_mysql(self):\r\n return execute(self._stop_mysql)", "def test_999_stop(self):\n HEADING()\n self.db.stop()\n result = True\n assert result", "def close_database(db):\n global DB_CONNECTIONS\n con = DB_CONNECTIONS.get(db, None)\n if con is not None:\n ...
[ "0.6292627", "0.6269914", "0.61567426", "0.6102034", "0.60873514", "0.6037964", "0.603006", "0.60020083", "0.59715295", "0.59715295", "0.5951946", "0.5898135", "0.58935505", "0.5879832", "0.5875505", "0.58601457", "0.5833953", "0.5812572", "0.58010906", "0.57873577", "0.57863...
0.7592816
0
Kills the given database, if the MonetDB Database Server
def kill(self, database_name): return isempty(self._send_command(database_name, "kill"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self, database_name):\n return isempty(self._send_command(database_name, \"stop\"))", "def drop_database():\n drop_db(app)", "def destroy_test_db(self, old_database_name, verbosity=1):\n self.connection.close()\n test_database_name = self.connection.settings_dict['NAME'...
[ "0.70621175", "0.668488", "0.66601753", "0.6639436", "0.6625639", "0.6622231", "0.65847725", "0.6581438", "0.6519131", "0.6501935", "0.6501935", "0.648851", "0.64559126", "0.6453718", "0.6452397", "0.6417063", "0.64053965", "0.6404914", "0.63921344", "0.63916725", "0.638752",...
0.75097257
0
sets property to value for the given database for a list of properties, use `pymonetdb get all`
def set(self, database_name, property_, value): return isempty(self._send_command(database_name, "%s=%s" % (property_, value)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, property_dict):\r\n self.metadata = self.db.update(self.path, property_dict).json()", "def readProperties(db, queue):\n \n sql = \"\"\"\n select lh.propertyName, rh.propertyValue from \n (\n select propertyName \n from properties \n group by propertyName...
[ "0.61808574", "0.59632134", "0.5908364", "0.5874879", "0.56116724", "0.5587571", "0.54143554", "0.54143554", "0.54143554", "0.54143554", "0.54143554", "0.53938246", "0.5385813", "0.5377703", "0.5362984", "0.53364676", "0.53163886", "0.52788365", "0.5256911", "0.5189823", "0.5...
0.70697963
0
Add engine to the excel writer registry.io.excel. You must use this method to integrate with ``to_excel``.
def register_writer(klass: ExcelWriter_t) -> None: if not callable(klass): raise ValueError("Can only register callables as engines") engine_name = klass._engine _writers[engine_name] = klass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_engine(self, engine):\n self.engines.append(engine)", "def to_excel(\n self,\n excel_writer: Union[str, pd.ExcelWriter],\n sheet_name: str = \"Sheet1\",\n na_rep: str = \"\",\n float_format: Optional[str] = None,\n columns: Optional[Union[str, List[str]]] ...
[ "0.59891015", "0.5654491", "0.56344676", "0.5526736", "0.5484377", "0.54817307", "0.5341425", "0.52914476", "0.5237405", "0.5225116", "0.5198229", "0.5164766", "0.5133117", "0.512281", "0.5120415", "0.5101528", "0.509269", "0.5089717", "0.50290436", "0.50269765", "0.5017671",...
0.6770388
0
Return the default reader/writer for the given extension.
def get_default_engine(ext: str, mode: Literal["reader", "writer"] = "reader") -> str: _default_readers = { "xlsx": "openpyxl", "xlsm": "openpyxl", "xlsb": "pyxlsb", "xls": "xlrd", "ods": "odf", } _default_writers = { "xlsx": "openpyxl", "xlsm": "openp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getReaderByExtension(self, ext, isRGB = 0):\n\t\tassert ext in self.extMapping, \"Extension not recognized: %s\" % ext\n\t\tmpr = self.extMapping[ext]\n\t\tprefix=\"vtk\"\n\t\t# If it's a tiff file, we use our own, extended TIFF reader\n\t\tif self.extMapping[ext] == \"TIFF\":\n\t\t\tmpr = \"ExtTIFF\"\n\t\t\tp...
[ "0.6333161", "0.5815955", "0.5575813", "0.5566973", "0.55284584", "0.55028903", "0.543945", "0.53887784", "0.5236415", "0.52271795", "0.5170472", "0.5116645", "0.5062605", "0.49983218", "0.49872482", "0.49841344", "0.4973922", "0.4969136", "0.49688828", "0.49029467", "0.48629...
0.6867949
0
Convert Excel column name like 'AB' to 0based column index.
def _excel2num(x: str) -> int: index = 0 for c in x.upper().strip(): cp = ord(c) if cp < ord("A") or cp > ord("Z"): raise ValueError(f"Invalid column name: {x}") index = index * 26 + cp - ord("A") + 1 return index - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_index_column(sheet, name, num):\n for idx in range(1, 26):\n if sheet[chr(idx + 64) + str(num)].value == name:\n index_col = chr(64 + idx)\n break\n return index_col", "def getColIdx(self, col):\n try: \n return int(col)\n except:\n ...
[ "0.7084728", "0.69859797", "0.6955808", "0.67711234", "0.6594881", "0.6540869", "0.653381", "0.65131027", "0.6482695", "0.6444519", "0.64184684", "0.6237477", "0.62241507", "0.62241507", "0.61984044", "0.6164168", "0.61435837", "0.6086738", "0.601789", "0.6016106", "0.6012974...
0.72755045
0
Convert `usecols` into a compatible format for parsing in `parsers.py`.
def maybe_convert_usecols( usecols: str | list[int] | list[str] | usecols_func | None, ) -> None | list[int] | list[str] | usecols_func: if usecols is None: return usecols if is_integer(usecols): raise ValueError( "Passing an integer for `usecols` is no longer supported. " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _modify_fields(usecols, dtype, badcols):\n for col in badcols:\n usecols = [badcols[col] if uc == col else uc for uc in usecols]\n try:\n dtype[badcols[col]] = dtype.pop(col)\n except KeyError:\n pass\n return usecols, dtype", "def parse_column_names(x_col_set...
[ "0.6249875", "0.6168102", "0.55963105", "0.5527389", "0.55064756", "0.5478284", "0.54078054", "0.5349134", "0.5195047", "0.5185341", "0.51440215", "0.50679815", "0.50426334", "0.50408536", "0.50077903", "0.4992427", "0.49845153", "0.49737564", "0.49694565", "0.49660233", "0.4...
0.68914336
0
Used to combine two sources of kwargs for the backend engine. Use of kwargs is deprecated, this function is solely for use in 1.3 and should be removed in 1.4/2.0. Also _base.ExcelWriter.__new__ ensures either engine_kwargs or kwargs must be None or empty respectively.
def combine_kwargs(engine_kwargs: dict[str, Any] | None, kwargs: dict) -> dict: if engine_kwargs is None: result = {} else: result = engine_kwargs.copy() result.update(kwargs) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_comm_kwargs(cls, *args, **kwargs):\n kwargs.setdefault('address', 'file.txt')\n return args, kwargs", "def _copy_kwargs(self, **kwargs):\n ns = self.__dict__\n for attr, kw in {'_engine': 'engine', '_format': 'format'}.items():\n assert kw not in kwargs\n ...
[ "0.5834273", "0.560226", "0.5542749", "0.53700733", "0.53244066", "0.5253519", "0.5241866", "0.5212112", "0.5209551", "0.5204854", "0.513808", "0.50734216", "0.5045135", "0.49953344", "0.49791324", "0.49790573", "0.4960159", "0.4952094", "0.49382854", "0.49001685", "0.4892000...
0.69650036
0
Returns a serialized list of accounts that the authenticated user has access to
def get(self): held_accounts = User.get_held_accounts( get_jwt_identity(), initialize_models=True) schema = AccountsListSchema(many=True) response = schema.dumps(held_accounts) return jsonify_response(json.loads(response.data), 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetAccountList(self):\n\t\treturn self.accounts.keys()", "def accounts(self):\n return self._accounts.values()", "def get_accounts(self):\r\n return self._accounts", "def get_accounts(self):\n return self.accounts", "def list_accounts(self):\n pass", "def get_accounts(self...
[ "0.74788964", "0.7285095", "0.7244795", "0.71850544", "0.71738577", "0.7160395", "0.71394664", "0.71022916", "0.6965334", "0.6840734", "0.6836083", "0.6786751", "0.6741984", "0.6732717", "0.6726503", "0.66663885", "0.6602529", "0.6556924", "0.6552381", "0.6477823", "0.6474597...
0.752067
0
POST endpoint used for creating new secondary Accounts linked to the currently authenticated user
def post(self): data = json.loads(request.data) user_id = get_jwt_identity() if 'title' not in data: return jsonify_response({"errors": "`title` field is required."}, 400) held_accounts = User.get_held_accounts(user_id) if held_accounts: user_accounts = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_account():\n if not request.json or not 'name' in request.json:\n abort(400)\n account = {\n 'id': accounts[-1]['id'] + 1, #last id + 1\n 'name': request.json['name'],\n 'surname': request.json['surname'],\n 'product': request.json.get('product', \"\"),\n ...
[ "0.6474772", "0.6133695", "0.6094583", "0.6071473", "0.59806687", "0.5967156", "0.5911281", "0.5822743", "0.5771977", "0.57137805", "0.57088554", "0.5676616", "0.5675375", "0.56728286", "0.5656858", "0.5656858", "0.5656858", "0.5656858", "0.5656858", "0.5656858", "0.5634938",...
0.62643695
1
Get the devices connected over adb.
def get_devices(adb=DEFAULT_ADB): # Check that adb is running Device.__start_adb(adb) # Split by newline and remove first line ("List of devices attached") # TODO: surround with try/except? devices = subprocess.check_output( [adb, "devices", "-l"]).decode().split('\n'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def androidDetectDevices():\n\tdevices = []\n\ttry:\n\t\tif (sys.platform == 'win32'):\n\t\t\tadb_output = check_output([\"adb\",\"devices\"])\n\t\t\tif len(adb_output) > 28:\n\t\t\t\tdevices = adb_output\n\t\telse:\n\t\t\tadb_output = subprocess.Popen([\"adb\",\"devices\"], stdout=subprocess.PIPE)\n\t\t\tgrep_out...
[ "0.76458573", "0.74749607", "0.74682266", "0.7464692", "0.7391381", "0.7379479", "0.7253853", "0.7210878", "0.7200504", "0.7152469", "0.7131481", "0.710864", "0.70594245", "0.702898", "0.6985802", "0.6985802", "0.6985802", "0.6985802", "0.69590795", "0.6940833", "0.69012237",...
0.7855478
0
Start adb if not started already
def __start_adb(adb): try: with open(os.devnull, "w") as dnl: subprocess.check_call(["pgrep", "adb"], stdout=dnl) except subprocess.CalledProcessError: # adb is not running try: # Try to start adb by calling "adb devices" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_start(self, str_arg):\n try:\n # self.adbc.startActivity(validateString(str_arg))\n # the above approach failed in unittest complaining device is offline, weird...\n return self.runAdbCmd('shell am start -n', validateString(str_arg))\n except RuntimeError:\n ...
[ "0.6743008", "0.66804284", "0.6434739", "0.6014262", "0.5888835", "0.5873413", "0.58408713", "0.5826529", "0.5793065", "0.5699411", "0.569473", "0.5668218", "0.5588021", "0.5585462", "0.5524604", "0.55213976", "0.5491612", "0.5482707", "0.5473484", "0.5451377", "0.5446446", ...
0.8380653
0
Copy the SELinux policy from the device to the target path. If no policy is specified, the default location is assumed.
def pull_policy(self, target, policy=DEFAULT_POLICY_FILE): self.pull_file(policy, target)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_policy(self):\n self._sess.run(self._hard_copy_to_target_op);", "def set_target_policy(self, policy):\n self.target_policy = policy", "def set_device_specific_load_balancing_policy(cls, device, load_balance_policy):\n assert device.InstanceName == load_balance_policy.InstanceNam...
[ "0.5945905", "0.59017", "0.54149956", "0.53863084", "0.53306067", "0.52236307", "0.50935125", "0.5024128", "0.49137443", "0.49071157", "0.49030507", "0.4855136", "0.4832843", "0.4797895", "0.47578222", "0.46905804", "0.4685196", "0.4650781", "0.4638576", "0.4634165", "0.46094...
0.606319
0
Return the appropriate "adb shell" command for the current device, taking into account the type of root available. Returns the command as a list.
def __get_adb_shell(self): shell = self.command + ["shell"] if self.root_adb == "root_adb": # Root adb-specific things pass elif self.root_adb == "root_shell": # Root shell-specific things shell.extend(["su", "-c"]) elif self.root_adb == "n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shell(cmd):\n return G.DEVICE.shell(cmd)", "def _do_adb_command(self, cmd, timeout=60):\n if not self.is_adb_available():\n return None\n\n # TODO: for android sdk emulator its using -e\n res = utils.do_shell_command(\n 'adb -s ' + self._device_serial + ' ' + cmd...
[ "0.6235044", "0.61736286", "0.6059379", "0.6035822", "0.5818458", "0.5799972", "0.57551557", "0.56131047", "0.5593294", "0.5531428", "0.5499363", "0.54493606", "0.54313564", "0.54310894", "0.5420309", "0.5401369", "0.53939396", "0.5360615", "0.5334273", "0.5301527", "0.526109...
0.81246424
0
The device Android version.
def android_version(self): if not self._android_version: # Get the Android version from the connected device cmd = ["getprop", "ro.build.version.release"] # TODO: surround with try/except? tmp = subprocess.check_output(self.shell + cmd).decode() self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self):\r\n return self._arm.get_version()", "def hardware_version(self) -> str:\n return self.camera_info[\"main_hw_version\"]", "def get_sdk_version(self):\n return int(self.get_property(ADB.VERSION_SDK_PROPERTY))", "def library_version():\n\n return appium_version.ve...
[ "0.728132", "0.7243305", "0.7096307", "0.7047162", "0.68846136", "0.68696684", "0.68512815", "0.68475586", "0.67665094", "0.6745548", "0.66814363", "0.665434", "0.66414535", "0.6626868", "0.66016096", "0.66016096", "0.6588704", "0.6516657", "0.65029305", "0.65025693", "0.6498...
0.8584862
0
The device SELinux mode (enforcing/permissive).
def selinux_mode(self): if not self._selinux_mode: # Get the SELinux mode from the connected device cmd = ["getenforce"] # TODO: surround with try/except? tmp = subprocess.check_output(self.shell + cmd).decode() self._selinux_mode = tmp.strip('\r\n').l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dev_mode(self):\r\n return self._dev_mode", "def se_linux(self) -> pulumi.Input['SELinuxStrategyOptionsArgs']:\n return pulumi.get(self, \"se_linux\")", "def get_socket_mode(self):\n\t\treturn call_sdk_function('PrlVmDevSerial_GetSocketMode', self.handle)", "def least_privilege_mode(self) -...
[ "0.70420724", "0.6369142", "0.6290629", "0.619331", "0.61909664", "0.609476", "0.60655224", "0.6046718", "0.5990297", "0.598248", "0.59677386", "0.5955588", "0.59555507", "0.5947772", "0.5920994", "0.5912432", "0.5868891", "0.5868891", "0.5868891", "0.5862763", "0.5861038", ...
0.8580302
0
Get the processes running on the device. Returns a dictionary (PID, Process).
def get_processes(self): processes = {} # Get ps output cmd = ["ps", "-Z"] # Split by newlines and remove first line ("LABEL USER PID PPID NAME") # TODO: surround with try/except? psz = subprocess.check_output(self.shell + cmd).decode().split('\n')[1:] for line in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_processes():\n cmd = 'ps -do pid:1,cmd' # linux command to run\n processes = {}\n\n with os.popen(cmd) as out:\n # see https://stackoverflow.com/questions/24362007/\n next(out.__iter__()) # skip header (first line)\n\n for line in out:\n # sepate pid and command i...
[ "0.8004653", "0.7839317", "0.75989866", "0.7547082", "0.7535625", "0.7497459", "0.7468857", "0.7359157", "0.7351565", "0.7316834", "0.7289452", "0.7062453", "0.7050207", "0.70008564", "0.6997936", "0.69961923", "0.6963558", "0.6958415", "0.6870904", "0.6743763", "0.6737957", ...
0.8318945
0
Get the files under the given path from a connected device. The path must be a directory. Returns a dictionary (filename, File).
def get_files(self, path="/"): files_dict = {} listing = [] path = os.path.normpath(path) cmd = ["ls", "-lRZ", "'" + path + "'"] # Get the File object for the top-level path # We could not get it otherwise files_dict.update(self.get_dir(path)) # If the de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_disk_info_path(path, save_md5sum=False):\n # if relative path, is treated relative to current directory\n\n if not os.path.exists(path):\n miscutils.fwdie(f\"Error: path does not exist ({path})\", 1)\n\n fileinfo = {}\n for (dirpath, _, filenames) in os.walk(path):\n for nam...
[ "0.657699", "0.6575564", "0.6547739", "0.6497786", "0.63563293", "0.62391114", "0.6101264", "0.6071561", "0.6064226", "0.6062935", "0.60460645", "0.604136", "0.59920377", "0.5989238", "0.59816", "0.5971359", "0.5966292", "0.59577966", "0.59536934", "0.59431815", "0.5933054", ...
0.7227736
0
Get the file matching the given path from a connected device. The path must be a file. Returns a dictionary (filename, File).
def get_file(self, path): path = os.path.normpath(path) cmd = ["ls", "-lZ", "'" + path + "'"] listing = subprocess.check_output(self.shell + cmd).decode().split('\n') line = listing[0].strip("\r") # Parse ls -lZ output for a single file try: f = File(line, os....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(self, path):\n return self._files.get(self._get_rel_path(path))", "def get_file(self, path):\n file = self.get('data_request?id=file&parameters=%s' % path)\n return file", "def get_file(self, path):\n b_file = self.get_b_file(path)\n if b_file:\n retur...
[ "0.6369668", "0.61869144", "0.60368913", "0.599473", "0.5962401", "0.5901324", "0.5898488", "0.5891237", "0.58418566", "0.56610084", "0.56437206", "0.56301874", "0.5623729", "0.55914", "0.55477846", "0.5511129", "0.55101854", "0.5483991", "0.5415795", "0.5415501", "0.54065967...
0.6961599
0
Initialize a File. l the line in the Android ls l(R)Z output d the directory in which the file is a_v the Android version string ("5.1.1", "6.0", "N", ...)
def __init__(self, l, d, a_v): # TODO: change the parsing to matching groups in the regexes and # extract parameters that way. # If this is an old-style file line (Android<=6.0) if a_v == "6.0" or (a_v[0].isdigit() and (int(a_v)) < 6): if not File.correct_line_6_0.match(l): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(self, path):\n path = os.path.normpath(path)\n cmd = [\"ls\", \"-lZ\", \"'\" + path + \"'\"]\n listing = subprocess.check_output(self.shell + cmd).decode().split('\\n')\n line = listing[0].strip(\"\\r\")\n # Parse ls -lZ output for a single file\n try:\n ...
[ "0.5654418", "0.52828264", "0.5250237", "0.5247701", "0.51692057", "0.5160202", "0.51539874", "0.51470786", "0.51423764", "0.5121386", "0.5119664", "0.5097081", "0.50709414", "0.50059736", "0.50055873", "0.49973413", "0.49820516", "0.49799067", "0.49771357", "0.49084148", "0....
0.71153945
0
Returns True if the file is a symlink, False otherwise
def is_symlink(self): return self._security_class == "lnk_file"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsSymlink(info):\n return (info.external_attr >> 16) == 0120777", "def _islink(path):\n if not os.path.isdir(path):\n return False\n\n if not isinstance(path, str):\n path = str(path)\n\n attributes = ctypes.windll.kernel32.GetFileAttributesW(path)\n if attributes == INVALID_FILE_A...
[ "0.8398552", "0.8225478", "0.80641615", "0.7954287", "0.78056484", "0.76460546", "0.7620406", "0.74970317", "0.74199927", "0.7399527", "0.72621393", "0.72538763", "0.7163031", "0.7083957", "0.7082458", "0.70796263", "0.7066253", "0.70538175", "0.6907686", "0.6905778", "0.6885...
0.8802012
0
Initialize a Process. line the line in the Android ps Z output a_v the Android version string ("5.1.1", "6.0", "N", ...)
def __init__(self, line, a_v): # If this is an old-style process line (Android<=6.0) if a_v == "6.0" or (a_v[0].isdigit() and (int(a_v[0])) < 6): if not Process.correct_line_6_0.match(line): raise ValueError('Bad process "{}"'.format(line)) p = line.split(None, 4)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getProcInfo(self, line):\n try:\n pid, rss, cpu, cmdAndArgs = line.split(None, 3)\n except ValueError:\n # Defunct processes look like this (no RSS data)\n # '28835916 00:00:00 <defunct>'\n pid, cpu, cmdAndArgs = line.split(None, 2)\n rss = \...
[ "0.54866856", "0.5358717", "0.5309955", "0.52140915", "0.5203966", "0.5198469", "0.51351666", "0.51294935", "0.5126981", "0.51127523", "0.50987864", "0.50874466", "0.5074295", "0.50167596", "0.49912265", "0.4975899", "0.49751362", "0.49713403", "0.4950691", "0.49420476", "0.4...
0.7552005
0
Get the process VSIZE
def vsize(self): if hasattr(self, "_vsize"): return self._vsize else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vm_size(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"vm_size\")", "def vm_size(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"vm_size\")", "def vm_size(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"vm_size\")", "def vm_size(self) -> ...
[ "0.7574942", "0.74362856", "0.7274893", "0.7274893", "0.7274893", "0.70539993", "0.68099606", "0.6705538", "0.66550165", "0.6484928", "0.642412", "0.6417719", "0.640502", "0.6403984", "0.6394093", "0.6373671", "0.6368347", "0.63539094", "0.63499284", "0.63433284", "0.6338247"...
0.74421084
1
Get the process RSS
def rss(self): if hasattr(self, "_rss"): return self._rss else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rss(self):\n out = subprocess.check_output(\n [\"ps\", \"-p\", \"%s\" % os.getpid(), \"-o\", \"rss\"])\n try:\n return int(out.splitlines()[-1].strip())\n except ValueError:\n return 0", "def run_rss(self):\n\n pass", "def request_rss(self, u...
[ "0.7574265", "0.71922404", "0.709611", "0.7027692", "0.695936", "0.6955429", "0.67134213", "0.6578471", "0.65564704", "0.6324223", "0.6295807", "0.62946737", "0.628673", "0.6241116", "0.61526155", "0.61503184", "0.60409164", "0.60295516", "0.6014977", "0.5986912", "0.59797096...
0.7500867
1
Get the process WCHAN
def wchan(self): if hasattr(self, "_wchan"): return self._wchan else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def REC_CHANCE():\n return 13", "def getChannel(self):\r\n return self.channel", "def wifi_channel(self):\n return self._wifi_channel", "def channel(self):\n return self._channel", "def channel(self):\n return self._channel", "def get_channels(self):\n return self.ch...
[ "0.6208549", "0.6087024", "0.6005837", "0.56930876", "0.56930876", "0.56640106", "0.56342334", "0.5634114", "0.5634114", "0.55119085", "0.5488193", "0.54823303", "0.54823303", "0.5474838", "0.54535514", "0.5447885", "0.5404778", "0.5403729", "0.5390345", "0.53384316", "0.5328...
0.70832384
0
Get the process PC
def pc(self): if hasattr(self, "_pc"): return self._pc else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pcname(): \n pc_name = '' \n try: \n pc_name = socket.gethostname() \n except Exception, e:\n initlog('failed to get PC name; %s' % str(e)) \n return pc_name", "def where_is_pc(self):\n program_counter = self.chipdata.get_reg_strict('REGFILE_PC')\n ...
[ "0.74275273", "0.700662", "0.69931036", "0.69579613", "0.671746", "0.65519476", "0.65519476", "0.6537028", "0.6488365", "0.64635414", "0.6393413", "0.6393413", "0.63648415", "0.63372844", "0.63372844", "0.63086027", "0.629303", "0.62841886", "0.62820274", "0.6268508", "0.6260...
0.7679139
0
Move a node from it's current position to end of queue (e.g. after a cache hit)
def move_to_end(self, node): # No need to move if node already at queue end if node is self.tail: return # If the node is at the head of the queue if node is self.head: self.head.next.prev = None self.tail.next = self.head self.head.prev ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dequeue(self): ##################### <-\n top = self.top\n def dQsub(top):\n if not top.next: return\n else:\n if top.next.next:\n topDQ = Node(top.value)\n topDQ.next = dQsub(top.next)\n else:\n ...
[ "0.6824465", "0.6754692", "0.67517626", "0.6743356", "0.663425", "0.65277755", "0.65256476", "0.64741474", "0.6443287", "0.6425627", "0.63601464", "0.6359169", "0.63562614", "0.63434285", "0.6332644", "0.6332644", "0.632892", "0.63220626", "0.6296589", "0.62753844", "0.627294...
0.7002939
0
Dequeue the node from head of queue, which is the LRU cache key
def dequeue(self): node = self.head self.head = self.head.next self.head.prev = None node.next = None return node.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dequeue(self):\n node = self.head.next\n self._remove_node(node)\n return node", "def dequeue(self):\n if self.head is None:\n raise Exception(\"nothing to dequeue, queue is empty\")\n _head = self.head.value\n self.head = self.head.next\n self.siz...
[ "0.750332", "0.7128267", "0.71115065", "0.70200634", "0.7014829", "0.7005423", "0.6984234", "0.6959342", "0.6943274", "0.68593025", "0.6840104", "0.68378", "0.67863965", "0.6737088", "0.67131644", "0.6701469", "0.66624403", "0.665007", "0.66300565", "0.65677494", "0.65522325"...
0.7185495
1
Convert one queue into several equivalent Queues >>> q1, q2, q3 = multiplex(3, in_q)
def multiplex(n, q, **kwargs): out_queues = [Queue(**kwargs) for i in range(n)] def f(): while True: x = q.get() for out_q in out_queues: out_q.put(x) t = Thread(target=f) t.daemon = True t.start() return out_queues
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queued(values, qsize):\n values = [_normalize(v) for v in values]\n if qsize < 1:\n raise ValueError(\"qsize must be 1 or larger\")\n q = []\n it = iter(values)\n try:\n for i in range(qsize):\n q.append(next(it))\n for i in cycle(range(qsize)):\n yield...
[ "0.59668434", "0.57556057", "0.5733719", "0.57038265", "0.5638448", "0.5638448", "0.55855674", "0.5572483", "0.5570804", "0.55679387", "0.55537575", "0.5494091", "0.5405254", "0.53997004", "0.5391408", "0.53889686", "0.5384326", "0.53516257", "0.5332532", "0.53235847", "0.531...
0.7273025
0
Merge multiple queues together >>> out_q = merge(q1, q2, q3)
def merge(*in_qs, **kwargs): out_q = Queue(**kwargs) threads = [Thread(target=push, args=(q, out_q)) for q in in_qs] for t in threads: t.daemon = True t.start() return out_q
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_merge():\n\n q1 = PriorityQueue()\n q2 = PriorityQueue()\n\n # input list (obj, priority) should be reversed\n # in the priority_queue\n input_list = [((1), 9), ((2), 8), ((3), 7),\n ((4), 6), ((5), 5), ((6), 4),\n ((7), 3), ((8), 2), ((9), 1)]\n\n # ins...
[ "0.6375784", "0.63390565", "0.61393034", "0.5799037", "0.5650533", "0.5633333", "0.55921215", "0.5567894", "0.5565101", "0.5537103", "0.54347867", "0.5429448", "0.5397555", "0.5376339", "0.5361147", "0.5361147", "0.53177804", "0.530263", "0.5251843", "0.52487576", "0.5247042"...
0.7773168
0
Tries to assign the policy definition to the assignment_id
def __assign_policy_def(self): self.logger.info( f"Creating policy assignment of definition {self.policy_id} to assignment {self.assignment_id}" ) policy_assignment_res = self.interactor.put_policy_assignment( self.policy_id, self.assignment_id ) if poli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_policy_def(self):\n\n self.logger.info(f\"Creating policy definition {self.policy_id}\")\n policy_definition_res = self.interactor.put_policy_definition(\n self.policy_id, self.policy_json\n )\n\n # definition was not created, report and abort\n if policy_...
[ "0.6168933", "0.60744184", "0.5946833", "0.5867972", "0.5844943", "0.57750934", "0.56777924", "0.56777924", "0.5625289", "0.56210494", "0.5598408", "0.5571178", "0.55008614", "0.5463797", "0.54217046", "0.5388606", "0.5352704", "0.5333551", "0.5329522", "0.5312992", "0.528455...
0.78169805
0
Tries to trigger the evaluation of the policy with the given assignment_id
def __trigger_policy(self): self.logger.info(f"Triggering policy assignment {self.assignment_id}") eval_status_loc = self.interactor.trigger_policy().headers["location"] self.logger.debug( f"Policy evaluation for {self.assignment_id} at {eval_status_loc}" ) return e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(rule_id):\n try:\n rule = Rule.objects.get(id=rule_id)\n except Rule.DoesNotExist:\n log.warning('Cannot evaluate rule %s, not found', rule_id)\n return\n rule.ctl.evaluate(update_state=True, trigger_actions=True)", "def __assign_policy_def(self):\n\n self.logger...
[ "0.6488523", "0.63556594", "0.6136139", "0.6058646", "0.5971928", "0.5842552", "0.5737626", "0.56232995", "0.54796296", "0.53975314", "0.5390378", "0.53681886", "0.53522503", "0.5338252", "0.5338252", "0.53368056", "0.5326708", "0.52778846", "0.5258841", "0.5231287", "0.52029...
0.67112106
0
Waits for the policy evaluation given at the url to be completed, blocks while evaluation ongoing (Status Code 202 Pending, 200 Completed)
def __poll_evalutation_result(self, eval_state_url, sleep_time): self.logger.debug( f"Starting poll cycle for {self.assignment_id}, eval_id {self.eval_id}. Polling {eval_state_url}" ) result = self.interactor.get_policy_eval_state(eval_state_url) while result.status_code =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_until_succeed(url):\n \n req = urllib2.Request(url)\n success = False\n while success is False:\n try: \n response = urllib2.urlopen(req)\n if response.getcode() == 200:\n success = True\n except Exception, e:\n print e\n ...
[ "0.5622579", "0.5364558", "0.53312665", "0.53279686", "0.5313581", "0.52460515", "0.52295077", "0.5214374", "0.521206", "0.5199905", "0.5162903", "0.51261437", "0.51187605", "0.5096074", "0.5096074", "0.5096074", "0.5096074", "0.5093483", "0.5084529", "0.5049391", "0.5044184"...
0.6579264
0
Tries to get the summary of the just finished evaluation
def __get_evaluation_summary(self): self.logger.debug( f"Getting summary for assignment {self.assignment_id}, eval_id {self.eval_id}" ) result = self.interactor.get_policy_eval_summary(self.assignment_id) if result.status_code != 200: self.logger.debug( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self):\n iterator = self._iterators['main']\n\n if self.eval_hook:\n self.eval_hook(self)\n\n summary = reporting.DictSummary()\n\n progress = IterationStatus(len(iterator))\n if self._progress_bar:\n pbar = _IteratorProgressBar(iterator=progres...
[ "0.65425926", "0.64546716", "0.6447569", "0.638864", "0.63746077", "0.6267512", "0.6227651", "0.62260455", "0.6225581", "0.6225581", "0.61395013", "0.6130722", "0.6117833", "0.60273993", "0.59813076", "0.5971692", "0.593604", "0.59249115", "0.5924053", "0.59147674", "0.590713...
0.72197354
0
Deletes Policy assignment and definition for the current policy
def __cleanup(self): self.logger.debug("Deleting assignment and definition of policy") self.interactor.delete_policy_assignment(self.assignment_id) self.interactor.delete_policy_definition(self.policy_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_unused(self, mode):\n self.policies = self.list_policies()\n for policy in self.policies['Policies']:\n if policy['AttachmentCount'] < 1:\n self.policy_versions = self.con.list_policy_versions(\n PolicyArn=policy['Arn']\n )\n ...
[ "0.6901397", "0.6715251", "0.64417833", "0.6432547", "0.64290214", "0.63265556", "0.6299334", "0.62928003", "0.61872303", "0.6090277", "0.60504955", "0.6048711", "0.6043672", "0.60322773", "0.5984947", "0.59238195", "0.59126985", "0.58960104", "0.5870526", "0.5870526", "0.581...
0.8001346
0
Creates a simulator with specified parameters
def create_simulator( simulation_parameters: Dict[str, Any], pulse_shape: str, num_realizations: int, distortion: bool ) -> QuantumMLSimulator: return QuantumMLSimulator( simulation_parameters["evolution_time"], simulation_parameters["num_time_steps"], simulat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_simulation(self):\n pass", "def __init__(self, simulator):\r\n self.initialize(simulator)", "def create_new_sim(save_file):\n sim = simulation.Simulation(save_file, 10)\n return sim", "def simulator_from_instrument(instrument):\r\n\r\n grid = grid_from_instrument(instrument=in...
[ "0.6698203", "0.6668623", "0.65711904", "0.6189242", "0.60968053", "0.60942024", "0.60574895", "0.6052008", "0.6005106", "0.593387", "0.5900636", "0.58974296", "0.5888143", "0.58840364", "0.5861426", "0.585451", "0.5842771", "0.58242387", "0.58156675", "0.5789547", "0.5789243...
0.7187922
0
Create a Quantum ML simulator from a known experiment name
def create_default_simulator( experiment_name: str, distortion: bool, num_realizations: int, pulse_shape: str, ) -> QuantumMLSimulator: if pulse_shape not in ["Gaussian", "Square", "Zero"]: raise ValueError( "Pulse Shape is not known. Expected one of {}, found {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newExperiment(self):\n experiment = Experiment()\n newtitle = 'Untitled ' + self.getNextUntitled()\n experimentFrame = SequenceFrame(self, experiment, True, newtitle)\n experiment.setInteractionParameters(parentFrame=experimentFrame,\n graphManagerC...
[ "0.6002049", "0.5973029", "0.5677538", "0.5608699", "0.5599169", "0.558354", "0.5529039", "0.54996294", "0.54977274", "0.5491302", "0.5476763", "0.5451973", "0.5430242", "0.54274994", "0.5421874", "0.5388304", "0.5362882", "0.5358423", "0.53392714", "0.53332675", "0.53074354"...
0.62070054
0
adds forms for Bulk Add/Change and Bulk Delete to context
def change_view(self, request, object_id, form_url='', extra_context=None): section = models.Section.objects.filter(pk=object_id)\ .prefetch_related("facility__experiment", "participants")\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin():\n return render_template('bulkform.html')", "def get_context_data(self, **kwargs):\n context = super(CRUDCreateView, self).get_context_data(**kwargs)\n\n context.update({\n 'model_verbose_name': self.form_class._meta.model._meta.verbose_name,\n 'model_verbose_n...
[ "0.678577", "0.619054", "0.6068815", "0.60110676", "0.5972544", "0.5899351", "0.57841116", "0.5775893", "0.5747975", "0.5735887", "0.5724596", "0.569552", "0.564937", "0.56320167", "0.5628018", "0.56247705", "0.5581765", "0.55740815", "0.556313", "0.5560753", "0.5550769", "...
0.6613177
1
Test BIGIP refresh_ltm function.
def test_bigip_refresh_ltm(bigip_proxy): big_ip = bigip_proxy.mgmt_root() test_pools = [ IcrPool(**p) for p in big_ip.bigip_data['pools'] if p['partition'] == 'test' ] test_virtuals = [ VirtualServer(default_route_domain=0, **v) for v in big_ip.bigip_data['virtuals'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testRefresh(self):\n \n pass", "def test_lbheartbeat(self):\n pass", "def test_bigip_refresh_net(bigip_proxy):\n bigip = bigip_proxy.mgmt_root()\n\n test_arps = [\n IcrArp(**a) for a in bigip.bigip_net_data['arps']\n if a['partition'] == 'test'\n ]\n test_tunnels ...
[ "0.6619912", "0.64138675", "0.6229495", "0.59574944", "0.59380776", "0.5856258", "0.5747332", "0.5553251", "0.5552828", "0.55171466", "0.551602", "0.55028427", "0.5444007", "0.5425386", "0.5403734", "0.5385788", "0.5358422", "0.53571105", "0.53531486", "0.5348513", "0.5342806...
0.7945585
0
Test BIGIP refresh_net function.
def test_bigip_refresh_net(bigip_proxy): bigip = bigip_proxy.mgmt_root() test_arps = [ IcrArp(**a) for a in bigip.bigip_net_data['arps'] if a['partition'] == 'test' ] test_tunnels = [ IcrFDBTunnel(default_route_domain=0, **t) for t in bigip.bigip_net_data['fdbTunnels'] i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bigip_refresh_ltm(bigip_proxy):\n big_ip = bigip_proxy.mgmt_root()\n\n test_pools = [\n IcrPool(**p) for p in big_ip.bigip_data['pools']\n if p['partition'] == 'test'\n ]\n test_virtuals = [\n VirtualServer(default_route_domain=0, **v)\n for v in big_ip.bigip_data['...
[ "0.70486903", "0.6406606", "0.61931825", "0.5934167", "0.5907658", "0.5850446", "0.5774951", "0.5712928", "0.56594867", "0.56326914", "0.5548741", "0.55154794", "0.54941696", "0.5491759", "0.54886764", "0.54880565", "0.5484708", "0.5459663", "0.5435155", "0.54288685", "0.5418...
0.7918991
0
Test BIGIP properties function.
def test_bigip_properties(bigip_proxy): big_ip = bigip_proxy test_pools = [ IcrPool(**p) for p in big_ip.mgmt_root().bigip_data['pools'] if p['partition'] == 'test' ] test_virtuals = [ VirtualServer(default_route_domain=0, **v) for v in big_ip.mgmt_root().bigip_data['vir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_properties_get(self):\n pass", "def test_properties_distribution_get(self):\n pass", "def test_properties_stats_get(self):\n pass", "def test_properties_evolution_get(self):\n pass", "def test_test_property():\n\n contents = (\"[Info]\\n\"\n \"sdk = 23...
[ "0.66221553", "0.6483402", "0.6239974", "0.62317616", "0.61712855", "0.6056846", "0.5982921", "0.5978383", "0.5957984", "0.59287053", "0.5855536", "0.58451384", "0.575773", "0.5752789", "0.57005686", "0.5648957", "0.56461644", "0.5596355", "0.55827546", "0.55809677", "0.55801...
0.7858068
0
Takes a properly formatted XML backup file, and replies with the existence/condition of each Task.
def wmAnalyzeImportXML(self): inputtext = uiCommon.getAjaxArg("import_text") inputtext = uiCommon.unpackJSON(inputtext) on_conflict = uiCommon.getAjaxArg("on_conflict") # the trick here is to return enough information back to the client # to best interact with the user. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_indicator_files(tasks):\n\n for task in tasks:\n if task[\"status\"]==\"unknown\":\n if os.path.exists(task[\"result\"]):\n task[\"status\"]=\"previously completed\"\n else:\n task[\"status\"]=\"to do\"\n return", "def parse_file(input_fi...
[ "0.5698271", "0.5630911", "0.5264835", "0.52602625", "0.5245525", "0.5227591", "0.5215885", "0.5213721", "0.5210944", "0.5155119", "0.5153322", "0.5065229", "0.50611675", "0.5053524", "0.49941146", "0.49551627", "0.49417213", "0.49256587", "0.48780125", "0.48549002", "0.48490...
0.588243
0
This function will eventually have lots of flexibility based on the 'type' and 'in' parameters. For the moment we're starting with the ability to search Task function_xml for the pattern.
def wmSearch(self): _type = uiCommon.getAjaxArg("type") _in = uiCommon.getAjaxArg("in") _pattern = uiCommon.getAjaxArg("pattern") out = {} if _type == "task": # bare essentials - is the pattern in the function_xml column where_clause = "where (fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_filtered_task(seq, f_name):\n filter_list.append(f_name)\n # only tasks specified by name can contain parameters\n if f_name in self.tasks:\n # parse task_selection\n the_task = self.tasks[f_name]\n\n # Initialize options for the...
[ "0.52281475", "0.5209115", "0.5099008", "0.49171287", "0.48925123", "0.4852218", "0.4819932", "0.47696853", "0.4753128", "0.472965", "0.47084817", "0.47064057", "0.470616", "0.47040612", "0.46876827", "0.46673572", "0.466363", "0.46515846", "0.46498874", "0.4629617", "0.46103...
0.6003544
0
Utility function training a simple CNN for 1 client in a federated setting and adding those weights to the weights_accountant. Call this function in a federated loop that then makes the weights_accountant average the weights to send to a global model.
def train_client_model(client, local_epochs, model, train_data, train_labels, val_data, val_labels, val_people, val_all_labels, weights_accountant, individual_validation): weights = model.get_weights() model, history = train_cnn('federated', model, local_epochs, train_data, train_labels,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(federated_averaging_process, num_rounds, num_clients_per_round, summary_writer):\n # Create a environment to get communication cost.\n environment = set_sizing_environment()\n\n # Initialize the Federated Averaging algorithm to get the initial server state.\n state = federated_averaging_process.initi...
[ "0.653508", "0.6429746", "0.61477405", "0.6026671", "0.60140735", "0.59652656", "0.59649265", "0.59365046", "0.59151834", "0.5837172", "0.58357954", "0.5818957", "0.58125734", "0.57656133", "0.57248753", "0.5646588", "0.5589146", "0.55844325", "0.55814445", "0.55743146", "0.5...
0.69034714
0
Initializes a client model and kicks off the training of that client by calling "train_client_model".
def client_learning(model, client, local_epochs, train_data, train_labels, val_data, val_labels, val_people, val_all_labels, weights_accountant, individual_validation): # Get all client specific data points client_data = train_data.get(client) client_labels = train_labels.get(client) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_client_model(client, local_epochs, model, train_data, train_labels, val_data, val_labels, val_people,\n val_all_labels, weights_accountant, individual_validation):\n\n weights = model.get_weights()\n model, history = train_cnn('federated', model, local_epochs, train_data, trai...
[ "0.68188596", "0.68103606", "0.6695844", "0.6465694", "0.6424548", "0.63503927", "0.6335352", "0.6320292", "0.631809", "0.62836146", "0.62836146", "0.6276442", "0.6272259", "0.6268741", "0.6267786", "0.6259019", "0.62192667", "0.61965066", "0.6180977", "0.6178114", "0.6148739...
0.72599244
0
One round of communication between a 'server' and the 'clients'. Each client 'downloads' a global model and trains a local model, updating its weights locally. When all clients have updated their weights, they are 'uploaded' to the server and averaged.
def communication_round(model, clients, train_data, train_labels, train_people, val_data, val_labels, val_people, val_all_labels, local_epochs, weights_accountant, individual_validation, local_operation): # Split train and validation data into clients train_data, train_labels = dL.split...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n # Single GPU flag\n single_gpu = True if size()==1 else False\n print_rank(f\"Single GPU flag Client: {single_gpu}\", loglevel=logging.DEBUG)\n \n if not single_gpu:\n while True: # keeps listening for incoming server calls\n\n # Initialize...
[ "0.64254916", "0.6339241", "0.62862754", "0.61975026", "0.61441857", "0.61311364", "0.60955054", "0.6012031", "0.59114116", "0.58615744", "0.57271534", "0.56730413", "0.5626304", "0.56258166", "0.55598176", "0.55529356", "0.5526622", "0.55213", "0.548929", "0.54654336", "0.54...
0.65511453
0
Utility function adding individual validation callback, to track local validation metrics.
def add_additional_validation_callback(callbacks, val_data, val_labels, val_people, val_all_labels): _, val_data_split, val_labels_split, val_people_split = dL.split_data_into_labels(0, val_all_labels, False, val_data, val_labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_validation_start(self):\n for callback in self.callbacks:\n callback.on_validation_start(self, self.get_model())", "def validation_event(self, message):", "def validate(cls):\n\n def register_onvalidation(form):\n\n onvalidation = current.auth.settings.register_onvali...
[ "0.6598675", "0.6526562", "0.62632424", "0.61758786", "0.6034818", "0.60147756", "0.5868105", "0.5868105", "0.5856921", "0.57969826", "0.5730952", "0.5725371", "0.56966895", "0.5683423", "0.5658995", "0.5657877", "0.56458133", "0.56337935", "0.56282836", "0.5604404", "0.55685...
0.7172401
0
get data from this or last time sliced table
def get_data(self, table_name, key, timedelta_slice=1, pickled=True): item = self.get_item(table_name, key, timedelta_slice=timedelta_slice) if item: if pickled and item.get(self.data_property, None): return pickle.loads(str(item[self.data_property])) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self, date_time):\n id_columns = ','.join([col for col in self.table_primary_keys if col not in ['EFFECTIVEDATE', 'VERSIONNO']])\n return_columns = ','.join(self.table_columns)\n with self.con:\n cur = self.con.cursor()\n cur.execute(\"DROP TABLE IF EXISTS te...
[ "0.6511194", "0.63696617", "0.62910366", "0.6263766", "0.6064493", "0.6055778", "0.6034535", "0.60036254", "0.59617746", "0.59467924", "0.5900856", "0.58400726", "0.58294696", "0.58006513", "0.57950914", "0.57669014", "0.57626253", "0.5748046", "0.5747954", "0.5714059", "0.56...
0.6580407
0
save/update counter shard indice to the seperated index table
def _update_counter_indice(self, table_name, key, shard, retry=3): index_table_name = table_name + _COUNTER_SHARD_INDEX_TABLE_SUFFIX try: self.conn.update_item(index_table_name, {self.hash_key_name: {"S": key}}, {self.data_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment(cls):\n index = random.randint(0, SimpleCounterShard.NUM_SHARDS - 1)\n shard_name = 'shard' + str(index)\n counter = SimpleCounterShard.objects.get_or_create(pk=shard_name)[0]\n counter.count += 1\n counter.save()", "def _write_shard(filename, dataset, indices):\n...
[ "0.6604422", "0.6319584", "0.62968904", "0.6131772", "0.604892", "0.6035898", "0.6035898", "0.60352343", "0.60293794", "0.5916049", "0.5857519", "0.5857516", "0.58545333", "0.5826654", "0.5806787", "0.57729423", "0.5748174", "0.5746786", "0.57276005", "0.56532913", "0.5649769...
0.7214528
0
delete sharded counter use hight level table to do batch write
def delete_counter(self, table_name, key): sharded_keys = self._get_counter_keys(table_name, key) if sharded_keys: counter_table = self.get_table(table_name) with counter_table.batch_write() as batch: for sharded_key in sharded_keys: batch.dele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_counts(self):\n\n qry = \"TRUNCATE TABLE baseline.parameter_value_counts\"\n self.engine.execute(text(qry))", "def delete(self, key):\n self._cur_batch.delete(key)\n self._num_mutations += 1\n if self._num_mutations >= MAX_MUTATIONS_IN_BATCH:\n self.commit()\n self.beg...
[ "0.60339683", "0.5903159", "0.5700051", "0.5556756", "0.5540176", "0.5516961", "0.5512008", "0.54954195", "0.54385835", "0.54374343", "0.5420206", "0.5418899", "0.541232", "0.5405903", "0.5399159", "0.53843766", "0.53728247", "0.535848", "0.5314674", "0.53141826", "0.5312722"...
0.73413813
0
assert exception is raised if a repo has no tracking branch
def test_repo_no_remote(repo): with pytest.raises(ValueError): gitb.pull(repo.working_tree_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_branch_fail(repository: Repository) -> None:\n with pytest.raises(KeyError):\n repository.branch(\"branch\")", "def test_heads_contains_false(repository: Repository) -> None:\n assert \"branch\" not in repository.heads", "def test_path_not_repo(folder):\n\n with pytest.raises(ValueErro...
[ "0.75480485", "0.7263348", "0.7199445", "0.7009176", "0.6826254", "0.6780176", "0.6755103", "0.67515707", "0.67448026", "0.6742422", "0.67161465", "0.66541594", "0.6649784", "0.66389626", "0.66336024", "0.6609925", "0.6602508", "0.6420919", "0.64028436", "0.6387867", "0.63641...
0.7269188
1
Given a successor edge map, produce an inverted predecessor edge map.
def get_pred(succ): out = {key: [] for key in succ} for p, ss in succ.items(): for s in ss: out[s].append(p) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_predecessors(graph, node=\"\"):\n return {\n \"predecessors\": [\n {\n \"source\": pred,\n \"target\": node,\n \"edge_attribute\": graph.pred[node][pred][\"edge_attribute\"],\n }\n for pred in graph.pred[node]\n ...
[ "0.5793302", "0.5770379", "0.5723809", "0.5602367", "0.5539576", "0.54516363", "0.54101074", "0.53934604", "0.5391035", "0.5376142", "0.52544457", "0.52541155", "0.52379316", "0.516592", "0.5125495", "0.5118392", "0.51066905", "0.5055842", "0.5046301", "0.5044316", "0.5030809...
0.5795014
0
Given a successor edge map, produce a list of all the nodes in the graph in postorder by appending to the `out` list.
def postorder_helper(succ, root, explored, out): if root in explored: return explored.add(root) for s in succ[root]: postorder_helper(succ, s, explored, out) out.append(root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_path(self, node_map: dict = None, src: int = 0, dest: int = 0) -> list:\n if node_map is None or src == dest:\n return None\n ans = [self._graph.get_node(dest)]\n next_node = node_map.get(dest)\n ans.append(next_node)\n while next_node.key is not src: # Ba...
[ "0.60491115", "0.5670343", "0.56613624", "0.56503856", "0.5490603", "0.54518074", "0.5408261", "0.5395948", "0.5365153", "0.5347279", "0.5327631", "0.5325399", "0.530851", "0.5287929", "0.5230151", "0.52038926", "0.5192097", "0.5186079", "0.51727337", "0.5156704", "0.51355916...
0.5799239
1
Sets the transaction_notification_url of this StoreUrlConfiguration.
def transaction_notification_url(self, transaction_notification_url): self._transaction_notification_url = transaction_notification_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recurring_transaction_notification_url(self, recurring_transaction_notification_url):\n\n self._recurring_transaction_notification_url = recurring_transaction_notification_url", "def notify_url(self, notify_url):\n\n self._notify_url = notify_url", "def method_notification_url(self, method_no...
[ "0.743379", "0.6348347", "0.617391", "0.5849823", "0.50333273", "0.4990913", "0.49459577", "0.49224275", "0.4912939", "0.4912939", "0.4905969", "0.48247993", "0.4809686", "0.47674695", "0.47674695", "0.47510424", "0.46979332", "0.4695061", "0.46826473", "0.46764046", "0.46138...
0.86247927
0
Sets the recurring_transaction_notification_url of this StoreUrlConfiguration.
def recurring_transaction_notification_url(self, recurring_transaction_notification_url): self._recurring_transaction_notification_url = recurring_transaction_notification_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transaction_notification_url(self, transaction_notification_url):\n\n self._transaction_notification_url = transaction_notification_url", "def method_notification_url(self, method_notification_url):\n\n self._method_notification_url = method_notification_url", "def notify_url(self, notify_url...
[ "0.73366183", "0.5945408", "0.58616453", "0.49812144", "0.47298342", "0.47298342", "0.46253613", "0.46181828", "0.45913643", "0.45379418", "0.45312813", "0.44840717", "0.44351047", "0.43826178", "0.43701798", "0.43670374", "0.43431824", "0.43294266", "0.4326882", "0.42897275", ...
0.84907234
0
Sets the response_success_url of this StoreUrlConfiguration.
def response_success_url(self, response_success_url): self._response_success_url = response_success_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_success_url(self, url):\n self.__success_url = url\n return self", "def on_success_url(self, on_success_url):\n\n self._on_success_url = on_success_url", "def get_success_url(self):\n if not self.success_url:\n return self.request.get_full_path()\n return ...
[ "0.71014994", "0.684946", "0.63355774", "0.6243574", "0.6171999", "0.6091107", "0.60322094", "0.5935141", "0.59321535", "0.59321535", "0.5891836", "0.58217734", "0.5745798", "0.5708686", "0.5694084", "0.567529", "0.56572485", "0.5510942", "0.5470778", "0.5441133", "0.539344",...
0.8465847
0
Sets the response_failure_url of this StoreUrlConfiguration.
def response_failure_url(self, response_failure_url): self._response_failure_url = response_failure_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_success_url(self, response_success_url):\n\n self._response_success_url = response_success_url", "def response_kafka_connection_url(self, response_kafka_connection_url: str):\n\n self._response_kafka_connection_url = response_kafka_connection_url", "def with_error_url(self, url):\n ...
[ "0.67325926", "0.61840147", "0.6133804", "0.5944127", "0.5575882", "0.5515315", "0.5437121", "0.53560185", "0.52995324", "0.5281394", "0.5277041", "0.5269514", "0.52312785", "0.5195577", "0.5164423", "0.5101275", "0.50832057", "0.50669324", "0.50382894", "0.50128365", "0.4986...
0.8542002
0
Sets the skip_result_page_for_success of this StoreUrlConfiguration.
def skip_result_page_for_success(self, skip_result_page_for_success): self._skip_result_page_for_success = skip_result_page_for_success
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_result_page_for_failure(self, skip_result_page_for_failure):\n\n self._skip_result_page_for_failure = skip_result_page_for_failure", "def v2_runner_on_skipped(self, result):\n super(Callback, self).v2_runner_on_skipped(result)\n self._store(result, STATUS_SKIPPED)", "def set_skip(...
[ "0.7781596", "0.57031137", "0.52726793", "0.49588716", "0.49287266", "0.4810245", "0.473015", "0.4712832", "0.45400152", "0.45209688", "0.45202103", "0.45113936", "0.44433716", "0.44041428", "0.43869552", "0.43729672", "0.4371329", "0.4352022", "0.43146196", "0.43135968", "0....
0.84920037
0
Sets the skip_result_page_for_failure of this StoreUrlConfiguration.
def skip_result_page_for_failure(self, skip_result_page_for_failure): self._skip_result_page_for_failure = skip_result_page_for_failure
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_result_page_for_success(self, skip_result_page_for_success):\n\n self._skip_result_page_for_success = skip_result_page_for_success", "def v2_runner_on_skipped(self, result):\n super(Callback, self).v2_runner_on_skipped(result)\n self._store(result, STATUS_SKIPPED)", "def set_skip(...
[ "0.73856544", "0.58639663", "0.5604166", "0.5302143", "0.52930707", "0.5133586", "0.51287705", "0.50973755", "0.5085664", "0.50740355", "0.49886614", "0.49836242", "0.48955712", "0.48941484", "0.48918492", "0.48815787", "0.48369977", "0.48243102", "0.47793093", "0.47763255", ...
0.86390513
0
Sets the overwrite_url_allowed of this StoreUrlConfiguration.
def overwrite_url_allowed(self, overwrite_url_allowed): self._overwrite_url_allowed = overwrite_url_allowed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMergeURLs(self,value):\n self.PDFreactorConfiguration.in1[\"mergeURLs\"] = value", "def set_url(self, url):\n super(Cabling, self).set_url(url)", "def overwrite_url(self):\n if self.has_url_overwrite:\n return self.path\n return None", "def store_url(self, store_...
[ "0.56947964", "0.5329151", "0.52944744", "0.50979084", "0.5042788", "0.49300197", "0.49186686", "0.48910424", "0.47950393", "0.4794281", "0.47661638", "0.4715199", "0.4647994", "0.46273112", "0.4620841", "0.4593409", "0.45831212", "0.45681605", "0.45349228", "0.45302624", "0....
0.85512465
0
Calculate IV curve for cells and substrings in series given current and voltage in increasing order by voltage, the average short circuit current and the max current at the breakdown voltage.
def calcSeries(self, I, V, meanIsc, Imax): # make sure all inputs are numpy arrays, but don't make extra copies I = np.asarray(I) # currents [A] V = np.asarray(V) # voltages [V] meanIsc = np.asarray(meanIsc) # mean Isc [A] Imax = np.asarray(Imax) # max current [A] # c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iv_curve(voc):\n \n set_mode(mode_cv) # set operation mode to CC\n time.sleep(.1)\n volt_step = voc\n while volt_step > 0.5:\n set_CV_volts(volt_step)\n time.sleep(.1)\n curve_vals = get_input_values()\n curve_data_point = data_point(curve_vals)\n print('voltag...
[ "0.59774095", "0.5940008", "0.5699484", "0.56029814", "0.55781555", "0.5427292", "0.5408146", "0.54023063", "0.5399235", "0.53704005", "0.53345525", "0.526223", "0.52585626", "0.5201066", "0.5200087", "0.5192422", "0.51846176", "0.5170427", "0.5170117", "0.5170028", "0.516832...
0.63544613
0
Get the sequence of series cells between parallel crossties.
def get_series_cells(cell_pos_column, prev_col=None): series_cells = [] # empty list of indices of cells in series # if the previous column is specified, find the indices of cells in the # current column that correspond to cells between parallel crossties in the # previous column if prev_col: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consecutive_sections(): # noqa: D416", "def cells(self):\n \"\"\"\n Note that we use the convention that the first cell is (1,1)\n \"\"\"\n spart_star = self.star()\n part = Partition(list(spart_star))\n coordinates = part.cells()\n coordinates = [(x+1, y...
[ "0.590445", "0.5790943", "0.55751693", "0.55303854", "0.52701956", "0.5266778", "0.5257846", "0.52178484", "0.5144677", "0.5140382", "0.50766927", "0.50659114", "0.50258607", "0.5021596", "0.50133306", "0.4999227", "0.4948937", "0.49432912", "0.49364156", "0.49342504", "0.492...
0.62917274
0
Dot product between two points
def dot(p1, p2): return p1[0] * p2[0] + p1[1] * p2[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]", "def dot(a,b):\n return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]", "def dot(x,y):\n\treturn sum([xi*yi for (xi,yi) in zip(x,y)])", "def dot(x, y):\n res = x[0] * y[0]\n for a, b in zip(x, y):\n res += a * b\n return res", "def dot(a, b)...
[ "0.80575734", "0.80163157", "0.7981756", "0.78800917", "0.7833627", "0.78089905", "0.777131", "0.776726", "0.7749556", "0.7709001", "0.7671875", "0.766193", "0.76345164", "0.7632237", "0.7632237", "0.763077", "0.7625666", "0.76185733", "0.7605201", "0.7595505", "0.75636303", ...
0.8218893
0
Computes the similarity between two lines, based on their angles
def angle_similarity(l1, l2): return angle(l1, l2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_similarity(p1a, p1b, p2a, p2b, T=CLOSE_DISTANCE_THRESHOLD):\n d = line_distance_similarity(p1a, p1b, p2a, p2b, T=T)\n a = abs(angle_similarity(normalize(line(p1a, p1b)), normalize(line(p2a, p2b))))\n return d * a", "def line_distance_similarity(p1a, p1b, p2a, p2b, T=CLOSE_DISTANCE_THRESHOLD):\n...
[ "0.7629994", "0.7398565", "0.65183115", "0.6350359", "0.63362044", "0.626053", "0.62440944", "0.62381816", "0.62263227", "0.6200599", "0.62003225", "0.61906576", "0.61895764", "0.6174542", "0.6166865", "0.6157326", "0.6121858", "0.60810333", "0.6075102", "0.607445", "0.607421...
0.74319327
1
Closest distance between a line segment and a point
def distance_to_line(a, b, p): return distance(closest_point(a, b, p), p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _distance_to_line(begin, end, point):\n return _vec_distance(point, _nearest_point_on_line(begin, end, point))", "def closest_point_on_line(point, line):\n a, b = line\n ab = subtract_vectors(b, a)\n ap = subtract_vectors(point, a)\n c = vector_component(ap, ab)\n return add_vectors(a, c)",...
[ "0.81862724", "0.7828562", "0.77968067", "0.7728606", "0.7727276", "0.7581186", "0.75243306", "0.75206876", "0.7515487", "0.7501045", "0.7454979", "0.7439724", "0.7368258", "0.73511803", "0.73502994", "0.7311799", "0.72662973", "0.7258923", "0.71916497", "0.7185546", "0.71545...
0.8061818
1
Line distance similarity between two line segments
def line_distance_similarity(p1a, p1b, p2a, p2b, T=CLOSE_DISTANCE_THRESHOLD): d1 = distance_similarity(p1a, p1b, p2a, T=T) d2 = distance_similarity(p1a, p1b, p2b, T=T) return abs(d1 + d2) * 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_similarity(p1a, p1b, p2a, p2b, T=CLOSE_DISTANCE_THRESHOLD):\n d = line_distance_similarity(p1a, p1b, p2a, p2b, T=T)\n a = abs(angle_similarity(normalize(line(p1a, p1b)), normalize(line(p2a, p2b))))\n return d * a", "def _distance(point, line_point1, line_point2):\n vec1 = line_point1...
[ "0.7638525", "0.74453497", "0.73965883", "0.73627657", "0.7215345", "0.71117514", "0.70393413", "0.69712627", "0.6954822", "0.69028586", "0.68928796", "0.6882581", "0.6880322", "0.6871446", "0.68706524", "0.68433255", "0.68348014", "0.6779737", "0.6773317", "0.6752462", "0.67...
0.7801239
0
Similarity between two lines
def line_similarity(p1a, p1b, p2a, p2b, T=CLOSE_DISTANCE_THRESHOLD): d = line_distance_similarity(p1a, p1b, p2a, p2b, T=T) a = abs(angle_similarity(normalize(line(p1a, p1b)), normalize(line(p2a, p2b)))) return d * a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_distance_similarity(p1a, p1b, p2a, p2b, T=CLOSE_DISTANCE_THRESHOLD):\n d1 = distance_similarity(p1a, p1b, p2a, T=T)\n d2 = distance_similarity(p1a, p1b, p2b, T=T)\n return abs(d1 + d2) * 0.5", "def wordSimilarityRatio(sent_1,sent_2):", "def similarity(self, e1, e2):\n\t\tpass", "def get_sim...
[ "0.74902856", "0.72094303", "0.67256373", "0.6657809", "0.6613019", "0.6546288", "0.64379406", "0.6437496", "0.6401152", "0.63746625", "0.63679564", "0.6357602", "0.6354725", "0.6354725", "0.6336552", "0.6321181", "0.6317048", "0.629436", "0.62886405", "0.6266155", "0.6263822...
0.7845479
0
Yield info about the atoms in the batch. Yields
def get_atom_infos(self): yield from self._atom_infos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_atom_infos(self):\n\n yield from self._molecule_state.get_atom_infos()", "def iter_atoms(self):\n for frag in self.fragment_list:\n for atm in frag.atom_list:\n yield atm", "def iter_atoms(self):\n for chain in self.chain_list:\n for frag in cha...
[ "0.7242046", "0.7157172", "0.71297324", "0.70284635", "0.69747776", "0.6971991", "0.67970383", "0.6707273", "0.6699349", "0.6684387", "0.6659008", "0.6550168", "0.64912003", "0.64268315", "0.63423115", "0.6305241", "0.6292929", "0.6257811", "0.62538654", "0.62493324", "0.6247...
0.7247744
0
Test block get number of channels.
async def test_block_get_number_of_channels(mock_block_device, monkeypatch) -> None: monkeypatch.setattr(mock_block_device.blocks[DEVICE_BLOCK_ID], "type", "emeter") monkeypatch.setitem(mock_block_device.shelly, "num_emeters", 3) assert ( get_number_of_channels( mock_block_device, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_channels(self):\n return 3", "def get_num_channels():\r\n check_mixer()\r\n return sdl.Mix_GroupCount(-1)", "def n_channels(self):\n return len(self.channels)", "def num_blocks(self): # -> int:\n ...", "def channels(self) -> int:\n return len(self._channel_arrays)", ...
[ "0.6666171", "0.6631296", "0.6608011", "0.65197086", "0.63598883", "0.6340037", "0.62888104", "0.6272894", "0.62246263", "0.6173776", "0.6155137", "0.6117499", "0.6108603", "0.6061354", "0.60538876", "0.6026151", "0.60135025", "0.60135025", "0.58940625", "0.58448714", "0.5843...
0.6883377
0
Test block get block channel name.
async def test_block_get_block_channel_name(mock_block_device, monkeypatch) -> None: monkeypatch.setattr(mock_block_device.blocks[DEVICE_BLOCK_ID], "type", "relay") assert ( get_block_channel_name( mock_block_device, mock_block_device.blocks[DEVICE_BLOCK_ID], ) =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_get_rpc_channel_name(mock_rpc_device) -> None:\n assert get_rpc_channel_name(mock_rpc_device, \"input:0\") == \"test switch_0\"\n assert get_rpc_channel_name(mock_rpc_device, \"input:3\") == \"Test name switch_3\"", "def getName(self):\n return self.block.__name__", "def name(self):...
[ "0.67481595", "0.6521728", "0.6447584", "0.60758513", "0.6075571", "0.6026974", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", "0.5914204", ...
0.71845853
0
Test get block device sleep period.
async def test_get_block_device_sleep_period(settings, sleep_period) -> None: assert get_block_device_sleep_period(settings) == sleep_period
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sleep_get(mocker):\n mocker.patch('serial.Serial.open')\n mocker.patch('serial.Serial.flushInput')\n cgs = mocker.patch('pysds011.driver.SDS011.cmd_get_sleep')\n cgs.return_value = 1\n runner = CliRunner()\n result = runner.invoke(main, ['sleep'])\n cgs.assert_called_once_with(id=b'\\...
[ "0.68484414", "0.6204949", "0.6103036", "0.60953665", "0.6046451", "0.6043059", "0.60016555", "0.59838265", "0.5927185", "0.58067167", "0.5788999", "0.57102466", "0.57051843", "0.56726736", "0.56593573", "0.56552535", "0.56223905", "0.5617636", "0.56159085", "0.56144947", "0....
0.8533826
0
Test block test get device uptime.
async def test_get_device_uptime() -> None: assert get_device_uptime( 55, dt_util.as_utc(dt_util.parse_datetime("2019-01-10 18:42:00+00:00")) ) == dt_util.as_utc(dt_util.parse_datetime("2019-01-10 18:42:00+00:00")) assert get_device_uptime( 50, dt_util.as_utc(dt_util.parse_datetime("2019-01...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uptime():\n run('uptime')", "def uptime(self):\n return self._call_txtrader_api('uptime', {})", "async def test_get_block_device_sleep_period(settings, sleep_period) -> None:\n assert get_block_device_sleep_period(settings) == sleep_period", "async def get_uptime(message):\n\n runtime = i...
[ "0.6630632", "0.6444792", "0.6050095", "0.60466015", "0.60253656", "0.60105556", "0.5985552", "0.5952031", "0.59283274", "0.5891722", "0.58885413", "0.5841687", "0.5841687", "0.5817099", "0.57781196", "0.5770053", "0.573073", "0.56750745", "0.5654125", "0.5646615", "0.5629617...
0.71320456
0
Test get block input triggers.
async def test_get_block_input_triggers(mock_block_device, monkeypatch) -> None: monkeypatch.setattr( mock_block_device.blocks[DEVICE_BLOCK_ID], "sensor_ids", {"inputEvent": "S", "inputEventCnt": 0}, ) monkeypatch.setitem( mock_block_device.settings, "rollers", [{"button_type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_input_block():\n return Mock()", "def test_01(self):\n assert 'True' == Api.requestBlock('test-01')", "def test_45(self):\n assert 'True' == Api.requestBlock('test-45')", "def test_29(self):\n assert 'True' == Api.requestBlock('test-29')", "async def test_get_rpc_input_t...
[ "0.6596907", "0.6197186", "0.6123457", "0.6072346", "0.606217", "0.6054609", "0.6032091", "0.6017897", "0.6001783", "0.5964847", "0.59617215", "0.5961448", "0.5956584", "0.595641", "0.5939003", "0.5920687", "0.5909376", "0.5904034", "0.5901287", "0.58769405", "0.58660996", ...
0.73085886
0
Test get RPC channel name.
async def test_get_rpc_channel_name(mock_rpc_device) -> None: assert get_rpc_channel_name(mock_rpc_device, "input:0") == "test switch_0" assert get_rpc_channel_name(mock_rpc_device, "input:3") == "Test name switch_3"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unicode_channel_name(self):\n channel_layer.send(\"\\u00a3_test\", {\"value\": \"blue\"})\n # Get just one first\n channel, message = channel_layer.receive_many([\"\\u00a3_test\"])\n self.assertEqual(channel, \"\\u00a3_test\")\n self.assertEqual(messa...
[ "0.66524565", "0.6453233", "0.61550343", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205", "0.61273205",...
0.85295635
0
Test get RPC input triggers.
async def test_get_rpc_input_triggers(mock_rpc_device, monkeypatch) -> None: monkeypatch.setattr(mock_rpc_device, "config", {"input:0": {"type": "button"}}) assert set(get_rpc_input_triggers(mock_rpc_device)) == { ("btn_down", "button1"), ("btn_up", "button1"), ("single_push", "button1")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_run(self):\n pass", "def test_rpcCall(self):\n pass", "def test_command_trigger_webhook_post(self):\n pass", "def test_stdin_input(self, api_client):\n runner = CliRunner()\n\n query = \"<query>\"\n api_client.query.return_value = []\n expected = ...
[ "0.6106724", "0.60229707", "0.5964011", "0.5906763", "0.5794138", "0.57866555", "0.57590294", "0.5756468", "0.5728743", "0.57266974", "0.56973886", "0.56858367", "0.56770766", "0.56710064", "0.5640447", "0.5629508", "0.5629347", "0.562135", "0.5571366", "0.55619645", "0.55478...
0.72832596
0
Get the dialogue_reference of the message.
def dialogue_reference(self) -> Tuple[str, str]: enforce(self.is_set("dialogue_reference"), "dialogue_reference is not set.") return cast(Tuple[str, str], self.get("dialogue_reference"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message(self):\n return self.message", "def get_message(self):\n return self.message", "def _get_message(self):\n return self.__message", "def get_message (self) :\n return self._message", "def get_message(self):\n return self.__mess", "def get_reference(self):\...
[ "0.5959654", "0.5959654", "0.5914954", "0.5835652", "0.5816795", "0.58139884", "0.5798165", "0.56435615", "0.5603565", "0.55960155", "0.55960155", "0.5579671", "0.5579671", "0.5579671", "0.5579671", "0.5579671", "0.5565717", "0.55399346", "0.55399346", "0.55309427", "0.552806...
0.79154986
0
Get the message_id of the message.
def message_id(self) -> int: enforce(self.is_set("message_id"), "message_id is not set.") return cast(int, self.get("message_id"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_id(self):\n return self._message_id", "def getMessageID(self):\n return self._payload[1]", "def message_id(self) -> str:\n return self[\"Sns\"][\"MessageId\"]", "def msg_id(self):\n return struct.unpack('<H', self.pkt.payload[0:2])[0]", "def get_message_by_id(message...
[ "0.8787715", "0.8481341", "0.80076957", "0.7417332", "0.6884192", "0.6880647", "0.68433136", "0.6767874", "0.67058575", "0.67058575", "0.66893184", "0.6680958", "0.6643317", "0.6600039", "0.6521175", "0.64887494", "0.6466459", "0.64267176", "0.6333503", "0.633283", "0.6313509...
0.8594349
1
Get the performative of the message.
def performative(self) -> Performative: # type: ignore # noqa: F821 enforce(self.is_set("performative"), "performative is not set.") return cast(SigningMessage.Performative, self.get("performative"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMessage(self):\n m = self.messages\n l = len(m)\n if (l == 0):\n return \"\"\n elif (l == 1):\n return self.acronym + \" | \" + m[0]\n else:\n msg = self.acronym + \" | \"\n for i in range(0,l):\n msg += m[i]\n ...
[ "0.667278", "0.6628262", "0.6560743", "0.65362114", "0.6522832", "0.6507694", "0.64969105", "0.64569235", "0.64569235", "0.6410618", "0.6401095", "0.6401095", "0.6401095", "0.6401095", "0.6401095", "0.64002436", "0.64002436", "0.6379844", "0.6352671", "0.6338372", "0.633616",...
0.81371075
0
Get the 'raw_message' content from the message.
def raw_message(self) -> CustomRawMessage: enforce(self.is_set("raw_message"), "'raw_message' content is not set.") return cast(CustomRawMessage, self.get("raw_message"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_message(self) -> RawMessage:\n return self.__raw_message", "def get_message_content(message): # pylint: disable=too-many-return-statements\n if message.content_type == \"photo\":\n return message.photo[0].file_id\n if message.content_type == \"text\":\n return message.text\n ...
[ "0.8032004", "0.72907066", "0.7252867", "0.7227824", "0.71971655", "0.7040535", "0.7012771", "0.6958191", "0.6909674", "0.6897377", "0.6897377", "0.67984945", "0.6786966", "0.67800176", "0.67800176", "0.67790717", "0.6768183", "0.67483693", "0.6687858", "0.66784155", "0.66462...
0.7808511
1