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 that the PNG directories exists if not it creates them
def check_png_directories(self): check_dir_of = Locations.check_dir_of check_dir_of(self.HISTO_PNG) check_dir_of(self.LABELS_PNG) check_dir_of(self.SOURCE_PNG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_dirs(self):\r\n for dir in [self.papers_dir,\r\n self.buffer_dir]:\r\n if not os.path.exists(dir):\r\n message = f'Dir not exists: {dir}. Making it.'\r\n logging.warning(message)\r\n os.mkdir(dir)", "def create_directory...
[ "0.7306773", "0.70073175", "0.69785833", "0.6906268", "0.68699163", "0.6868954", "0.6845684", "0.6698808", "0.6694639", "0.66394055", "0.66372293", "0.6557312", "0.65152556", "0.6488042", "0.64863986", "0.64772093", "0.6472387", "0.6460976", "0.6445166", "0.642431", "0.641943...
0.7632398
0
Returns the location of the slice mask for the requested index. It does not validate the index. A subject must be set prior to call this method
def get_mask_png_location(self, index): if self.subject == None: raise AssertionError('A subject must be set before calling this method') f = Locations.partial_formatter return f(self.SLICE_MASK_PNG, index=index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask_index(self) -> int:\n return self._mask_index", "def mask(self):\n return self.mask_index", "def get_mask(self, index):\n if not self.masked:\n return None\n \n x, y = self.location_of(index)\n # Do not take patches from out of bounds spaces\n ...
[ "0.73455626", "0.7261472", "0.64302695", "0.639594", "0.62014866", "0.60594404", "0.6010678", "0.59553385", "0.59553385", "0.59553385", "0.59553385", "0.57957006", "0.57448375", "0.5725256", "0.57158476", "0.5667323", "0.56491894", "0.5641712", "0.5563752", "0.5561733", "0.55...
0.73636913
0
Returns the location of the requested label file. A subject must be set prior to call this method
def get_label_png_location(self, index): if self.subject == None: raise AssertionError('A subject must be set before calling this method') f = Locations.partial_formatter return f(self.LABELS_PNG, index=index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetPathFromLabel(self, label):\n\n return os.path.join(self.GetRoot(),\n self._GetRelativeLabelPath(label))", "def _GetRelativeLabelPath(self, label):\n\n if self._AreLabelsPaths():\n return label\n\n path = \"\"\n components = self.GetLabelC...
[ "0.6648611", "0.6380659", "0.62147915", "0.6169521", "0.591856", "0.5886688", "0.58614296", "0.5729815", "0.57252276", "0.5621918", "0.5616924", "0.5591803", "0.5585961", "0.55759835", "0.5569629", "0.55620193", "0.5542063", "0.5513758", "0.54805475", "0.54596347", "0.5458770...
0.64731854
1
Returns the location of the requested histology file. A subject must be set prior to call this method
def get_histo_png_location(self,index): if self.subject == None: raise AssertionError('A subject must be set before calling this method') f = Locations.partial_formatter return f(self.HISTO_PNG,index=index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_path(self):\n return self._obs_file()", "def get_location(self):\n return os.path.dirname(self.filename)", "def svn_fs_history_location(*args):\r\n return _fs.svn_fs_history_location(*args)", "def file_loc(self):\n\t\treturn self.__dbfile", "def get_hist(self, dmc, year, trigger, pt...
[ "0.59872836", "0.57290167", "0.5555855", "0.55376714", "0.5519211", "0.55075973", "0.5495559", "0.54652685", "0.5446337", "0.54237443", "0.54112005", "0.53727615", "0.5362345", "0.53595704", "0.5332021", "0.531647", "0.5274756", "0.5249345", "0.52212", "0.52183527", "0.521678...
0.6232143
0
Close and reopen all file handlers.
def reopen_files(self): for log in (self.error_log, self.access_log): for h in log.handlers: if isinstance(h, logging.FileHandler): h.acquire() h.stream.close() h.stream = open(h.baseFilename, h.mode) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_all_file_handles(self):\n\n if isinstance(getattr(self, \"_file_handles\", None), dict):\n for fh in self._file_handles.values():\n fh.close()\n self._file_handles.clear()", "def close(self):\n if not self.__closed:\n self.counters = { \"err...
[ "0.7845344", "0.75302327", "0.7509484", "0.72066605", "0.7174362", "0.7027809", "0.70179516", "0.6978493", "0.6978493", "0.68127835", "0.6807487", "0.6763765", "0.67139983", "0.66308576", "0.6599396", "0.6508524", "0.6469078", "0.6453326", "0.63491166", "0.62819314", "0.62806...
0.78520674
0
Convert to a new object of networkx.MultiGraphlike class cls
def convertTo( self, cls, data=False, keys=False ): g = cls() g.add_nodes_from( self.nodes( data=data ) ) g.add_edges_from( self.edges( data=( data or keys ), keys=keys ) ) return g
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_graph(edges):\n \n G = nx.MultiGraph()\n G.add_edges_from(edges)\n return G", "def collapse_multigraph_to_nx(graph: Union[gr.MultiDiGraph, gr.OrderedMultiDiGraph]) -> nx.DiGraph:\n\n # Create the digraph nodes.\n digraph_nodes: List[Tuple[int, Dict[str, nd.Node]]] = ([None] * graph.nu...
[ "0.6156872", "0.6093618", "0.60673475", "0.59905785", "0.5913077", "0.5776343", "0.57379025", "0.57106227", "0.56839067", "0.5642758", "0.5619346", "0.558172", "0.5574337", "0.55602324", "0.5526403", "0.5499183", "0.54969406", "0.5460194", "0.54598016", "0.54490125", "0.54461...
0.63634163
0
Transforme une video en dictionnaire "JSON" de ses keypoints
def video_to_dict(inputVideo, start, end): params = set_params(tracking = 0, hand_opti = True) opWrapper = init_openpose(params) videoJson = [] vs = cv2.VideoCapture(inputVideo) vs.set(cv2.CAP_PROP_FPS, 25) id_frame = 1 while(1): (ret, frame) = vs.read() if (not ret) or (end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrangle_video_record(json_obj: dict):\n entry_dict = {}\n for key, value in get_final_key_paths(\n json_obj, '', True, black_list=['localized', 'thumbnails'],\n final_keys_only=True):\n if key in video_keys_and_columns: # converting camelCase to underscore\n new_k...
[ "0.6351646", "0.62693363", "0.6039878", "0.5948034", "0.58440053", "0.58440053", "0.57589173", "0.57589173", "0.57279646", "0.5714623", "0.56589276", "0.56396013", "0.5506513", "0.54930335", "0.5426834", "0.5410226", "0.5388581", "0.53463376", "0.53265417", "0.5283384", "0.52...
0.6927642
0
Ecrit en format JSON le contenu du dictionnaire videoJson sous le nom {id_gloss}_{id_instance}.json
def dict_to_json(videoJson, id_gloss, id_instance): path = "/home/nmiguens/JSON/WLASL" name = "{}_".format(id_gloss) + "{}.json".format(id_instance) with open(os.path.join(path, name), 'w') as fout: json.dump(videoJson , fout) return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrangle_video_record(json_obj: dict):\n entry_dict = {}\n for key, value in get_final_key_paths(\n json_obj, '', True, black_list=['localized', 'thumbnails'],\n final_keys_only=True):\n if key in video_keys_and_columns: # converting camelCase to underscore\n new_k...
[ "0.6025468", "0.5868325", "0.57273495", "0.56607246", "0.56546223", "0.5646203", "0.56321543", "0.56124234", "0.55609107", "0.5533504", "0.55251294", "0.55178976", "0.5456793", "0.54222846", "0.54157853", "0.54101205", "0.53957343", "0.5393648", "0.539035", "0.53855884", "0.5...
0.7464959
0
Creates instance of DungeonMap using id of Dungeon and calls function to update rooms. Should only be used ONCE
def _update_map(self): # Creates an instance of DungeonMap using the id of Dungeon self._map = DungeonMap(self._id) # Calls function to update rooms self._map._update_rooms()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_map(self) -> GameMap:\n player = self.engine.player\n dungeon = GameMap(\n self.engine, self.map_width, self.map_height, entities=[player]\n )\n\n player.place(int(self.map_width / 2), int(self.map_height / 2), dungeon)\n\n start_pos = (int(self.map_width / 2...
[ "0.6638245", "0.66051424", "0.6174843", "0.6125215", "0.6114841", "0.60952884", "0.60184324", "0.5820419", "0.5677035", "0.5667187", "0.560798", "0.55109024", "0.5457504", "0.5321221", "0.5276006", "0.52715224", "0.5267841", "0.52529025", "0.5226872", "0.52195966", "0.5119134...
0.8780594
0
Tests the home page.
def test_home(self): response = self.client.get('/') self.assertContains(response, 'Home Page', 1, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_home(self):\n response = self.client.get('/')\n self.assertContains(response, 'Home Page', 1, 200)", "def test_home_page(self):\r\n url = reverse('home')\r\n response = self.client.get(url)\r\n\r\n self.assertEqual(response.status_code, 200)", "def test_home_page(sel...
[ "0.85700876", "0.83283335", "0.8285781", "0.82591826", "0.82452273", "0.82392025", "0.82392025", "0.8199806", "0.8114395", "0.8091571", "0.8031986", "0.7946267", "0.79409236", "0.79266375", "0.7866116", "0.7856337", "0.7807612", "0.7719456", "0.7685034", "0.7626273", "0.75936...
0.86721593
0
Tests the contact page.
def test_contact(self): response = self.client.get('/contact') self.assertContains(response, 'Contact', 4, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_contact_page(self, client):\n response = client.get(url_for('contact.index'))\n assert response.status_code == 200", "def test_contact(self):\n response = self.client.get('/contact')\n self.assertContains(response, 'Contact', 3, 200)", "def test_contact_page(self):\n ...
[ "0.865358", "0.8362252", "0.83329916", "0.8207289", "0.7702842", "0.76554585", "0.7019257", "0.699411", "0.68651897", "0.6854455", "0.6845448", "0.68376964", "0.6822424", "0.6779587", "0.6712402", "0.6696219", "0.66620266", "0.66492194", "0.6567752", "0.6566299", "0.65647703"...
0.84670943
1
Tests the register page.
def test_register(self): response = self.client.get('/register') self.assertContains(response, 'Register', 3, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_register_page(self):\n\n result = self.client.get('/register')\n self.assertIn('<h1>Register</h1>', result.data)\n\n print \"DONE WITH REGISTER CHECK\"", "def test_registerpage_view(self):\n response = self.client.get(url_for('register'))\n self.assertEqual(response.st...
[ "0.8870613", "0.83922213", "0.83834046", "0.80776733", "0.80514234", "0.8031665", "0.8017677", "0.79519755", "0.79405785", "0.78576744", "0.78112644", "0.77617806", "0.7749312", "0.7685649", "0.74160886", "0.74112695", "0.7395869", "0.73778504", "0.7310296", "0.7306154", "0.7...
0.85511273
1
Ordered object for configuration. Loops through files in the `configs`directory by weight, and breaks after it finishes the file which contains the `environment` key.
def __init__(self, environment='develop'): cwd = path.dirname(path.abspath(__file__)) config_dir = path.join(cwd, 'configs') config_files = [] for (root, _, file_names) in walk(config_dir): for file_name in file_names: config_files.append(path.join(root, fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_builds(self):\n conf = build_config.BuildConfig(\n cmake_defs={\"BOARD\": self.config.zephyr_board}\n )\n\n kconfig_files = []\n prj_conf = self.config.project_dir / \"prj.conf\"\n if prj_conf.is_file():\n kconfig_files.append(prj_conf)\n kco...
[ "0.5682938", "0.56562144", "0.56032443", "0.55194974", "0.5488775", "0.5429362", "0.53881335", "0.53552264", "0.5261554", "0.5189298", "0.5165816", "0.5155886", "0.51521325", "0.51439726", "0.51407737", "0.5138546", "0.51242834", "0.51000327", "0.50886273", "0.50497407", "0.5...
0.6080864
0
n, the number of stairs O(2n) time and space
def climbing_stairs(n): if n < 2: return 1 if n == 2: return 2 return climbing_stairs(n-1) + climbing_stairs(n-2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amount_of_stairs(n):\n\n matrix = [[0] * n for i in range(n)]\n\n for i in range(0, n):\n for j in range(1, i):\n matrix[i][j] = sum(matrix[i - j - 1][:j])\n matrix[i][i] = 1\n\n # print_matrix(matrix)\n return sum(matrix[n-1])", "def climbing_stairs(n):\n\tdico = {0:1, 1...
[ "0.80979145", "0.7657417", "0.7441372", "0.6898625", "0.6698458", "0.66620463", "0.6619402", "0.65921396", "0.65706915", "0.6519971", "0.64716715", "0.629827", "0.62598455", "0.6244193", "0.62325424", "0.6217279", "0.6208951", "0.61819106", "0.60444623", "0.6036394", "0.60297...
0.7815618
1
Evaluate the Borehole function on a set of input values.
def evaluate(xx: np.ndarray) -> np.ndarray: # Compute the Borehole function nom = 2 * np.pi * xx[:, 2] * (xx[:, 3] - xx[:, 5]) denom_1 = np.log(xx[:, 1] / xx[:, 0]) denom_2 = ( 2 * xx[:, 6] * xx[:, 2] / (np.log(xx[:, 1] / xx[:, 0]) * xx[:, 0] ** 2 * xx[:, 7]) ) de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _computeValueFunction(self, nbDims, low, high, retstep=False):\n # algorithms performing in discrete space will have a discrete\n # value function that cannot be evaluated at any point - only on the\n # ones for which they have been setup based on the problem it has been\n # setup t...
[ "0.5320009", "0.5202257", "0.5186564", "0.5178047", "0.5152033", "0.5131482", "0.5117862", "0.5089781", "0.50886065", "0.506275", "0.5042652", "0.5041347", "0.50235534", "0.50224406", "0.50089675", "0.4991437", "0.49813336", "0.49782556", "0.4977974", "0.4956625", "0.4945631"...
0.6051596
0
Returns the weak classifier that produces the least error for a given training set
def _fetch_best_weak_classifier(self, weighted_patches): min_error = 2. print "Training and measuring error for %d classifiers" % len(self.all_classifiers), dec = .05 i = 0 for wc in self.all_classifiers: i += 1 wc.train(weighted_patches) if wc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainWeakClassifier(trainingSamples, weights, feature):\n #compute feature values\n featureValues = []\n positiveOrNegative = []\n for sample in trainingSamples:\n featureValues.append(feature.computeScore(sample[0], 0, 0))\n positiveOrNegative.append(sample[1])\n \n #zip wi...
[ "0.67219883", "0.6134577", "0.6098932", "0.6068661", "0.6026129", "0.60093874", "0.5770285", "0.5695005", "0.56644756", "0.56505865", "0.5635311", "0.5626304", "0.5611976", "0.55347", "0.5491511", "0.54789203", "0.54689837", "0.54498893", "0.54498893", "0.54152846", "0.541088...
0.7245201
0
H_t(x) returns the summation of the responses of the first t weak classifiers.
def h_t(self, x, t): ret = 0 strong_classifier = self.classifiers[0:t+1] for wc in strong_classifier: ret += wc.classify(x) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_step(self, x, h):\n concatHX = torch.cat((x, h), 1)\n ft = self.sigmoid(self.linearF(concatHX))\n it = self.sigmoid(self.linearI(concatHX))\n newCt = ft*self.ct.clone() + it*self.tanh(self.linearC(concatHX))\n #self.ct = ft*self.ct.clone() + it*self.tanh(self.linearC(conc...
[ "0.68166625", "0.67978925", "0.6778078", "0.6264831", "0.61125785", "0.60929614", "0.60755724", "0.6063902", "0.600523", "0.59320676", "0.5920946", "0.5919724", "0.58609223", "0.58361953", "0.5825794", "0.58144814", "0.579117", "0.57640105", "0.57490045", "0.5742261", "0.5742...
0.74814725
0
H_t(x) returns the summation of the responses of the first t weak classifiers.
def h_t(self, x, t): ret = 0 strong_classifier = self.classifiers[0:t+1] for wc in strong_classifier: ret += wc.classify(x) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_step(self, x, h):\n concatHX = torch.cat((x, h), 1)\n ft = self.sigmoid(self.linearF(concatHX))\n it = self.sigmoid(self.linearI(concatHX))\n newCt = ft*self.ct.clone() + it*self.tanh(self.linearC(concatHX))\n #self.ct = ft*self.ct.clone() + it*self.tanh(self.linearC(conc...
[ "0.6817799", "0.67995626", "0.67790145", "0.62669414", "0.61134875", "0.60938984", "0.6076991", "0.6066603", "0.600625", "0.5934693", "0.59222114", "0.5919796", "0.58628464", "0.58377874", "0.58264107", "0.58153915", "0.579338", "0.5765072", "0.5750654", "0.5745055", "0.57428...
0.74806714
1
Search for a book by ISBN number
def searchbook(isbn): print("Searching for isbn " + isbn + " in googlebooks...") result = _search_by_isbn(isbn) if result["totalItems"] == 0: return None b = _item2book(result["items"][0]) return b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_book_by_isbn(isbn):\n return Book.get_book(isbn)", "def test_search_by_ISBN(self):\n s1 = System()\n b1 = Books(\"1984\", \"George Orwell\", \"Harvill Secker\", \"1949\", \"0123456789123\")\n self.assertEqual(s1.search_by_ISBN(\"0123456789123\"), 0)\n s1.add_resource(b1)\n ...
[ "0.79139775", "0.7770317", "0.75252795", "0.69055563", "0.68805486", "0.6762374", "0.6645071", "0.6621116", "0.6558435", "0.65381473", "0.64426", "0.64143974", "0.6401315", "0.63997155", "0.6371291", "0.6358525", "0.6311553", "0.62363183", "0.62286764", "0.6191785", "0.613116...
0.825122
0
Get the second move of the user from keyboard.
def getSecondMove(self, firstMove): while True: try: move = tuple(int(str.strip()) for str in raw_input('Choose your second move: ').split(',')) break except ValueError: print("Input is not a integer.") while len(move) != 2 or abs(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_move(self):\n return int(input('Enter your move: '))", "def get_next_move(self):\n if self.move == 'X':\n return 'O'\n return 'X'", "def second_move(self):\n self.play_sound(self.second_key)\n self.end_move()", "def getMovement(self):\n keys = uga...
[ "0.6976197", "0.61256886", "0.607909", "0.60758954", "0.60556537", "0.59408665", "0.59039104", "0.582013", "0.5779158", "0.57545716", "0.5722253", "0.57185733", "0.57105273", "0.56864023", "0.5655696", "0.56548995", "0.56412286", "0.5633291", "0.5616646", "0.55753934", "0.557...
0.6608401
1
Print the win rate of the user against the computer.
def calculateWinRate(): times = 10 winRate = 0.0 for i in range(times): game = Game('user', 6, 6) winRate += game.play(5, False, True, False, False) winRate = winRate/times print "Winrate:", winRate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_stats(self):\n print(\"Simulation took: {:.2f} seconds to execute\".format(time.time() - self.start_time))\n for i, win in enumerate(self.wins):\n average = 0\n if win:\n average = float(self.tries[i]) / win\n print(\"Player {} wins: {} with...
[ "0.73558235", "0.6755521", "0.6746405", "0.66018116", "0.65230495", "0.641469", "0.6412145", "0.6407791", "0.6297011", "0.6257574", "0.62541705", "0.6229966", "0.62088585", "0.61787057", "0.61663157", "0.61631507", "0.6109566", "0.6108312", "0.6083345", "0.6081153", "0.604782...
0.69364434
1
Recupera un empleado por su id
def get(self, id): resultado = EmployeeModel.query.filter_by(employee_id=id).first() if resultado: return resultado api.abort(404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_employee(self, id):\n from Employee import Employee\n cursor = self.dbconnect.get_cursor()\n cursor.execute('SELECT * FROM employee WHERE employeeID=%s ', (id,))\n row = cursor.fetchone()\n return Employee(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], ro...
[ "0.6796346", "0.6473423", "0.6111904", "0.61043555", "0.6066562", "0.59767336", "0.59119356", "0.58309406", "0.5822549", "0.5791337", "0.57300967", "0.5717637", "0.57097596", "0.56613207", "0.5634401", "0.5623324", "0.5607379", "0.55943084", "0.5550843", "0.5541731", "0.55400...
0.6809357
0
Elimina un empleado por su id
def delete(self, id): empleadoeliminar = EmployeeModel.query.filter_by(employee_id=id).first() if empleadoeliminar: db.session.delete(empleadoeliminar) db.session.commit() return 201 api.abort(404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deletar_empresa(id):\n empresa = Empresa.query.get_or_404(id)\n \n db.session.delete(empresa)\n db.session.commit()\n flash('Empresa deletada com sucesso.')\n\n return redirect(url_for('home.listar_empresas'))", "def remove_employee(self, id):\n cursor = self.dbconnect.get_cursor()\n...
[ "0.7282368", "0.7227127", "0.71270996", "0.6703881", "0.66633046", "0.664032", "0.6582684", "0.6498842", "0.6348776", "0.6261464", "0.6236101", "0.62215394", "0.61652684", "0.6162873", "0.61538523", "0.61431855", "0.61428344", "0.6076793", "0.6056831", "0.6049542", "0.60467",...
0.75576895
0
Actualiza los datos de un empleado por su id
def put(self, id): empleadoactualizar = EmployeeModel.query.filter_by(employee_id=id).first() if empleadoactualizar: reg = api.payload empleadoactualizar.employee_id = reg['employee_id'] empleadoactualizar.name = reg['name'] empleadoactualizar.age = reg['a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_employee(self, obj):\n cursor = self.dbconnect.get_cursor()\n try:\n cursor.execute('UPDATE employee '\n 'SET name = %s, email = %s, office = %s, extra_info = %s, picture_location = %s, '\n 'research_group = %s, title = %s, is_...
[ "0.6351262", "0.6216321", "0.60944134", "0.60876113", "0.60243225", "0.59532285", "0.5936486", "0.59092456", "0.5875384", "0.5838871", "0.5790332", "0.5743715", "0.5691845", "0.5663868", "0.56201196", "0.56019706", "0.5600619", "0.5597508", "0.5596143", "0.55812967", "0.55798...
0.7382169
0
This endpoint allows clients to GET the min sensor reading for a device.
def request_device_readings_min(device_uuid): # Set the db that we want and open the connection if app.config['TESTING']: conn = sqlite3.connect('test_database.db') else: conn = sqlite3.connect('database.db') conn.row_factory = sqlite3.Row cur = conn.cursor() # Execute the quer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_device_readings_min(device_uuid):\n\n if request.data:\n post_data = json.loads(request.data)\n type = post_data.get('type', None)\n if not type or type not in ('temperature', 'humidity'):\n return 'error on the required type data', 400\n start = post_data.get(...
[ "0.73609155", "0.7277634", "0.6801135", "0.6467421", "0.62297684", "0.6126676", "0.6126676", "0.60351396", "0.5986735", "0.59371185", "0.59295577", "0.592824", "0.59234166", "0.5918338", "0.59107876", "0.58846885", "0.5864855", "0.5862119", "0.58309174", "0.58287567", "0.5826...
0.7499323
0
This endpoint allows clients to GET the max sensor reading for a device.
def request_device_readings_max(device_uuid): # Set the db that we want and open the connection if app.config['TESTING']: conn = sqlite3.connect('test_database.db') else: conn = sqlite3.connect('database.db') conn.row_factory = sqlite3.Row cur = conn.cursor() # Execute the quer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_device_readings_max(self):\n request = self.client().get('/devices/{}/readings/max/'.format(self.device_uuid))\n\n self.assertEqual(request.json.get('value', None), 100)", "def request_device_readings_max(device_uuid):\n\n if request.data:\n post_data = json.loads(request.data)\n...
[ "0.7779371", "0.75452", "0.6591695", "0.6190245", "0.6057066", "0.59755903", "0.5965035", "0.58626163", "0.58388036", "0.5802646", "0.5797329", "0.57818156", "0.5768744", "0.5755819", "0.5721714", "0.5696872", "0.56544673", "0.56484824", "0.564793", "0.56272566", "0.56242967"...
0.779173
0
This endpoint allows clients to GET the median sensor reading for a device.
def request_device_readings_median(device_uuid): # Set the db that we want and open the connection if app.config['TESTING']: conn = sqlite3.connect('test_database.db') else: conn = sqlite3.connect('database.db') conn.row_factory = sqlite3.Row cur = conn.cursor() # Execute the que...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_device_readings_median(device_uuid):\n\n if request.data:\n post_data = json.loads(request.data)\n type = post_data.get('type', None)\n if not type or type not in ('temperature', 'humidity'):\n return 'error on the required type data', 400\n start = post_data.g...
[ "0.7735845", "0.7634895", "0.67608035", "0.64864635", "0.63579154", "0.6352341", "0.6207965", "0.618097", "0.6035242", "0.59368026", "0.59210455", "0.5914636", "0.5910662", "0.58867925", "0.5876195", "0.582881", "0.5785498", "0.5767511", "0.5755149", "0.5734404", "0.57133216"...
0.7654329
1
This endpoint allows clients to GET the mean sensor readings for a device.
def request_device_readings_mean(device_uuid): # Set the db that we want and open the connection if app.config['TESTING']: conn = sqlite3.connect('test_database.db') else: conn = sqlite3.connect('database.db') conn.row_factory = sqlite3.Row cur = conn.cursor() # Execute the que...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_device_readings_mean(device_uuid):\n\n if request.data:\n post_data = json.loads(request.data)\n type = post_data.get('type', None)\n if not type or type not in ('temperature', 'humidity'):\n return 'error on the required type data', 400\n start = post_data.get...
[ "0.7780582", "0.7480308", "0.6766443", "0.67064244", "0.6468211", "0.64030886", "0.6369193", "0.63479865", "0.6325126", "0.6304141", "0.61911434", "0.6138687", "0.61250997", "0.60851073", "0.60354185", "0.6026088", "0.5993065", "0.5972872", "0.5889185", "0.5886066", "0.585985...
0.779958
0
Removes old files from a directory older than a given limit
def removeOldFiles(directory,daysLimit): files = os.listdir(directory) files = [ f for f in files if re.search('.tif$', f, re.I)] now = time.time() for file in files: if os.stat(directory+file).st_mtime < now - daysLimit * 86400: if os.path.isfile(directory+file): os....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_old_entries(captchas_dir, max_age=1200):\n if access(captchas_dir, W_OK):\n basetime = datetime.datetime.now() - datetime.timedelta(seconds=max_age)\n for dname in listdir(captchas_dir):\n d = path.join(captchas_dir, dname)\n if basetime > datetime.datetime.fromtime...
[ "0.7052211", "0.69445324", "0.68056613", "0.6585461", "0.65334916", "0.6289249", "0.62429726", "0.6144015", "0.5986444", "0.59845823", "0.59236914", "0.58389485", "0.581854", "0.5799415", "0.5794532", "0.57340544", "0.5671793", "0.56483847", "0.5646341", "0.56375355", "0.5629...
0.7327303
0
Generate input file for ANN
def genInput(tasksInfo, results, origLocation, destLocation, typeGray, samplSize = 0.10): print '\nbegin of genInput\n' # Training / aplication treina = True verdade = False # Sampling pixels from image sampl = True if sampl == True: buildSampl = True else: buildSampl = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_train_txt(name, path):\n with open(path + '/test.txt', 'a') as file:\n file.write('/content/YOLO_metric/data/obj/' + name + '\\n')", "def train(self, trainfile):", "def main(input_filepath, output_filepath):\n logger = logging.getLogger(__name__)\n logger.info('making final data se...
[ "0.6576268", "0.6575241", "0.65125704", "0.65125704", "0.6435176", "0.6422982", "0.6407261", "0.6396108", "0.6367985", "0.63629234", "0.6240938", "0.6206771", "0.61674213", "0.6161097", "0.61383295", "0.6135501", "0.6114891", "0.60825133", "0.6082016", "0.6017317", "0.6014352...
0.66078776
0
Converts RGB values to gray scale depending on type of convertion
def rgb2gray(R,G,B,T): gammaCorrection = (1.0/2.2) if T == 'intensity': grayValue = (R+G+B)/3.0 elif T == 'gleam': grayValue = (R**(gammaCorrection)+G**(gammaCorrection)+B**(gammaCorrection))/3.0 elif T == 'luminance': grayValue = 0.3*R + 0.59*G + 0.11*B elif T == 'luma': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb2gray(rgb):\n # this will translate a uint8 array into a float64 one\n grey = np.dot(rgb[..., :3], [0.299, 0.587, 0.114])\n # transform back if the input is a uint8 array\n if rgb.dtype.type is np.uint8:\n grey = round(grey).astype(np.uint8)\n return grey", "def convertImageToGrey(se...
[ "0.7124209", "0.70213044", "0.70147705", "0.6998558", "0.69844764", "0.6971335", "0.6954955", "0.6914645", "0.68670905", "0.6861035", "0.6856123", "0.68298274", "0.6808763", "0.6797492", "0.67851967", "0.6773447", "0.6722287", "0.6699727", "0.6688521", "0.66259533", "0.662455...
0.74719244
0
Check if the exchange exist
def check_exchange_exists(self, exchange_name): try: yield from self.exchange_declare(exchange_name, passive=True) except asyncio.exceptions.ChannelClosed: return False exchange = self.http_client.get_exchange(self.VHOST, exchange_name) return exchange is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertExchangeExists(self, exchange_name):\n exchange = self.http_client.get_exchange(self.VHOST, exchange_name)\n if not exchange or not self.check_exchange_exists(exchange_name):\n self.fail(\"Exchange {} does not exists\".format(exchange_name))", "def test_update_exchange_not_exis...
[ "0.76463896", "0.6932534", "0.6805306", "0.651784", "0.6458291", "0.6433818", "0.63781905", "0.62697124", "0.62050086", "0.60667396", "0.60465", "0.6019676", "0.5993576", "0.59078103", "0.581015", "0.5700562", "0.5681127", "0.5681127", "0.5673045", "0.564337", "0.5592218", ...
0.81995
0
Check if the exchange exists
def assertExchangeExists(self, exchange_name): exchange = self.http_client.get_exchange(self.VHOST, exchange_name) if not exchange or not self.check_exchange_exists(exchange_name): self.fail("Exchange {} does not exists".format(exchange_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_exchange_exists(self, exchange_name):\n try:\n yield from self.exchange_declare(exchange_name, passive=True)\n except asyncio.exceptions.ChannelClosed:\n return False\n exchange = self.http_client.get_exchange(self.VHOST, exchange_name)\n return exchange ...
[ "0.8322733", "0.67963177", "0.6719261", "0.6502801", "0.63569736", "0.6326286", "0.6242829", "0.6210772", "0.61285925", "0.604688", "0.6040342", "0.59260064", "0.5919058", "0.59123266", "0.57819825", "0.57609856", "0.56974137", "0.5673107", "0.5673107", "0.5597733", "0.559433...
0.777473
1
Check if the queue exist
def check_queue_exists(self, queue_name): try: yield from self.queue_declare(queue_name, passive=True) except asyncio.exceptions.ChannelClosed: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_queue(self):\n return (os.path.exists(self._queue_path) and\n os.path.getsize(self._queue_path) > 0)", "def queue_exists(self, queue_name):\n # resp = self._channel.queue_declare(queue_name, passive=True,\n # callback=self._queue_exis...
[ "0.8026836", "0.78004205", "0.77506423", "0.73082227", "0.717858", "0.7174335", "0.7098522", "0.7097279", "0.703504", "0.69714975", "0.6923398", "0.6896911", "0.68656427", "0.68311435", "0.6799334", "0.6783198", "0.67765915", "0.67744863", "0.67744863", "0.6768916", "0.674215...
0.8107538
0
Delete the exchange but does not raise any exception if it fails The operation has a timeout as well.
def safe_exchange_delete(self, exchange_name, channel=None): channel = channel or self.channel full_exchange_name = self.full_name(exchange_name) try: yield from channel.exchange_delete(full_exchange_name, no_wait=False, timeout=1.0) except asyncio.TimeoutError: l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_exchange(self):\n new_exchange = self.app.add_exchange(\"test\", \"test\", \"test\")\n ret = self.app.delete_exchange(new_exchange.id)\n self.assertIn(ret[0], \"success\")", "def test_delete_exchange_not_exists(self):\n ret = self.app.delete_exchange(20)\n self....
[ "0.7276048", "0.71246606", "0.6664925", "0.607659", "0.5633418", "0.563197", "0.5606057", "0.55958897", "0.5558147", "0.55456984", "0.55141497", "0.54579496", "0.5420487", "0.53386253", "0.53213537", "0.531655", "0.52993995", "0.52779245", "0.52039284", "0.51991016", "0.51729...
0.75520235
0
this test will fail is there is no step function deployed on aws
def test_stepfunction_exists2(): sf = boto3.client('stepfunctions') res= sf.list_state_machines() sfn_name = res['stateMachines'][0]['name'] # some existing step function assert Job.stepfunction_exists(sfn_name) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_deployment(self):\n pass", "def test_launch_deployment(self):\n pass", "def test_get_deployment_run(self):\n pass", "def TestOneStep(self):\n pass", "def test_aws_provisioner(host):\n\n assert True", "def test_no_such_step(self):\n with self.assertRa...
[ "0.68600166", "0.6702098", "0.656663", "0.65146595", "0.6469141", "0.6326048", "0.63145554", "0.63145554", "0.63077724", "0.62984747", "0.6284911", "0.62324506", "0.6199514", "0.61387306", "0.6086996", "0.6077555", "0.6043144", "0.59923697", "0.5979849", "0.5977083", "0.59760...
0.7515801
0
Raise NotAuthenticated exception if not authenticated.
def check_authentication(self, request): if not self.request.user.is_authenticated: raise NotAuthenticated()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _authenticated_or_die(self):\n if not self._authenticated:\n raise Exception('The client is not authenticated!')", "def test_not_authenticated(self):\n pass # lint-amnesty, pylint: disable=unnecessary-pass", "def test_not_authenticated(self):\n pass # lint-amnesty, pylint:...
[ "0.81067973", "0.7579304", "0.7579304", "0.68916255", "0.6863911", "0.6831236", "0.67285824", "0.67270446", "0.67251", "0.67042917", "0.6684563", "0.6644959", "0.661338", "0.6590485", "0.6588753", "0.6570428", "0.6554263", "0.652594", "0.652594", "0.652594", "0.64416474", "...
0.7580139
1
Return whether this is a getting action.
def is_get(self): return self.action in ["list", "retrieve"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bool__(self):\n return bool(self._actions)", "def match_action(self, action):\n\n return hasattr(self, self._action_handler_name(action))", "def is_action(self) -> bool:\n return self.is_action_str(self.content)", "def action_required(self) -> Optional[pulumi.Input[str]]:\n ...
[ "0.66465306", "0.6514637", "0.63705033", "0.61986583", "0.61492366", "0.611826", "0.6019523", "0.6010379", "0.6007403", "0.60029685", "0.5971159", "0.5971159", "0.5971159", "0.5971159", "0.59573185", "0.58928037", "0.58693737", "0.58690596", "0.58690596", "0.58690596", "0.583...
0.85034436
0
Return whether this is an updatting action.
def is_update(self): return self.action in ["update", "partial_update"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_update_active(self):\n return self._update_action", "def isConfirmedDataUp(self):\n return self.mhdr.mtype == CO_DATA_UP", "def isUnconfirmedDataUp(self):\n return self.mhdr.mtype == UN_DATA_UP", "def isUp ( self ) :\n return not self.isDown()", "def __bool__(self):...
[ "0.65594274", "0.6467985", "0.63728833", "0.63440377", "0.61977506", "0.61768883", "0.6129319", "0.6117427", "0.6098021", "0.6055959", "0.60226405", "0.60025406", "0.5969736", "0.5941043", "0.5921024", "0.5878445", "0.58667946", "0.58482164", "0.58346134", "0.58339983", "0.57...
0.6551283
1
Filter queryset to users based on permissions.
def get_queryset(self, *args, **kwargs): qs = super().get_queryset(*args, **kwargs) user = self.request.user if not user.is_authenticated: return qs.none() if self.is_get and not user.has_perm("users.view_user"): return qs.filter(pk=user.pk) if self.is_upd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_queryset(self, request, queryset, view):\n if view.action == \"retrieve\" and request.method == \"GET\":\n return queryset.model.objects.all()\n\n filtered_queryset = super().filter_queryset(request, queryset, view)\n org_users = set(\n [group.team.organization...
[ "0.7223497", "0.70795846", "0.7036792", "0.6972066", "0.6936853", "0.6928938", "0.6916886", "0.6859023", "0.6803199", "0.67962486", "0.6774986", "0.6733345", "0.6714067", "0.6703698", "0.66519463", "0.66389406", "0.65361154", "0.65361154", "0.6525295", "0.65201217", "0.651718...
0.72607553
0
Detect obstacles by deploying Canny filter on the depth_colormap. Prerequisites
def detect_obstacle(depth_image, color_image, depth_colormap, depth_scale=0.001): height, width = int(color_image.shape[0]), int(color_image.shape[1]) font = cv2.FONT_HERSHEY_SIMPLEX text_position = int(height/10), int(width/10) # We will be removing the background of objects more than # clipping_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vis_detections(color_image, depth_colormap, class_col, dets_col, thresh=0.5):\n\n for cls_ind, class_name in enumerate(class_col):\n dets = dets_col[cls_ind]\n\n inds = np.where(dets[:, -1] >= thresh)[0]\n if len(inds) == 0:\n continue\n\n for i in inds:\n b...
[ "0.6465045", "0.63361573", "0.618783", "0.61272085", "0.6077512", "0.60599184", "0.60292345", "0.6024568", "0.601719", "0.5986781", "0.59664744", "0.5910309", "0.58662456", "0.58420956", "0.5835442", "0.58258045", "0.5802556", "0.5799526", "0.5788895", "0.5763871", "0.5751048...
0.766101
0
CounterPointer a model defined in Swagger
def __init__(self, counter_type: str=None, counter: int=None): # noqa: E501 self.swagger_types = { 'counter_type': str, 'counter': int } self.attribute_map = { 'counter_type': 'counterType', 'counter': 'counter' } self._counter_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_counter(self, counter, entity):", "def api_callcounter():\n try:\n return jsonify({'callcounter': get_model().call_counter})\n except Exception as e:\n response = jsonify({'error': 'API error'})\n response.status_code = 400\n return response", "def __init__(self, c...
[ "0.58467513", "0.5743902", "0.54858905", "0.5383966", "0.5349426", "0.5337461", "0.5337461", "0.5337461", "0.5337461", "0.5337461", "0.5311203", "0.5290875", "0.51737857", "0.5157004", "0.51550364", "0.51355237", "0.5131821", "0.51205987", "0.51058364", "0.50097054", "0.49639...
0.5896417
0
Gets the counter_type of this CounterPointer.
def counter_type(self) -> str: return self._counter_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_perfcount_type(self):\n return self._perfcount_type", "def get_type(self):\n return self._TYPE", "def getType(self):\n return self._type", "def get_type(self):\n return self._type", "def get_type(self):\n return self._type", "def type(self) -> MetricType...
[ "0.68725675", "0.6516205", "0.64693546", "0.6462432", "0.6462432", "0.64550483", "0.6409898", "0.6399005", "0.6373705", "0.636375", "0.6335509", "0.6335509", "0.6335509", "0.6335509", "0.6335509", "0.6335509", "0.6335509", "0.6335509", "0.6335509", "0.6335509", "0.6335509", ...
0.78557086
0
Sets the counter_type of this CounterPointer.
def counter_type(self, counter_type: str): allowed_values = ["character", "byte", "page"] # noqa: E501 if counter_type not in allowed_values: raise ValueError( "Invalid value for `counter_type` ({0}), must be one of {1}" .format(counter_type, allowed_values) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetType(self, ct_type):\r\n\r\n self._type = ct_type", "def set_type(self, type):\n self._type = type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self.type = type", "def __init__(self, counter_type: str=None, counter: int=None): # noqa: E5...
[ "0.6586995", "0.64445937", "0.6394954", "0.6394954", "0.6363235", "0.62764454", "0.62764454", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", "0.62655395", ...
0.77912813
0
Gets the counter of this CounterPointer.
def counter(self) -> int: return self._counter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCounter(self):\n return self.i", "def current(self):\n return self.counter.count", "def get_counter(self):\n counter = self.driver.find_element_by_name(self.COUNTER_NAME)\n return int(counter.text)", "def _get_counter(cls, counter_name: str, counter_category: str = None) ->...
[ "0.7747119", "0.69934356", "0.6839439", "0.670072", "0.66731805", "0.66731805", "0.66731805", "0.66731805", "0.6605191", "0.64229405", "0.6273553", "0.62684166", "0.6229281", "0.6121677", "0.61209786", "0.61209786", "0.6081115", "0.6050365", "0.6046811", "0.5928756", "0.58936...
0.7122936
1
Sets the counter of this CounterPointer.
def counter(self, counter: int): if counter is None: raise ValueError("Invalid value for `counter`, must not be `None`") # noqa: E501 self._counter = counter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setCount(self, num):\n self.count=num", "def set_sequence(self, counter):\n self.seq_counter = counter", "def inc_counter(self, *_, **__): # pylint: disable=arguments-differ\n pass", "def set_count(self, count):\n self._count = count", "def set_counter_increase(self, val=1)...
[ "0.6262257", "0.61544836", "0.6107164", "0.60725594", "0.60548764", "0.5941396", "0.59272134", "0.5889299", "0.5781394", "0.57757884", "0.5772924", "0.5759819", "0.5737988", "0.57238454", "0.56709605", "0.5640289", "0.559615", "0.5585219", "0.5573069", "0.554153", "0.55058885...
0.6550495
0
Context manager that sets the MAPPINGS_USE_NESTED setting with the given value, default True
def mappings_use_nested(value=True): old_setting = Settings.MAPPINGS_USE_NESTED try: Settings.MAPPINGS_USE_NESTED = value yield finally: Settings.MAPPINGS_USE_NESTED = old_setting
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isNest(self):\n\t\tif self.nestInfo == None:\n\t\t\treturn False\n\t\telse:\n\t\t\treturn True", "def test_documentation_popxl_nested_session_contexts(self):\n filename = \"nested_session_contexts.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def default_n...
[ "0.51234853", "0.5110324", "0.51092035", "0.5021755", "0.49843925", "0.49771792", "0.4961515", "0.46479183", "0.46340314", "0.45778015", "0.4566229", "0.45511296", "0.4512281", "0.4510831", "0.44475397", "0.4445361", "0.44344524", "0.4433714", "0.43684018", "0.43653566", "0.4...
0.65204585
0
Test basic mapping properties for each item type
def test_type_mapping(registry, item_type): with mappings_use_nested(False): mapping = type_mapping(registry[TYPES], item_type) assert mapping assert 'properties' in mapping if item_type == 'TestingLinkTargetElasticSearch': assert mapping['properties']['reverse_es'].get('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_items(self):\n self.assertEqual([(\"described_model_type\", self.expected_described_model)], list(self.mapped_model.items()))", "def test_create_mapping_drops_unmappable_properties(registry):\n test_item_type = \"embedding_test\"\n expected_embeds = [\"pattern_property_embed\", \"additional...
[ "0.72993106", "0.717978", "0.687299", "0.67445046", "0.67349356", "0.6609082", "0.63543266", "0.6196516", "0.6173583", "0.6149421", "0.61348146", "0.6124618", "0.6093486", "0.60665125", "0.6055508", "0.6018713", "0.5910689", "0.58788294", "0.5799283", "0.5745749", "0.5725811"...
0.76476127
0
Tests that mapping a field with a list of dicts in it maps with type=nested only if told to do so on the schema. For this case it is not specified, so if object is expected.
def test_type_mapping_nested(registry): with mappings_use_nested(True): mapping = type_mapping(registry[TYPES], 'TestingLinkTargetElasticSearch') assert mapping assert 'properties' in mapping # if type is defined on this field, it should beg object, NOT nested since it is not enabled...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_type_mapping_nested_with_disabled_parameter(registry):\n with mappings_use_nested(True):\n mapping = type_mapping(registry[TYPES], 'TestingNestedEnabled')\n assert mapping\n assert 'properties' in mapping\n assert mapping['properties']['object_options'].get('type', 'object')...
[ "0.65566456", "0.6533364", "0.64874804", "0.63195527", "0.61757094", "0.61565745", "0.5889713", "0.5874048", "0.58668673", "0.58391446", "0.58335656", "0.5819415", "0.58100975", "0.5807514", "0.57962775", "0.5795738", "0.57222366", "0.5711259", "0.570308", "0.56359315", "0.56...
0.66391444
0
Tests that mapping a type with an object field with nested enabled correctly maps with nested.
def test_type_mapping_nested_with_disabled_parameter(registry): with mappings_use_nested(True): mapping = type_mapping(registry[TYPES], 'TestingNestedEnabled') assert mapping assert 'properties' in mapping assert mapping['properties']['object_options'].get('type', 'object') != 'neste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_type_mapping_nested(registry):\n with mappings_use_nested(True):\n mapping = type_mapping(registry[TYPES], 'TestingLinkTargetElasticSearch')\n assert mapping\n assert 'properties' in mapping\n # if type is defined on this field, it should beg object, NOT nested since it is n...
[ "0.8126932", "0.72236913", "0.7048768", "0.6998724", "0.6372483", "0.61942005", "0.61895186", "0.5984007", "0.59549826", "0.5913331", "0.5892807", "0.58536166", "0.5798939", "0.5778446", "0.57278585", "0.5703927", "0.5660505", "0.5648864", "0.5636653", "0.5601702", "0.5564571...
0.74837184
1
Tests merging schemas with EmbeddingTest
def test_merge_schemas(registry): test_schema = registry[TYPES][unit_test_type].schema test_subschema = test_schema['properties']['attachment'] res = merge_schemas(test_subschema, registry[TYPES]) assert res assert res != test_subschema assert res['properties']['attachment']['attachment'] is Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_merge_model_relationships(bf, dataset, organization, assert_in_neo4j):\n person = dataset.create_model(\n \"Person\",\n schema=[ModelProperty(\"name\", data_type=str, title=True, required=True)],\n )\n\n food = dataset.create_model(\n \"Food\", schema=[ModelProperty(\"name\",...
[ "0.677895", "0.63466245", "0.6154003", "0.6025654", "0.6007597", "0.5987249", "0.5959084", "0.58845913", "0.58188117", "0.5803733", "0.5755856", "0.575136", "0.5711838", "0.568449", "0.5677796", "0.5663447", "0.5576394", "0.5543358", "0.5517996", "0.55151016", "0.5514564", ...
0.745198
0
Use EmbeddingTest schema to ensure unmappable properties under patternProperties and additionalProperties are not mapped.
def test_create_mapping_drops_unmappable_properties(registry): test_item_type = "embedding_test" expected_embeds = ["pattern_property_embed", "additional_property_embed"] expected_mapped_property = "should_be_mapped" mapping = type_mapping(registry[TYPES], test_item_type) mapped_properties = mapping...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_schema_strict():\n path = os.path.join(extensiondir, 'release-schema.json')\n if os.path.isfile(path):\n with open(path) as f:\n data = json.load(f)\n\n original = deepcopy(data)\n add_validation_properties(data)\n\n assert data == original, f'{path} is missing...
[ "0.61446816", "0.61118954", "0.6097759", "0.60460526", "0.59127545", "0.5869367", "0.58246493", "0.5662752", "0.56013864", "0.5595379", "0.5581337", "0.55700654", "0.5553623", "0.5466026", "0.54529816", "0.54280853", "0.53772664", "0.53680813", "0.5362037", "0.53439116", "0.5...
0.7337448
0
Test Elasticsearch items requiring an upgrade are identified for indexing.
def test_get_items_to_upgrade(mock_check_index, testapp, biosample): ignored(mock_check_index) # mocked for side effect app = testapp.app es = None # ES component mocked item_type = "testing_biosample_sno" biosample_uuid = biosample["uuid"] with mock.patch("snovault.elasticsearch.create_mappin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_with_auto_upgrade_latest_engine_enabled():", "def test_index_availability(client):\n response = client.get('/')\n assert response.status_code == 200", "def test_recreate_index_that_exists(self):\n indices = self.elasticsearch_cls().indices\n indices.exists.return_value = Tr...
[ "0.6379135", "0.6328735", "0.61283654", "0.6004192", "0.600253", "0.5985512", "0.59654146", "0.5963622", "0.5941494", "0.59300137", "0.59283274", "0.5898374", "0.5886221", "0.58828264", "0.58389443", "0.5829789", "0.5815221", "0.5757381", "0.57297903", "0.5676319", "0.5669657...
0.6900662
0
shape_dim=3, pad=list[1, 2], mode='constant', len(pad)=2, data_format=NCL
def test_Pad3D1(): input_shape = (1, 2, 3) pad = [1, 2] mode = "constant" res = [[[0, 1, 2, 3, 0, 0], [0, 4, 5, 6, 0, 0]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.base(res=res, padding=pad, mode=mode, data_format="NCL", data=data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D4():\n input_shape = (1, 2, 3)\n # pad = np.array([1, 2]).astype('int32')\n pad = [1, 2]\n mode = \"constant\"\n res = [[[0, 1, 2, 3, 0, 0], [0, 4, 5, 6, 0, 0]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.base(res=res, padding=pad, mode=mode, data_for...
[ "0.7574175", "0.7328738", "0.7217285", "0.7185073", "0.7179193", "0.71389383", "0.7063445", "0.6920521", "0.6832594", "0.6778972", "0.6775516", "0.6772584", "0.6717206", "0.67117643", "0.6686753", "0.66300046", "0.660099", "0.6598098", "0.6565018", "0.6488363", "0.64845353", ...
0.74304086
1
shape_dim=3, pad=tensor[1, 2], mode='constant', len(pad)=2, data_format=NCL
def test_Pad3D4(): input_shape = (1, 2, 3) # pad = np.array([1, 2]).astype('int32') pad = [1, 2] mode = "constant" res = [[[0, 1, 2, 3, 0, 0], [0, 4, 5, 6, 0, 0]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.base(res=res, padding=pad, mode=mode, data_format="NCL", dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D1():\n input_shape = (1, 2, 3)\n pad = [1, 2]\n mode = \"constant\"\n res = [[[0, 1, 2, 3, 0, 0], [0, 4, 5, 6, 0, 0]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.base(res=res, padding=pad, mode=mode, data_format=\"NCL\", data=data)", "def test_Pad3D16(...
[ "0.7340136", "0.7218572", "0.7137639", "0.7123048", "0.70074975", "0.6894596", "0.6894202", "0.68156576", "0.67800885", "0.6777805", "0.67192423", "0.6674043", "0.6633804", "0.6597761", "0.6552479", "0.6533389", "0.65330267", "0.64464813", "0.64454484", "0.64092356", "0.64089...
0.7512845
0
shape_dim=3, pad=tensor[1, 0, 1, 2], mode='constant', len(pad)=4, data_format=NCHW
def test_Pad3D5(): input_shape = (1, 1, 2, 3) # pad = np.array([1, 0, 1, 2]).astype('int32') pad = [1, 0, 1, 2] mode = "constant" res = [[[[0, 0, 0, 0], [0, 1, 2, 3], [0, 4, 5, 6], [0, 0, 0, 0], [0, 0, 0, 0]]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.run(res=res, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D4():\n input_shape = (1, 2, 3)\n # pad = np.array([1, 2]).astype('int32')\n pad = [1, 2]\n mode = \"constant\"\n res = [[[0, 1, 2, 3, 0, 0], [0, 4, 5, 6, 0, 0]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.base(res=res, padding=pad, mode=mode, data_for...
[ "0.7555017", "0.7396482", "0.7254787", "0.721744", "0.71152276", "0.7049675", "0.7046378", "0.70024747", "0.700044", "0.6937854", "0.6908162", "0.68594635", "0.6833953", "0.6811814", "0.67920035", "0.6791336", "0.67853403", "0.6761495", "0.6758956", "0.6755592", "0.6754462", ...
0.7529686
1
shape_dim=3, pad=list[1, 2], mode='reflect', len(pad)=2, data_format=NCL must set left and right value < W, top and bottom < H.
def test_Pad3D7(): input_shape = (1, 2, 3) pad = [1, 2] mode = "reflect" res = [[[2, 1, 2, 3, 2, 1], [5, 4, 5, 6, 5, 4]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.base(res=res, padding=pad, mode=mode, data_format="NCL", data=data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D12():\n input_shape = (1, 2, 3)\n # pad = np.array([1, 2]).astype('int32')\n pad = [1, 2]\n mode = \"reflect\"\n res = [[[2, 1, 2, 3, 2, 1], [5, 4, 5, 6, 5, 4]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.run(res=res, padding=pad, mode=mode, data=data...
[ "0.7113082", "0.67949843", "0.67728066", "0.67715853", "0.6747454", "0.6736785", "0.6714607", "0.6617691", "0.6598806", "0.6399041", "0.6382364", "0.6346402", "0.6342303", "0.6328459", "0.6254949", "0.6217158", "0.6181735", "0.6166698", "0.61532205", "0.6087225", "0.60173815"...
0.6933413
1
shape_dim=3, pad=list[1, 2], mode='reflect', len(pad)=2, data_format=NCL
def test_Pad3D12(): input_shape = (1, 2, 3) # pad = np.array([1, 2]).astype('int32') pad = [1, 2] mode = "reflect" res = [[[2, 1, 2, 3, 2, 1], [5, 4, 5, 6, 5, 4]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.run(res=res, padding=pad, mode=mode, data=data, data_format=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D7():\n input_shape = (1, 2, 3)\n pad = [1, 2]\n mode = \"reflect\"\n res = [[[2, 1, 2, 3, 2, 1], [5, 4, 5, 6, 5, 4]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.base(res=res, padding=pad, mode=mode, data_format=\"NCL\", data=data)", "def test_Pad3D9():...
[ "0.74735045", "0.732375", "0.72852135", "0.71872795", "0.71636003", "0.7149898", "0.71228147", "0.7097487", "0.70847744", "0.69549984", "0.6883246", "0.68575925", "0.6828769", "0.6778449", "0.6663831", "0.6538713", "0.6519225", "0.6482645", "0.63899547", "0.63770014", "0.6361...
0.7672928
0
shape_dim=3, pad=tensor[1, 1, 1, 0], mode='reflect', len(pad)=2, data_format='NHWC'
def test_Pad3D13(): input_shape = (1, 2, 3, 1) pad = [1, 1, 1, 0] mode = "reflect" res = [[[[5], [4], [5], [6], [5]], [[2], [1], [2], [3], [2]], [[5], [4], [5], [6], [5]]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.run(res=res, padding=pad, mode=mode, data_format="NHWC"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D10():\n input_shape = (1, 2, 3, 1)\n pad = [1, 1, 1, 0]\n mode = \"reflect\"\n res = [[[[5], [4], [5], [6], [5]], [[2], [1], [2], [3], [2]], [[5], [4], [5], [6], [5]]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.run(res=res, padding=pad, mode=mode, data_...
[ "0.743592", "0.7412066", "0.7233009", "0.72233677", "0.71813476", "0.71769875", "0.71484405", "0.70754975", "0.70616287", "0.69861776", "0.69375956", "0.68913984", "0.68714756", "0.68257403", "0.67965996", "0.6769647", "0.67384905", "0.66786844", "0.66665286", "0.66623294", "...
0.75172204
0
shape_dim=3, pad=list[2, 1], mode='replicate', len(pad)=2, data_format=NCL
def test_Pad3D17(): input_shape = (1, 2, 3) pad = [2, 1] mode = "replicate" res = [[[1, 1, 1, 2, 3, 3], [4, 4, 4, 5, 6, 6]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.run(res=res, padding=pad, mode=mode, data=data, data_format="NCL")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D21():\n input_shape = (1, 2, 3)\n # pad = np.array([2, 1]).astype('int32')\n pad = [2, 1]\n mode = \"replicate\"\n res = [[[1, 1, 1, 2, 3, 3], [4, 4, 4, 5, 6, 6]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.run(res=res, padding=pad, mode=mode, data=da...
[ "0.80337155", "0.79982525", "0.79480815", "0.7743944", "0.7216146", "0.71544755", "0.71229935", "0.7099466", "0.7025264", "0.70234096", "0.7021302", "0.6972085", "0.69312805", "0.68579054", "0.6719512", "0.66343516", "0.65743333", "0.65555793", "0.651141", "0.6510628", "0.650...
0.80598235
0
shape_dim=2, pad=list[1, 2], mode='replicate', len(pad)=2, data_format=NLC
def test_Pad3D19(): input_shape = (1, 2, 3) pad = [1, 2] mode = "replicate" res = [[[1, 2, 3], [1, 2, 3], [4, 5, 6], [4, 5, 6], [4, 5, 6]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.run(res=res, padding=pad, mode=mode, data_format="NLC", data=data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D17():\n input_shape = (1, 2, 3)\n pad = [2, 1]\n mode = \"replicate\"\n res = [[[1, 1, 1, 2, 3, 3], [4, 4, 4, 5, 6, 6]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.run(res=res, padding=pad, mode=mode, data=data, data_format=\"NCL\")", "def test_Pad3D21...
[ "0.77679384", "0.7764022", "0.77187085", "0.77154005", "0.70600796", "0.70272607", "0.70131814", "0.7012119", "0.69885784", "0.6947094", "0.69383657", "0.68388224", "0.66823745", "0.66219604", "0.64789426", "0.641125", "0.63886523", "0.63435936", "0.6326833", "0.62947047", "0...
0.78964156
0
shape_dim=3, pad=tensor[2, 1], mode='replicate', len(pad)=2, data_format=NCL
def test_Pad3D21(): input_shape = (1, 2, 3) # pad = np.array([2, 1]).astype('int32') pad = [2, 1] mode = "replicate" res = [[[1, 1, 1, 2, 3, 3], [4, 4, 4, 5, 6, 6]]] data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1 obj.run(res=res, padding=pad, mode=mode, data=data, data_forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Pad3D17():\n input_shape = (1, 2, 3)\n pad = [2, 1]\n mode = \"replicate\"\n res = [[[1, 1, 1, 2, 3, 3], [4, 4, 4, 5, 6, 6]]]\n data = np.arange(np.prod(input_shape)).reshape(input_shape) + 1\n obj.run(res=res, padding=pad, mode=mode, data=data, data_format=\"NCL\")", "def test_Pad3D16...
[ "0.79318434", "0.7797551", "0.76867455", "0.7518421", "0.7086973", "0.7018578", "0.69699883", "0.6949413", "0.68757856", "0.68674964", "0.68330324", "0.66925746", "0.6622649", "0.6594129", "0.6534619", "0.65186477", "0.6466588", "0.6418636", "0.63755435", "0.6347652", "0.6341...
0.7886506
1
Add a topic publisher for a joystick command.
def register_topic(self, name, command): topic_name = command['topic_name'] try: topic_type = self.get_interface_type(command['interface_type'], '.msg') self.pubs[topic_name] = self.create_publisher(topic_type, topic_name, 1) except JoyTeleopException as e: se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topic(phenny, input):\n if not input.admin:\n return\n text = input.group().split()\n topic = ' '.join(text[1:])\n if topic == '':\n return\n channel = input.sender\n phenny.write(['PRIVMSG', 'ChanServ'], 'TOPIC %s %s' % (input.sender, topic))\n return", "def topic(self, channel, topic=None):\n ...
[ "0.6031776", "0.5997131", "0.58900696", "0.58886224", "0.58743054", "0.58579695", "0.5785329", "0.57462335", "0.57402533", "0.57101375", "0.5690793", "0.5680169", "0.56232977", "0.55973136", "0.55766237", "0.5570244", "0.5550636", "0.5547172", "0.552251", "0.54776114", "0.544...
0.726427
0
Add an AsyncServiceProxy for a joystick command.
def register_service(self, name, command): service_name = command['service_name'] try: service_type = self.get_interface_type(command['interface_type'], '.srv') self.srv_clients[service_name] = self.AsyncServiceProxy( self, service_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_with_proxy(self, proxy: CommandProxy):\n return proxy.argument(*self.name_or_flags, **self.kwargs)", "def add_proxy(self, app: Flask, handle_errors: bool = True, auth: list = [\"\"]) -> Flask:\n raise NotImplemented('proxys are not yet supported')\n if hasattr(app, 'HOIST_INTERN...
[ "0.53599304", "0.5337162", "0.52263916", "0.51141346", "0.51067567", "0.5030058", "0.5025323", "0.5012126", "0.49890283", "0.4984398", "0.49809358", "0.49488193", "0.49456048", "0.49326336", "0.49211985", "0.491806", "0.49023402", "0.48898253", "0.48897958", "0.4888669", "0.4...
0.61700124
0
Returns lists for keeping track of free (outside of GCs) memory and naive B cells as well as a list of lists of B cells waiting for surivival signals in each GC.
def new_lists(): free_naives, free_memory = [], [] GC_waiting = [[] for gc in range(cf.nGCs)] return free_naives, free_memory, GC_waiting
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cells_enter_GCs(GC_waiting, celllist, tnow, RIs):\n for cell in celllist:\n # get a random GC for entry\n GCpos = RIs.getR()\n # set entrytnow into the waiting area and new position\n cell.GCentrytime = tnow\n cell.AIDstart = tnow\n # add cell to correct waitlist\n ...
[ "0.6278023", "0.6249889", "0.60423493", "0.5866494", "0.5843637", "0.57247835", "0.57123166", "0.5661632", "0.56212527", "0.55807775", "0.55428755", "0.5538133", "0.5531805", "0.5523965", "0.5468503", "0.54654175", "0.5453251", "0.54434454", "0.5362702", "0.5341909", "0.53411...
0.7558097
0
Given an epitopic sequence, queries the objective distribution of the unselected binding repertoire and generates sequences according to this distribution. Incorporates a cutoff mechanism in case there are bins that have not been filled at least once after a given number of tries. Returns a list of Ab sequences whose e...
def make_shaped_repertoire(RNs): # get objective distribution bin_edges, obj_dist, volume = objective_distribution() # get an antigenic epitope sequence, and in case of nkey=1,2 check whether # it can populate all required bins, thus avoiding infinite loop below AgEpitope = get_AgEpitope(RNs) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Ag_seq(RNs):\n seq = []\n for res in range(cf.lAg):\n randi = RNs.getR()\n for i in range(20):\n if randi < cf.cumprob20[i]:\n seq.append(i + 1) # want amino acids between 1 and 20\n break\n return seq", "def get_low_binder(RNs, AgEpitope, ntes...
[ "0.5575298", "0.5412178", "0.54081595", "0.51966965", "0.5137365", "0.50596523", "0.50536424", "0.4986733", "0.4958774", "0.49356183", "0.4860119", "0.48584643", "0.48507887", "0.47952068", "0.47873732", "0.47784394", "0.47781447", "0.47645146", "0.4723615", "0.47215456", "0....
0.60680664
0
Given a number of selecting limiting factors and a list of qualities of the B cells competing, selects LFnum winners based on a Boltzmann energy distribution.
def Boltzchoice(LFnum, energylist, RNs): # transform list to energy values in kT according to experimental # affinities and the energy window allowed by the threshold energylist = cf.y0 + np.array(energylist) * cf.m # calculate norm of initial list Norm = sum([math.exp(-ener) for ener in energylist]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_best_waiters(LFnum, cellSK, GCpos, tnow, AgEpitope, mut_list, RNs):\n # determine the indices of cells to be chosen\n selinds = Boltzchoice(LFnum, [cell.affinity for cell in cellSK], RNs)\n\n # put selected cells on one list, rest on another\n select = [cellSK[i] for i in range(len(cellSK)) ...
[ "0.5976898", "0.5713007", "0.5497896", "0.5418031", "0.5372128", "0.5295576", "0.5200423", "0.51970977", "0.5166391", "0.5161692", "0.5148483", "0.51379246", "0.5100337", "0.5083833", "0.5076801", "0.5060033", "0.50580966", "0.5048066", "0.5047098", "0.50349486", "0.50295734"...
0.7377097
0
Creates an Ab CDR seq of length nkey consisting of 20 different symbols which are used probabilistically according to the codon number leading to each group.
def Ab_seq(RNs): seq = [] for res in range(cf.nkey): randi = RNs.getR() for i in range(20): if randi < cf.cumprob20[i]: seq.append(i + 1) # want amino acids between 1 and 20 break return seq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Ag_seq(RNs):\n seq = []\n for res in range(cf.lAg):\n randi = RNs.getR()\n for i in range(20):\n if randi < cf.cumprob20[i]:\n seq.append(i + 1) # want amino acids between 1 and 20\n break\n return seq", "def _generate(self, n):\n # See ...
[ "0.60891575", "0.58298236", "0.572854", "0.57153106", "0.5714318", "0.5624596", "0.5576946", "0.5558232", "0.5541624", "0.5505016", "0.5482114", "0.5454591", "0.5376457", "0.5367231", "0.5347369", "0.5342323", "0.5340728", "0.53314793", "0.5306699", "0.5301995", "0.52934927",...
0.7048876
0
Creates an Ag epitope seq of length lAg consisting of 20 different symbols which are used probabilistically according to the codon number leading to each group. [identical to Ab_seq in this version]
def Ag_seq(RNs): seq = [] for res in range(cf.lAg): randi = RNs.getR() for i in range(20): if randi < cf.cumprob20[i]: seq.append(i + 1) # want amino acids between 1 and 20 break return seq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Ab_seq(RNs):\n seq = []\n for res in range(cf.nkey):\n randi = RNs.getR()\n for i in range(20):\n if randi < cf.cumprob20[i]:\n seq.append(i + 1) # want amino acids between 1 and 20\n break\n return seq", "def Sequence(nbr_by_label, nbr_by_labe...
[ "0.6658332", "0.6241003", "0.6202885", "0.6068937", "0.603792", "0.5953803", "0.58824986", "0.5805228", "0.5768547", "0.5682909", "0.5623935", "0.5590501", "0.5581104", "0.5535313", "0.5436303", "0.5406636", "0.5395256", "0.5393105", "0.53856844", "0.53707266", "0.5350533", ...
0.75282496
0
Calculates the normalized binding energy given Ab and Ag sequences, binding matrix and the best and worst binding values possible for the given Ag (required for normalization). 1 then means the best binder, 0 the worst.
def E_norm(Ab, Ag, top, bottom): # calculate binding energy before normalization Esum = sum([cf.TD20[int(Ab[i]) - 1][int(Ag[i]) - 1] for i in range(len(Ab))]) # normalize using the supplied top and bottom values Enormal = (Esum - bottom) / (top - bottom) return Enormal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def E_best(Ab, AgEpitope):\n\n E = E_norm(Ab, AgEpitope[0], AgEpitope[1], AgEpitope[2])\n\n return E", "def _sigma_ee_rel(self,gam,eps):\n A = 1 - 8 / 3 * (gam - 1)**0.2 / (gam + 1) * (eps / gam)**(1./3.)\n\n return (self._sigma_1(gam,eps) + self._sigma_2(gam,eps)) * A", "def update_model(s...
[ "0.5989815", "0.53740555", "0.5230325", "0.5117697", "0.50739473", "0.49998295", "0.49388465", "0.49281248", "0.49246195", "0.4903912", "0.4902104", "0.488608", "0.48850486", "0.4882683", "0.48631883", "0.4862339", "0.48141176", "0.4811674", "0.48107347", "0.48089716", "0.480...
0.7355312
0
Given an Ab and a prepared list containing the epitope as well as its best and worst binding partner energies, this function calculates the normalized binding energy of the Ab towards the epitope. It then returns the binding energy value.
def E_best(Ab, AgEpitope): E = E_norm(Ab, AgEpitope[0], AgEpitope[1], AgEpitope[2]) return E
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def E_norm(Ab, Ag, top, bottom):\n\n # calculate binding energy before normalization\n Esum = sum([cf.TD20[int(Ab[i]) - 1][int(Ag[i]) - 1]\n for i in range(len(Ab))])\n\n # normalize using the supplied top and bottom values\n Enormal = (Esum - bottom) / (top - bottom)\n\n return Enorm...
[ "0.68311244", "0.5498993", "0.5194535", "0.51908374", "0.5127645", "0.5109397", "0.50883734", "0.50480145", "0.5023572", "0.5000986", "0.49812147", "0.4969033", "0.49680704", "0.49594802", "0.495168", "0.4943552", "0.49178055", "0.4909567", "0.48931104", "0.48774794", "0.4869...
0.638375
1
Prepares a naive B cell with a sequence that binds to the epitope with above threshold affinity and returns a B cell object.
def make_naive(RNs, seq_list, AgEpitope, tnow): # pick a random sequence from the pregenerated pool ab = random.choice(seq_list) Emax = E_best(ab, AgEpitope) if tnow == 0: # in initialisation, distribute ages evenly over # lifespan birthtime = -np.round(RNs.getR() * cf.tlif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constructCell():\n\t\tself.weightGenerate()", "def setup_b_instance(self,norm,add_ps_mask=True):\n inst_tag = self.tag + '_'+str(self.flux_array_ebin)\n b = bsm.bayesian_scan_NPTF(tag=inst_tag,nside=self.nside,work_dir='/tmp/'+self.tag+'/',psf_dir=psf_dir,nlive=700)\n # Input the data, u...
[ "0.5430549", "0.54229766", "0.53464353", "0.52291906", "0.5195737", "0.5010717", "0.49687093", "0.48980033", "0.48972934", "0.48607045", "0.4837311", "0.48047954", "0.47999904", "0.47738087", "0.4773558", "0.47519714", "0.47448894", "0.47322154", "0.47322154", "0.47309393", "...
0.61007017
0
Prepares an unspecific memory B cell with a sequence that binds to the epitope with above threshold affinity and returns a B cell object with a random number of mutations from its past (040).
def make_memory(RNs, seq_list, AgEpitope, tnow): ab = random.choice(seq_list) Emax = E_best(ab, AgEpitope) mutcount = np.round(RNs.getR() * 40) newcell = Bcell(sequence=ab, sequence0=ab, affinity=Emax, affinity0=Emax, origin='umem', mutations=mutcount, family=None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_naive(RNs, seq_list, AgEpitope, tnow):\n # pick a random sequence from the pregenerated pool\n ab = random.choice(seq_list)\n Emax = E_best(ab, AgEpitope)\n if tnow == 0: # in initialisation, distribute ages evenly over\n # lifespan\n birthtime = -np.round(RNs.getR(...
[ "0.5811449", "0.5382434", "0.5294318", "0.5251425", "0.5192706", "0.5065947", "0.49759793", "0.49485117", "0.49466747", "0.4929278", "0.491417", "0.4913077", "0.487761", "0.48603368", "0.48593628", "0.48590797", "0.4839911", "0.48218063", "0.47829044", "0.47814372", "0.477638...
0.631812
0
If simulation is run for the purpose of comparing affinity maturation with different numbers of hotspots in equally seeded GCs, the following function checks out what low quality binders in the range just above 0.6 can realistically be expected to appear (relevant for low HS case, where larger binding energy intervals ...
def get_low_binder(RNs, AgEpitope, ntest): E_collect = [] while len(E_collect) < ntest: ab = Ab_seq(RNs) Emax = E_best(ab, AgEpitope) if Emax >= cf.thr: E_collect.append(Emax) return min(E_collect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self):\n self.lower_bound(5e-4)\n self.upper_bound(5e2)", "def test_constructed_is_small(self):\n self.assertTrue(all(elt<10 for elt in goodwinsheaf.checkradii()))#check all entries have small radii", "def _guess_firm_size_upper_too_low(self, bound, tol):\n theta = self.iv...
[ "0.5819317", "0.57218736", "0.5664285", "0.5512384", "0.5491544", "0.5476615", "0.54661477", "0.54643595", "0.544348", "0.54200816", "0.54185605", "0.5366565", "0.53566635", "0.5350197", "0.53409666", "0.53298765", "0.532814", "0.53204817", "0.5299489", "0.52875227", "0.52862...
0.58382094
0
Mutates a given Ab seq according to the rules for mutations in FWR and CDR parts. If no deadly mutation happens to the FWR part, there is a possibility of change in the CDR part.
def mutate_seq(seq, block0, RNs): sequence = seq block = block0 # get the number of changes in the FWR part and key part # for framework part, include the rate of silent mutations (75%), this # is not necessary for the explicitly modeled residues as changes there # can lead to replacement with t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SimultaneousRB_AC(qubits: qreg, seqs, add_cals=True):\n # Original:\n # seqsBis = []\n # for seq in zip(*seqs):\n # seqsBis.append([reduce(operator.__mul__, [AC(q,c) for q,c in zip(qubits,\n # pulseNums)]) for pulseNums in ...
[ "0.5245027", "0.5227622", "0.5217706", "0.5205439", "0.5075445", "0.5072723", "0.50680596", "0.50551826", "0.50075334", "0.49982312", "0.49953303", "0.49861366", "0.49375024", "0.4926492", "0.48596647", "0.48129907", "0.48101753", "0.4808212", "0.47136652", "0.46780968", "0.4...
0.6742125
0
Given a mother cell and the epitope present in the system, the function produces between zero and two daughter cells, according to the division success and returns them as Bcell objects in a single list.
def divide(mother, AgEpitope, tnow, mut_list, RNs): dlist = [] # get new sequences, additional mutation counts and block status # for the daughters; mutations may happen during division ONLY if # the cell's family has been in the GC for long enough to have enough AID if ((tnow - mother.AIDstart) >= ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cell_division(waitlist, celllist, AgEpitope, tnow, mut_list, RNs):\n for cell in celllist:\n # get list of 0 to 2 daughters\n dlist, mut_list = divide(cell, AgEpitope, tnow, mut_list, RNs)\n # add daughters to waitlist\n waitlist = waitlist + dlist\n return waitlist, mut_list"...
[ "0.7026222", "0.5630059", "0.5613996", "0.55163336", "0.54273593", "0.5390995", "0.53396046", "0.53241175", "0.5278331", "0.5259016", "0.5221316", "0.52150244", "0.52112615", "0.52056575", "0.51980996", "0.5194948", "0.51921505", "0.5188548", "0.5138519", "0.5136642", "0.5085...
0.643389
1
Returns an array of Ag present in the system at every timestep using the initial dose and assuming exponential decay with the decay constant supplied. Maximum intial dose is 1 so that all values in this array range between 0 and 1. Values below 0.01 are set to 0. Several vaccination timepoints are handled by adding the...
def Ag_density(): # initialise no infection default for the number of infections required agcurves = [np.zeros(cf.endtime + 1) for inf in cf.tinf] # for every infection, calculate its individual effect per timepoint for i in range(len(cf.tinf)): pag = cf.dose[i] # peak tai = 0 # tnow a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gae(rewards, value_estimates, value_next=0.0, gamma=0.99, lambd=0.95):\n value_estimates = np.append(value_estimates, value_next)\n delta_t = rewards + gamma * value_estimates[1:] - value_estimates[:-1]\n advantage = discount_rewards(r=delta_t, gamma=gamma * lambd)\n return advantage", "def m...
[ "0.571016", "0.5588797", "0.5566866", "0.5552068", "0.55310565", "0.55223566", "0.54889387", "0.5482954", "0.5337391", "0.53091055", "0.5293329", "0.5291754", "0.5280999", "0.5240395", "0.5240054", "0.5230036", "0.52182394", "0.5211412", "0.5211144", "0.52106285", "0.5179112"...
0.659793
0
Takes a list of cells, checks their birthtime and evaluates whether they live on based on their given lifetime.
def old_cells_die(celllist, tnow): survivors = [cell for cell in celllist if tnow - cell.birthtime <= cf.tlifeN] return survivors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_waiters_die(celllist, tnow):\n survivors = []\n for sublist in celllist:\n newsub = []\n for cell in sublist:\n if tnow - cell.GCentrytime <= cf.tlifeGC:\n newsub.append(cell)\n survivors.append(newsub)\n return survivors", "def _should_cell_live(s...
[ "0.62469876", "0.61972153", "0.586499", "0.56494385", "0.5582217", "0.55195665", "0.55055493", "0.54996973", "0.54730326", "0.5453139", "0.5450774", "0.5255261", "0.52387965", "0.5236539", "0.5226822", "0.5223596", "0.5202929", "0.5185039", "0.5181881", "0.5146562", "0.514296...
0.71631736
0
Takes the list of sorted waiting lists and removes cells that have spent more than the allowed time period waiting for survival sinal.
def long_waiters_die(celllist, tnow): survivors = [] for sublist in celllist: newsub = [] for cell in sublist: if tnow - cell.GCentrytime <= cf.tlifeGC: newsub.append(cell) survivors.append(newsub) return survivors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_dead_obstacles(obstacle_list):\n\tfor obstacle in obstacle_list:\n\t\tobstacle.lifetime -= 1\n\t\tif obstacle.lifetime == 0:\n\t\t\tobstacle_list.remove(obstacle)\n\t\tprint(obstacle)", "def old_cells_die(celllist, tnow):\n survivors = [cell for cell in celllist\n if tnow - cell.bir...
[ "0.58844036", "0.588434", "0.58419377", "0.5756025", "0.57415056", "0.57187665", "0.56889147", "0.56837434", "0.5636393", "0.56136954", "0.55720395", "0.5538212", "0.55239934", "0.5519692", "0.5505961", "0.5505401", "0.54820275", "0.54682", "0.5465266", "0.54433537", "0.53814...
0.66973364
0
Given the current antigen density and the lists of free cells, the function tries to activate a corresponding number of cells and applies an activation probability corresponding to its affinity to every one of them. The lists of remaining free cells as well as an event of germination to be added to the event_list are r...
def try_activation(Agden, free_naives, free_memory, tnow, RNs): activated = [] fail_naive = [] fail_memory = [] # randomize free cell lists random.shuffle(free_naives) random.shuffle(free_memory) # get number of cells to activate from naive list act_n = np.random.binomial(len(free_naives...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_activation(self):\r\n\r\n x=0\r\n edges=self.in_edges\r\n for edge in edges:\r\n x+= edge.source.activation*edge.weight\r\n self.activation=1/(1+exp(-x))", "def _update_activation_state(self):\n activation_count = 0\n for task_id in self.task_dict:...
[ "0.5888912", "0.5608717", "0.5381771", "0.5291022", "0.5285021", "0.52689457", "0.5249405", "0.52287054", "0.51110786", "0.5111017", "0.510888", "0.5092028", "0.5085741", "0.5020816", "0.5018179", "0.4999845", "0.4999845", "0.49943686", "0.49876347", "0.49850073", "0.49526134...
0.6911425
0
Distributes the cells waiting to enter a GC at this timepoint randomly to the available GCs, supplies a GCentrytime to each of the cells and returns the modified GC waitlist.
def cells_enter_GCs(GC_waiting, celllist, tnow, RIs): for cell in celllist: # get a random GC for entry GCpos = RIs.getR() # set entrytnow into the waiting area and new position cell.GCentrytime = tnow cell.AIDstart = tnow # add cell to correct waitlist GC_wai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_waiters_die(celllist, tnow):\n survivors = []\n for sublist in celllist:\n newsub = []\n for cell in sublist:\n if tnow - cell.GCentrytime <= cf.tlifeGC:\n newsub.append(cell)\n survivors.append(newsub)\n return survivors", "def select_best_waiters...
[ "0.62247455", "0.54630756", "0.5448373", "0.5303373", "0.5191223", "0.51758844", "0.50630546", "0.49670702", "0.48943335", "0.48723188", "0.4871407", "0.4869202", "0.48606297", "0.4835821", "0.48289672", "0.48086908", "0.48080382", "0.47971594", "0.47934476", "0.47799096", "0...
0.7323367
0
Given the current number of available limiting factors and the sorted list of waiting cells, this function picks the LFnum cells to be moved on according to the Boltzmann choice and distributes them to the fates differentiation and division according to the given recycle frequency. In order to incorporate double cell d...
def select_best_waiters(LFnum, cellSK, GCpos, tnow, AgEpitope, mut_list, RNs): # determine the indices of cells to be chosen selinds = Boltzchoice(LFnum, [cell.affinity for cell in cellSK], RNs) # put selected cells on one list, rest on another select = [cellSK[i] for i in range(len(cellSK)) if i in se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Boltzchoice(LFnum, energylist, RNs):\n # transform list to energy values in kT according to experimental\n # affinities and the energy window allowed by the threshold\n energylist = cf.y0 + np.array(energylist) * cf.m\n # calculate norm of initial list\n Norm = sum([math.exp(-ener) for ener in e...
[ "0.611805", "0.5760464", "0.51817936", "0.5052647", "0.500325", "0.49627137", "0.49470758", "0.48633406", "0.4851506", "0.48268813", "0.48119494", "0.47923657", "0.47850725", "0.4731373", "0.46988776", "0.46939072", "0.4659001", "0.46333724", "0.4608515", "0.46050254", "0.459...
0.7092034
0
Monkeypatches graphqlcore library to trace graphql calls execution.
def patch(): logger.debug('Patching `graphql.graphql` function.') wrapt.wrap_function_wrapper(graphql, 'graphql', _traced_graphql)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _traced_graphql(func, _, args, kwargs):\n\n schema = args[0]\n\n # get the query as a string\n if len(args) > 1:\n request_string = args[1]\n else:\n request_string = kwargs.get('request_string')\n\n if isinstance(request_string, Document):\n query = request_string.loc.sourc...
[ "0.6343182", "0.56782556", "0.5526918", "0.5416044", "0.5391245", "0.52725345", "0.52248937", "0.49928382", "0.49856138", "0.48868668", "0.4881803", "0.4879053", "0.48706585", "0.4842129", "0.48220646", "0.47949135", "0.47835508", "0.4759621", "0.47522473", "0.4750627", "0.47...
0.6942677
0
Wrapper for graphql.graphql function.
def _traced_graphql(func, _, args, kwargs): schema = args[0] # get the query as a string if len(args) > 1: request_string = args[1] else: request_string = kwargs.get('request_string') if isinstance(request_string, Document): query = request_string.loc.source.body else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_graphql(raw_query, endpoint):\n query = \" \".join(shlex.split(raw_query, posix=False))\n r = requests.get(endpoint, params={\"query\": query})\n if r.status_code == 200:\n return r.json()\n elif r.status_code == 400:\n response = r.json()\n assert \"errors\" in response\...
[ "0.66280913", "0.6354022", "0.632226", "0.6310396", "0.58947986", "0.5789386", "0.56969786", "0.5674856", "0.56201303", "0.5613056", "0.5543577", "0.5480393", "0.54736185", "0.5457626", "0.54279554", "0.53645164", "0.53170335", "0.53066283", "0.52594376", "0.5255184", "0.5250...
0.68230045
0
Convert from a PGM file to a FITS file.
def convert_to_fits(image_file, clobber=True): img = load_image(image_file) fits.writeto(image_file.replace('pgm', 'fits'), img, clobber=clobber) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_fits(self, filename):", "def f2tif(path,is_gray=1): \n# import tifffile\n import tqdm\n print(\"==============================================\")\n print(\"Convert file to tif stack!\")\n pathout = path[:-4]+'_'+str(is_gray)+'.tif' \n video = mp.VideoFileClip(path)\n i=0\n ...
[ "0.5638094", "0.5415192", "0.53508157", "0.5323675", "0.5319744", "0.52432823", "0.52354145", "0.52249837", "0.5175307", "0.517244", "0.5168601", "0.51595557", "0.5145556", "0.5114861", "0.5103376", "0.50699925", "0.5058637", "0.50480443", "0.50276166", "0.50008374", "0.49999...
0.65275276
0
Calculate the FWHM on a single bright star (either open or closed loops). image_file either FITS or PGM fwhm_init (def=2) pixels for FWHM initial guess
def calc_fwhm_on_bright_star(image_file, print=True, fwhm_init=2.0): img = load_image(image_file) # Calculate the bacgkround bkg = photutils.Background(img, img.shape, filter_shape=(1,1), method='median') threshold = bkg.background + (30.0 * bkg.background_rms) sigma = 2.0 * gaussian_fwh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_psf_fwhm_inpix_moffat(arr):\n\tmodel = fit_moffat(arr)\n\n\tfwhm = 2.* model.gamma * np.sqrt( 2.**(1./model.alpha) - 1. )\n\n\treturn fwhm", "def estimateFWHM(imgID, side='blue'):\r\n\r\n iraf.unlearn('imexam')\r\n iraf.rimexam.fittype = \"gaussian\"\r\n iraf.delete('trace.xy', verify=\"no\")\r...
[ "0.6711939", "0.65907663", "0.6529644", "0.6306172", "0.6146442", "0.6140123", "0.609935", "0.5993391", "0.5977707", "0.5863462", "0.58407354", "0.5749594", "0.572178", "0.56493753", "0.563274", "0.5542923", "0.5449296", "0.5418304", "0.5362673", "0.53052205", "0.5297855", ...
0.7942247
0
Computes box scale as function of k
def box_scale(k, m, s_min=0.1, s_max=0.9): # equation 4 from paper return s_min + (s_max - s_min) * (k - 1) / (m - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaling_factor_box( h ):\n h = np.array( h, copy=False).ravel()\n n = len(h)\n s = ( np.pi**(n/2.0) ) / sp.special.gamma( n/2.0 + 1 )\n s = 1.0/s\n s /= np.product(h)\n return s", "def scale(self, k_x, k_y = None):\r\n if (k_y is None):\r\n return vec2(k_x*self.x, k_x*self...
[ "0.6722605", "0.6683108", "0.66285825", "0.65496975", "0.63913274", "0.623833", "0.60930306", "0.6081411", "0.60072404", "0.5964558", "0.59401745", "0.59369767", "0.5929781", "0.5921312", "0.59208435", "0.5897965", "0.58625317", "0.58455175", "0.57387984", "0.57370836", "0.57...
0.8007818
0
Create default centerbox for given position (i, j)
def get_default_box(i, j, scale, box_ratio, width, height): default_w = scale * sqrt(box_ratio) default_h = scale / sqrt(box_ratio) center_x = (j + 0.5) / width center_y = (i + 0.5) / height return (center_x, center_y, default_w, default_h)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(box):\n x_center = box[:, 0] + (box[:, 2] - box[:, 0]) // 2\n y_center = box[:, 1] + (box[:, 3] - box[:, 1]) // 2\n return torch.stack((x_center, y_center)).t().to(box.device)", "def center_size(boxes):\n concat = P.Concat(1)\n return concat(((boxes[:, 2:] + boxes[:, :2])/2, # cx, c...
[ "0.6984537", "0.6536565", "0.6419982", "0.6356094", "0.61390704", "0.6124859", "0.60519403", "0.6050198", "0.6037", "0.60185087", "0.60182935", "0.60087377", "0.5990671", "0.59769964", "0.5975228", "0.5962497", "0.59607095", "0.59463704", "0.59422565", "0.59399325", "0.592970...
0.7353168
0
Returns BoundBoxArray of default boxes
def get_default_boxes(out_shapes, box_ratios): default_boxes = [] n_outs = len(out_shapes) scales = (box_scale(n_out + 1, n_outs) for n_out in range(n_outs)) layer_params = zip(out_shapes, scales, box_ratios) for out_shape, scale, layer_box_ratios in layer_params: height, width = height_an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_boxes(self):\r\n\r\n boxes = [(\" \", self.worldbox.tl, self.worldbox.br)]\r\n# boxes = []\r\n boxes += [(\".\", b.tl, b.br) for b in self.wallboxes]\r\n boxes += [(\"x\", b.tl, b.br) for b in self.targetboxes]\r\n agentscale = 100\r\n boxes += [(\"a\", (self.i_sta...
[ "0.6688832", "0.65859437", "0.6556119", "0.6538074", "0.6434962", "0.6420856", "0.6287684", "0.62804985", "0.62618226", "0.6227584", "0.62249935", "0.61945534", "0.61637175", "0.6134957", "0.60598016", "0.60597944", "0.6055284", "0.5994084", "0.5981978", "0.59624654", "0.5955...
0.7455453
0
Ensure fetching is waiting FETCH_MINIMUM_WAIT_SECONDS seconds inbetween each request.
def __ensure_fetching_rate_limit(self) -> None: current = datetime.now() difference = current - self.fetched_last time_to_wait = FETCH_MINIMUM_WAIT_SECONDS - difference.total_seconds() if time_to_wait > 0: time.sleep(time_to_wait) self.fetched_last = datetime.now()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fair_use_delay(self):\n if self.next_request_no_sooner_than is not None and type(self.next_request_no_sooner_than) == int:\n sleep_time = max(0, self.next_request_no_sooner_than)\n log.info('Sleeping for {} seconds until next request.'.format(sleep_time))\n time.sleep(s...
[ "0.6250035", "0.6202518", "0.5788163", "0.57635534", "0.575597", "0.5703448", "0.56474084", "0.5559574", "0.5528586", "0.5481914", "0.5442929", "0.54330456", "0.53454167", "0.5343117", "0.5315743", "0.5307995", "0.5278265", "0.52664554", "0.5192012", "0.5185223", "0.5163235",...
0.7916572
0
Produce web token value from agreement HTML.
def __parse_agreement(html: str) -> str: soup = BeautifulSoup(html, features='html.parser') web_token = soup.find('input', {'name': 'csrfmiddlewaretoken'}) if hasattr(web_token, 'value'): return web_token['value'] raise ValueError('Expected to find web token within HTML.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __fetch_web_token(self) -> str:\n self.__ensure_fetching_rate_limit()\n response = self.session.get(EFD_ENDPOINT_SEARCH)\n web_token = EFD.__parse_agreement(response.text)\n return web_token", "def _generate_token_value():\n return secrets.token_urlsafe()", "def get_token(sel...
[ "0.6441431", "0.5810527", "0.5624718", "0.55785173", "0.55474305", "0.55416983", "0.5341234", "0.52849877", "0.52341986", "0.51770765", "0.51665294", "0.51665294", "0.51665294", "0.51644754", "0.51423883", "0.5113351", "0.5105391", "0.5065668", "0.50644654", "0.50285536", "0....
0.767607
0
Return search form input names.
def __parse_search_form(html: str) -> List[str]: soup = BeautifulSoup(html, features='html.parser') form_names = [i['name'] for i in soup.find('form').findAll('input')] return form_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_input_names(self):\n return self._input_names", "def search_form(self, name_filter):\n from sagas.ofbiz.forms import print_form_list\n print_form_list(name_filter=name_filter)", "def get_input_names(self):\n inputNames = []\n for inVar in self.inputs:\n # inVar...
[ "0.6950789", "0.67164797", "0.6396843", "0.630177", "0.62223536", "0.6088735", "0.6041806", "0.60160005", "0.60123277", "0.600498", "0.59274644", "0.5919662", "0.58825165", "0.58457726", "0.5825849", "0.5805771", "0.5787204", "0.5785471", "0.5738464", "0.5688952", "0.56775737...
0.75881535
0
Add required token from cookie to header
def __header_update_token(self) -> None: cookies = self.session.cookies.get_dict() self.session.headers.update({ 'Referer': 'https://efdsearch.senate.gov/search/', 'X-CSRFToken': cookies['csrftoken'], })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_token(token):\n return {'Authorization': '{0} {1}'.format('JWT', token)}", "def _token_header(token=None):\n if not token:\n return None\n\n message = '{token}:Ignored'.format(token=token)\n headers = {'Authorization': 'Basic {code}'.format(\n code=base64.b64encode(message))}...
[ "0.7128207", "0.700346", "0.68207276", "0.66793406", "0.66069144", "0.64189374", "0.6404582", "0.639439", "0.63904995", "0.63799286", "0.63683873", "0.62969685", "0.6278751", "0.6263158", "0.622593", "0.62056905", "0.6190562", "0.6187023", "0.6172328", "0.6169181", "0.6153334...
0.7365751
0
Create Google Drive service using provided Flow flags and OAuth keys
def create_service(flags, client_id, client_secret): flow = OAuth2WebServerFlow( client_id=client_id, client_secret=client_secret, scope='https://www.googleapis.com/auth/drive.readonly', redirect_uri='http://localhost') storage = Storage('oauth_storage') crede...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_service():\n creds = None\n # The file token.pickle stores the user's access and refresh tokens, and is\n # created automatically when the authorization flow completes for the first\n # time.\n if os.path.exists('token.pickle'):\n with open('token.pickle', 'rb') as token:\n ...
[ "0.7701686", "0.7527261", "0.7475176", "0.7074418", "0.69454056", "0.6692553", "0.6619492", "0.66136366", "0.6600691", "0.65582865", "0.65500313", "0.6303524", "0.6166362", "0.61439687", "0.6088845", "0.60803515", "0.6030853", "0.60077214", "0.6000676", "0.59963655", "0.59902...
0.80562335
0
Download all files from provided list
def download_files(service, file_list, out_path): total = len(file_list) for i, file_id in enumerate(file_list, 1): name = get_file(service, file_id)['title'] print('Downloading {}... ({}/{}) [{}%]'.format(name, i, total, round(i / total * 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_files(self) -> None:\n\n for name, url in self.files.items():\n print(f\"Download {name.split('/')[-1]}\")\n wget.download(url, os.path.join(\"data\", name))", "def download_files(self):", "def multi_download(self, url_list):\n workers = 4\n with ThreadPo...
[ "0.7878511", "0.78570163", "0.7798649", "0.7391583", "0.73496884", "0.728595", "0.72161186", "0.716233", "0.7137925", "0.7103304", "0.70779246", "0.7064052", "0.7041122", "0.7000575", "0.6984006", "0.6970926", "0.69130874", "0.68817306", "0.6855708", "0.68175423", "0.6751781"...
0.7884188
0
merge all documents into one bigger file
def merge_docs(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_documents(path=os.path.join(os.curdir, \"data/processed\"), name='corpus.txt'):\n outname=os.path.join(path, name)\n if os.path.exists(outname):\n os.remove(outname)\n filenames = [f for f in os.listdir(path) if fnmatch.fnmatch(f, '*.txt')]\n with open(outname, 'w') as outfile:\n ...
[ "0.7000478", "0.6545423", "0.6462658", "0.63792735", "0.62568164", "0.6245949", "0.6204331", "0.61666673", "0.6163962", "0.6136766", "0.6123079", "0.6118926", "0.61155397", "0.60974044", "0.6090275", "0.5976273", "0.5972494", "0.5966715", "0.5928108", "0.59268343", "0.5917983...
0.760634
0
parseBA(fd) > dict() Parses Rabit's BA format into a simple dictionary.
def parseBA(fd): aut = dict() first_line = fd.readline().strip() aut["initial"] = [first_line] aut["transitions"] = [] aut["final"] = [] while True: line = fd.readline() if not line: return aut line = line.strip() if line == "": continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FASTAfile_to_dict(FASTAfile):\n FASTADict = {}\n for line in FASTAfile:\n if '>' in line:\n FASTALabel = line\n FASTADict[FASTALabel] = \"\"\n else:\n FASTADict[FASTALabel] += line\n return FASTADict", "def parseHOA(fd):\n aut = dict()\n aut[\"ini...
[ "0.5891278", "0.5844353", "0.58382297", "0.57476145", "0.56055814", "0.558734", "0.5553851", "0.5519351", "0.5498047", "0.548586", "0.5482621", "0.54821944", "0.5435535", "0.5382995", "0.53779835", "0.53777", "0.5375928", "0.5373505", "0.53611994", "0.5351868", "0.5351013", ...
0.69841844
0
parseHOA(fd) > dict() Parses Hanoi Omega Automata format into a simple dictionary. (Supports only a subset focused on statebased acceptance Buchi automata.)
def parseHOA(fd): aut = dict() aut["initial"] = [] aut["transitions"] = [] aut["final"] = [] aps = dict() # atomic propositions # reading header while True: line = fd.readline() if not line: # no body raise Exception("Missing body!") line = line.strip(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseBA(fd):\n aut = dict()\n first_line = fd.readline().strip()\n aut[\"initial\"] = [first_line]\n aut[\"transitions\"] = []\n aut[\"final\"] = []\n\n while True:\n line = fd.readline()\n if not line:\n return aut\n\n line = line.strip()\n if line == \...
[ "0.63681", "0.6347017", "0.5696547", "0.5572677", "0.5515874", "0.5506609", "0.5462382", "0.54618406", "0.54504764", "0.54472536", "0.53847593", "0.5374126", "0.5333519", "0.5292556", "0.5265104", "0.52295166", "0.51738256", "0.51727885", "0.51565576", "0.51344913", "0.511988...
0.81904477
0
aut2BA(aut) > string Serializes an automaton as Rabit's BA file.
def aut2BA(aut): res = "" for st in aut["initial"]: res += st + "\n" for trans in aut["transitions"]: src, symb, tgt = trans res += "{},{}->{}".format(symb, src, tgt) + "\n" for st in aut["final"]: res += st + "\n" return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_string(representation):\r\n auto = Automaton()\r\n lines = [line.strip() for line in representation.split('\\n')]\r\n auto.transitions = [Transition(*line.split()) for line in lines[:-1]]\r\n auto.final_states = lines[-1].split()[1:]\r\n auto.start_state = lines[-1].spli...
[ "0.5600367", "0.5583563", "0.52981955", "0.5286957", "0.52553785", "0.5212133", "0.51995844", "0.5184662", "0.5136247", "0.50710785", "0.5066019", "0.50640976", "0.50595695", "0.5055324", "0.50280625", "0.5026861", "0.5022681", "0.50217015", "0.5005895", "0.49576405", "0.4945...
0.74356085
0
aut2HOA(aut) > string Serializes an automaton as the Hanoi Omega Automata file format.
def aut2HOA(aut): state_cnt = 0 state_transl_dict = dict() ########################################### def state_transl(state): """state_transl(state) -> int Translates state names into numbers. """ nonlocal state_cnt nonlocal state_transl_dict if state not in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aut2BA(aut):\n res = \"\"\n for st in aut[\"initial\"]:\n res += st + \"\\n\"\n for trans in aut[\"transitions\"]:\n src, symb, tgt = trans\n res += \"{},{}->{}\".format(symb, src, tgt) + \"\\n\"\n for st in aut[\"final\"]:\n res += st + \"\\n\"\n\n return res", "as...
[ "0.583925", "0.56710726", "0.54376674", "0.543635", "0.5432066", "0.5290863", "0.5243628", "0.5122951", "0.510304", "0.50739604", "0.50417066", "0.5039839", "0.50381833", "0.5025238", "0.50088596", "0.49178177", "0.48926035", "0.48878336", "0.48868248", "0.48853645", "0.48714...
0.7347903
0